import{r as o,d as y,H as l,h as b,s as v}from"./index.373e4c1e.js";import"./elementPlus.c5b0e04f.js";import{d as u}from"./dictionary.e641576e.js";import{q as _}from"./vue.65d9dadc.js";const n="/api/system/user/";function q(t){return o({url:n,method:"get",params:t})}function D(t){return o({url:n,method:"post",data:t})}function p(t){return o({url:n+t.id+"/",method:"put",data:t})}function O(t){return o({url:n+t+"/",method:"delete",data:{id:t}})}function S(t){return y({url:n+"export_data/",params:t,method:"get"})}function C(t,a){return o({url:`/api/system/dept/dept_info/?dept_id=${t}&show_all=${a}`,method:"get"})}const P=function({crudExpose:t,context:a}){const d=async e=>{const r=a!=null&&a.isShowChildFlag.value?"1":"0",c=await q({...e,show_all:r});return c.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)))}),c},m=async({form:e,row:r})=>(e.id=r.id,await p(e)),h=async({row:e})=>{const r=await O(e.id);return a==null||a.getDeptInfo(),r},f=async({form:e})=>{const r=await D(e);return a==null||a.getDeptInfo(),r},g=async e=>await S(e),i=_("$hasPermissions");return{crudOptions:{table:{remove:{confirmMessage:"是否删除该用户？"}},request:{pageRequest:d,addRequest:f,editRequest:m,delRequest:h},actionbar:{buttons:{add:{show:i("user:Create")},export:{text:"导出",title:"导出",click(){return g(t.getSearchFormData())}}}},search:{container:{action:{col:{span:10}}}},rowHandle:{fixed:"right",width:250,buttons:{view:{show:!1},edit:{show:i("user:Update")},remove:{show:i("user:Delete")},custom:{text:"重设密码",type:"primary",show:i("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:l({isTree:!0,url:"/api/system/dept/all_dept/",value:"id",label:"name",getData:async({url:e})=>o({url:e}).then(r=>r.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:l({url:"/api/system/role/",value:"id",label:"name",isTree:!0,getData:async({url:e})=>o({url:e,params:{page:1,limit:10}}).then(r=>r.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:l({data:u("gender")}),form:{value:1,component:{span:12}},component:{props:{color:"auto"}}},user_type:{title:"用户类型",search:{show:!0},type:"dict-select",dict:l({data:u("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:b(e=>()=>{p(e.row).then(r=>{v(r.msg)})})}},dict:l({data:u("button_status_bool")})},avatar:{title:"头像",type:"avatar-cropper",form:{show:!1}}}}}},F=Object.freeze(Object.defineProperty({__proto__:null,createCrudOptions:P},Symbol.toStringTag,{value:"Module"}));export{F as a,P as c,C as g};
