You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
8.3KB

  1. import{d as me,C as G,B as k,b as P,r as m,y as pe,o as fe,c as u,e as g,G as h,i as a,u as b,h as t,k as F,g as p,f as C,F as O,H as Y,j as f,R as A,t as N,Y as ce,ay as ge,aw as _e,ax as be,az as ve,aA as Re,q as ye}from"./index.88314652.js";import{E as Ne}from"./index.095525b5.js";import{h as Le}from"./moment.40bc58bf.js";import{g as S,a as Ie}from"./getIsShowRegionTree.6f629642.js";const he=["onClick"],Ee=["onClick"],we=["onClick"],ke=me({name:"userManage"}),xe=Object.assign(ke,{setup(Ce){const{proxy:v}=ye(),q=G(k.userStore).userInfo||{},z=G(k.userStore).roleList||{},s=P({userRoleList:void 0,name:void 0,phoneNo:void 0,orgName:void 0}),R=m(),B=m(0),j=P([{label:"\u5E8F\u53F7",type:"index",width:"80"},{label:"\u59D3\u540D",key:"name",prop:"name"},{label:"\u624B\u673A\u53F7\u7801",key:"phoneNo",prop:"phoneNo",width:"150"},{label:"\u6240\u5C5E\u5355\u4F4D\uFF08\u4E3B\u804C\uFF09",key:"orgName",prop:"orgName",showOverflowTooltip:!0,width:250},{label:"\u6240\u5C5E\u533A\u57DF",key:"regionName",prop:"regionName",width:"150"},{label:"\u7528\u6237\u89D2\u8272",key:"userRoleList",prop:"userRoleList",width:200},{label:"\u72B6\u6001",slot:"isEnable",width:"100"},{label:"\u66F4\u65B0\u65F6\u95F4",key:"updateTime",prop:"updateTime",width:"250"},{label:"\u64CD\u4F5C",slot:"action",width:"200",fixed:"right"}]),V=m([]),c=async(o=R.value.pageParams)=>{const e=await ce({...o,...s,scene:2,userRoleList:[{id:s.userRoleList}]}),n=e.data.records;n.forEach(r=>{const d=[];r.userRoleList.forEach(E=>{d.push(E.name)}),r.userRoleList=d}),V.value=n,B.value=e.data.total},H=()=>{c()},J=()=>{s.userRoleList=void 0,s.name=void 0,s.phoneNo=void 0,s.orgName=void 0,R.value.pageParams.pageNumber=1,R.value.pageParams.pageSize=10,c()},y=m(!1),x=m(),i=m({}),K=async o=>{oe(),y.value=!0,x.value=o.name;const e=await ge({employeeCode:o.employeeCode,userId:o.userId}),n=[];e.data.userRoleInfoList.forEach(r=>{n.push(r.id)}),i.value={employeeCode:o.employeeCode,userRoleInfoList:n,phoneNo:o.phoneNo,status:o.status!=="DISABLE",userId:o.userId}},Q={phoneNo:[{required:!0,pattern:/^1[3456789]\d{9}$/,message:"\u624B\u673A\u53F7\u7801\u683C\u5F0F\u4E0D\u6B63\u786E",trigger:"blur"}],userRoleInfoList:[{required:!0,message:"\u8BF7\u9009\u62E9\u7528\u6237\u89D2\u8272",trigger:"change"}],status:[{required:!0,message:"\u8BF7\u9009\u62E9\u72B6\u6001",trigger:"change"}]},D=m(),W=async o=>{!o||await o.validate(async e=>{if(e){const n={...i.value},r=JSON.parse(JSON.stringify(n));r.status?r.status="ENABLE":r.status="DISABLE",r.userRoleInfoList=[],n.userRoleInfoList.forEach(d=>{r.userRoleInfoList.push({id:d})}),await _e(r),v.$message.success("\u7F16\u8F91\u6210\u529F\uFF01"),y.value=!1,c()}})},X=o=>{const e=o.status==="DISABLE"?"\u542F\u7528":"\u7981\u7528";v.$messageBox.confirm(`\u662F\u5426${e}\u8BE5\u7528\u6237?`,"\u63D0\u793A\uFF01",{type:"warning"}).then(async()=>{await be({employeeCode:o.employeeCode,operation:o.status==="DISABLE"?"ENABLE":"DISABLE",userId:o.userId}),v.$message.success(`${e}\u6210\u529F\uFF01`),c()})},Z=pe(),ee=async o=>{v.$messageBox.confirm(`\u786E\u5B9A\u8981\u4EE3\u767B\u5F55${o.name}\u8D26\u53F7?`,"\u63D0\u793A\uFF01",{type:"warning"}).then(async()=>{const e=new URLSearchParams;e.append("userId",o.userId),await ve(e),v.$message.success("\u767B\u5F55\u6210\u529F\uFF01"),location.reload(),Z.push("/")})},le=o=>{s.regionId=o.regionLevel===3?o.regionCode:void 0,R.value.pageParams.pageNumber=1,c()},ae=m(!1),te=(o,e)=>{e==="\u5355\u4F4D\u7BA1\u7406\u5458"&&(ae.value=o)},$=m(),oe=async()=>{const o=await Re();$.value=o.data};return fe(()=>{k.userStore.setRoleStore(),S(["SUPER_ADMIN","REGION_MANAGER"])||c()}),(o,e)=>{const n=u("el-col"),r=u("el-input"),d=u("el-form-item"),E=u("el-option"),se=u("el-select"),w=u("el-row"),L=u("el-button"),M=u("el-form"),U=u("el-card"),ne=u("table-list"),re=u("el-checkbox"),ue=u("el-checkbox-group"),de=u("el-switch"),ie=u("el-dialog");return g(),h(w,null,{default:a(()=>[b(S)(["SUPER_ADMIN","REGION_MANAGER"])?(g(),h(n,{key:0,style:{"padding-right":"16px"},span:4},{default:a(()=>[t(Ne,{params:b(Ie)({SUPER_ADMIN:!1,REGION_MANAGER:!1}),onGetTree:le},null,8,["params"])]),_:1})):F("",!0),t(n,{span:b(S)(["SUPER_ADMIN","REGION_MANAGER"])?20:24},{default:a(()=>[p("div",null,[t(U,{class:"search mb-16"},{default:a(()=>[t(M,{"label-suffix":":",model:s,size:"small"},{default:a(()=>[t(w,{gutter:16,class:"mb-16"},{default:a(()=>[t(n,{span:8},{default:a(()=>[t(d,{label:"\u7528\u6237\u59D3\u540D"},{default:a(()=>[t(r,{modelValue:s.name,"onUpdate:modelValue":e[0]||(e[0]=l=>s.name=l),placeholder:"\u8BF7\u8F93\u5165"},null,8,["modelValue"])]),_:1})]),_:1}),t(n,{span:8},{default:a(()=>[t(d,{label:"\u624B\u673A\u53F7\u7801"},{default:a(()=>[t(r,{modelValue:s.phoneNo,"onUpdate:modelValue":e[1]||(e[1]=l=>s.phoneNo=l),maxlength:"11",placeholder:"\u8BF7\u8F93\u5165"},null,8,["modelValue"])]),_:1})]),_:1}),t(n,{span:8},{default:a(()=>[t(d,{label:"\u7528\u6237\u89D2\u8272"},{default:a(()=>[t(se,{modelValue:s.userRoleList,"onUpdate:modelValue":e[2]||(e[2]=l=>s.userRoleList=l),style:{width:"100%"},clearable:"",placeholder:"\u8BF7\u9009\u62E9"},{default:a(()=>[(g(!0),C(O,null,Y(b(z),(l,_)=>(g(),h(E,{key:_,label:l.name,value:l.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1}),t(w,{gutter:16},{default:a(()=>[t(n,{span:8},{default:a(()=>[t(d,{label:"\u6240\u5728\u5355\u4F4D",maxlength:"50"},{default:a(()=>[t(r,{modelValue:s.orgName,"onUpdate:modelValue":e[3]||(e[3]=l=>s.orgName=l),placeholder:"\u8BF7\u8F93\u5165"},null,8,["modelValue"])]),_:1})]),_:1}),t(n,{span:16},{default:a(()=>[t(d,{class:"btn"},{default:a(()=>[t(L,{type:"primary",onClick:H},{default:a(()=>e[10]||(e[10]=[f("\u67E5\u8BE2")])),_:1}),t(L,{onClick:J},{default:a(()=>e[11]||(e[11]=[f("\u91CD\u7F6E")])),_:1})]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])]),_:1}),t(U,null,{header:a(()=>e[12]||(e[12]=[p("div",{class:"flex justify-between items-center"},[p("span",null,"\u7528\u6237\u5217\u8868")],-1)])),default:a(()=>[t(ne,{ref_key:"tableListRef",ref:R,column:j,data:V.value,total:B.value,onGetTableData:c},{isEnable:a(({scope:l})=>[p("div",{class:"dot",style:A({background:l.row.status=="DISABLE"?"#FF3B30":"#4ECB74"})},null,4),e[13]||(e[13]=f(" \xA0")),p("span",{style:A({color:l.row.status=="DISABLE"?"#FF3B30":"#4ECB74"})},N(l.row.status=="DISABLE"?"\u7981\u7528\u4E2D":"\u542F\u7528\u4E2D"),5)]),updated:a(({scope:l})=>[f(N(b(Le)(l.row.updated).format("YYYY-MM-DD HH:mm:ss")),1)]),action:a(({scope:l})=>{var _,T;return[p("a",{onClick:I=>K(l.row)},"\u7F16\u8F91",8,he),l.row.status==="ENABLE"&&((T=(_=b(q).userRoleInfoList)==null?void 0:_.filter(I=>I.code==="SUPER_ADMIN"))==null?void 0:T.length)?(g(),C("a",{key:0,onClick:I=>ee(l.row)},"\u4EE3\u767B\u5F55",8,Ee)):F("",!0),p("a",{onClick:I=>X(l.row)},N(l.row.status==="DISABLE"?"\u542F\u7528":"\u7981\u7528"),9,we)]}),_:1},8,["column","data","total"])]),_:1}),t(ie,{"model-value":y.value,title:"\u7F16\u8F91 - "+x.value,width:"600px",onClose:e[9]||(e[9]=l=>y.value=!1)},{footer:a(()=>[t(L,{type:"primary",onClick:e[7]||(e[7]=l=>W(D.value))},{default:a(()=>e[15]||(e[15]=[f(" \u63D0\u4EA4 ")])),_:1}),t(L,{onClick:e[8]||(e[8]=l=>y.value=!1)},{default:a(()=>e[16]||(e[16]=[f(" \u5173\u95ED ")])),_:1})]),default:a(()=>[t(M,{ref_key:"formRef",ref:D,model:i.value,rules:Q,"label-width":"90px","label-suffix":":"},{default:a(()=>[t(d,{label:"\u624B\u673A\u53F7\u7801",prop:"phoneNo"},{default:a(()=>[t(r,{modelValue:i.value.phoneNo,"onUpdate:modelValue":e[4]||(e[4]=l=>i.value.phoneNo=l),placeholder:"\u8BF7\u8F93\u5165",maxlength:"11"},null,8,["modelValue"])]),_:1}),t(d,{label:"\u7528\u6237\u89D2\u8272",prop:"userRoleInfoList"},{default:a(()=>[t(ue,{modelValue:i.value.userRoleInfoList,"onUpdate:modelValue":e[5]||(e[5]=l=>i.value.userRoleInfoList=l)},{default:a(()=>[(g(!0),C(O,null,Y($.value,l=>(g(),h(re,{key:l.id,label:l.id,onChange:_=>te(_,l.name)},{default:a(()=>[f(N(l.name),1)]),_:2},1032,["label","onChange"]))),128))]),_:1},8,["modelValue"])]),_:1}),t(d,{label:"\u72B6\u6001",prop:"status"},{default:a(()=>[t(de,{modelValue:i.value.status,"onUpdate:modelValue":e[6]||(e[6]=l=>i.value.status=l),style:{"--el-switch-on-color":"#4ecb74","--el-switch-off-color":"#ff3b30"}},null,8,["modelValue"]),e[14]||(e[14]=f("\xA0 ")),p("span",{style:A({color:i.value.status?"#4ECB74":"#FF3B30"})},N(i.value.status?"\u5DF2\u542F\u7528":"\u5DF2\u7981\u7528"),5)]),_:1})]),_:1},8,["model"])]),_:1},8,["model-value","title"])])]),_:1},8,["span"])]),_:1})}}});export{xe as default};