import{a0 as R,D as U,C as z,F as I}from"./element-plus.3a5be7a7.js";import{_ as L}from"./picker.1e07f33b.js";import{P}from"./index.164c0d34.js";import{r as i}from"./index.077791ea.js";import"./lodash.60201f64.js";import{d as C,s as g,r as q,b as j,Z as F,o as A,c as N,U as l,L as p,u as a}from"./@vue.18505fe0.js";function O(u){return i.get({url:"/store_category/storecategory/lists",params:u})}function T(u){return i.post({url:"/store_category/storecategory/add",params:u})}function Z(u){return i.post({url:"/store_category/storecategory/edit",params:u})}function $(u){return i.post({url:"/store_category/storecategory/delete",params:u})}function G(u){return i.get({url:"/store_category/storecategory/detail",params:u})}const H={class:"edit-popup"},J=C({name:"storeCategoryEdit"}),ee=C({...J,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(u,{expose:E,emit:V}){const f=V,_=g(),c=g(),m=q("add"),b={value:"id",label:"name",checkStrictly:!0,emitPath:!1,lazy:!0,lazyLoad(o,e){let d=o.value||0;O({pid:d,page_size:1e4}).then(s=>{e(s.lists.map(n=>(n.leaf=n.pid>0,n)))})}},v=j(()=>m.value=="edit"?"\u7F16\u8F91\u5546\u54C1\u5206\u7C7B\u8868":"\u65B0\u589E\u5546\u54C1\u5206\u7C7B\u8868"),t=F({id:"",pid:0,name:"",data:"",pic:"",sort:""}),B=F({name:[{required:!0,message:"\u8BF7\u8F93\u5165\u5206\u7C7B\u540D\u79F0",trigger:["blur"]}]}),y=async o=>{for(const e in t)o[e]!=null&&o[e]!=null&&(t[e]=o[e])},D=async o=>{const e=await G({id:o.id});y(e)},w=async()=>{var e,d;await((e=_.value)==null?void 0:e.validate());let o={...t};m.value=="edit"?await Z(o):await T(o),(d=c.value)==null||d.close(),f("success")},k=(o="add")=>{var e;m.value=o,(e=c.value)==null||e.open()},S=()=>{f("close")};return E({open:k,setFormData:y,getDetail:D}),(o,e)=>{const d=R,s=U,n=z,h=L,x=I;return A(),N("div",H,[l(P,{ref_key:"popupRef",ref:c,title:a(v),async:!0,width:"550px",onConfirm:w,onClose:S},{default:p(()=>[l(x,{ref_key:"formRef",ref:_,model:a(t),"label-width":"90px",rules:a(B)},{default:p(()=>[l(s,{label:"\u6240\u5C5EID",prop:"pid"},{default:p(()=>[l(d,{modelValue:a(t).pid,"onUpdate:modelValue":e[0]||(e[0]=r=>a(t).pid=r),props:b,"show-all-levels":!1,style:{width:"100%"}},null,8,["modelValue"])]),_:1}),l(s,{label:"\u5206\u7C7B\u540D\u79F0",prop:"name"},{default:p(()=>[l(n,{modelValue:a(t).name,"onUpdate:modelValue":e[1]||(e[1]=r=>a(t).name=r),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5206\u7C7B\u540D\u79F0"},null,8,["modelValue"])]),_:1}),l(s,{label:"\u5907\u6CE8\u4FE1\u606F",prop:"data"},{default:p(()=>[l(n,{modelValue:a(t).data,"onUpdate:modelValue":e[2]||(e[2]=r=>a(t).data=r),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5907\u6CE8\u4FE1\u606F"},null,8,["modelValue"])]),_:1}),l(s,{label:"\u56FE\u7247",prop:"pic"},{default:p(()=>[l(h,{modelValue:a(t).pic,"onUpdate:modelValue":e[3]||(e[3]=r=>a(t).pic=r)},null,8,["modelValue"])]),_:1}),l(s,{label:"\u6392\u5E8F",prop:"sort"},{default:p(()=>[l(n,{modelValue:a(t).sort,"onUpdate:modelValue":e[4]||(e[4]=r=>a(t).sort=r),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u6392\u5E8F"},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["title"])])}}});export{ee as _,$ as a,O as b};
