import{d as _,u as v,e as C,r as m,n as F,f as s,h as y,M as S,A as j,c7 as g,F as I,k as h,v as q}from"./index-502caedd.js";import{B as x}from"./index-0efe3d53.js";import{d as N,k as E}from"./isCollaose-98ace63e.js";import{T as k}from"./index-6213254f.js";import{u as R}from"./index-4e12b913.js";import{s as A}from"./state-a81f0512.js";import{U as G}from"./updateSubject-647df72a.js";import{u as T}from"./index-6b017b46.js";import{N as L}from"./contants-94f6a81f.js";const U="_attendClass_x9qn7_1",D="_attendClassSearch_x9qn7_4",K="_iconSearch_x9qn7_20",z="_classList_x9qn7_24",B="_listSection_x9qn7_29",M="_emptySection_x9qn7_32",O="_thingItem_x9qn7_36",P="_title_x9qn7_57",V="_subjects_x9qn7_74",$="_noSubjects_x9qn7_80",H="_content_x9qn7_83",l={attendClass:U,attendClassSearch:D,iconSearch:K,classList:z,listSection:B,emptySection:M,thingItem:O,title:P,subjects:V,noSubjects:$,content:H},w=[];for(let a=1;a<=40;a++)w.push({label:a+"班",value:a});const le=_({name:"attend-class",props:{type:{type:String,default:"change"}},emits:["close","preview","confirm"],setup(a,{emit:o}){const u=R();v();const t=C({showSubjectClass:!1,activeRow:{},keyword:null,currentGradeNum:null,currentClass:null}),r=m([]),n=m(!1),f=async e=>{try{if(a.type=="change"){e.subjectId?o("confirm",{lastUseCoursewareId:e.lessonCoursewareId,unit:e.lessonCoursewareKnowledgeDetailId,subjectId:e.subjectId,name:e.name,classGroupId:e.id}):(t.showSubjectClass=!0,t.activeRow=e);return}await N({lessonCoursewareKnowledgeDetailId:u.selectKey,classGroupId:e.id}),o("close"),o("preview",{type:"class",classId:res.data,classGroupId:e.id,subjectId:u.getSubjectId,detailId:u.getSelectKey,lessonCourseId:u.getBaseCourseware.id}),window.matchMedia("(display-mode: standalone)").matches&&(A.application=window.matchMedia("(display-mode: standalone)").matches,setTimeout(()=>{b()},200))}catch(i){}},b=()=>{const e=document.documentElement;document.fullScreen||document.mozFullScreen||document.webkitIsFullScreen?document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen():e.requestFullscreen&&e.requestFullscreen()||e.mozRequestFullScreen&&e.mozRequestFullScreen()||e.webkitRequestFullscreen&&e.webkitRequestFullscreen()||e.msRequestFullscreen&&e.msRequestFullscreen()},d=async()=>{n.value=!0;try{const{data:e}=await E({page:1,rows:99,...t});(e.rows||[]).forEach(p=>{p.preStudentNum>0&&r.value.push(p)})}catch(e){}n.value=!1},c=T(()=>d(),500);return F(()=>{d()}),()=>s("div",{class:l.attendClass},[s("div",{class:l.attendClassSearch},[s(y,{placeholder:"请输入班级名称",clearable:!0,value:t.keyword,"onUpdate:value":e=>t.keyword=e,onKeyup:e=>{e.code==="Enter"&&c()},onClear:()=>c()},{prefix:()=>s("span",{class:"icon-search-input",onClick:()=>c()},null)}),s(S,{placeholder:"全部年级",clearable:!0,options:[{label:"全部年级",value:null},...x.grades],value:t.currentGradeNum,"onUpdate:value":[e=>t.currentGradeNum=e,()=>c()]},null),s(S,{placeholder:"全部班级",clearable:!0,options:[{label:"全部班级",value:null},...w],value:t.currentClass,"onUpdate:value":[e=>t.currentClass=e,()=>c()]},null)]),s(L,{class:l.classList},{default:()=>[s(j,{show:n.value},{default:()=>[s("div",{class:[l.listSection,!n.value&&r.value.length<=0?l.emptySection:""]},[r.value.map(e=>s("div",{onClick:()=>f(e)},[s(g,{class:[l.thingItem,"isFull"]},{header:()=>s(I,null,[s("div",{class:l.title},[e.name,h(" "),e.preStudentNum,h("人")]),s("div",{class:[l.subjects,e.subjectName?"":l.noSubjects]},[e.subjectName?e.subjectName:"暂未设置声部"])]),default:()=>e.lastStudy&&s("div",{class:l.content},[e.lastStudy])})])),!n.value&&r.value.length<=0&&s(k,null,null)])]})]}),s(q,{show:t.showSubjectClass,"onUpdate:show":e=>t.showSubjectClass=e,style:{width:"500px"},preset:"card",class:["modalTitle background"],title:"修改声部"},{default:()=>[t.showSubjectClass?s(G,{activeRow:t.activeRow,onGetList:()=>d(),onConfirm:e=>{o("confirm",e)},onClose:()=>t.showSubjectClass=!1},null):null]})])}});export{le as A};