import{d as A,Q as B,r as d,x as D,o as y,A as V,B as s,f as c,a,E as b,k as K,a2 as j,a8 as E,V as G,W as P,K as Q,Z as R,__tla as W}from"./index-92ad187a.js";import{_ as Z,__tla as z}from"./Dialog-44c9fa34.js";import{h as H,i as J,j as L,__tla as M}from"./index-d0152a3f.js";import{u as N,__tla as O}from"./useMessage-d9788660.js";let g,T=Promise.all([(()=>{try{return W}catch{}})(),(()=>{try{return z}catch{}})(),(()=>{try{return M}catch{}})(),(()=>{try{return O}catch{}})()]).then(async()=>{g=A({__name:"Demo03GradeForm",emits:["success"],setup(X,{expose:w,emit:k}){const{t:m}=B(),_=N(),r=d(!1),v=d(""),u=d(!1),p=d(""),l=d({id:void 0,studentId:void 0,name:void 0,teacher:void 0}),x=D({studentId:[{required:!0,message:"\u5B66\u751F\u7F16\u53F7\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],name:[{required:!0,message:"\u540D\u5B57\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],teacher:[{required:!0,message:"\u73ED\u4E3B\u4EFB\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}]}),n=d();w({open:async(t,e,i)=>{if(r.value=!0,v.value=m("action."+t),p.value=t,U(),l.value.studentId=i,e){u.value=!0;try{l.value=await H(e)}finally{u.value=!1}}}});const I=k,q=async()=>{await n.value.validate(),u.value=!0;try{const t=l.value;p.value==="create"?(await J(t),_.success(m("common.createSuccess"))):(await L(t),_.success(m("common.updateSuccess"))),r.value=!1,I("success")}finally{u.value=!1}},U=()=>{var t;l.value={id:void 0,studentId:void 0,name:void 0,teacher:void 0},(t=n.value)==null||t.resetFields()};return(t,e)=>{const i=E,f=G,C=P,h=Q,F=Z,S=R;return y(),V(F,{title:a(v),modelValue:a(r),"onUpdate:modelValue":e[3]||(e[3]=o=>j(r)?r.value=o:null)},{footer:s(()=>[c(h,{onClick:q,type:"primary",disabled:a(u)},{default:s(()=>[b("\u786E \u5B9A")]),_:1},8,["disabled"]),c(h,{onClick:e[2]||(e[2]=o=>r.value=!1)},{default:s(()=>[b("\u53D6 \u6D88")]),_:1})]),default:s(()=>[K((y(),V(C,{ref_key:"formRef",ref:n,model:a(l),rules:a(x),"label-width":"100px"},{default:s(()=>[c(f,{label:"\u540D\u5B57",prop:"name"},{default:s(()=>[c(i,{modelValue:a(l).name,"onUpdate:modelValue":e[0]||(e[0]=o=>a(l).name=o),placeholder:"\u8BF7\u8F93\u5165\u540D\u5B57"},null,8,["modelValue"])]),_:1}),c(f,{label:"\u73ED\u4E3B\u4EFB",prop:"teacher"},{default:s(()=>[c(i,{modelValue:a(l).teacher,"onUpdate:modelValue":e[1]||(e[1]=o=>a(l).teacher=o),placeholder:"\u8BF7\u8F93\u5165\u73ED\u4E3B\u4EFB"},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])),[[S,a(u)]])]),_:1},8,["title","modelValue"])}}})});export{g as _,T as __tla};
