import{a2 as H,H as M,I as N,D as z,S as J,T as K,C as Q,F as W}from"./element-plus.55d71530.js";import{_ as X}from"./picker.76cdcf9b.js";import{P as Y}from"./index.9939838f.js";import{r as p}from"./index.b7f6427b.js";import"./lodash.d6737109.js";import"./dayjs.37feae28.js";import{d as h,s as w,r as A,b as Z,_ as k,o as d,c as m,V as l,M as a,u as o,U as b,aa as E,L as B}from"./@vue.96c135a1.js";function $(s){return p.get({url:"/goods_category.goods_category/lists",params:s})}function ee(s){return p.post({url:"/goods_category.goods_category/add",params:s})}function ue(s){return p.post({url:"/goods_category.goods_category/edit",params:s})}function me(s){return p.post({url:"/goods_category.goods_category/delete",params:s})}function te(s){return p.get({url:"/goods_category.goods_category/detail",params:s})}const le={class:"edit-popup"},oe=h({name:"goodsCategoryEdit"}),ge=h({...oe,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(s,{expose:x,emit:I}){const F=I,D=w(),g=w(),_=A("add"),C=A([]),U=Z(()=>_.value=="edit"?"\u7F16\u8F91\u670D\u52A1\u7C7B\u76EE":"\u65B0\u589E\u670D\u52A1\u7C7B\u76EE"),t=k({id:"",pid:"",category_type:"",picture:"",name:"",is_goods:"",status:"",weigh:""}),q=k({pid:[{required:!0,message:"\u8BF7\u8F93\u5165\u7236\u7EA7ID",trigger:["blur"]}],category_type:[{required:!0,message:"\u8BF7\u9009\u62E9\u670D\u52A1\u7C7B\u578B",trigger:["blur"]}],name:[{required:!0,message:"\u8BF7\u8F93\u5165\u540D\u79F0",trigger:["blur"]}],is_goods:[{required:!0,message:"\u8BF7\u9009\u62E9\u670D\u52A1\u4EA7\u54C1",trigger:["blur"]}],status:[{required:!0,message:"\u8BF7\u9009\u62E9\u72B6\u6001",trigger:["blur"]}],weigh:[{required:!0,message:"\u8BF7\u8F93\u5165\u6743\u91CD",trigger:["blur"]}]}),V=async r=>{for(const e in t)r[e]!=null&&r[e]!=null&&(t[e]=r[e])},R=async r=>{const e=await te({id:r.id});V(e)},L=async()=>{var e,c;await((e=D.value)==null?void 0:e.validate());const r={...t};_.value=="edit"?await ue(r):await ee(r),(c=g.value)==null||c.close(),F("success")},G=(r="add")=>{var e;_.value=r,(e=g.value)==null||e.open()},S=()=>{F("close")};return(async()=>{const r=await $(),e={id:0,name:"\u9876\u7EA7",children:[]};e.children=r.lists,C.value.push(e)})(),x({open:G,setFormData:V,getDetail:R}),(r,e)=>{const c=H,n=z,f=J,y=K,T=X,O=M,P=N,v=Q,j=W;return d(),m("div",le,[l(Y,{ref_key:"popupRef",ref:g,title:o(U),async:!0,width:"550px",onConfirm:L,onClose:S},{default:a(()=>[l(j,{ref_key:"formRef",ref:D,model:o(t),"label-width":"90px",rules:o(q)},{default:a(()=>[l(n,{label:"\u7236\u7EA7ID",prop:"pid"},{default:a(()=>[l(c,{class:"flex-1",modelValue:o(t).pid,"onUpdate:modelValue":e[0]||(e[0]=u=>o(t).pid=u),data:o(C),clearable:"","node-key":"id",props:{label:"name",value:"id",children:"children"},"default-expand-all":!0,placeholder:"\u8BF7\u9009\u62E9\u7236\u7EA7ID","check-strictly":""},null,8,["modelValue","data"])]),_:1}),l(n,{label:"\u670D\u52A1\u7C7B\u578B",prop:"category_type"},{default:a(()=>[l(y,{class:"flex-1",modelValue:o(t).category_type,"onUpdate:modelValue":e[1]||(e[1]=u=>o(t).category_type=u),clearable:"",placeholder:"\u8BF7\u9009\u62E9\u670D\u52A1\u7C7B\u578B"},{default:a(()=>[(d(!0),m(b,null,E(s.dictData.category_type,(u,i)=>(d(),B(f,{key:i,label:u.name,value:parseInt(u.value)},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),l(P,null,{default:a(()=>[l(O,{span:12},{default:a(()=>[l(n,{label:"\u5206\u7C7B\u56FE\u7247",prop:"picture"},{default:a(()=>[l(T,{modelValue:o(t).picture,"onUpdate:modelValue":e[2]||(e[2]=u=>o(t).picture=u)},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),l(n,{label:"\u540D\u79F0",prop:"name"},{default:a(()=>[l(v,{modelValue:o(t).name,"onUpdate:modelValue":e[3]||(e[3]=u=>o(t).name=u),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u540D\u79F0"},null,8,["modelValue"])]),_:1}),l(n,{label:"\u670D\u52A1\u4EA7\u54C1",prop:"is_goods"},{default:a(()=>[l(y,{class:"flex-1",modelValue:o(t).is_goods,"onUpdate:modelValue":e[4]||(e[4]=u=>o(t).is_goods=u),clearable:"",placeholder:"\u8BF7\u9009\u62E9\u670D\u52A1\u4EA7\u54C1"},{default:a(()=>[(d(!0),m(b,null,E(s.dictData.is_goods,(u,i)=>(d(),B(f,{key:i,label:u.name,value:parseInt(u.value)},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),l(n,{label:"\u72B6\u6001",prop:"status"},{default:a(()=>[l(y,{class:"flex-1",modelValue:o(t).status,"onUpdate:modelValue":e[5]||(e[5]=u=>o(t).status=u),clearable:"",placeholder:"\u8BF7\u9009\u62E9\u72B6\u6001"},{default:a(()=>[(d(!0),m(b,null,E(s.dictData.is_goods,(u,i)=>(d(),B(f,{key:i,label:u.name,value:parseInt(u.value)},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),l(n,{label:"\u6743\u91CD",prop:"weigh"},{default:a(()=>[l(v,{modelValue:o(t).weigh,"onUpdate:modelValue":e[6]||(e[6]=u=>o(t).weigh=u),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u6743\u91CD"},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["title"])])}}});export{ge as _,$ as a,me as b};
