ProductCategoryForm-8278b9f1.js 2.7 KB

1
  1. import{d as R,P as j,r as u,x as A,o as i,C as c,A as s,f as n,a,D as h,k as J,c as W,F as Z,R as B,a2 as E,S as M,U as G,V as H,a9 as K,W as L,J as N,Z as O,_ as Q,__tla as T}from"./index-0b2503c4.js";import{_ as X,__tla as Y}from"./Dialog-3207cd36.js";import{a as $,g as ee,c as ae,u as le,__tla as te}from"./index-4c7b1031.js";import{u as re,__tla as se}from"./useMessage-d05433ee.js";let w,ue=Promise.all([(()=>{try{return T}catch{}})(),(()=>{try{return Y}catch{}})(),(()=>{try{return te}catch{}})(),(()=>{try{return se}catch{}})()]).then(async()=>{w=Q(R({name:"CrmProductCategoryForm",__name:"ProductCategoryForm",emits:["success"],setup(oe,{expose:I,emit:k}){const{t:_}=j(),p=re(),o=u(!1),v=u(""),d=u(!1),f=u(""),r=u({id:void 0,name:void 0,parentId:void 0}),x=A({name:[{required:!0,message:"\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],parentId:[{required:!0,message:"\u7236\u7EA7\u5206\u7C7B\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}]}),m=u(),y=u([]);I({open:async(t,e)=>{if(o.value=!0,v.value=_("action."+t),f.value=t,P(),e){d.value=!0;try{r.value=await $(e)}finally{d.value=!1}}y.value=await ee({parentId:0})}});const C=k,F=async()=>{if(m&&await m.value.validate()){d.value=!0;try{const t=r.value;f.value==="create"?(await ae(t),p.success(_("common.createSuccess"))):(await le(t),p.success(_("common.updateSuccess"))),o.value=!1,C("success")}finally{d.value=!1}}},P=()=>{var t;r.value={id:void 0,name:void 0,parentId:void 0},(t=m.value)==null||t.resetFields()};return(t,e)=>{const g=M,U=G,b=H,D=K,S=L,V=N,q=X,z=O;return i(),c(q,{title:a(v),modelValue:a(o),"onUpdate:modelValue":e[3]||(e[3]=l=>E(o)?o.value=l:null)},{footer:s(()=>[n(V,{onClick:F,type:"primary",disabled:a(d)},{default:s(()=>[h("\u786E \u5B9A")]),_:1},8,["disabled"]),n(V,{onClick:e[2]||(e[2]=l=>o.value=!1)},{default:s(()=>[h("\u53D6 \u6D88")]),_:1})]),default:s(()=>[J((i(),c(S,{ref_key:"formRef",ref:m,model:a(r),rules:a(x),"label-width":"100px"},{default:s(()=>[n(b,{label:"\u7236\u7EA7\u5206\u7C7B",prop:"parentId"},{default:s(()=>[n(U,{modelValue:a(r).parentId,"onUpdate:modelValue":e[0]||(e[0]=l=>a(r).parentId=l),placeholder:"\u8BF7\u9009\u62E9\u4E0A\u7EA7\u5206\u7C7B"},{default:s(()=>[(i(),c(g,{key:0,label:"\u9876\u7EA7\u5206\u7C7B",value:0})),(i(!0),W(Z,null,B(a(y),l=>(i(),c(g,{key:l.id,label:l.name,value:l.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),n(b,{label:"\u540D\u79F0",prop:"name"},{default:s(()=>[n(D,{modelValue:a(r).name,"onUpdate:modelValue":e[1]||(e[1]=l=>a(r).name=l),placeholder:"\u8BF7\u8F93\u5165\u540D\u79F0"},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])),[[z,a(d)]])]),_:1},8,["title","modelValue"])}}}),[["__file","D:/zx/mall-newfeifan-zx-admin/src/views/crm/product/category/ProductCategoryForm.vue"]])});export{ue as __tla,w as default};