import{B as g}from"./index-5a357ad2-1720452812367.js";import{m as y,n as I}from"./api-f93b1546-1720452812367.js";import{T as F}from"./index-7ecc3f27-1720452812367.js";import{u as N}from"./index-e0f57327-1720452812367.js";import{d as j,e as E,r as p,q as k,f as s,h as G,I as h,E as R,J as q,F as A,k as v,l as x,m as T,z as D}from"./index-8fb4d12a-1720452812367.js";import{U as L}from"./updateSubject-50eca7d4-1720452812367.js";import{a as U}from"./api-fc8e817b-1720452812367.js";import{a as z}from"./index-d6e02b87-1720452812367.js";import{N as K}from"./Scrollbar-95c0c49b-1720452812367.js";const B="_attendClass_ev241_1",M="_attendClassSearch_ev241_4",Y="_iconSearch_ev241_16",O="_classList_ev241_20",P="_listSection_ev241_25",V="_emptySection_ev241_28",J="_thingItem_ev241_32",$="_title_ev241_55",H="_subjects_ev241_72",Q="_noSubjects_ev241_83",W="_content_ev241_88",l={attendClass:B,attendClassSearch:M,iconSearch:Y,classList:O,listSection:P,emptySection:V,thingItem:J,title:$,subjects:H,noSubjects:Q,content:W},w=[];for(let n=1;n<=40;n++)w.push({label:n+"班",value:n});const ue=j({name:"attend-class",props:{type:{type:String,default:"change"}},emits:["close","preview","confirm"],setup(n,{emit:r}){const u=N(),t=E({showSubjectClass:!1,activeRow:{},keyword:null,currentGradeNum:null,currentClass:null}),S=p(null),d=p([]),c=p(!1),C=async e=>{try{if(n.type=="change"){e.instrumentId?r("confirm",{lastUseCoursewareId:e.lessonCoursewareId,unit:e.lessonCoursewareKnowledgeDetailId,instrumentId:e.instrumentId,courseScheduleSubjectId:e.courseScheduleSubjectId,name:e.name,classGroupId:e.id,preStudentNum:e.preStudentNum}):(t.showSubjectClass=!0,t.activeRow=e);return}const a=await y({lessonCoursewareKnowledgeDetailId:u.selectKey,classGroupId:e.id,instrumentId:u.getInstrumentId});r("close"),r("preview",{type:"class",classId:a.data,classGroupId:e.id,instrumentId:u.getInstrumentId,detailId:u.getSelectKey,lessonCourseId:u.getBaseCourseware.id,preStudentNum:e.preStudentNum}),window.matchMedia("(display-mode: standalone)").matches&&(D.application=window.matchMedia("(display-mode: standalone)").matches,setTimeout(()=>{f()},200))}catch(a){}},f=()=>{const e=document.documentElement,a=document;a.fullScreen||a.mozFullScreen||a.webkitIsFullScreen?a.exitFullscreen?a.exitFullscreen():a.mozCancelFullScreen?a.mozCancelFullScreen():a.webkitExitFullscreen&&a.webkitExitFullscreen():e.requestFullscreen&&e.requestFullscreen()||e.mozRequestFullScreen&&e.mozRequestFullScreen()||e.webkitRequestFullscreen&&e.webkitRequestFullscreen()||e.msRequestFullscreen&&e.msRequestFullscreen()},i=async()=>{c.value=!0;try{const{data:e}=await I({page:1,rows:99,gradeYear:S.value,upgradeFlag:!0,...t}),a=e.rows||[],m=[];a.forEach(b=>{m.push(b)}),d.value=m}catch(e){}c.value=!1},o=z(()=>i(),500),_=async()=>{try{const{data:e}=await U({});S.value=e}catch(e){}};return k(async()=>{c.value=!0,await _(),i()}),()=>s("div",{class:l.attendClass},[s("div",{class:l.attendClassSearch},[s(G,{placeholder:"请输入班级名称",clearable:!0,value:t.keyword,"onUpdate:value":e=>t.keyword=e,onKeyup:e=>{e.code==="Enter"&&o()},onClear:()=>o()},{prefix:()=>s("span",{class:"icon-search-input",onClick:()=>o()},null)}),s(h,{placeholder:"全部年级",clearable:!0,options:[{label:"全部年级",value:null},...g.grades],value:t.currentGradeNum,"onUpdate:value":[e=>t.currentGradeNum=e,()=>o()]},null),s(h,{placeholder:"全部班级",clearable:!0,options:[{label:"全部班级",value:null},...w],value:t.currentClass,"onUpdate:value":[e=>t.currentClass=e,()=>o()]},null)]),s(K,{class:l.classList},{default:()=>[s(R,{show:c.value},{default:()=>[s("div",{class:[l.listSection,!c.value&&d.value.length<=0?l.emptySection:""]},[d.value.map(e=>s("div",{onClick:()=>C(e)},[s(q,{class:[l.thingItem,"isFull"]},{header:()=>s(A,null,[s("div",{class:l.title},[e.name,v(" "),e.preStudentNum,v("人")]),s("div",{class:[l.subjects,e.instrumentName?"":l.noSubjects]},[e.instrumentName?e.instrumentName:"暂无乐器"])]),default:()=>e.lastStudy&&s("div",{class:l.content},[e.lastStudy])})])),!c.value&&d.value.length<=0&&s(F,null,null)])]})]}),s(x,{maskClosable:T,show:t.showSubjectClass,"onUpdate:show":e=>t.showSubjectClass=e,style:{width:"500px"},preset:"card",class:["modalTitle background"],title:"修改乐器"},{default:()=>[t.showSubjectClass?s(L,{activeRow:t.activeRow,onGetList:()=>i(),onConfirm:e=>{r("confirm",e)},onClose:()=>t.showSubjectClass=!1},null):null]})])}});export{ue as A};
