import{G as y,U as i,D as g,A as b,e as x,r as v,b as q}from"./api.BC6Q2lgM.js";import{d as D,P as r,l as R,s as l}from"./index.DoJnwA7v.js";import"./elementPlus.CqHltQSO.js";import{d as s}from"./dictionary.BbheqGs8.js";import{a as o}from"./authFunction.DSpD5R8m.js";import{aD as _,k as n}from"./vue.1RczIYhx.js";import{M as C}from"./md5.DLPczxzP.js";import{c as S}from"./commonCrud.DPyHTIsZ.js";import{e as O}from"./emitter.EXGx020l.js";const E=function({crudExpose:c}){const u=async e=>await y(e),m=async({form:e,row:t})=>(e.id=t.id,await i(e)),p=async({row:e})=>await g(e.id),d=async({form:e})=>await b(e),h=async e=>await x(e),w=async e=>{await v(e.id),l("重置密码成功")},f=D(),{systemConfig:a}=_(f);return n(()=>a.value),{crudOptions:{table:{remove:{confirmMessage:"是否删除该用户？"}},request:{pageRequest:u,addRequest:d,editRequest:m,delRequest:p},form:{initialForm:{password:n(()=>a.value["base.default_password"])}},actionbar:{buttons:{add:{show:o("user:Create")},export:{text:"导出",title:"导出",show:o("user:Export"),click(){return h(c.getSearchFormData())}}}},rowHandle:{fixed:"right",width:150,buttons:{view:{show:!1},edit:{iconRight:"Edit",type:"text",show:o("user:Update")},remove:{iconRight:"Delete",type:"text",show:o("user:Delete")},custom:{text:"重设密码",type:"text",show:o("user:ResetPassword"),tooltip:{placement:"top",content:"重设密码"},click:e=>{const{row:t}=e;w(t)}},custom2:{text:"店铺授权",type:"text",tooltip:{placement:"top",content:"店铺授权"},click:e=>{const{row:t}=e;O.emit("shop-authorize",t)}}}},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=C.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:r({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:{checkStrictly:!0,props:{value:"id",label:"name"}}}}},role:{title:"角色",search:{disabled:!0},type:"dict-select",dict:r({url:"/api/system/role/",value:"id",label:"name"}),column:{minWidth:100},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:r({data:s("gender")}),form:{value:1,component:{span:12}},component:{props:{color:"auto"}}},user_type:{title:"用户类型",search:{show:!1},type:"dict-select",dict:r({data:s("user_type")}),column:{minWidth:100},form:{show:!1,value:0,component:{span:12}}},shop:{title:"授权店铺",type:"dict-select",search:{show:!0,component:{props:{filterable:!0}}},dict:r({value:"id",label:"name",getData:()=>q({is_all:!0}).then(e=>[{id:0,name:"全部"},...e.data])}),column:{show:!1}},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:R(e=>()=>{i(e.row).then(t=>{l(t.msg)})})}},dict:r({data:s("button_status_bool")})},avatar:{title:"头像",type:"avatar-cropper",form:{show:!1},column:{minWidth:400}},...S({dept_belong_id:{form:!0,table:!0}})}}}};export{E as createCrudOptions};
