import{x as r,s as i,W as s}from"./index.BlHGagmh.js";import{a as f}from"./authFunction.XhUWOTU5.js";import{r as _}from"./vue.YrNK8sx4.js";const n="/api/system/app_user/";function g(a){return r({url:n,method:"get",params:a})}function y(a){return r({url:n+a+"/",method:"get"})}function z(a){return r({url:n,method:"post",data:a})}function w(a){return r({url:n+a.id+"/",method:"put",data:a})}function b(a){return r({url:n+a+"/",method:"delete",data:{id:a}})}function x(){return r({url:n,method:"get"})}const q=function({crudExpose:a}){const u=async e=>await g(e),c=async({row:e})=>await y(e.id),d=async({form:e,row:t})=>(e.id=t.id,await w(e)),m=async({row:e})=>await b(e.id),p=async({form:e})=>await z(e),l=_([]),h=e=>{console.log("selection",e),l.value=e.map(t=>t.id)};return a.selectedIds=l,{crudOptions:{request:{pageRequest:u,editRequest:d,delRequest:m,addRequest:p,getDetail:c},actionbar:{buttons:{add:{show:f("area:Create")}}},form:{wrapper:{buttons:{ok:{text:"提交",show:i(e=>e.mode!=="view")}}}},pagination:{show:!0},table:{rowSelection:{show:!0,multiple:!0},onSelectionChange:h},columns:{$checked:{title:"选择",form:{show:!1},column:{type:"selection",align:"center",width:"55px",columnSetDisabled:!0,selectable(e,t){return e.id}}},_index:{title:"序号",form:{show:!1},column:{type:"index",align:"center",width:"70px",columnSetDisabled:!0}},search:{title:"关键字搜索",search:{show:!0,type:"input"},type:"input",form:{component:{placeholder:"请输入"},show:!1},column:{show:!1}},user_code:{title:"学号/工号",type:"input",column:{minWidth:120},form:{component:{placeholder:"请填写学号/工号"},rules:[{required:!0,message:"请填写学号/工号"}]},viewForm:{component:{placeholder:""}}},username:{title:"用户名",type:"input",column:{show:!1,minWidth:120},form:{component:{placeholder:"请填写用户名"},rules:[{required:!0,message:"请填写用户名"}]},viewForm:{component:{placeholder:""}}},name:{title:"姓名",search:{show:!1},treeNode:!0,type:"input",column:{minWidth:120},form:{rules:[{required:!0,message:"姓名必填项"}],component:{placeholder:"请输入姓名"}}},password:{title:"密码",type:"input",column:{minWidth:120,show:!1},form:{component:{placeholder:"请填写密码"}},addForm:{component:{placeholder:"请填写密码"},rules:[{required:!0,message:"请填写密码"}]},editForm:{show:!0},viewForm:{show:!1}},email:{title:"邮箱",type:"input",column:{show:!1,minWidth:120},form:{component:{placeholder:"请填写邮箱"},rules:[{required:!1,message:"请填写邮箱"}]},viewForm:{component:{placeholder:""}}},mobile:{title:"手机号",type:"input",column:{show:!1,minWidth:120},form:{component:{placeholder:"请填写手机号"},rules:[{required:!0,message:"请填写手机号"}]},viewForm:{component:{placeholder:""}}},gender:{title:"性别",type:"dict-select",column:{show:!0,minWidth:120},dict:s({data:[{label:"男",value:1},{label:"女",value:2}]}),form:{component:{placeholder:"请选择性别"},rules:[{required:!0,message:"请选择性别"}]}},user_type:{title:"用户类型",type:"dict-select",search:{show:!1},column:{minWidth:120},dict:s({data:[{label:"学生",value:0},{label:"教师",value:1},{label:"外部用户",value:2},{label:"学院领导",value:3}]}),form:{component:{placeholder:"请选择用户类型"},rules:[{required:!1,message:"请选择用户类型"}]}},organization_ref:{title:"学院",type:"dict-cascader",column:{show:!1}},organization_detail:{title:"组织架构",type:"dict-cascader",column:{show:!1,minWidth:200,formatter:({row:e,value:t})=>e.organization_detail&&e.organization_detail.full_path?e.organization_detail.full_path:t||""},form:{show:!1,component:{placeholder:"请填写组织架构"},rules:[{required:!1,message:"请填写组织架构"}]},viewForm:{component:{placeholder:""}}},organization:{title:"学院",type:"input",search:{show:!0},column:{show:!0,minWidth:200,formatter:({row:e,value:t})=>{if(e.user_type!==0)return e.organization_detail&&e.organization_detail.name?e.organization_detail.name:t||e.class_or_group;if(e.organization_detail&&e.organization_detail.parent_chain&&e.organization_detail.parent_chain.length>=2){if(!e.organization_detail.parent_chain[1])return;const o=e.organization_detail.parent_chain[1];return o.name||o.code||""}return t||e.sub_organization}},form:{show:i(e=>e.user_type===0||e.user_type===1||e.user_type===3),component:{placeholder:"请选择学院"},rules:[{required:!1,message:"请选择学院"}]},viewForm:{component:{placeholder:""}}},sub_organization:{title:"专业",type:"input",search:{show:!0},column:{show:!0,minWidth:120,formatter:({row:e,value:t})=>{if(e.organization_detail&&e.organization_detail.parent_chain&&e.organization_detail.parent_chain.length>=2){if(!e.organization_detail.parent_chain[2])return;const o=e.organization_detail.parent_chain[2];return o.name||o.code||""}return t||e.sub_organization}},form:{show:i(({form:e})=>e&&e.user_type==0),component:{placeholder:"请填写专业"},rules:[{required:!1,message:"请填写专业"}]}},grade_or_level:{title:"年级",type:"input",search:{show:!0},column:{show:!0,minWidth:120,formatter:({row:e,value:t})=>{if(e.user_type===0)return e.organization_detail&&e.organization_detail.name?e.organization_detail.name:t||e.class_or_group}},form:{show:i(({form:e})=>e&&e.user_type==0),component:{placeholder:"请选择年级"},rules:[{required:!1,message:"请选择年级"}]},viewForm:{component:{placeholder:""}}},class_or_group:{title:"班级",type:"input",search:{show:!0},column:{show:!1,minWidth:120,formatter:({row:e,value:t})=>e.organization_detail&&e.organization_detail.name?e.organization_detail.name:t||e.class_or_group},form:{show:!1,component:{placeholder:"请填写班级"},rules:[{required:!1,message:"请填写班级"}]},viewForm:{component:{placeholder:""}}}}}}},O=Object.freeze(Object.defineProperty({__proto__:null,createCrudOptions:q},Symbol.toStringTag,{value:"Module"}));export{x as G,O as a,q as c};