import{a2 as M,Z as N,$ as Q,D as W,Q as Z,R as $,C as z,F as H}from"./element-plus.ae09c4a0.js";import{_ as J}from"./picker.c1dbbe62.js";import{P as K}from"./index.e64ff1d1.js";import{r as p}from"./index.80696382.js";import"./lodash.fc1b942f.js";import{d as h,s as w,r as A,b as X,a0 as k,o as d,c as m,W as l,O as a,u as o,V as b,a7 as E,M as B}from"./@vue.a7a54728.js";function Y(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 ce(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"}),me=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([]),R=X(()=>_.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])},U=async r=>{const e=await te({id:r.id});V(e)},G=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")},L=(r="add")=>{var e;_.value=r,(e=g.value)==null||e.open()},O=()=>{F("close")};return(async()=>{const r=await Y(),e={id:0,name:"\u9876\u7EA7",children:[]};e.children=r.lists,C.value.push(e)})(),x({open:L,setFormData:V,getDetail:U}),(r,e)=>{const c=M,n=W,f=Z,y=$,S=J,P=N,T=Q,v=z,j=H;return d(),m("div",le,[l(K,{ref_key:"popupRef",ref:g,title:o(R),async:!0,width:"550px",onConfirm:G,onClose:O},{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(T,null,{default:a(()=>[l(P,{span:12},{default:a(()=>[l(n,{label:"\u5206\u7C7B\u56FE\u7247",prop:"picture"},{default:a(()=>[l(S,{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{me as _,Y as a,ce as b};
