import{d as j,i as A,r as u,f as B,o as i,x as m,w as s,g as n,a,q as w,y as G,c as J,F as Q,v as R,Q as M,z as T,A as X,B as E,X as H,G as K,D as L,J as N,_ as O,__tla as W}from"./index-7d5b26d3.js";import{_ as Y,__tla as Z}from"./Dialog-2be588df.js";import{a as $,g as ee,c as ae,u as le,__tla as te}from"./index-35960962.js";import{u as re,__tla as se}from"./useMessage-c81eaa5b.js";let V,ue=Promise.all([(()=>{try{return W}catch{}})(),(()=>{try{return Z}catch{}})(),(()=>{try{return te}catch{}})(),(()=>{try{return se}catch{}})()]).then(async()=>{V=O(j({name:"CrmProductCategoryForm",__name:"ProductCategoryForm",emits:["success"],setup(oe,{expose:x,emit:C}){const{t:_}=A(),p=re(),o=u(!1),v=u(""),d=u(!1),f=u(""),r=u({id:void 0,name:void 0,parentId:void 0}),I=B({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"}]}),c=u(),y=u([]);x({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 k=C,F=async()=>{if(c&&await c.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,k("success")}finally{d.value=!1}}},P=()=>{var t;r.value={id:void 0,name:void 0,parentId:void 0},(t=c.value)==null||t.resetFields()};return(t,e)=>{const g=T,q=X,b=E,z=H,U=K,h=L,D=Y,S=N;return i(),m(D,{title:a(v),modelValue:a(o),"onUpdate:modelValue":e[3]||(e[3]=l=>M(o)?o.value=l:null)},{footer:s(()=>[n(h,{onClick:F,type:"primary",disabled:a(d)},{default:s(()=>[w("\u786E \u5B9A")]),_:1},8,["disabled"]),n(h,{onClick:e[2]||(e[2]=l=>o.value=!1)},{default:s(()=>[w("\u53D6 \u6D88")]),_:1})]),default:s(()=>[G((i(),m(U,{ref_key:"formRef",ref:c,model:a(r),rules:a(I),"label-width":"100px"},{default:s(()=>[n(b,{label:"\u7236\u7EA7\u5206\u7C7B",prop:"parentId"},{default:s(()=>[n(q,{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(),m(g,{key:0,label:"\u9876\u7EA7\u5206\u7C7B",value:0})),(i(!0),J(Q,null,R(a(y),l=>(i(),m(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(z,{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"])),[[S,a(d)]])]),_:1},8,["title","modelValue"])}}}),[["__file","D:/zx/mall-newfeifan-zx-business/src/views/crm/product/category/ProductCategoryForm.vue"]])});export{ue as __tla,V as default};
