import{x as r,s as l,W as g}from"./index.BznwVsHD.js";import{a as q}from"./authFunction.CYpTiIHq.js";import{r as W}from"./vue.YrNK8sx4.js";const o="/api/system/app_user/";function j(i){return r({url:o,method:"get",params:i})}function F(i){return r({url:o+i+"/",method:"get"})}function x(i){return r({url:o,method:"post",data:i})}function O(i){return r({url:o+i.id+"/",method:"put",data:i})}function S(i){return r({url:o+i+"/",method:"delete",data:{id:i}})}function C(){return r({url:o,method:"get"})}const R=function({crudExpose:i}){const f=async e=>await j(e),y=async({row:e})=>await F(e.id),z=async({form:e,row:a})=>(e.id=a.id,await O(e)),w=async({row:e})=>await S(e.id),b=async({form:e})=>await x(e),s=W([]),v=e=>{console.log("selection",e),s.value=e.map(a=>a.id)};return i.selectedIds=s,{crudOptions:{request:{pageRequest:f,editRequest:z,delRequest:w,addRequest:b,getDetail:y},actionbar:{buttons:{add:{show:q("area:Create")}}},form:{wrapper:{buttons:{ok:{text:"提交",show:l(e=>e.mode!=="view")}}}},pagination:{show:!0},table:{rowSelection:{show:!0,multiple:!0},onSelectionChange:v},columns:{$checked:{title:"选择",form:{show:!1},column:{type:"selection",align:"center",width:"55px",columnSetDisabled:!0,selectable(e,a){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:g({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:g({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},valueBuilder({form:e,value:a}){var u,d,c,p,m,_,h;e.organization_ref=a;const t=e.organization_detail;if(e.user_type===0&&t&&Array.isArray(t.parent_chain)){const n=t.parent_chain;n.length>=4?(e._college_id=(u=n[1])==null?void 0:u.id,e._major_id=(d=n[2])==null?void 0:d.id,e._grade_id=t==null?void 0:t.id):n.length===3?(e._college_id=(c=n[1])==null?void 0:c.id,e._major_id=(p=n[2])==null?void 0:p.id,e._grade_id=t==null?void 0:t.id):n.length===2?(e._college_id=(m=n[0])==null?void 0:m.id,e._major_id=(_=n[1])==null?void 0:_.id,e._grade_id=t==null?void 0:t.id):n.length===1?(e._college_id=(h=n[0])==null?void 0:h.id,e._major_id=void 0,e._grade_id=t==null?void 0:t.id):(e._college_id=void 0,e._major_id=void 0,e._grade_id=t==null?void 0:t.id)}else(e.user_type===1||e.user_type===3)&&t&&t.id&&(e.organization_ref=t.id)},valueResolve({form:e,value:a}){if(e.user_type!==0){e.organization_ref=a??e.organization_ref;return}if(e._grade_id){e.organization_ref=e._grade_id;return}}},organization_detail:{title:"组织架构",type:"dict-cascader",column:{show:!1,minWidth:200,formatter:({row:e,value:a})=>e.organization_detail&&e.organization_detail.full_path?e.organization_detail.full_path:a||""},form:{show:!1,component:{placeholder:"请填写组织架构"},rules:[{required:!1,message:"请填写组织架构"}]},viewForm:{component:{placeholder:""}}},organization:{title:"学院",type:"input",search:{show:!1},column:{show:!0,minWidth:200,formatter:({row:e,value:a})=>{if(e.user_type!==0)return e.organization_detail&&e.organization_detail.name?e.organization_detail.name:a||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 t=e.organization_detail.parent_chain[1];return t.name||t.code||""}return a||e.sub_organization}},form:{show:l(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:!1},column:{show:!0,minWidth:120,formatter:({row:e,value:a})=>{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 t=e.organization_detail.parent_chain[2];return t.name||t.code||""}return a||e.sub_organization}},form:{show:l(({form:e})=>e&&e.user_type==0),component:{placeholder:"请填写专业"},rules:[{required:!1,message:"请填写专业"}]}},grade_or_level:{title:"年级",type:"input",search:{show:!1},column:{show:!0,minWidth:120,formatter:({row:e,value:a})=>{if(e.user_type===0)return e.organization_detail&&e.organization_detail.name?e.organization_detail.name:a||e.class_or_group}},form:{show:l(({form:e})=>e&&e.user_type==0),component:{placeholder:"请选择年级"},rules:[{required:!1,message:"请选择年级"}]},viewForm:{component:{placeholder:""}}},class_or_group:{title:"班级",type:"input",search:{show:!1},column:{show:!1,minWidth:120,formatter:({row:e,value:a})=>e.organization_detail&&e.organization_detail.name?e.organization_detail.name:a||e.class_or_group},form:{show:!1,component:{placeholder:"请填写班级"},rules:[{required:!1,message:"请填写班级"}]},viewForm:{component:{placeholder:""}}}}}}},P=Object.freeze(Object.defineProperty({__proto__:null,createCrudOptions:R},Symbol.toStringTag,{value:"Module"}));export{C as G,P as a,R as c};