import{A as g}from"./index-780c4593-1706882452509.js";import{d as b,bD as j,y as c,p as y,O as C,f as a,l as N,F as i,e as m,b as R,r as v,N as S,g as F,x as G,w as L,j as w,k as f}from"./index-f5a86b16-1706882452509.js";import{s as p}from"./index.module-d1ab12c4-1706882452509.js";import{C as U}from"./index-a323c227-1706882452509.js";import{r as x}from"./api-260cc46c-1706882452509.js";import{u as D}from"./catchData-557c9c01-1706882452509.js";const W="_previewWindow_1jnin_1",A={previewWindow:W},P=b({name:"preview-window",props:{show:{type:Boolean,default:!1},type:{type:String,default:""},params:{type:Object,default:()=>({})}},emit:["update:show"],setup(e,{emit:l}){const{show:u,type:o,params:t}=j(e);c(()=>e.show,()=>{u.value=e.show}),c(()=>e.type,()=>{o.value=e.type}),c(()=>e.params,()=>{t.value=e.params});const r=n=>{n.data.api==="iframe_exit"&&l("update:show",!1)};return y(()=>{window.addEventListener("message",r)}),C(()=>{window.removeEventListener("message",r)}),()=>a(i,null,[a(N,{show:u.value,"onUpdate:show":[n=>u.value=n,()=>{l("update:show",u.value)}],class:A.previewWindow,showIcon:!1,displayDirective:"show"},{default:()=>[a(i,null,[u.value?o.value=="attend"?a(g,{type:t.value.type||"",subjectId:t.value.subjectId||"",detailId:t.value.detailId||"",classGroupId:t.value.classGroupId||"",lessonCourseId:t.value.lessonCourseId||"",classId:t.value.classId||"",preStudentNum:t.value.preStudentNum,onClose:()=>l("update:show",!1)},null):o.value=="notation"?a("iframe",{src:t.value.src},null):o.value=="music"?a("iframe",{src:t.value.src,style:{height:"100vh"}},null):"":""])]})])}}),V=b({props:{activeRow:{type:Object,default:()=>({id:""})},subjectList:{type:Array,default:()=>[]}},name:"resetStudent",emits:["close","getList","confirm"],setup(e,{emit:l}){const u=D(),o=m({uploading:!1}),t=R(),r=v([]),n=v(),s=m({currentGradeNum:null,currentClass:null,subjectId:null,id:null});y(async()=>{await u.getSubjects(),r.value=[{id:null,name:"选择声部"},...u.getSubjectList],s.currentGradeNum=e.activeRow.currentGradeNum,s.currentClass=e.activeRow.currentClass,s.subjectId=e.activeRow.subjectId,s.id=e.activeRow.id});const I=()=>{n.value.validate(async d=>{if(!d){o.uploading=!0;try{await x({...s}),t.success("修改成功"),l("close"),l("confirm",{lastUseCoursewareId:e.activeRow.lessonCoursewareId,unit:e.activeRow.lessonCoursewareKnowledgeDetailId,subjectId:s.subjectId,name:e.activeRow.name,classGroupId:e.activeRow.id}),l("getList")}catch(h){console.log(h)}o.uploading=!1}})};return()=>a("div",{class:[p.addClass]},[a(S,{"label-placement":"left",model:s,ref:n},{default:()=>[a(F,{path:"subjectId",rule:[{required:!0,message:"请选择声部"}]},{default:()=>[a(U,G({style:{width:"400px"},options:r.value,placeholder:"选择声部",labelField:"name",valueField:"id",clearable:!0},{value:s.subjectId,"onUpdate:value":d=>s.subjectId=d}),null)]})]}),a(L,{class:p.btnGroup,justify:"center"},{default:()=>[a(w,{round:!0,onClick:()=>l("close")},{default:()=>[f("取消")]}),a(w,{round:!0,loading:o.uploading,onClick:()=>I(),type:"primary"},{default:()=>[f("确定")]})]})])}});export{P,V as U};
