index-legacy-f6019b45-1724872791500.js 3.9 KB

1
  1. System.register(["./api-legacy-67ba6d57-1724872791500.js","./contants-legacy-7e501506-1724872791500.js","./index-legacy-508a3c9b-1724872791500.js"],(function(e,a){"use strict";var r,t,l,n,u,d,c,s,o,i,p,g,m,b,h,v,f;return{setters:[e=>{r=e.r,t=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,b=e.I,h=e.x,v=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 _={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(l()),G=s([...n]),w=s(),N=async()=>{w.value?.validate((async t=>{if(!t){y.uploading=!0;try{await r({...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 t({}),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(b,{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(b,{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(b,{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(b,{filterable:!0,value:C.currentClass,"onUpdate:value":e=>C.currentClass=e,placeholder:"请选择班级",clearable:!0,options:G.value},null)]}),i(h,{class:_.updateBtnGroup},{default:()=>[i(v,{strong:!0,type:"default",round:!0,onClick:()=>a("close")},{default:()=>[f("取消")]}),i(v,{strong:!0,type:"primary",round:!0,disabled:y.uploading,loading:y.uploading,onClick:N},{default:()=>[f("确认")]})]})]})])}}))}}}));