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