index.BXpZ14Oj.js 4.3 KB

1
  1. import{k as O}from"./index.Ct1jRGWi.js";import{G as P,c as R}from"./api.UWyDlsHb.js";import{createCrudOptions as E}from"./crud.ctEfrRvp.js";import{h as I}from"./columnPermission.MiYqOtNR.js";import{a as C,r as M,f as L,q as N,aj as c,J as i,o as n,K as d,S as g,H as q,u as F,c as u,R as m,a9 as _}from"./vue.YrNK8sx4.js";const H={key:0,style:{display:"flex",gap:"8px",width:"100%"}},J=C({name:"studentInfo"}),X=C({...J,setup(K,{expose:k}){const{crudBinding:A,crudRef:w,crudExpose:x,crudOptions:z,resetCrudOptions:U}=O({createCrudOptions:E}),t=M([]),s=L(()=>{const e=Array.isArray(t.value)?t.value:[],o=[];return e.forEach(r=>{Array.isArray(r==null?void 0:r.children)&&o.push(...r.children)}),o.map(r=>({id:r.id,name:r.name}))});function h(e){if(!e)return;const o=[...t.value||[]];for(;o.length;){const r=o.shift();if((r==null?void 0:r.id)===e)return r;Array.isArray(r==null?void 0:r.children)&&r.children.length&&o.push(...r.children)}}function v(e){const o=h(e);return Array.isArray(o==null?void 0:o.children)?o.children:[]}function y(e){const o=h(e);return Array.isArray(o==null?void 0:o.children)?o.children:[]}function b(e){e.form._major_id=void 0,e.form._grade_id=void 0,e.form.user_type===0?e.form.organization_ref=void 0:e.form.organization_ref=e.form._college_id}function p(e){e.form._grade_id=void 0,e.form.user_type===0&&(e.form.organization_ref=void 0)}function V(e){e.form.user_type===0&&(e.form.organization_ref=e.form._grade_id)}const j=()=>{P().then(e=>{if(console.log("组织架构API响应:",e),e&&(e.code===200||e.code===2e3||!e.code)){const o=e.data||e.results||e;Array.isArray(o)?(t.value=o,console.log("成功赋值组织架构数据:",t.value)):(console.warn("返回的数据不是数组格式:",o),t.value=[])}else console.error("获取组织架构数据失败:",e),t.value=[]}).catch(e=>{console.error("请求组织架构数据失败:",e),t.value=[]})};return N(async()=>{j();const e=await I(R,z);U(e),x.doRefresh()}),k({getMajors:v,getGrades:y,onCollegeChange:b,onMajorChange:p,onGradeChange:V,colleges:s}),(e,o)=>{const r=c("el-option"),f=c("el-select"),B=c("fs-crud"),G=c("fs-page");return n(),i(G,null,{default:d(()=>[g(B,q({ref_key:"crudRef",ref:w},F(A)),{form_organization_ref:d(a=>[a.form.user_type===0?(n(),u("div",H,[g(f,{style:{flex:"1"},disabled:a.mode=="view",modelValue:a.form._college_id,"onUpdate:modelValue":l=>a.form._college_id=l,placeholder:"请选择学院",filterable:"",clearable:"",onChange:()=>b(a)},{default:d(()=>[(n(!0),u(m,null,_(s.value,l=>(n(),i(r,{key:l.id,label:l.name,value:l.id},null,8,["label","value"]))),128))]),_:2},1032,["disabled","modelValue","onUpdate:modelValue","onChange"])])):a.form.user_type===1||a.form.user_type===3?(n(),i(f,{key:1,disabled:a.mode=="view",modelValue:a.form.organization_ref,"onUpdate:modelValue":l=>a.form.organization_ref=l,placeholder:"请选择学院",filterable:"",clearable:""},{default:d(()=>[(n(!0),u(m,null,_(s.value,l=>(n(),i(r,{key:l.id,label:l.name,value:l.id},null,8,["label","value"]))),128))]),_:2},1032,["disabled","modelValue","onUpdate:modelValue"])):(n(),i(f,{key:2,disabled:a.mode=="view",modelValue:a.form.organization_ref,"onUpdate:modelValue":l=>a.form.organization_ref=l,placeholder:"请选择学院",filterable:"",clearable:""},{default:d(()=>[(n(!0),u(m,null,_(s.value,l=>(n(),i(r,{key:l.id,label:l.name,value:l.id},null,8,["label","value"]))),128))]),_:2},1032,["disabled","modelValue","onUpdate:modelValue"]))]),form_sub_organization:d(a=>[g(f,{style:{flex:"1"},disabled:a.mode=="view"||!a.form._college_id,modelValue:a.form._major_id,"onUpdate:modelValue":l=>a.form._major_id=l,placeholder:"请选择专业",filterable:"",clearable:"",onChange:()=>p(a)},{default:d(()=>[(n(!0),u(m,null,_(v(a.form._college_id),l=>(n(),i(r,{key:l.id,label:l.name,value:l.id},null,8,["label","value"]))),128))]),_:2},1032,["disabled","modelValue","onUpdate:modelValue","onChange"])]),form_grade_or_level:d(a=>[g(f,{style:{flex:"1"},disabled:a.mode=="view"||!a.form._major_id,modelValue:a.form._grade_id,"onUpdate:modelValue":l=>a.form._grade_id=l,placeholder:"请选择年级",filterable:"",clearable:"",onChange:()=>V(a)},{default:d(()=>[(n(!0),u(m,null,_(y(a.form._major_id),l=>(n(),i(r,{key:l.id,label:l.name,value:l.id},null,8,["label","value"]))),128))]),_:2},1032,["disabled","modelValue","onUpdate:modelValue","onChange"])]),_:1},16)]),_:1})}}});export{X as default};