System.register(["./api-legacy-93aef9cd-1706882452509.js","./contants-legacy-573f3310-1706882452509.js","./index-legacy-26fae7cb-1706882452509.js"],(function(e,a){"use strict";var t,n,l,r,u,d,c,o,s,i,p,g,m,h,b,f;return{setters:[e=>{t=e.r},e=>{n=e.g,l=e.c},e=>{r=e.d,u=e.b,d=e.e,c=e.r,o=e.p,s=e.f,i=e.N,p=e.g,g=e.h,m=e.C,h=e.w,b=e.j,f=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 v={updateStudentContainer:"_updateStudentContainer_aa0c9_1",updateBtnGroup:"_updateBtnGroup_aa0c9_4"};e("U",r({name:"update-student",props:{row:{type:Object,default:()=>({})}},emits:["close","confirm"],setup(e,{emit:a}){const r=u(),_=d({uploading:!1,gradeList:[],classList:[]}),y=d({phone:null,nickname:null,gender:null,currentGradeNum:null,currentClass:null}),C=c(n()),G=c([...l]),w=c(),N=async()=>{w.value?.validate((async n=>{if(!n){_.uploading=!0;try{await t({...y,id:e.row.id,schoolId:e.row.schoolId,tenantId:e.row.tenantId}),r.success("修改成功"),a("confirm"),a("close")}catch{}_.uploading=!1}}))};o((async()=>{const a=e.row;a.id&&(y.nickname=a.nickname,y.phone=a.phone,y.gender=a.gender,y.currentGradeNum=a.currentGradeNum,y.currentClass=a.currentClass),y.currentGradeNum&&-1===C.value.findIndex((e=>e.value===y.currentGradeNum))&&(y.currentGradeNum=null)}));const k=e=>!e||/^\d+$/.test(e);return()=>s("div",{class:v.updateStudentContainer},[s(i,{ref:w,model:y,labelAlign:"right",labelWidth:"auto",labelPlacement:"left"},{default:()=>[s(p,{label:"姓名",path:"nickname",rule:{required:!0,message:"请填写学生姓名",trigger:"blur"}},{default:()=>[s(g,{maxlength:15,placeholder:"请填写学生姓名",value:y.nickname,"onUpdate:value":e=>y.nickname=e},null)]}),s(p,{label:"手机号",path:"phone",rule:[{required:!0,message:"请填写学生手机号",trigger:"blur"},{pattern:/^1[3456789]\d{9}$/,message:"手机号格式不正确",trigger:"blur"}]},{default:()=>[s(g,{maxlength:11,allowInput:k,placeholder:"请填写学生手机号",value:y.phone,"onUpdate:value":e=>y.phone=e},null)]}),s(p,{label:"性别",path:"gender",rule:[{required:!0,message:"请选择性别",trigger:"blur",type:"number"}]},{default:()=>[s(m,{class:v.select,clearable:!0,filterable:!0,placeholder:"请选择性别",options:[{label:"男",value:1},{label:"女",value:0}],value:y.gender,"onUpdate:value":e=>y.gender=e},null)]}),s(p,{label:"年级",path:"currentGradeNum",rule:[{required:!0,message:"请选择年级",trigger:"change",type:"number"}]},{default:()=>[s(m,{value:y.currentGradeNum,"onUpdate:value":e=>y.currentGradeNum=e,placeholder:"请选择年级",options:C.value,clearable:!0,filterable:!0},null)]}),s(p,{label:"班级",path:"currentClass",rule:[{required:!0,message:"请选择班级",trigger:"change",type:"number"}]},{default:()=>[s(m,{filterable:!0,value:y.currentClass,"onUpdate:value":e=>y.currentClass=e,placeholder:"请选择班级",clearable:!0,options:G.value},null)]}),s(h,{class:v.updateBtnGroup},{default:()=>[s(b,{strong:!0,type:"default",round:!0,onClick:()=>a("close")},{default:()=>[f("取消")]}),s(b,{strong:!0,type:"primary",round:!0,disabled:_.uploading,loading:_.uploading,onClick:N},{default:()=>[f("确认")]})]})]})])}}))}}}));
