import{r as s,d as y,H as n,h as b,s as x}from"./index.ad3efb29.js";import"./elementPlus.4833989a.js";import{d as c}from"./dictionary.bf4815bd.js";import{r as d,B as v}from"./vue.adf17aba.js";const a="/api/system/user/";function C(e){return s({url:"/api/system/dept/dept_lazy_tree/",method:"get",params:e})}function _(e){return s({url:a,method:"get",params:e})}function q(e){return s({url:a,method:"post",data:e})}function p(e){return s({url:a+e.id+"/",method:"put",data:e})}function D(e){return s({url:a+e+"/",method:"delete",data:{id:e}})}function R(e){return y({url:a+"export_data/",params:e,method:"get"})}function F(e,o){return s({url:a+`${o}/reset_password/`,method:"put",data:e})}function P(){const e=d(!1),o=d(0);function l(u){e.value=!0,o.value=u}return{dialogVisible:e,resetId:o,isShowDialog:l}}const O=function({crudExpose:e}){const o=async t=>await _(t),l=async({form:t,row:r})=>(t.id=r.id,await p(t)),u=async({row:t})=>await D(t.id),m=async({form:t})=>await q(t),h=async t=>await R(t),i=v("$hasPermissions"),{dialogVisible:f,isShowDialog:w,resetId:g}=P();return{dialogVisible:f,resetId:g,crudOptions:{table:{remove:{confirmMessage:"是否删除该用户？"},border:!1},request:{pageRequest:o,addRequest:m,editRequest:l,delRequest:u},actionbar:{buttons:{add:{show:i("user:Create")},export:{text:"导出",title:"导出",click(){return h(e.getSearchFormData())}}}},rowHandle:{fixed:"right",width:200,buttons:{view:{show:!1},edit:{iconRight:"Edit",type:"text",show:i("user:Update")},remove:{iconRight:"Delete",type:"text",show:i("user:Delete")},custom:{text:"重设密码",type:"text",show:i("user:ResetPassword"),tooltip:{placement:"top",content:"重设密码"},click:t=>{const{row:r}=t;console.log("row",r),w(r.id)}}}},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:"input",column:{show:!1},editForm:{show:!1},form:{rules:[{required:!0,message:"密码必填项"}],component:{span:12,showPassword:!0,placeholder:"请输入密码"}}},name:{title:"姓名",search:{show:!0},type:"input",column:{minWidth:100},form:{rules:[{required:!0,message:"姓名必填项"}],component:{span:12,placeholder:"请输入姓名"}}},gender:{title:"性别",type:"dict-select",dict:n({data:c("gender")}),column:{minWidth:80},form:{value:1,component:{span:12}},component:{props:{color:"auto"}}},dept:{title:"部门",search:{disabled:!0},type:"dict-tree",dict:n({isTree:!0,url:"/api/system/dept/all_dept/",value:"id",label:"name",getData:async({url:t})=>s({url:t}).then(r=>r.data)}),column:{minWidth:180},form:{rules:[{required:!0,message:"必填项"}],component:{filterable:!0,placeholder:"请选择",props:{props:{value:"id",label:"name"}}}}},role:{title:"角色",search:{disabled:!0},type:"dict-select",dict:n({url:"/api/system/role/",value:"id",label:"name",isTree:!0,getData:async({url:t})=>s({url:t,params:{page:1,limit:30}}).then(r=>r.data)}),column:{minWidth:180},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:"请输入邮箱"}}},user_type:{title:"用户类型",search:{show:!0},type:"dict-select",dict:n({data:c("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(t=>()=>{p(t.row).then(r=>{x(r.msg)})})}},dict:n({data:c("button_status_bool")})},avatar:{title:"头像",type:"avatar-cropper",column:{show:!1},form:{show:!1}}}}}},G=Object.freeze(Object.defineProperty({__proto__:null,createCrudOptions:O},Symbol.toStringTag,{value:"Module"}));export{C as G,G as a,O as c,F as p};
