25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
8.2KB

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