import{B as g}from"./index-662b2149-1726219372904.js";import{m as I,n as y}from"./api-9de750df-1726219372904.js";import{T as F}from"./index-2727764b-1726219372904.js";import{u as N}from"./index-20e23818-1726219372904.js";import{d as j,e as E,r as p,q as k,f as t,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-1ec0a32d-1726219372904.js";import{U as L}from"./updateSubject-a58a4b8f-1726219372904.js";import{a as U}from"./api-b3e2f6f8-1726219372904.js";import{a as z}from"./index-ff9a89ac-1726219372904.js";import{N as K}from"./Scrollbar-c3ae1e59-1726219372904.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 c=N(),s=E({showSubjectClass:!1,activeRow:{},keyword:null,currentGradeNum:null,currentClass:null}),S=p(null),d=p([]),u=p(!1),C=async e=>{try{if(n.type=="change"){e.instrumentId?r("confirm",{lastUseCoursewareId:e.lessonCoursewareId,unit:e.lessonCoursewareKnowledgeDetailId,instrumentId:c.getInstrumentId,courseScheduleSubjectId:e.courseScheduleSubjectId,name:e.name,classGroupId:e.id,preStudentNum:e.preStudentNum}):(s.showSubjectClass=!0,s.activeRow=e);return}const a=await I({lessonCoursewareKnowledgeDetailId:c.selectKey,classGroupId:e.id,instrumentId:c.getInstrumentId});r("close"),r("preview",{type:"class",classId:a.data,classGroupId:e.id,instrumentId:c.getInstrumentId,detailId:c.getSelectKey,lessonCourseId:c.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()=>{u.value=!0;try{const{data:e}=await y({page:1,rows:99,gradeYear:S.value,upgradeFlag:!0,...s}),a=e.rows||[],m=[];a.forEach(b=>{m.push(b)}),d.value=m}catch(e){}u.value=!1},o=z(()=>i(),500),_=async()=>{try{const{data:e}=await U({});S.value=e}catch(e){}};return k(async()=>{u.value=!0,await _(),i()}),()=>t("div",{class:l.attendClass},[t("div",{class:l.attendClassSearch},[t(G,{placeholder:"请输入班级名称",clearable:!0,value:s.keyword,"onUpdate:value":e=>s.keyword=e,onKeyup:e=>{e.code==="Enter"&&o()},onClear:()=>o()},{prefix:()=>t("span",{class:"icon-search-input",onClick:()=>o()},null)}),t(h,{placeholder:"全部年级",clearable:!0,options:[{label:"全部年级",value:null},...g.grades],value:s.currentGradeNum,"onUpdate:value":[e=>s.currentGradeNum=e,()=>o()]},null),t(h,{placeholder:"全部班级",clearable:!0,options:[{label:"全部班级",value:null},...w],value:s.currentClass,"onUpdate:value":[e=>s.currentClass=e,()=>o()]},null)]),t(K,{class:l.classList},{default:()=>[t(R,{show:u.value},{default:()=>[t("div",{class:[l.listSection,!u.value&&d.value.length<=0?l.emptySection:""]},[d.value.map(e=>t("div",{onClick:()=>C(e)},[t(q,{class:[l.thingItem,"isFull"]},{header:()=>t(A,null,[t("div",{class:l.title},[e.name,v(" "),e.preStudentNum,v("人")]),t("div",{class:[l.subjects,e.instrumentName?"":l.noSubjects]},[e.instrumentName?e.instrumentName:"暂无乐器"])]),default:()=>e.lastStudy&&t("div",{class:l.content},[e.lastStudy])})])),!u.value&&d.value.length<=0&&t(F,null,null)])]})]}),t(x,{maskClosable:T,show:s.showSubjectClass,"onUpdate:show":e=>s.showSubjectClass=e,style:{width:"500px"},preset:"card",class:["modalTitle background"],title:"修改乐器"},{default:()=>[s.showSubjectClass?t(L,{activeRow:s.activeRow,onGetList:()=>i(),onConfirm:e=>{r("confirm",e)},onClose:()=>s.showSubjectClass=!1},null):null]})])}});export{ue as A};