import{s as o}from"./index.module-eed6ff4d-1776006071491.js";import{g as C,u as p}from"./api-f361bb3e-1776006071491.js";import{u as y}from"./catchData-b0d27a71-1776006071491.js";import{d as I,e as d,b as N,r as i,q as b,f as a,N as h,g as R,x as j,j as m,k as f}from"./index-8c26cc43-1776006071491.js";import{N as F}from"./Cascader-f80df73e-1776006071491.js";const L=I({props:{activeRow:{type:Object,default:()=>({id:""})},subjectList:{type:Array,default:()=>[]}},name:"resetStudent",emits:["close","getList","confirm"],setup(t,{emit:s}){y();const u=d({uploading:!1}),g=N(),l=i([]),c=i(),e=d({currentGradeNum:null,currentClass:null,gradeYear:null,instrumentId:null,id:null}),v=async()=>{try{const{data:r}=await C({gradeYear:e.gradeYear,currentGradeNum:e.currentGradeNum,currentClass:e.currentClass}),n=r||[];l.value=n}catch(r){}};b(async()=>{e.gradeYear=t.activeRow.gradeYear,e.currentGradeNum=t.activeRow.currentGradeNum,e.currentClass=t.activeRow.currentClass,e.instrumentId=t.activeRow.instrumentId,e.id=t.activeRow.id,v()});const w=()=>{c.value.validate(async r=>{if(!r){u.uploading=!0;try{await p({...e}),g.success("修改成功"),s("close"),s("confirm",{lastUseCoursewareId:t.activeRow.lessonCoursewareId,unit:t.activeRow.lessonCoursewareKnowledgeDetailId,instrumentId:e.instrumentId,name:t.activeRow.name,classGroupId:t.activeRow.id}),s("getList")}catch(n){console.log(n)}u.uploading=!1}})};return()=>a("div",{class:[o.addClass]},[a(h,{"label-placement":"left",model:e,ref:c},{default:()=>[a(R,{path:"instrumentId",rule:[{required:!0,message:"请选择乐器"}]},{default:()=>[a(F,{placeholder:"请选择乐器",value:e.instrumentId,"onUpdate:value":r=>e.instrumentId=r,options:l.value,checkStrategy:"child",showPath:!1,childrenField:"instruments",expandTrigger:"hover",labelField:"name",valueField:"id",clearable:!0,filterable:!0,style:{width:"400px"}},null)]})]}),a(j,{class:o.btnGroup,justify:"center"},{default:()=>[a(m,{round:!0,onClick:()=>s("close")},{default:()=>[f("取消")]}),a(m,{round:!0,loading:u.uploading,onClick:()=>w(),type:"primary"},{default:()=>[f("确定")]})]})])}});export{L as U};
