import{H as a,h as g,r as n,s as y}from"./index.ad3efb29.js";import"./elementPlus.4833989a.js";import{G as b,U as c,D as v,A as q,e as D}from"./api.abdfe0a6.js";import{d as l}from"./dictionary.bf4815bd.js";import{B as _}from"./vue.adf17aba.js";import"./echarts.72dc8373.js";import"./dictionary.506d4581.js";const P=function({crudExpose:p,context:r}){const u=async e=>{const t=r!=null&&r.isShowChildFlag.value?"1":"0",i=await b({...e,show_all:t});return i.data.forEach(s=>{s.dept=String(s.dept),s.role&&Array.isArray(s.role)&&s.role.length>0&&(s.role=s.role.map(w=>String(w)))}),i},m=async({form:e,row:t})=>(e.id=t.id,await c(e)),d=async({row:e})=>{const t=await v(e.id);return r==null||r.getDeptInfo(),t},h=async({form:e})=>{const t=await q(e);return r==null||r.getDeptInfo(),t},f=async e=>await D(e),o=_("$hasPermissions");return{crudOptions:{table:{remove:{confirmMessage:"是否删除该用户？"}},request:{pageRequest:u,addRequest:h,editRequest:m,delRequest:d},actionbar:{buttons:{add:{show:o("user:Create")},export:{text:"导出",title:"导出",click(){return f(p.getSearchFormData())}}}},search:{container:{action:{col:{span:10}}}},rowHandle:{fixed:"right",width:250,buttons:{view:{show:!1},edit:{show:o("user:Update")},remove:{show:o("user:Delete")},custom:{text:"重设密码",type:"primary",show:o("user:ResetPassword"),tooltip:{placement:"top",content:"重设密码"},click:e=>{}}}},columns:{_index:{title:"序号",form:{show:!1},column:{type:"index",align:"center",width:"70px",columnSetDisabled:!0}},search:{title:"关键词",column:{show:!1},search:{show:!0,component:{props:{clearable:!0},placeholder:"请输入关键词"}},form:{show:!1,component:{props:{clearable:!0}}}},username:{title:"账号",type:"input",column:{minWidth:100},form:{rules:[{required:!0,message:"账号必填项"}],component:{placeholder:"请输入账号"}}},password:{title:"密码",type:"input",column:{show:!1},editForm:{show:!1},form:{rules:[{required:!0,message:"密码必填项"}],component:{span:12,showPassword:!0,placeholder:"请输入密码"}}},name:{title:"姓名",type:"input",column:{minWidth:100},form:{rules:[{required:!0,message:"姓名必填项"}],component:{span:12,placeholder:"请输入姓名"}}},dept:{title:"部门",type:"dict-tree",dict:a({isTree:!0,url:"/api/system/dept/all_dept/",value:"id",label:"name",getData:async({url:e})=>n({url:e}).then(t=>t.data)}),column:{minWidth:150},form:{rules:[{required:!0,message:"必填项"}],component:{filterable:!0,placeholder:"请选择",props:{props:{value:"id",label:"name"}}}}},role:{title:"角色",search:{show:!0,component:{props:{clearable:!0}}},type:"dict-select",dict:a({url:"/api/system/role/",value:"id",label:"name",isTree:!0,getData:async({url:e})=>n({url:e,params:{page:1,limit:10}}).then(t=>t.data)}),column:{minWidth:100},form:{rules:[{required:!0,message:"必填项"}],component:{multiple:!0,filterable:!0,placeholder:"请选择角色"}}},mobile:{title:"手机号码",type:"input",column:{minWidth:120},form:{rules:[{max:20,message:"请输入正确的手机号码",trigger:"blur"},{pattern:/^1[3-9]\d{9}$/,message:"请输入正确的手机号码"}],component:{placeholder:"请输入手机号码"}}},email:{title:"邮箱",column:{width:260},form:{rules:[{type:"email",message:"请输入正确的邮箱地址",trigger:["blur","change"]}],component:{placeholder:"请输入邮箱"}}},gender:{title:"性别",type:"dict-select",dict:a({data:l("gender")}),form:{value:1,component:{span:12}},component:{props:{color:"auto"}}},user_type:{title:"用户类型",search:{show:!0},type:"dict-select",dict:a({data:l("user_type")}),column:{minWidth:100},form:{show:!1,value:0,component:{span:12}}},is_active:{title:"锁定",search:{show:!0},type:"dict-radio",column:{component:{name:"fs-dict-switch",activeText:"",inactiveText:"",style:"--el-switch-on-color: var(--el-color-primary); --el-switch-off-color: #dcdfe6",onChange:g(e=>()=>{c(e.row).then(t=>{y(t.msg)})})}},dict:a({data:l("button_status_bool")})},avatar:{title:"头像",type:"avatar-cropper",form:{show:!1}}}}}};export{P as createCrudOptions};
