import{d as H,n as S,r as d,f as j,o as b,l as g,w as t,i,a,j as V,C as A,y as E,U as P,H as G,K as J,J as K,N,_ as O,__tla as R}from"./index-2c56227b.js";import{_ as z,__tla as B}from"./Dialog-1050d437.js";import{a as L,b as M,d as Q,__tla as T}from"./index-e52e4373.js";import{u as W,__tla as X}from"./useMessage-96878a4a.js";let w,Y=Promise.all([(()=>{try{return R}catch{}})(),(()=>{try{return B}catch{}})(),(()=>{try{return T}catch{}})(),(()=>{try{return X}catch{}})()]).then(async()=>{w=O(H({__name:"Demo03CourseForm",emits:["success"],setup(Z,{expose:h,emit:C}){const{t:n}=S(),_=W(),r=d(!1),v=d(""),o=d(!1),f=d(""),l=d({id:void 0,studentId:void 0,name:void 0,score:void 0}),I=j({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"}]}),c=d();h({open:async(s,e,m)=>{if(r.value=!0,v.value=n("action."+s),f.value=s,q(),l.value.studentId=m,e){o.value=!0;try{l.value=await L(e)}finally{o.value=!1}}}});const U=C,k=async()=>{await c.value.validate(),o.value=!0;try{const s=l.value;f.value==="create"?(await M(s),_.success(n("common.createSuccess"))):(await Q(s),_.success(n("common.updateSuccess"))),r.value=!1,U("success")}finally{o.value=!1}},q=()=>{var s;l.value={id:void 0,studentId:void 0,name:void 0,score:void 0},(s=c.value)==null||s.resetFields()};return(s,e)=>{const m=P,p=G,x=J,y=K,F=z,D=N;return b(),g(F,{title:a(v),modelValue:a(r),"onUpdate:modelValue":e[3]||(e[3]=u=>E(r)?r.value=u:null)},{footer:t(()=>[i(y,{onClick:k,type:"primary",disabled:a(o)},{default:t(()=>[V("\u786E \u5B9A")]),_:1},8,["disabled"]),i(y,{onClick:e[2]||(e[2]=u=>r.value=!1)},{default:t(()=>[V("\u53D6 \u6D88")]),_:1})]),default:t(()=>[A((b(),g(x,{ref_key:"formRef",ref:c,model:a(l),rules:a(I),"label-width":"100px"},{default:t(()=>[i(p,{label:"\u540D\u5B57",prop:"name"},{default:t(()=>[i(m,{modelValue:a(l).name,"onUpdate:modelValue":e[0]||(e[0]=u=>a(l).name=u),placeholder:"\u8BF7\u8F93\u5165\u540D\u5B57"},null,8,["modelValue"])]),_:1}),i(p,{label:"\u5206\u6570",prop:"score"},{default:t(()=>[i(m,{modelValue:a(l).score,"onUpdate:modelValue":e[1]||(e[1]=u=>a(l).score=u),placeholder:"\u8BF7\u8F93\u5165\u5206\u6570"},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])),[[D,a(o)]])]),_:1},8,["title","modelValue"])}}}),[["__file","E:/GAOHP_2023/mall/newfeifan-front/yudao-ui-admin-vue3/src/views/infra/demo/demo03/erp/components/Demo03CourseForm.vue"]])});export{Y as __tla,w as default};
