Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

2 lignes
5.4KB

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