import{a2 as O,D as P,C as T,Q as j,R as M,F as N}from"./element-plus.9cae3cb1.js";import{_ as Q}from"./picker.b9386bc9.js";import{P as z}from"./index.b375235f.js";import{r as p}from"./index.7f83e315.js";import"./lodash.fc1b942f.js";import"./dayjs.37feae28.js";import{d as B,s as F,r as b,b as G,_ as C,o as m,c as E,V as u,M as r,u as a,U as H,aa as J,L as K}from"./@vue.96c135a1.js";function W(s){return p.get({url:"/shops.shop_category/lists",params:s})}function X(s){return p.post({url:"/shops.shop_category/add",params:s})}function Y(s){return p.post({url:"/shops.shop_category/edit",params:s})}function pe(s){return p.post({url:"/shops.shop_category/delete",params:s})}function Z(s){return p.get({url:"/shops.shop_category/detail",params:s})}const $={class:"edit-popup"},ee=B({name:"shopCategoryEdit"}),ie=B({...ee,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(s,{expose:V,emit:D}){const _=D,f=F(),d=F(),c=b("add"),g=b([]),v=G(()=>c.value=="edit"?"\u7F16\u8F91\u5546\u57CE\u5206\u7C7B":"\u65B0\u589E\u5546\u57CE\u5206\u7C7B"),t=C({id:"",pid:"",picture:"",name:"",status:"",weigh:""}),w=C({name:[{required:!0,message:"\u8BF7\u8F93\u5165\u540D\u79F0",trigger:["blur"]}],status:[{required:!0,message:"\u8BF7\u9009\u62E9\u72B6\u6001",trigger:["blur"]}],weigh:[{required:!0,message:"\u8BF7\u8F93\u5165\u6743\u91CD",trigger:["blur"]}]}),h=async o=>{for(const e in t)o[e]!=null&&o[e]!=null&&(t[e]=o[e])},k=async o=>{const e=await Z({id:o.id});h(e)},x=async()=>{var e,i;await((e=f.value)==null?void 0:e.validate());const o={...t};c.value=="edit"?await Y(o):await X(o),(i=d.value)==null||i.close(),_("success")},S=(o="add")=>{var e;c.value=o,(e=d.value)==null||e.open()},R=()=>{_("close")};return(async()=>{const o=await W(),e={id:0,name:"\u9876\u7EA7",children:[]};e.children=o.lists,g.value.push(e)})(),V({open:S,setFormData:h,getDetail:k}),(o,e)=>{const i=O,n=P,L=Q,y=T,U=j,I=M,q=N;return m(),E("div",$,[u(z,{ref_key:"popupRef",ref:d,title:a(v),async:!0,width:"550px",onConfirm:x,onClose:R},{default:r(()=>[u(q,{ref_key:"formRef",ref:f,model:a(t),"label-width":"90px",rules:a(w)},{default:r(()=>[u(n,{label:"\u7236\u7EA7ID",prop:"pid"},{default:r(()=>[u(i,{class:"flex-1",modelValue:a(t).pid,"onUpdate:modelValue":e[0]||(e[0]=l=>a(t).pid=l),data:a(g),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}),u(n,{label:"\u5206\u7C7B\u56FE\u7247",prop:"picture"},{default:r(()=>[u(L,{modelValue:a(t).picture,"onUpdate:modelValue":e[1]||(e[1]=l=>a(t).picture=l)},null,8,["modelValue"])]),_:1}),u(n,{label:"\u540D\u79F0",prop:"name"},{default:r(()=>[u(y,{modelValue:a(t).name,"onUpdate:modelValue":e[2]||(e[2]=l=>a(t).name=l),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u540D\u79F0"},null,8,["modelValue"])]),_:1}),u(n,{label:"\u72B6\u6001",prop:"status"},{default:r(()=>[u(I,{class:"flex-1",modelValue:a(t).status,"onUpdate:modelValue":e[3]||(e[3]=l=>a(t).status=l),clearable:"",placeholder:"\u8BF7\u9009\u62E9\u72B6\u6001"},{default:r(()=>[(m(!0),E(H,null,J(s.dictData.show_status,(l,A)=>(m(),K(U,{key:A,label:l.name,value:parseInt(l.value)},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),u(n,{label:"\u6743\u91CD",prop:"weigh"},{default:r(()=>[u(y,{modelValue:a(t).weigh,"onUpdate:modelValue":e[4]||(e[4]=l=>a(t).weigh=l),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u6743\u91CD"},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["title"])])}}});export{ie as _,W as a,pe as b};
