import{r as o,S as g,f as y,W as s,I as b,F as _,s as u}from"./index.CL7yl-Wb.js";import{d as n}from"./dictionary.BGob_AR7.js";import{aC as v,f as c}from"./vue.D1BjjNmv.js";import{M as x}from"./md5.DLPczxzP.js";import{c as q}from"./commonCrud.BgclFrj_.js";const a="/api/system/user/";function B(t){return o({url:"/api/system/dept/all_dept/",method:"get",params:t})}function S(t){return o({url:a,method:"get",params:{...t,tenant_id:g.get("tenant_id")}})}function R(t){return o({url:a,method:"post",data:t})}function d(t){return o({url:a+t.id+"/",method:"put",data:t})}function T(t){return o({url:a+t+"/",method:"delete",data:{id:t}})}function W(t){return o({url:a+t+"/reset_to_default_password/",method:"put"})}const C=function({crudExpose:t}){const m=async e=>await S(e),p=async({form:e,row:r})=>(e.id=r.id,await d(e)),h=async({row:e})=>await T(e.id),f=async({form:e})=>await R(e),i=async e=>{await W(e.id),u("重置密码成功")},w=y(),{systemConfig:l}=v(w);return c(()=>l.value),{crudOptions:{table:{remove:{confirmMessage:"是否删除该用户？"}},request:{pageRequest:m,addRequest:f,editRequest:p,delRequest:h},form:{initialForm:{password:c(()=>l.value["base.default_password"])}},actionbar:{buttons:{add:{show:!0},export:{text:"导出",title:"导出",show:!0,click:e=>_.confirm("确定重设密码吗？","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(()=>i(e.row))}}},rowHandle:{fixed:"right",width:200,buttons:{view:{show:!1},edit:{iconRight:"Edit",type:"text",show:!0},remove:{iconRight:"Delete",type:"text",show:!0},custom:{text:"重设密码",type:"text",show:!0,tooltip:{placement:"top",content:"重设密码"},click:e=>{const{row:r}=e;i(r)}}}},columns:{_index:{title:"序号",form:{show:!1},column:{type:"index",align:"center",width:"70px",columnSetDisabled:!0}},username:{title:"账号",search:{show:!0},type:"input",column:{minWidth:100},form:{rules:[{required:!0,message:"账号必填项"}],component:{placeholder:"请输入账号"}}},password:{title:"密码",type:"password",column:{show:!1},editForm:{show:!1},form:{rules:[{required:!0,message:"密码必填项"}],component:{span:12,showPassword:!0,placeholder:"请输入密码"}},valueResolve({form:e}){e.password&&(e.password=x.hashStr(e.password))}},name:{title:"姓名",search:{show:!0},type:"input",column:{minWidth:100},form:{rules:[{required:!0,message:"姓名必填项"}],component:{span:12,placeholder:"请输入姓名"}}},dept:{title:"部门",search:{disabled:!0},type:"dict-tree",dict:s({isTree:!0,url:"/api/system/dept/all_dept/",value:"id",label:"name"}),column:{minWidth:200,formatter({value:e,row:r,index:O}){return r.dept_name_all}},form:{rules:[{required:!0,message:"必填项"}],component:{filterable:!0,placeholder:"请选择",props:{checkStrictly:!0,props:{value:"id",label:"name"}}}}},role:{title:"角色",search:{disabled:!0},type:"dict-select",dict:s({url:"/api/system/role/",value:"id",label:"name"}),column:{minWidth:200},form:{rules:[{required:!0,message:"必填项"}],component:{multiple:!0,filterable:!0,placeholder:"请选择角色"}}},mobile:{title:"手机号码",search:{show:!0},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:s({data:n("gender")}),form:{value:1,component:{span:12}},component:{props:{color:"auto"}}},user_type:{title:"用户类型",search:{show:!0},type:"dict-select",dict:s({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:b(e=>()=>{d(e.row).then(r=>{u(r.msg)})})}},dict:s({data:n("button_status_bool")})},avatar:{title:"头像",type:"avatar-uploader",align:"center",form:{show:!1},column:{minWidth:100}},...q({dept_belong_id:{form:!0,table:!0}})}}}},E=Object.freeze(Object.defineProperty({__proto__:null,createCrudOptions:C},Symbol.toStringTag,{value:"Module"}));export{B as G,E as a,C as c};
