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