| 1 |
- import{d as x,u as V,r as h,W as P,G as l,e as b,j as D,o as L,w as o,i as p,q as r,g as N,y as R,l as T,t as q,A as B,P as F}from"./index-DrOmHhrX.js";import{u as E,N as G,G as f,C as U}from"./index-CncJgErG.js";import{u as j,C as A}from"./index-Ch8YRhaD.js";import"./index-B-Iy9lJB.js";import"./index-DnkDK8NR.js";const I={style:{display:"flex","justify-content":"flex-end",width:"100%"}},K=x({__name:"index",setup(M){const{t:a}=V(),n=h([]),i=h([]),{register:_,tableActions:d}=E({title:"管理员",api:l.getAdminList,showSelection:!1,showIndex:!1,showAction:P(100,110),immediate:!0,columns:[{prop:"username",label:"账号"},{prop:"role_name",label:"角色",formatter(e){return e.role?.name}},{prop:"department",label:"部门",formatter(e){return e.department?.name}},{prop:"nickname",label:"昵称"},{prop:"user_code",label:"邀请码"},{prop:"sex",label:"性别",enums:f},{prop:"phone",label:"手机号"},{prop:"email",label:"邮箱"},{prop:"remark",label:"备注"}],schema:[{label:"昵称",prop:"username",type:"input"},{label:"状态",prop:"status",type:"select",options:G}],actionProps:{width:240,btnList:[{perm:100,label:"编辑",click:e=>{m({title:a("编辑")},t=>{t.setSchema("role_id","options",n.value),e.row.id!==1?t.setSchema("role_id","hidden",!1):t.setSchema("role_id","hidden",!0),t.setSchema("username","props",{disabled:!0}),t.setSchema("password","props",{placeholder:a("不输入则不做修改"),type:"password",showPassword:!1}),t.setSchema("password","required",!1),y().setFormModel({...e.row,password:""})})}},{perm:110,label:"删除",isPopConfirm:!0,type:"danger",popConfirmEmits:{confirm(e){return l.getAdminDelete({id:e.row.id}).then(()=>{d.reload()}),!0}}}]}}),[w,{open:m,getFormActions:y}]=j({api:l.getAdminUpdate,successCallBack(e){d.reload()},formConfig:{schema:[{label:"id",prop:"id",type:"input",notShow:!0},{label:"账号",prop:"username",type:"input",props:{disabled:!0},required:!0},{label:"是否客服",prop:"is_kefu",type:"switch",props:{inlinePrompt:!0,activeText:"是",activeValue:1,inactiveText:"否",inactiveValue:0,size:"large"}},{label:"昵称",prop:"nickname",type:"input"},{label:"性别",prop:"sex",type:"radio-group",options:f,defaultValue:0},{label:"角色",prop:"role_id",type:"select",options:[]},{label:"部门",prop:"department_id",type:"select",options:[],slotName:"department"},{label:"手机号",prop:"phone",type:"input"},{label:"邮箱",prop:"email",type:"input"},{label:"备注",prop:"remark",type:"input"},{label:"登录密码",prop:"password",type:"input",required:!0,props:{placeholder:a("不输入则不做修改"),type:"password",showPassword:!1}}]}}),u=e=>Array.isArray(e)?e.map(t=>{const s={...t,label:t.name,name:t.name};return t.children&&t.children.length>0&&(s.children=u(t.children)),s}):[];function g(){l.roleList({}).then(e=>{n.value=e.list.map(t=>({...t,label:t.name,value:t.id}))})}function v(){l.departmentTree({}).then(e=>{i.value=u(e)})}function C(){m({title:a("新增")},e=>{e.reset(),e.setSchema("username","props",{disabled:!1}),e.setSchema("role_id","options",n.value),e.setSchema("password","props",{placeholder:a("请输入"),type:"password",showPassword:!1})})}return g(),v(),(e,t)=>{const s=b("el-button"),S=b("el-tree-select");return L(),D(F,null,{default:o(()=>[p(r(U),{onRegister:r(_)},{titleRight:o(()=>[N("div",I,[R(p(s,{type:"primary",onClick:C},{default:o(()=>[T(q(r(a)("新增")),1)]),_:1},512),[[B,e.$perm(90)]])])]),_:1},8,["onRegister"]),p(r(A),{onRegister:r(w),width:"450",top:"5vh",draggable:""},{department:o(({model:c})=>[p(S,{modelValue:c.department_id,"onUpdate:modelValue":k=>c.department_id=k,data:r(i),"node-key":"id","check-strictly":""},null,8,["modelValue","onUpdate:modelValue","data"])]),_:1},8,["onRegister"])]),_:1})}}});export{K as default};
|