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
5.7KB

  1. import{d as Z,z as ee,b as A,r as i,a0 as D,o as te,D as k,c as o,e as d,f as g,h as a,i as l,F as L,J as x,u as le,I as R,j as m,t as y,g as E,U as ae,$ as se,av as oe,aw as ue,x as ne}from"./index.3d9e59d0.js";const re=["onClick"],ie=["onClick"],de=Z({name:"memberManage"}),pe=Object.assign(de,{setup(me){const I=ee(),{proxy:w}=ne(),r=A({name:void 0,userRoleList:void 0}),_=i(),B=i(0),U=A([{label:"\u5E8F\u53F7",type:"index",width:"80"},{label:"\u59D3\u540D",key:"name",prop:"name"},{label:"\u89D2\u8272",slot:"userRoleList",minWidth:"200"},{label:"\u72B6\u6001",key:"status",prop:"status",width:"120",render:s=>[D("span",{class:["dot mr-4",`${s.status==="ENABLE"?"bg-success":"bg-danger"}`]}),D("span",{class:`${s.status==="ENABLE"?"text-success":"text-danger"}`},s.status==="ENABLE"?"\u542F\u7528":"\u7981\u7528")]},{label:"\u64CD\u4F5C",slot:"action",width:"120",fixed:"right"}]),V=i([]),c=async(s=_.value.pageParams)=>{const t=await se({...s,...r,orgCode:I.query.id});V.value=t.data.records,B.value=t.data.total},F=()=>{c()},q=()=>{r.name=void 0,r.userRoleList=void 0,_.value.pageParams.pageNumber=1,_.value.pageParams.pageSize=10,c()},p=i(!1),C=i(),u=i({status:!0}),z=s=>{C.value=s.name,u.value={...s,userRoleList:s.userRoleList.map(t=>t.id),status:s.status==="ENABLE"},p.value=!0},P={phoneNo:[{required:!0,pattern:/^1[3456789]\d{9}$/,message:"\u624B\u673A\u53F7\u7801\u683C\u5F0F\u4E0D\u6B63\u786E",trigger:"blur"}],userRoleList:[{required:!0,message:"\u8BF7\u9009\u62E9\u7528\u6237\u89D2\u8272",trigger:"change"}],status:[{required:!0,message:"\u8BF7\u9009\u62E9\u72B6\u6001",trigger:"change"}]},N=i(),T=async s=>{!s||await s.validate(async t=>{if(t){const v={...u.value,status:u.value.status?"ENABLE":"DISABLE",userRoleInfoList:k.userStore.roleListDict.filter(n=>u.value.userRoleList.includes(n.id)).map(n=>({id:n.id,name:n.name}))};await oe(v),w.$message.success("\u7F16\u8F91\u6210\u529F\uFF01"),p.value=!1,c()}})},j=s=>{const t=s.status==="DISABLE"?"\u542F\u7528":"\u7981\u7528";w.$messageBox.confirm(`\u662F\u5426${t}\u8BE5\u7528\u6237?`,"\u63D0\u793A\uFF01",{type:"warning"}).then(async()=>{await ue({employeeCode:s.employeeCode,operation:s.status==="DISABLE"?"ENABLE":"DISABLE",userId:s.userId}),w.$message.success(`${t}\u6210\u529F\uFF01`),c()})};return te(()=>{k.userStore.setRoleStore(),c()}),(s,t)=>{const v=o("el-input"),n=o("el-form-item"),h=o("el-col"),M=o("el-option"),G=o("el-select"),b=o("el-button"),J=o("el-row"),$=o("el-form"),S=o("el-card"),O=o("el-tag"),W=o("table-list"),H=o("el-checkbox"),K=o("el-checkbox-group"),Q=o("el-switch"),X=o("el-dialog");return d(),g(L,null,[a(S,{shadow:"never",class:"search"},{default:l(()=>[a($,{"label-suffix":":",model:r,size:"small"},{default:l(()=>[a(J,{gutter:16},{default:l(()=>[a(h,{span:8},{default:l(()=>[a(n,{label:"\u59D3\u540D"},{default:l(()=>[a(v,{modelValue:r.name,"onUpdate:modelValue":t[0]||(t[0]=e=>r.name=e),placeholder:"\u8BF7\u8F93\u5165"},null,8,["modelValue"])]),_:1})]),_:1}),a(h,{span:8},{default:l(()=>[a(n,{label:"\u7528\u6237\u89D2\u8272"},{default:l(()=>[a(G,{modelValue:r.userRoleList,"onUpdate:modelValue":t[1]||(t[1]=e=>r.userRoleList=e),style:{width:"100%"},placeholder:"\u8BF7\u9009\u62E9",multiple:!0,"value-key":"id"},{default:l(()=>[(d(!0),g(L,null,x(le(k).userStore.roleListDict,(e,f)=>(d(),R(M,{key:f,label:e.name,value:e},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),a(h,{span:8},{default:l(()=>[a(n,{class:"btn"},{default:l(()=>[a(b,{type:"primary",onClick:F},{default:l(()=>[m("\u67E5\u8BE2")]),_:1}),a(b,{onClick:q},{default:l(()=>[m("\u91CD\u7F6E")]),_:1})]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])]),_:1}),a(S,{title:"\u89D2\u8272\u5217\u8868",shadow:"never"},{default:l(()=>[a(W,{ref_key:"tableListRef",ref:_,column:U,data:V.value,total:B.value,onGetTableData:c},{userRoleList:l(({scope:e})=>[(d(!0),g(L,null,x(e.row.userRoleList,(f,Y)=>(d(),R(O,{key:Y,type:"info",class:"mr-4 mb-4"},{default:l(()=>[m(y(f.name),1)]),_:2},1024))),128))]),action:l(({scope:e})=>[E("a",{class:"text-primary",onClick:f=>z(e.row)},"\u7F16\u8F91",8,re),E("a",{onClick:f=>j(e.row)},y(e.row.status==="ENABLE"?"\u7981\u7528":"\u542F\u7528"),9,ie)]),_:1},8,["column","data","total"])]),_:1}),a(X,{"model-value":p.value,title:"\u7F16\u8F91 - "+C.value,width:"600px",onClose:t[7]||(t[7]=e=>p.value=!1)},{footer:l(()=>[a(b,{type:"primary",onClick:t[5]||(t[5]=e=>T(N.value))},{default:l(()=>[m(" \u63D0\u4EA4 ")]),_:1}),a(b,{onClick:t[6]||(t[6]=e=>p.value=!1)},{default:l(()=>[m(" \u5173\u95ED ")]),_:1})]),default:l(()=>[a($,{ref_key:"formRef",ref:N,model:u.value,rules:P,"label-width":"90px","label-suffix":":"},{default:l(()=>[a(n,{label:"\u624B\u673A\u53F7\u7801",prop:"phoneNo"},{default:l(()=>[a(v,{modelValue:u.value.phoneNo,"onUpdate:modelValue":t[2]||(t[2]=e=>u.value.phoneNo=e),style:{width:"200px"},placeholder:"\u8BF7\u8F93\u5165",maxlength:"11"},null,8,["modelValue"])]),_:1}),a(n,{label:"\u7528\u6237\u89D2\u8272",prop:"userRoleList"},{default:l(()=>[a(K,{modelValue:u.value.userRoleList,"onUpdate:modelValue":t[3]||(t[3]=e=>u.value.userRoleList=e)},{default:l(()=>[(d(!0),g(L,null,x(s.roleList.filter(e=>e.name==="\u666E\u901A\u7528\u6237"||e.name==="\u5355\u4F4D\u7BA1\u7406\u5458"),e=>(d(),R(H,{key:e.id,label:e.id},{default:l(()=>[m(y(e.name),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])]),_:1}),a(n,{label:"\u72B6\u6001",prop:"status"},{default:l(()=>[a(Q,{modelValue:u.value.status,"onUpdate:modelValue":t[4]||(t[4]=e=>u.value.status=e),style:{"--el-switch-on-color":"#4ecb74","--el-switch-off-color":"#ff3b30"}},null,8,["modelValue"]),m("\xA0 "),E("span",{style:ae({color:u.value.status?"#4ECB74":"#FF3B30"})},y(u.value.status?"\u5DF2\u542F\u7528":"\u5DF2\u7981\u7528"),5)]),_:1})]),_:1},8,["model"])]),_:1},8,["model-value","title"])],64)}}});export{pe as default};