1 |
- import{d as C,r as B,Z as k,$ as A,c as t,aj as I,a5 as E,ak as M,B as b,q as h,P as y,al as _,m as v,ag as F,F as R,g as V,o as j}from"./index.332c7f08.js";import{O as w}from"./index.ed5fc819.js";import{O as f}from"./index.d7c1b6ac.js";import{s as z}from"./index.module.9976e9f3.js";import{O as J}from"./index.d2064f3d.js";import{c as U}from"./icon-checkbox-check.b4753e7f.js";import{c as G}from"./icon-checkbox-default.a253b329.js";import{i as W}from"./icon_student.660125da.js";import{L as D}from"./index.b186dfda.js";import{C as N}from"./index.4b720f43.js";import{C as P}from"./index.91135ff9.js";import{I as T}from"./index.96a8db5e.js";import{C as O}from"./index.2e331ab5.js";import{P as L}from"./index.656e257f.js";import{r as Z,c as a}from"./create.977e0546.js";import{d as Y}from"./deep-clone.c5af4e6b.js";import{C as q}from"./index.324108a5.js";import{F as x}from"./index.1ed6273e.js";import"./use-tab-status.9d769af8.js";import"./Checker.1af5496e.js";import"./Picker.e56f94bd.js";import"./index.7c580591.js";import"./index.1e2dfe6e.js";import"./index.4aa8e076.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]"&&!_(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",7:"\u4E03\u5E74\u7EA7",8:"\u516B\u5E74\u7EA7",9:"\u4E5D\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=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},{text:"\u516D\u5E74\u7EA7",value:6},{text:"\u4E03\u5E74\u7EA7",value:7},{text:"\u516B\u5E74\u7EA7",value:8},{text:"\u4E5D\u5E74\u7EA7",value:9}],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}},n=()=>{e.params.page=1,e.list=[],e.listState.dataShow=!0,e.listState.loading=!1,e.listState.finished=!1,r()},u=()=>{i("close"),i("select",e.check),setTimeout(()=>{e.check=[]},100)};return k(()=>o.subjectId,()=>{console.log("subjectId"),n()}),k(()=>o.selectStudentIds,()=>{console.log(o.selectStudentIds,"watch"),e.check=[...o.selectStudentIds]}),A(()=>{if(console.log(o.selectStudentIds,"onmount"),o.orchestraList.length>0){const c=o.orchestraList[0];e.orchestra.id=c.value,e.orchestra.name=c.text}r(),e.check=[...o.selectStudentIds]}),()=>{let c;return t("div",{class:p.studentList},[t(f,{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,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(D,{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||W},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(E,{class:p.iconChecked,name:d.checked?U:G},null)})})))?c:{default:()=>[c]})]}):t(M,{btnStatus:!1,tips:"\u6682\u65E0\u5B66\u5458"},null),t(f,{position:"bottom"},{default:()=>[t("div",{class:["btnGroup",p.btnMore]},[t(b,{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(b,{type:"primary",round:!0,block:!0,onClick:u},{default:()=>[h("\u786E\u8BA4")]})])]}),t(y,{show:e.oPopover,"onUpdate:show":s=>e.oPopover=s,position:"bottom",round:!0,class:"popupBottomSearch"},{default:()=>[t(L,{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,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 d=s.selectedOptions[0];e.class.id=d.value,e.class.name=d.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 m={subjectList:oe,subject:le,iconChecked:ne,img:ue,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]"&&!_(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=B({check:[],checkboxRefs:[]}),l=n=>{e.checkboxRefs[n].toggle()},r=()=>{i("select",e.check),i("close")};return k(()=>o.selectSubjects,()=>{e.check=[...o.selectSubjects]}),A(()=>{e.check=[...o.selectSubjects]}),()=>{let n;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":u=>e.check=u,style:{paddingBottom:"24px"}},ie(n=o.subjectList.map(u=>t("div",{class:m.subject,onClick:()=>l(u.subjectId)},[t(O,{name:u.subjectId,class:m.checkbox,ref:c=>e.checkboxRefs[u.subjectId]=c,onClick:c=>{c.stopPropagation()}},{icon:c=>t(E,{class:m.iconChecked,name:c.checked?U:de},null)}),t(T,{class:m.img,src:u.subjectImg},null),t("p",{class:m.name},[u.subjectName])])))?n:{default:()=>[n]}),t(f,{position:"bottom"},{default:()=>[t("div",{class:["btnGroup","btnMore"],style:"padding-left: 13px; padding-right: 13px;"},[t(b,{round:!0,color:"#CCCCCC",onClick:()=>i("close")},{default:()=>[h("\u53D6\u6D88")]}),t(b,{type:"primary",round:!0,onClick:r},{default:()=>[h("\u786E\u8BA4")]})])]})])}}}),Me=C({name:"create-orchestra",setup(){const o=F(),S=async()=>{try{const{data:l}=await v.post("/api-school/subjectBasicConfig/page",{data:{page:1,rows:50,enableFlag:!0}});a.subjectList=l.rows||[]}catch{}},g=async()=>{try{const{data:l}=await v.post("/api-school/orchestra/page",{data:{page:1,rows:100,schoolId:V.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{}},i=l=>{a.selectSubjectIds=[...l];const r=[];console.log(a.selectSubjects,"1212",a.subjectList),a.subjectList.forEach(n=>{const u=a.selectSubjects.findIndex(c=>c.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(c=>c.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 c={};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 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=Y(n),c.id&&a.selectLastTeacherSubjects.push(c),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]}),o.push({path:"/create-orchestra-teacher"})};return A(()=>{Z(),S(),g()}),()=>t("div",{class:z["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(P,{title:l.name,isLink:!0,onClick:()=>{a.studentStatus=!0,a.selectSubjectStudents=l}},{value:()=>{var r;return t(R,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(f,{position:"bottom"},{default:()=>[t("div",{class:["btnGroup"]},[t(b,{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{Me as default};
|