import{d as C,r as x,Z as k,$ as A,g as B,c as t,aj as I,a5 as _,ak as M,B as f,q as h,P as y,al as U,m as v,ag as R,F as V,o as j}from"./index.5f7ffb46.js";import{O as w}from"./index.59b9f984.js";import{O as b}from"./index.7790de2a.js";import{s as z}from"./index.module.9976e9f3.js";import{O as J}from"./index.ec2a7822.js";import{c as F}from"./icon-checkbox-check.b4753e7f.js";import{c as D}from"./icon-checkbox-default.a253b329.js";import{i as G}from"./icon_student.660125da.js";import{L as W}from"./index.9ef28852.js";import{C as N}from"./index.d979c853.js";import{C as P}from"./index.abd668f7.js";import{I as T}from"./index.276a5d68.js";import{C as O}from"./index.13900508.js";import{P as E}from"./index.de1f78a6.js";import{r as Y,c as a}from"./create.c1872607.js";import{d as Z}from"./deep-clone.c5af4e6b.js";import{C as q}from"./index.052b3caa.js";import{F as L}from"./index.6438a25f.js";import"./use-tab-status.69b57a37.js";import"./Checker.40bdbb46.js";import"./Picker.148c9d83.js";import"./index.6bbd7daa.js";import"./index.99e0cf1f.js";import"./index.61ab9823.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 p={searchBand:H,bandName:Q,studentList:K,iconChecked:X,img:$,name:ee,class:"_class_1v64m_41",btnMore:te};function se(o){return typeof o=="function"||Object.prototype.toString.call(o)==="[object Object]"&&!U(o)}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=C({name:"student-list",props:{orchestraList:{type:Array,default:()=>[]},subjectId:{type:[String,Number],default:""},selectStudentIds:{type:Array,default:()=>[]}},emits:["close","select"],setup(o,{slots:S,attrs:g,emit:i}){const e=x({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=c=>{e.checkboxRefs[c].toggle()},r=async()=>{try{if(e.isLoad)return;e.isLoad=!0;const c=await v.post("/api-school/student/page",{data:{...e.params,subjectId:o.subjectId,orchestraId:e.orchestra.id,currentGradeNum:e.class.id===-1?null:e.class.id}});e.listState.loading=!1;const s=c.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}},u=()=>{e.params.page=1,e.list=[],e.listState.dataShow=!0,e.listState.loading=!1,e.listState.finished=!1,r()},n=()=>{i("close"),i("select",e.check),setTimeout(()=>{e.check=[]},100)};return k(()=>o.subjectId,()=>{console.log("subjectId"),u()}),k(()=>o.selectStudentIds,()=>{console.log(o.selectStudentIds,"watch"),e.check=[...o.selectStudentIds]}),A(()=>{var c;if(console.log(o.selectStudentIds,"onmount"),((c=B.user.data.school)==null?void 0:c.schoolSystem)==="sixYearSystem"&&e.classList.push({text:"\u516D\u5E74\u7EA7",value:6}),o.orchestraList.length>0){const s=o.orchestraList[0];e.orchestra.id=s.value,e.orchestra.name=s.text}r(),e.check=[...o.selectStudentIds]}),()=>{let c;return t("div",{class:p.studentList},[t(b,{position:"top"},{default:()=>[t(I,{title:"\u9009\u62E9\u5B66\u5458",desotry:!1,border:!1},null),t(J,{class:"searchGroupInput",placeholder:"\u5B66\u5458\u540D\u79F0/\u624B\u673A\u53F7",onSearch:s=>{e.params.keyword=s,u()}},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(W,{finished:e.listState.finished,finishedText:" ",class:[p.liveList],onLoad:r,style:{paddingTop:"12px"},immediateCheck:!1},{default:()=>[t(N,{modelValue:e.check,"onUpdate:modelValue":s=>e.check=s},se(c=e.list.map(s=>t(P,{modelValue:e.check,"onUpdate:modelValue":d=>e.check=d,center:!0,onClick:()=>l(s.id)},{icon:()=>t(T,{class:p.img,src:s.avatar||G},null),title:()=>t("div",{class:p.content},[t("p",{class:p.name},[s.nickname]),t("p",{class:p.class},[s.currentGradeNum>0?ae[s.currentGradeNum]:""])]),"right-icon":()=>t(O,{name:s.id,ref:d=>e.checkboxRefs[s.id]=d,onClick:d=>{d.stopPropagation(),d.preventDefault()}},{icon:d=>t(_,{class:p.iconChecked,name:d.checked?F:D},null)})})))?c:{default:()=>[c]})]}):t(M,{btnStatus:!1,tips:"\u6682\u65E0\u5B66\u5458"},null),t(b,{position:"bottom"},{default:()=>[t("div",{class:["btnGroup",p.btnMore]},[t(f,{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:()=>[h("\u5168\u9009")]}),t(f,{type:"primary",round:!0,block:!0,onClick:n},{default:()=>[h("\u786E\u8BA4")]})])]}),t(y,{show:e.oPopover,"onUpdate:show":s=>e.oPopover=s,position:"bottom",round:!0,class:"popupBottomSearch"},{default:()=>[t(E,{columns:o.orchestraList,onCancel:()=>e.oPopover=!1,onConfirm:s=>{const d=s.selectedOptions[0];e.orchestra.id=d.value,e.orchestra.name=d.text,e.oPopover=!1,u()}},null)]}),t(y,{show:e.showPopover,"onUpdate:show":s=>e.showPopover=s,position:"bottom",round:!0,class:"popupBottomSearch"},{default:()=>[t(E,{columns:e.classList,onCancel:()=>e.showPopover=!1,onConfirm:s=>{const d=s.selectedOptions[0];e.class.id=d.value,e.class.name=d.text,e.showPopover=!1,u()}},null)]})])}}});const oe="_subjectList_hptt0_1",le="_subject_hptt0_1",ue="_iconChecked_hptt0_19",ne="_img_hptt0_27",re="_name_hptt0_34";var m={subjectList:oe,subject:le,iconChecked:ue,img:ne,name:re},de="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 ie(o){return typeof o=="function"||Object.prototype.toString.call(o)==="[object Object]"&&!U(o)}var pe=C({name:"subject-list",props:{subjectList:{type:Array,default:()=>[]},selectSubjects:{type:Array,default:()=>[]}},emits:["close","select"],setup(o,{slots:S,attrs:g,emit:i}){const e=x({check:[],checkboxRefs:[]}),l=u=>{e.checkboxRefs[u].toggle()},r=()=>{i("select",e.check),i("close")};return k(()=>o.selectSubjects,()=>{e.check=[...o.selectSubjects]}),A(()=>{e.check=[...o.selectSubjects]}),()=>{let u;return t("div",{style:{minHeight:"100vh"}},[t(I,{title:"\u9009\u62E9\u58F0\u90E8",desotry:!1},null),t(N,{class:m.subjectList,modelValue:e.check,"onUpdate:modelValue":n=>e.check=n,style:{paddingBottom:"24px"}},ie(u=o.subjectList.map(n=>t("div",{class:m.subject,onClick:()=>l(n.subjectId)},[t(O,{name:n.subjectId,class:m.checkbox,ref:c=>e.checkboxRefs[n.subjectId]=c,onClick:c=>{c.stopPropagation()}},{icon:c=>t(_,{class:m.iconChecked,name:c.checked?F:de},null)}),t(T,{class:m.img,src:n.subjectImg},null),t("p",{class:m.name},[n.subjectName])])))?u:{default:()=>[u]}),t(b,{position:"bottom"},{default:()=>[t("div",{class:["btnGroup","btnMore"],style:"padding-left: 13px; padding-right: 13px;"},[t(f,{round:!0,color:"#CCCCCC",onClick:()=>i("close")},{default:()=>[h("\u53D6\u6D88")]}),t(f,{type:"primary",round:!0,onClick:r},{default:()=>[h("\u786E\u8BA4")]})])]})])}}}),Oe=C({name:"create-orchestra",setup(){const o=R(),S=async()=>{try{const{data:l}=await v.post("/api-school/subjectBasicConfig/page",{data:{page:1,rows:50}});a.subjectList=l.rows||[]}catch{}},g=async()=>{try{const{data:l}=await v.post("/api-school/orchestra/page",{data:{page:1,rows:100,schoolId:B.user.data.school.id,status:"DONE"}}),r=l.rows||[],u=[];r.forEach(n=>{u.push({text:n.name,value:n.id})}),a.orchestraList=[...u]}catch{}},i=l=>{a.selectSubjectIds=[...l];const r=[];console.log(a.selectSubjects,"1212",a.subjectList),a.subjectList.forEach(u=>{const n=a.selectSubjects.findIndex(c=>c.id===u.subjectId);l.includes(u.subjectId)&&(n<0?r.push({id:u.subjectId,name:u.subjectName,subjectCode:u.subjectCode,type:null,teacher:{},students:[]}):r.push(a.selectSubjects.find(c=>c.id===u.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 u=[],n=[];let c={};a.selectSubjects.forEach(s=>{if(console.log(s,"item.name"),n.push(...s.students),s.subjectCode!=="BARITONE"&&s.subjectCode!=="TUBA")u.push(s);else{const d=c.students?c.students:[];c={id:c.id?c.id+","+s.id:s.id,name:c.name?c.name+"-"+s.name:s.name,type:null,teacher:{},students:[...d,...s.students]}}}),a.selectLastTeacherSubjects=Z(u),c.id&&a.selectLastTeacherSubjects.push(c),a.selectLastTeacherSubjects.push({id:null,name:"\u4E50\u7406\u73ED",type:"MUSIC_THEORY",teacher:{},students:[...n]},{id:null,name:"\u5408\u594F\u73ED",type:"INSTRUMENTAL_ENSEMBLE",teacher:{},students:[...n]}),o.push({path:"/create-orchestra-teacher"})};return A(()=>{Y(),S(),g()}),()=>t("div",{class:z["create-orchestra"]},[t(I,null,null),t(q,{inset:!0},{default:()=>[t(L,{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(L,{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(P,{title:l.name,isLink:!0,onClick:()=>{a.studentStatus=!0,a.selectSubjectStudents=l}},{value:()=>{var r;return t(V,null,[h("\u5DF2\u9009")," ",t("span",{style:{color:"var(--van-primary-color)"}},[((r=l.students)==null?void 0:r.length)||0])," ",h("\u540D\u5B66\u5458")])}}))]}),t(b,{position:"bottom"},{default:()=>[t("div",{class:["btnGroup"]},[t(f,{type:"primary",block:!0,round:!0,onClick:e},{default:()=>[h("\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:i},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{Oe as default};