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