import{s as n,W as p}from"./index.BznwVsHD.js";import{a as _,A as m,D as h,U as g,b as f}from"./api.BTJbHM5p.js";import"./vue.YrNK8sx4.js";const R=function({crudExpose:y}){return{crudOptions:{request:{pageRequest:async e=>await f(e),editRequest:async({form:e,row:i})=>(e.id=i.id,await g(e)),delRequest:async({row:e})=>await h(e.id),addRequest:async({form:e})=>await m(e),getDetail:async({row:e})=>await _(e.id)},actionbar:{buttons:{add:{show:!1}}},form:{wrapper:{buttons:{ok:{text:"提交",show:n(e=>e.mode!=="view")}}}},pagination:{show:!0},columns:{_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:"请输入姓名"}},viewForm:{component:{placeholder:""}}},password:{title:"密码",type:"password",column:{minWidth:120,show:!1},form:{component:{placeholder:"请填写密码"}},addForm:{component:{placeholder:"请填写密码"},rules:[{required:!0,message:"请填写密码"},{validator:(e,i,t)=>{if(!i){t();return}if(i.length<8){t(new Error("密码长度不能少于8位"));return}const r=/[a-zA-Z]/.test(i),o=/[0-9]/.test(i),s=/[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?`~]/.test(i);if(!r||!o||!s){t(new Error("密码必须包含字母、数字和特殊符号"));return}t()},trigger:"blur"}]},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:!1,minWidth:120},dict:p({data:[{label:"男",value:1},{label:"女",value:2}]}),form:{component:{placeholder:"请选择性别"},rules:[{required:!0,message:"请选择性别"}]}},user_type:{title:"用户类型",type:"dict-select",column:{minWidth:120},dict:p({data:[{label:"学生",value:0}]}),form:{value:0,component:{placeholder:"请选择用户"},rules:[{required:!1,message:"请选择用户"}]}},organization_ref:{title:"组织架构",type:"dict-cascader",column:{show:!1},valueBuilder({form:e,value:i}){var r,o,s,l,d,u,c;e.organization_ref=i;const t=e.organization_detail;if(e.user_type===0&&t&&Array.isArray(t.parent_chain)){const a=t.parent_chain;a.length>=4?(e._college_id=(r=a[1])==null?void 0:r.id,e._major_id=(o=a[2])==null?void 0:o.id,e._grade_id=t==null?void 0:t.id):a.length===3?(e._college_id=(s=a[1])==null?void 0:s.id,e._major_id=(l=a[2])==null?void 0:l.id,e._grade_id=t==null?void 0:t.id):a.length===2?(e._college_id=(d=a[0])==null?void 0:d.id,e._major_id=(u=a[1])==null?void 0:u.id,e._grade_id=t==null?void 0:t.id):a.length===1?(e._college_id=(c=a[0])==null?void 0:c.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:i}){if(e.user_type!==0){e.organization_ref=i??e.organization_ref;return}if(e._grade_id){e.organization_ref=e._grade_id;return}}},organization:{title:"学院",type:"input",search:{show:!1},column:{show:!0,minWidth:200,formatter:({row:e,value:i})=>{if(e.user_type!==0)return e.organization_detail&&e.organization_detail.name?e.organization_detail.name:i||"";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 i||e.sub_organization}},form:{show:n(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:n(({row:e})=>e&&e.user_type===0),minWidth:120,formatter:({row:e,value:i})=>{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 i||e.sub_organization}},form:{show:n(({form:e})=>e&&e.user_type==0),component:{placeholder:"请填写专业"},rules:[{required:!1,message:"请填写专业"}]},viewForm:{component:{placeholder:""}}},grade_or_level:{title:"年级",type:"input",search:{show:!1},column:{show:n(({row:e})=>e&&e.user_type===0),minWidth:120,formatter:({row:e,value:i})=>e.organization_detail&&e.organization_detail.name?e.organization_detail.name:i||e.class_or_group},form:{show:n(({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:n(({row:e})=>e&&e.user_type===0),minWidth:120,formatter:({row:e,value:i})=>e.organization_detail&&e.organization_detail.name?e.organization_detail.name:i||e.class_or_group},form:{show:!1,component:{placeholder:"请填写班级"},rules:[{required:!1,message:"请填写班级"}]},viewForm:{component:{placeholder:""}}}}}}};export{R as createCrudOptions};