Demo03GradeForm-0693bd03.js 2.6 KB

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