import{r as s,W as r}from"./index.BBRX_LCt.js";import{G as l}from"./api.D3DSHzTB.js";import{M as i}from"./md5.DLPczxzP.js";const a="/api/platform/users/";function n(t){return s({url:a,method:"get",params:t})}function u(t){return s({url:a,method:"post",data:t})}function c(t){return s({url:a+t.id+"/",method:"put",data:t})}function d(t){return s({url:a+t+"/",method:"delete",data:{id:t}})}const h=function({crudExpose:t}){return{crudOptions:{toolbar:{buttons:{search:{show:!1},refresh:{show:!1},compact:{show:!1},export:{text:"导出",type:"primary",size:"small",icon:"upload",circle:!1,display:!0,show:!1},columns:{show:!1}}},search:{col:{span:3},show:!0,autoSearch:!1,buttons:{search:{size:"small"},reset:{size:"small"}}},request:{pageRequest:async e=>(console.log(e),await n(e)),addRequest:async({form:e})=>await u(e),editRequest:async({form:e,row:o})=>(e.id=o.id,await c(e)),delRequest:async({row:e})=>await d(e.id)},actionbar:{buttons:{add:{show:!0}}},rowHandle:{fixed:"right",width:200,buttons:{view:{iconRight:"View",type:"text",show:!0},edit:{iconRight:"Edit",type:"text",show:!1},remove:{iconRight:"Delete",type:"text",show:!1}}},columns:{_index:{title:"序号",form:{show:!1},column:{type:"index",align:"center",width:"70px",columnSetDisabled:!0}},username:{title:"用户名",type:"text",search:{show:!0},form:{component:{placeholder:"请输入用户名"},rules:[{required:!0,message:"请输入用户名"}]},column:{minWidth:120}},password:{title:"密码",type:"password",search:{show:!1},column:{show:!1},form:{component:{placeholder:"请输入密码"},rules:[{required:!0,message:"请输入密码"}],show:!0,column:{show:!1}},valueResolve({form:e}){e.password&&(e.password=i.hashStr(e.password))}},name:{title:"姓名",type:"text",search:{show:!1},form:{component:{placeholder:"请输入姓名"},rules:[{required:!0,message:"请输入姓名"}]},column:{minWidth:120}},mobile:{title:"手机号",type:"text",search:{show:!0},form:{component:{placeholder:"请输入手机号"},rules:[{required:!0,message:"请输入手机号"}]},column:{minWidth:120}},email:{title:"邮箱",type:"text",search:{show:!0},form:{component:{placeholder:"请输入邮箱"},rules:[{required:!0,message:"请输入邮箱"}]},column:{minWidth:180}},tenant_id:{title:"商户ID",search:{show:!0},type:"dict-select",dict:r({url:"/api/platform/tenants/",value:"tenant_id",label:"name",getData:e=>l({page:1,limit:20}).then(o=>o.data.results)})},is_active:{title:"账号状态",search:{show:!0},type:"dict-select",form:{show:!1,component:{placeholder:"请选择账号状态"}},column:{minWidth:120},dict:r({data:[{value:!0,label:"启用"},{value:!1,label:"禁用"}]})},date_joined:{title:"开通时间",type:"datetime",search:{show:!1},form:{component:{placeholder:"请选择开通时间"},show:!1},column:{minWidth:150}},last_login:{title:"最后登录时间",type:"datetime",search:{show:!1},form:{component:{placeholder:"请选择最后登录时间"},show:!1},column:{minWidth:150}},permission_level:{title:"权限等级",search:{show:!1},type:"dict-select",form:{component:{placeholder:"请选择权限等级"},show:!1},column:{minWidth:120},dict:r({data:[{value:"admin",label:"管理员"},{value:"user",label:"普通用户"},{value:"guest",label:"访客"}]})}}}}},x=Object.freeze(Object.defineProperty({__proto__:null,createCrudOptions:h},Symbol.toStringTag,{value:"Module"}));export{n as G,x as a,h as c};