Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

2 řádky
5.4KB

  1. import{x as Y,a as A,r as i,$ as D,o as ee,E as x,b as o,c as d,d as g,f as a,h as l,F as L,H as E,u as te,L as R,i as m,t as y,e as B,M as le,k as ae,Z as se,ax as oe,ay as ue,s as ne}from"./index-dd5fae99.js";const re=["onClick"],ie=["onClick"],de=ae({name:"memberManage"}),fe=Object.assign(de,{setup(me){const I=Y(),{proxy:k}=ne(),r=A({name:void 0,userRoleList:void 0}),_=i(),V=i(0),F=A([{label:"序号",type:"index",width:"80"},{label:"姓名",key:"name",prop:"name"},{label:"角色",slot:"userRoleList",minWidth:"200"},{label:"状态",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"?"启用":"禁用")]},{label:"操作",slot:"action",width:"120",fixed:"right"}]),C=i([]),p=async(s=_.value.pageParams)=>{const e=await se({...s,...r,orgCode:I.query.id});C.value=e.data.records,V.value=e.data.total},U=()=>{p()},q=()=>{r.name=void 0,r.userRoleList=void 0,_.value.pageParams.pageNumber=1,_.value.pageParams.pageSize=10,p()},f=i(!1),N=i(),u=i({status:!0}),z=s=>{N.value=s.name,u.value={...s,userRoleList:s.userRoleList.map(e=>e.id),status:s.status==="ENABLE"},f.value=!0},M={phoneNo:[{required:!0,pattern:/^1[3456789]\d{9}$/,message:"手机号码格式不正确",trigger:"blur"}],userRoleList:[{required:!0,message:"请选择用户角色",trigger:"change"}],status:[{required:!0,message:"请选择状态",trigger:"change"}]},$=i(),P=async s=>{s&&await s.validate(async e=>{if(e){const v={...u.value,status:u.value.status?"ENABLE":"DISABLE",userRoleInfoList:x.userStore.roleListDict.filter(n=>u.value.userRoleList.includes(n.id)).map(n=>({id:n.id,name:n.name}))};await oe(v),k.$message.success("编辑成功!"),f.value=!1,p()}})},T=s=>{const e=s.status==="DISABLE"?"启用":"禁用";k.$messageBox.confirm(`是否${e}该用户?`,"提示!",{type:"warning"}).then(async()=>{await ue({employeeCode:s.employeeCode,operation:s.status==="DISABLE"?"ENABLE":"DISABLE",userId:s.userId}),k.$message.success(`${e}成功!`),p()})};return ee(()=>{x.userStore.setRoleStore(),p()}),(s,e)=>{const v=o("el-input"),n=o("el-form-item"),w=o("el-col"),j=o("el-option"),G=o("el-select"),b=o("el-button"),H=o("el-row"),h=o("el-form"),S=o("el-card"),O=o("el-tag"),W=o("table-list"),Z=o("el-checkbox"),J=o("el-checkbox-group"),K=o("el-switch"),Q=o("el-dialog");return d(),g(L,null,[a(S,{shadow:"never",class:"search"},{default:l(()=>[a(h,{"label-suffix":":",model:r,size:"small"},{default:l(()=>[a(H,{gutter:16},{default:l(()=>[a(w,{span:8},{default:l(()=>[a(n,{label:"姓名"},{default:l(()=>[a(v,{modelValue:r.name,"onUpdate:modelValue":e[0]||(e[0]=t=>r.name=t),placeholder:"请输入"},null,8,["modelValue"])]),_:1})]),_:1}),a(w,{span:8},{default:l(()=>[a(n,{label:"用户角色"},{default:l(()=>[a(G,{modelValue:r.userRoleList,"onUpdate:modelValue":e[1]||(e[1]=t=>r.userRoleList=t),style:{width:"100%"},placeholder:"请选择",multiple:!0,"value-key":"id"},{default:l(()=>[(d(!0),g(L,null,E(te(x).userStore.roleListDict,(t,c)=>(d(),R(j,{key:c,label:t.name,value:t},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),a(w,{span:8},{default:l(()=>[a(n,{class:"btn"},{default:l(()=>[a(b,{type:"primary",onClick:U},{default:l(()=>e[8]||(e[8]=[m("查询")])),_:1}),a(b,{onClick:q},{default:l(()=>e[9]||(e[9]=[m("重置")])),_:1})]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])]),_:1}),a(S,{title:"角色列表",shadow:"never"},{default:l(()=>[a(W,{ref_key:"tableListRef",ref:_,column:F,data:C.value,total:V.value,onGetTableData:p},{userRoleList:l(({scope:t})=>[(d(!0),g(L,null,E(t.row.userRoleList,(c,X)=>(d(),R(O,{key:X,type:"info",class:"mr-4 mb-4"},{default:l(()=>[m(y(c.name),1)]),_:2},1024))),128))]),action:l(({scope:t})=>[B("a",{class:"text-primary",onClick:c=>z(t.row)},"编辑",8,re),B("a",{onClick:c=>T(t.row)},y(t.row.status==="ENABLE"?"禁用":"启用"),9,ie)]),_:1},8,["column","data","total"])]),_:1}),a(Q,{"model-value":f.value,title:"编辑 - "+N.value,width:"600px",onClose:e[7]||(e[7]=t=>f.value=!1)},{footer:l(()=>[a(b,{type:"primary",onClick:e[5]||(e[5]=t=>P($.value))},{default:l(()=>e[11]||(e[11]=[m(" 提交 ")])),_:1}),a(b,{onClick:e[6]||(e[6]=t=>f.value=!1)},{default:l(()=>e[12]||(e[12]=[m(" 关闭 ")])),_:1})]),default:l(()=>[a(h,{ref_key:"formRef",ref:$,model:u.value,rules:M,"label-width":"90px","label-suffix":":"},{default:l(()=>[a(n,{label:"手机号码",prop:"phoneNo"},{default:l(()=>[a(v,{modelValue:u.value.phoneNo,"onUpdate:modelValue":e[2]||(e[2]=t=>u.value.phoneNo=t),style:{width:"200px"},placeholder:"请输入",maxlength:"11"},null,8,["modelValue"])]),_:1}),a(n,{label:"用户角色",prop:"userRoleList"},{default:l(()=>[a(J,{modelValue:u.value.userRoleList,"onUpdate:modelValue":e[3]||(e[3]=t=>u.value.userRoleList=t)},{default:l(()=>[(d(!0),g(L,null,E(s.roleList.filter(t=>t.name==="普通用户"||t.name==="单位管理员"),t=>(d(),R(Z,{key:t.id,label:t.id},{default:l(()=>[m(y(t.name),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])]),_:1}),a(n,{label:"状态",prop:"status"},{default:l(()=>[a(K,{modelValue:u.value.status,"onUpdate:modelValue":e[4]||(e[4]=t=>u.value.status=t),style:{"--el-switch-on-color":"#4ecb74","--el-switch-off-color":"#ff3b30"}},null,8,["modelValue"]),e[10]||(e[10]=m("  ")),B("span",{style:le({color:u.value.status?"#4ECB74":"#FF3B30"})},y(u.value.status?"已启用":"已禁用"),5)]),_:1})]),_:1},8,["model"])]),_:1},8,["model-value","title"])],64)}}});export{fe as default};