TagForm-5dd83d2a.js 2.1 KB

1
  1. import{d as j,n as D,r,o as y,l as w,w as o,i,a as t,j as g,C as K,y as M,U as R,H as S,K as q,J as z,N as J,_ as N,__tla as P}from"./index-af173888.js";import{_ as X,__tla as A}from"./Dialog-987c90a1.js";import{g as B,c as E,u as G,__tla as L}from"./index-99c004e3.js";import{u as O,__tla as Q}from"./useMessage-170c1b43.js";let h,W=Promise.all([(()=>{try{return P}catch{}})(),(()=>{try{return A}catch{}})(),(()=>{try{return L}catch{}})(),(()=>{try{return Q}catch{}})()]).then(async()=>{h=N(j({name:"MpTagForm",__name:"TagForm",emits:["success"],setup(Y,{expose:V,emit:b}){const{t:_}=D(),d=O(),s=r(!1),f=r(""),u=r(!1),p=r(""),l=r({accountId:-1,name:""}),x={name:[{required:!0,message:"\u8BF7\u8F93\u5165\u6807\u7B7E\u540D\u79F0",trigger:"blur"}]},c=r(null),k=b;V({open:async(e,a,n)=>{if(s.value=!0,f.value=_("action."+e),p.value=e,U(),l.value.accountId=a,n){u.value=!0;try{l.value=await B(n)}finally{u.value=!1}}}});const F=async()=>{var e;if(c&&await((e=c.value)==null?void 0:e.validate())){u.value=!0;try{const a=l.value;p.value==="create"?(await E(a),d.success(_("common.createSuccess"))):(await G(a),d.success(_("common.updateSuccess"))),s.value=!1,k("success")}finally{u.value=!1}}},U=()=>{var e;l.value={accountId:-1,name:""},(e=c.value)==null||e.resetFields()};return(e,a)=>{const n=R,C=S,I=q,v=z,T=X,H=J;return y(),w(T,{modelValue:t(s),"onUpdate:modelValue":a[2]||(a[2]=m=>M(s)?s.value=m:null),title:t(f)},{footer:o(()=>[i(v,{disabled:t(u),type:"primary",onClick:F},{default:o(()=>[g("\u786E \u5B9A")]),_:1},8,["disabled"]),i(v,{onClick:a[1]||(a[1]=m=>s.value=!1)},{default:o(()=>[g("\u53D6 \u6D88")]),_:1})]),default:o(()=>[K((y(),w(I,{ref_key:"formRef",ref:c,model:t(l),rules:x,"label-width":"80px"},{default:o(()=>[i(C,{label:"\u6807\u7B7E\u540D\u79F0",prop:"name"},{default:o(()=>[i(n,{modelValue:t(l).name,"onUpdate:modelValue":a[0]||(a[0]=m=>t(l).name=m),placeholder:"\u8BF7\u8F93\u5165\u6807\u7B7E\u540D\u79F0"},null,8,["modelValue"])]),_:1})]),_:1},8,["model"])),[[H,t(u)]])]),_:1},8,["modelValue","title"])}}}),[["__file","/Users/RuHu.Xu/Desktop/mall-newfeifan-zx-admin/src/views/mp/tag/TagForm.vue"]])});export{W as __tla,h as default};