import{B as g}from"./index-ed87910d-1715787996172.js";import{m as y,n as F}from"./api-ed69fc26-1715787996172.js";import{T as I}from"./index-61a24da2-1715787996172.js";import{u as N}from"./index-a000e307-1715787996172.js";import{s as j}from"./state-d497e350-1715787996172.js";import{U as E}from"./updateSubject-5226a575-1715787996172.js";import{a as k}from"./api-60490966-1715787996172.js";import{d as G,e as R,r as m,p as A,f as t,h as q,G as h,C as x,H as T,F as D,k as v,l as L}from"./index-ded57513-1715787996172.js";import{a as U}from"./index-cdf44544-1715787996172.js";import{N as K}from"./Scrollbar-80e39f0a-1715787996172.js";const z="_attendClass_ev241_1",B="_attendClassSearch_ev241_4",M="_iconSearch_ev241_16",Y="_classList_ev241_20",O="_listSection_ev241_25",P="_emptySection_ev241_28",V="_thingItem_ev241_32",H="_title_ev241_55",$="_subjects_ev241_72",J="_noSubjects_ev241_83",Q="_content_ev241_88",l={attendClass:z,attendClassSearch:B,iconSearch:M,classList:Y,listSection:O,emptySection:P,thingItem:V,title:H,subjects:$,noSubjects:J,content:Q},w=[];for(let n=1;n<=40;n++)w.push({label:n+"班",value:n});const ue=G({name:"attend-class",props:{type:{type:String,default:"change"}},emits:["close","preview","confirm"],setup(n,{emit:o}){const u=N(),s=R({showSubjectClass:!1,activeRow:{},keyword:null,currentGradeNum:null,currentClass:null}),S=m(null),d=m([]),c=m(!1),f=async e=>{try{if(n.type=="change"){e.instrumentId?o("confirm",{lastUseCoursewareId:e.lessonCoursewareId,unit:e.lessonCoursewareKnowledgeDetailId,instrumentId:e.instrumentId,courseScheduleSubjectId:e.courseScheduleSubjectId,name:e.name,classGroupId:e.id,preStudentNum:e.preStudentNum}):(s.showSubjectClass=!0,s.activeRow=e);return}const a=await y({lessonCoursewareKnowledgeDetailId:u.selectKey,classGroupId:e.id,instrumentId:u.getInstrumentId});o("close"),o("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&&(j.application=window.matchMedia("(display-mode: standalone)").matches,setTimeout(()=>{C()},200))}catch(a){}},C=()=>{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 F({page:1,rows:99,gradeYear:S.value,upgradeFlag:!0,...s}),a=e.rows||[],p=[];a.forEach(b=>{p.push(b)}),d.value=p}catch(e){}c.value=!1},r=U(()=>i(),500),_=async()=>{try{const{data:e}=await k({});S.value=e}catch(e){}};return A(async()=>{c.value=!0,await _(),i()}),()=>t("div",{class:l.attendClass},[t("div",{class:l.attendClassSearch},[t(q,{placeholder:"请输入班级名称",clearable:!0,value:s.keyword,"onUpdate:value":e=>s.keyword=e,onKeyup:e=>{e.code==="Enter"&&r()},onClear:()=>r()},{prefix:()=>t("span",{class:"icon-search-input",onClick:()=>r()},null)}),t(h,{placeholder:"全部年级",clearable:!0,options:[{label:"全部年级",value:null},...g.grades],value:s.currentGradeNum,"onUpdate:value":[e=>s.currentGradeNum=e,()=>r()]},null),t(h,{placeholder:"全部班级",clearable:!0,options:[{label:"全部班级",value:null},...w],value:s.currentClass,"onUpdate:value":[e=>s.currentClass=e,()=>r()]},null)]),t(K,{class:l.classList},{default:()=>[t(x,{show:c.value},{default:()=>[t("div",{class:[l.listSection,!c.value&&d.value.length<=0?l.emptySection:""]},[d.value.map(e=>t("div",{onClick:()=>f(e)},[t(T,{class:[l.thingItem,"isFull"]},{header:()=>t(D,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])})])),!c.value&&d.value.length<=0&&t(I,null,null)])]})]}),t(L,{show:s.showSubjectClass,"onUpdate:show":e=>s.showSubjectClass=e,style:{width:"500px"},preset:"card",class:["modalTitle background"],title:"修改乐器"},{default:()=>[s.showSubjectClass?t(E,{activeRow:s.activeRow,onGetList:()=>i(),onConfirm:e=>{o("confirm",e)},onClose:()=>s.showSubjectClass=!1},null):null]})])}});export{ue as A};
