Demo03CourseForm-569ede32.js 2.5 KB

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