import{d as A,Q as B,r as d,x as D,o as V,A as b,B as s,f as c,a,E as g,k as K,a2 as E,a8 as P,V as Q,W as R,K as W,Z,__tla as j}from"./index-92ad187a.js";import{_ as z,__tla as G}from"./Dialog-44c9fa34.js";import{a as H,b as J,d as L,__tla as M}from"./index-d0152a3f.js";import{u as N,__tla as O}from"./useMessage-d9788660.js";let h,T=Promise.all([(()=>{try{return j}catch{}})(),(()=>{try{return G}catch{}})(),(()=>{try{return M}catch{}})(),(()=>{try{return O}catch{}})()]).then(async()=>{h=A({__name:"Demo03CourseForm",emits:["success"],setup(X,{expose:w,emit:x}){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,score:void 0}),k=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"}],score:[{required:!0,message:"\u5206\u6570\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,C(),l.value.studentId=i,e){u.value=!0;try{l.value=await H(e)}finally{u.value=!1}}}});const I=x,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}},C=()=>{var t;l.value={id:void 0,studentId:void 0,name:void 0,score:void 0},(t=n.value)==null||t.resetFields()};return(t,e)=>{const i=P,f=Q,U=R,y=W,F=z,S=Z;return V(),b(F,{title:a(v),modelValue:a(r),"onUpdate:modelValue":e[3]||(e[3]=o=>E(r)?r.value=o:null)},{footer:s(()=>[c(y,{onClick:q,type:"primary",disabled:a(u)},{default:s(()=>[g("\u786E \u5B9A")]),_:1},8,["disabled"]),c(y,{onClick:e[2]||(e[2]=o=>r.value=!1)},{default:s(()=>[g("\u53D6 \u6D88")]),_:1})]),default:s(()=>[K((V(),b(U,{ref_key:"formRef",ref:n,model:a(l),rules:a(k),"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:"\u5206\u6570",prop:"score"},{default:s(()=>[c(i,{modelValue:a(l).score,"onUpdate:modelValue":e[1]||(e[1]=o=>a(l).score=o),placeholder:"\u8BF7\u8F93\u5165\u5206\u6570"},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])),[[S,a(u)]])]),_:1},8,["title","modelValue"])}}})});export{h as _,T as __tla};
