System.register(["./api-legacy-7b5d83ef-1742362401929.js","./contants-legacy-3050a02d-1742362401929.js","./index-legacy-932d7415-1742362401929.js"],(function(e,a){"use strict";var t,r,l,n,u,d,c,s,o,i,p,g,m,h,b,f,v;return{setters:[e=>{t=e.r,r=e.a},e=>{l=e.g,n=e.c},e=>{u=e.d,d=e.b,c=e.e,s=e.r,o=e.q,i=e.f,p=e.N,g=e.g,m=e.h,h=e.ac,b=e.x,f=e.j,v=e.k}],execute:function(){var a=document.createElement("style");a.textContent="._updateStudentContainer_aa0c9_1{padding:1.25vw 1.5625vw}._updateStudentContainer_aa0c9_1 ._updateBtnGroup_aa0c9_4{padding:0;justify-content:center!important}._updateStudentContainer_aa0c9_1 ._updateBtnGroup_aa0c9_4 .n-button{min-width:8.125vw}\n",document.head.appendChild(a);const _={updateStudentContainer:"_updateStudentContainer_aa0c9_1",updateBtnGroup:"_updateBtnGroup_aa0c9_4"};e("U",u({name:"update-student",props:{row:{type:Object,default:()=>({})}},emits:["close","confirm"],setup(e,{emit:a}){const u=d(),y=c({uploading:!1,gradeList:[],classList:[],gradeYearList:[]}),C=c({phone:null,nickname:null,gender:null,gradeYear:null,currentGradeNum:null,currentClass:null}),Y=s(function(){const e=l(),a=[];for(let t=1;t<e.length;t++)a.push(e[t]);return a}()),G=s(function(){const e=n,a=[];for(let t=1;t<e.length;t++)a.push(e[t]);return a}()),w=s(),N=async()=>{w.value?.validate((async r=>{if(!r){y.uploading=!0;try{await t({...C,id:e.row.id,schoolId:e.row.schoolId,tenantId:e.row.tenantId}),u.success("修改成功"),a("confirm"),a("close")}catch{}y.uploading=!1}}))};o((async()=>{const a=e.row;(async()=>{try{const{data:e}=await r({}),a=[{label:e+1,value:e+1},{label:e,value:e}];y.gradeYearList=a}catch{}})(),a.id&&(C.nickname=a.nickname,C.phone=a.phone,C.gender=a.gender,C.currentGradeNum=a.currentGradeNum,C.currentClass=a.currentClass,C.gradeYear=a.gradeYear),-1===y.gradeYearList.findIndex((e=>e.value===a.gradeYear))&&a.gradeYear&&y.gradeYearList.push({label:a.gradeYear,value:a.gradeYear}),C.currentGradeNum&&-1===Y.value.findIndex((e=>e.value===C.currentGradeNum))&&(C.currentGradeNum=null)}));const k=e=>!e||/^\d+$/.test(e);return()=>i("div",{class:_.updateStudentContainer},[i(p,{ref:w,model:C,labelAlign:"right",labelWidth:"auto",labelPlacement:"left"},{default:()=>[i(g,{label:"姓名",path:"nickname",rule:{required:!0,message:"请填写学生姓名",trigger:"blur"}},{default:()=>[i(m,{maxlength:15,placeholder:"请填写学生姓名",value:C.nickname,"onUpdate:value":e=>C.nickname=e},null)]}),i(g,{label:"手机号",path:"phone",rule:[{required:!0,message:"请填写学生手机号",trigger:"blur"},{pattern:/^1[3456789]\d{9}$/,message:"手机号格式不正确",trigger:"blur"}]},{default:()=>[i(m,{maxlength:11,allowInput:k,placeholder:"请填写学生手机号",value:C.phone,"onUpdate:value":e=>C.phone=e},null)]}),i(g,{label:"性别",path:"gender",rule:[{required:!0,message:"请选择性别",trigger:"blur",type:"number"}]},{default:()=>[i(h,{class:_.select,clearable:!0,filterable:!0,placeholder:"请选择性别",options:[{label:"男",value:1},{label:"女",value:0}],value:C.gender,"onUpdate:value":e=>C.gender=e},null)]}),i(g,{label:"学年",path:"gradeYear",rule:[{required:!0,message:"请选择学年",trigger:"change",type:"number"}]},{default:()=>[i(h,{value:C.gradeYear,"onUpdate:value":e=>C.gradeYear=e,placeholder:"请选择学年",options:y.gradeYearList,clearable:!0,filterable:!0},null)]}),i(g,{label:"年级",path:"currentGradeNum",rule:[{required:!0,message:"请选择年级",trigger:"change",type:"number"}]},{default:()=>[i(h,{value:C.currentGradeNum,"onUpdate:value":e=>C.currentGradeNum=e,placeholder:"请选择年级",options:Y.value,clearable:!0,filterable:!0},null)]}),i(g,{label:"班级",path:"currentClass",rule:[{required:!0,message:"请选择班级",trigger:"change",type:"number"}]},{default:()=>[i(h,{filterable:!0,value:C.currentClass,"onUpdate:value":e=>C.currentClass=e,placeholder:"请选择班级",clearable:!0,options:G.value},null)]}),i(b,{class:_.updateBtnGroup},{default:()=>[i(f,{strong:!0,type:"default",round:!0,onClick:()=>a("close")},{default:()=>[v("取消")]}),i(f,{strong:!0,type:"primary",round:!0,disabled:y.uploading,loading:y.uploading,onClick:N},{default:()=>[v("确认")]})]})]})])}}))}}}));
