index.dfa12d7b.js 12 KB

1
  1. import{d as A,r as B,Z as k,$ as C,g as E,c as t,aj as I,a5 as _,ak as R,B as S,q as f,P as y,al as U,m as v,ag as V,F as z,o as j}from"./index.1c621181.js";import{O as w}from"./index.be2c3766.js";import{O as g}from"./index.b491c24a.js";import{s as J}from"./index.module.9976e9f3.js";import{O as G}from"./index.944c4ba2.js";import{c as N}from"./icon-checkbox-check.b4753e7f.js";import{c as W}from"./icon-checkbox-default.a253b329.js";import{i as D}from"./icon_student.660125da.js";import{L as Y}from"./index.d5ee0b18.js";import{C as P}from"./index.9813a8ae.js";import{C as O}from"./index.fd5ae97b.js";import{I as T}from"./index.4c221cbe.js";import{C as M}from"./index.3e68170a.js";import{P as L}from"./index.53518914.js";import{r as Z,c as a}from"./create.7f721359.js";import{C as q}from"./index.2db9d877.js";import{F as x}from"./index.c7a20c76.js";import"./index.339fc024.js";import"./use-tab-status.40058c51.js";import"./Checker.6bb59ec3.js";import"./Picker.9bc4331c.js";import"./index.88a00aa9.js";import"./index.78a302c3.js";import"./index.d5b73933.js";const H="_searchBand_1v64m_1",Q="_bandName_1v64m_7",K="_studentList_1v64m_12",X="_iconChecked_1v64m_18",$="_img_1v64m_27",ee="_name_1v64m_35",te="_btnMore_1v64m_47";var m={searchBand:H,bandName:Q,studentList:K,iconChecked:X,img:$,name:ee,class:"_class_1v64m_41",btnMore:te};function se(c){return typeof c=="function"||Object.prototype.toString.call(c)==="[object Object]"&&!U(c)}const ae={1:"\u4E00\u5E74\u7EA7",2:"\u4E8C\u5E74\u7EA7",3:"\u4E09\u5E74\u7EA7",4:"\u56DB\u5E74\u7EA7",5:"\u4E94\u5E74\u7EA7",6:"\u516D\u5E74\u7EA7"};var ce=A({name:"student-list",props:{orchestraList:{type:Array,default:()=>[]},subjectId:{type:[String,Number],default:""},selectStudentIds:{type:Array,default:()=>[]}},emits:["close","select"],setup(c,{slots:d,attrs:p,emit:h}){const e=B({showPopover:!1,oPopover:!1,isLoad:!1,classList:[{text:"\u5168\u90E8",value:-1},{text:"\u4E00\u5E74\u7EA7",value:1},{text:"\u4E8C\u5E74\u7EA7",value:2},{text:"\u4E09\u5E74\u7EA7",value:3},{text:"\u56DB\u5E74\u7EA7",value:4},{text:"\u4E94\u5E74\u7EA7",value:5}],check:[],checkboxRefs:[],orchestra:{id:null,name:"\u5168\u90E8\u4E50\u56E2"},class:{id:null,name:"\u5168\u90E8"},list:[],listState:{dataShow:!0,loading:!1,finished:!1},params:{keyword:null,page:1,rows:20}}),l=o=>{e.checkboxRefs[o].toggle()},r=async()=>{try{if(e.isLoad)return;e.isLoad=!0;const o=await v.post("/api-school/student/page",{data:{...e.params,subjectId:c.subjectId,orchestraId:e.orchestra.id,currentGradeNum:e.class.id===-1?null:e.class.id}});e.listState.loading=!1;const s=o.data||{};if(e.list.length>0&&s.current===1)return;e.list=e.list.concat(s.rows||[]),e.listState.finished=s.current>=s.pages,e.params.page=s.current+1,e.listState.dataShow=e.list.length>0,e.isLoad=!1}catch{e.listState.dataShow=!1,e.listState.finished=!0,e.isLoad=!1}},n=()=>{e.params.page=1,e.list=[],e.listState.dataShow=!0,e.listState.loading=!1,e.listState.finished=!1,r()},u=()=>{h("close"),h("select",e.check),setTimeout(()=>{e.check=[]},100)};return k(()=>c.subjectId,()=>{console.log("subjectId"),n()}),k(()=>c.selectStudentIds,()=>{console.log(c.selectStudentIds,"watch"),e.check=[...c.selectStudentIds]}),C(()=>{var o;if(console.log(c.selectStudentIds,"onmount"),((o=E.user.data.school)==null?void 0:o.schoolSystem)==="sixYearSystem"&&e.classList.push({text:"\u516D\u5E74\u7EA7",value:6}),c.orchestraList.length>0){const s=c.orchestraList[0];e.orchestra.id=s.value,e.orchestra.name=s.text}r(),e.check=[...c.selectStudentIds]}),()=>{let o;return t("div",{class:m.studentList},[t(g,{position:"top"},{default:()=>[t(I,{title:"\u9009\u62E9\u5B66\u5458",desotry:!1,border:!1},null),t(G,{class:"searchGroupInput",placeholder:"\u5B66\u5458\u540D\u79F0/\u624B\u673A\u53F7",onSearch:s=>{e.params.keyword=s,n()}},null),t("div",{class:"searchGroup"},[t("div",{class:["searchItem searchItem-large",e.showPopover?"searchItem-active":""],onClick:()=>e.showPopover=!0},[t("span",null,[e.class.name]),t("i",{class:"arrow"},null)]),t("div",{class:["searchItem searchItem-large",e.oPopover?"searchItem-active":""],onClick:()=>e.oPopover=!0},[t("span",null,[e.orchestra.name]),t("i",{class:"arrow"},null)])])]}),e.listState.dataShow?t(Y,{finished:e.listState.finished,finishedText:" ",class:[m.liveList],onLoad:r,style:{paddingTop:"12px"},immediateCheck:!1},{default:()=>[t(P,{modelValue:e.check,"onUpdate:modelValue":s=>e.check=s},se(o=e.list.map(s=>t(O,{modelValue:e.check,"onUpdate:modelValue":i=>e.check=i,center:!0,onClick:()=>l(s.id)},{icon:()=>t(T,{class:m.img,src:s.avatar||D},null),title:()=>t("div",{class:m.content},[t("p",{class:m.name},[s.nickname]),t("p",{class:m.class},[s.currentGradeNum>0?ae[s.currentGradeNum]:""])]),"right-icon":()=>t(M,{name:s.id,ref:i=>e.checkboxRefs[s.id]=i,onClick:i=>{i.stopPropagation(),i.preventDefault()}},{icon:i=>t(_,{class:m.iconChecked,name:i.checked?N:W},null)})})))?o:{default:()=>[o]})]}):t(R,{btnStatus:!1,tips:"\u6682\u65E0\u5B66\u5458"},null),t(g,{position:"bottom"},{default:()=>[t("div",{class:["btnGroup",m.btnMore]},[t(S,{type:"primary",plain:!0,round:!0,style:{backgroundColor:"transparent"},onClick:()=>{e.list.forEach(s=>{e.check.includes(s.id)||e.check.push(s.id)}),e.check}},{default:()=>[f("\u5168\u9009")]}),t(S,{type:"primary",round:!0,block:!0,onClick:u},{default:()=>[f("\u786E\u8BA4")]})])]}),t(y,{show:e.oPopover,"onUpdate:show":s=>e.oPopover=s,position:"bottom",round:!0,class:"popupBottomSearch"},{default:()=>[t(L,{columns:c.orchestraList,onCancel:()=>e.oPopover=!1,onConfirm:s=>{const i=s.selectedOptions[0];e.orchestra.id=i.value,e.orchestra.name=i.text,e.oPopover=!1,n()}},null)]}),t(y,{show:e.showPopover,"onUpdate:show":s=>e.showPopover=s,position:"bottom",round:!0,class:"popupBottomSearch"},{default:()=>[t(L,{columns:e.classList,onCancel:()=>e.showPopover=!1,onConfirm:s=>{const i=s.selectedOptions[0];e.class.id=i.value,e.class.name=i.text,e.showPopover=!1,n()}},null)]})])}}});const oe="_subjectList_hptt0_1",le="_subject_hptt0_1",ne="_iconChecked_hptt0_19",ue="_img_hptt0_27",re="_name_hptt0_34";var b={subjectList:oe,subject:le,iconChecked:ne,img:ue,name:re},ie="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAAXNSR0IArs4c6QAAA4BJREFUWEfVmT1sFEcUx/9vFntF4cI6FIGCEwmKYJnbnQsgIxIhuUgoaCIlIEKoKPgSoJRQUKWAEgHCQJEqwUpMQUMRKCyhJIoF5Gb2sBwKkIJBIMC6ggLWzs6LHtqzjuPjOPsMw7az773fztv3MW8Is3iYWSVJsoaIBph5FYBPmHkJEXWJOmZ+TET3ANwgomvMPBJF0RUicq2ao1YEjDEfAtgLYBuApa3IArgD4CcAJ7TWd99U9o0AR0dHC52dnT8Q0XYAYa78FhH9RkS/O+fGwzC87Zx7LGtKqa40TT9SSvUy8+fMvAHAslwuZeYfp6amDvX39082A20KaK3dwszHASxi5kwp9atS6kSxWPyzmfL69Uqlss45t9c5t5mIAgCPxBta619ep+eVgCMjIwu6u7sFbFeu4JJSan8URf+0Atb4bpIkK5xzxwB8ka+dqlar+wYGBv57md6XAk5MTCycnJwcBrARwBNm/r5UKp2ZC1ijbLlc3kFERwEsBHChUChs6unpedL43guA+c6dz+EeBEGwsVgsXm0nXE1XpVJZnWXZBQAfCGS1Wv2qcSdfADTGDOZufUBE6+M4vjEfcDWd1lpJUZdzyFNa69319p4DzANiSNwaBMH6+dq5xg/Od1Igxd1b6gNnBlBSSRiGEgASrTvb/c8180L+T56W6E7TdEUtBc0Alsvlk0Qk23tJa/1lM4XzsW6MuSjRzcyDpVJpj9h4BphXiJvMvCAIgpVzTSWzhZcUlGXZdSKSlLNcKk4N8DCAA0Q0FMfx1tkaaIectfYsM38L4IjW+iBJ4bfW/iu1NQiCz1qtEO2Aaqw4WZb9IbU7juOPyVrbz8x/AbiltV7eboOz0WeMuSm1m4jWUpIkB5xzh4loMI7jZz/mu36stSeZebdS6iAZY84B+Fop9V0URWffNZzYT5Jkq3PuZyI6J4AVACsBfKq1LvsAaIwpAfgbwHUBfCjJOQzDRb29vU37s7fxAePj44U0TaUdeyRB8pSZw46OjrCvr2/qbQA0szE2NtY5PT2dElHqP6D3LvY5SIioIi4eZuZvvE0z3idq70ud981C3g/62269Fw2rQHrd8gug94cmgfT62Fkr4F4f3AXS+9GHQHo9PKq52uvxW31D6e0Asx7S6xFwPai3Q/TGM0T9NYRzbrVcQwBYXH8NAeC+XEMopa7O5Rrif2YMj8Ww1rJlAAAAAElFTkSuQmCC";function de(c){return typeof c=="function"||Object.prototype.toString.call(c)==="[object Object]"&&!U(c)}var pe=A({name:"subject-list",props:{subjectList:{type:Array,default:()=>[]},selectSubjects:{type:Array,default:()=>[]}},emits:["close","select"],setup(c,{slots:d,attrs:p,emit:h}){const e=B({check:[],checkboxRefs:[]}),l=n=>{e.checkboxRefs[n].toggle()},r=()=>{h("select",e.check),h("close")};return k(()=>c.selectSubjects,()=>{e.check=[...c.selectSubjects]}),C(()=>{e.check=[...c.selectSubjects]}),()=>{let n;return t("div",{style:{minHeight:"100vh"}},[t(I,{title:"\u9009\u62E9\u58F0\u90E8",desotry:!1},null),t(P,{class:b.subjectList,modelValue:e.check,"onUpdate:modelValue":u=>e.check=u,style:{paddingBottom:"24px"}},de(n=c.subjectList.map(u=>t("div",{class:b.subject,onClick:()=>l(u.subjectId)},[t(M,{name:u.subjectId,class:b.checkbox,ref:o=>e.checkboxRefs[u.subjectId]=o,onClick:o=>{o.stopPropagation()}},{icon:o=>t(_,{class:b.iconChecked,name:o.checked?N:ie},null)}),t(T,{class:b.img,src:u.subjectImg},null),t("p",{class:b.name},[u.subjectName])])))?n:{default:()=>[n]}),t(g,{position:"bottom"},{default:()=>[t("div",{class:["btnGroup","btnMore"],style:"padding-left: 13px; padding-right: 13px;"},[t(S,{round:!0,color:"#CCCCCC",onClick:()=>h("close")},{default:()=>[f("\u53D6\u6D88")]}),t(S,{type:"primary",round:!0,onClick:r},{default:()=>[f("\u786E\u8BA4")]})])]})])}}});const F=c=>{if(c===null)return null;const d=Object.assign({},c);return Object.keys(d).forEach(p=>d[p]=typeof c[p]=="object"?F(c[p]):c[p]),Array.isArray(c)?(d.length=c.length,Array.from(d)):d};var Me=A({name:"create-orchestra",setup(){const c=V(),d=async()=>{try{const{data:l}=await v.post("/api-school/subjectBasicConfig/page",{data:{page:1,rows:50}});a.subjectList=l.rows||[]}catch{}},p=async()=>{try{const{data:l}=await v.post("/api-school/orchestra/page",{data:{page:1,rows:100,schoolId:E.user.data.school.id,status:"DONE"}}),r=l.rows||[],n=[];r.forEach(u=>{n.push({text:u.name,value:u.id})}),a.orchestraList=[...n]}catch{}},h=l=>{a.selectSubjectIds=[...l];const r=[];console.log(a.selectSubjects,"1212",a.subjectList),a.subjectList.forEach(n=>{const u=a.selectSubjects.findIndex(o=>o.id===n.subjectId);l.includes(n.subjectId)&&(u<0?r.push({id:n.subjectId,name:n.subjectName,subjectCode:n.subjectCode,type:null,teacher:{},students:[]}):r.push(a.selectSubjects.find(o=>o.id===n.subjectId)))}),a.selectSubjects=[...r]},e=()=>{if(!a.orchestraName){j("\u8BF7\u8F93\u5165\u4E50\u56E2\u540D\u79F0");return}if(a.selectSubjects&&a.selectSubjects.length<=0){j("\u8BF7\u9009\u62E9\u58F0\u90E8");return}const l=a.selectSubjects||[];let r=!1;if(l.forEach(s=>{(!s.students||s.students&&s.students.length<=0)&&(r=!0)}),r){j("\u8BF7\u9009\u62E9\u5B66\u5458");return}const n=[],u=[];let o={};a.selectSubjects.forEach(s=>{if(console.log(s,"item.name"),u.push(...s.students),s.subjectCode!=="BARITONE"&&s.subjectCode!=="TUBA")n.push(s);else{const i=o.students?o.students:[];o={id:o.id?o.id+","+s.id:s.id,name:o.name?o.name+"-"+s.name:s.name,type:null,teacher:{},students:[...i,...s.students]}}}),a.selectLastTeacherSubjects=F(n),o.id&&a.selectLastTeacherSubjects.push(o),a.selectLastTeacherSubjects.push({id:null,name:"\u4E50\u7406\u73ED",type:"MUSIC_THEORY",teacher:{},students:[...u]},{id:null,name:"\u5408\u594F\u73ED",type:"INSTRUMENTAL_ENSEMBLE",teacher:{},students:[...u]}),c.push({path:"/create-orchestra-teacher"})};return C(()=>{Z(),d(),p()}),()=>t("div",{class:J["create-orchestra"]},[t(I,null,null),t(q,{inset:!0},{default:()=>[t(x,{label:"\u4E50\u56E2\u540D\u79F0",modelValue:a.orchestraName,"onUpdate:modelValue":l=>a.orchestraName=l,placeholder:"\u8BF7\u8F93\u5165\u4E50\u56E2\u540D\u79F0",inputAlign:"right",maxlength:30},null),t(x,{label:"\u4E50\u56E2\u58F0\u90E8",readonly:!0,placeholder:a.selectSubjects.length>0?`\u5DF2\u9009${a.selectSubjects.length}\u4E2A`:"\u9009\u62E9\u58F0\u90E8",isLink:!0,inputAlign:"right",onClick:()=>a.subjectStatus=!0},null),a.selectSubjects.map(l=>t(O,{title:l.name,isLink:!0,onClick:()=>{a.studentStatus=!0,a.selectSubjectStudents=l}},{value:()=>{var r;return t(z,null,[f("\u5DF2\u9009")," ",t("span",{style:{color:"var(--van-primary-color)"}},[((r=l.students)==null?void 0:r.length)||0])," ",f("\u540D\u5B66\u5458")])}}))]}),t(g,{position:"bottom"},{default:()=>[t("div",{class:["btnGroup"]},[t(S,{type:"primary",block:!0,round:!0,onClick:e},{default:()=>[f("\u4E0B\u4E00\u6B65")]})])]}),t(w,{modelValue:a.subjectStatus,"onUpdate:modelValue":l=>a.subjectStatus=l,style:"background: #F8F8F8;"},{default:()=>[a.subjectStatus&&t(pe,{onClose:()=>a.subjectStatus=!1,subjectList:a.subjectList,selectSubjects:a.selectSubjectIds,onSelect:h},null)]}),t(w,{modelValue:a.studentStatus,"onUpdate:modelValue":l=>a.studentStatus=l,style:"background: #f8f8f8;"},{default:()=>[a.studentStatus&&t(ce,{orchestraList:a.orchestraList,subjectId:a.selectSubjectStudents.id,selectStudentIds:a.selectSubjectStudents.students,onClose:()=>a.studentStatus=!1,onSelect:l=>{a.selectSubjectStudents.students=[...l]}},null)]})])}});export{Me as default};