import{u as w}from"./useInstance.233fbdde.js";import{M}from"./index.dfdc0704.js";import{g as N,e as h,a as R}from"./store_category.63a78f28.js";import{d as S,a6 as j,s as I,r as C,b as L,p as P,c as n,e as p,k as g,i as a,h as t,u,f as T,j as $,m as f,t as q,F as z,a2 as G,E as F}from"./index.0308b213.js";const H=f("\u63D0\u4EA4"),J=f("\u53D6\u6D88"),X=S({props:{modelValue:{type:Boolean,default:!1},id:{default:0},templates:{default:[]}},emits:["update:modelValue","onClose"],setup(b,{emit:c}){const d=b;j();const{global:B}=w();let E=I(()=>Number(d.id)>0);const r=C(!1),_=C(),e=L({id:"",title:"",icon:"",sid:"",template_id:"",displayorder:0,goods:[],type:"parent"}),D=()=>{e.id>0?h(e).then(o=>{F({message:"\u7F16\u8F91\u5206\u7C7B\u6210\u529F",type:"success"}),m()}):R(e).then(o=>{F({message:"\u65B0\u589E\u5206\u7C7B\u6210\u529F",type:"success"}),m()})};P(()=>d.modelValue,o=>{r.value=o,o&&d.id&&(e.id=d.id,k())});const k=()=>{N({id:d.id}).then(o=>{e.title=o.title||"",e.icon=o.icon||"",e.sid=o.sid||"",e.template_id=o.template_id||"",e.displayorder=o.displayorder||0})},m=()=>{c("update:modelValue",!1),c("onClose"),B.$resetForm(_.value,e)};return(o,s)=>{const v=n("el-option"),A=n("el-select"),i=n("el-form-item"),V=n("el-input"),y=n("el-button"),x=n("el-dialog");return p(),g(x,{modelValue:r.value,"onUpdate:modelValue":s[4]||(s[4]=l=>r.value=l),title:u(E)?"\u7F16\u8F91\u5206\u7C7B":"\u6DFB\u52A0\u5206\u7C7B",width:"70%","destroy-on-close":"",onClose:m},{default:a(()=>[t(u(G),{ref_key:"formRef",ref:_,model:u(e),"inline-message":!0,"label-width":"160px"},{default:a(()=>[t(i,{label:"\u9009\u62E9\u6A21\u677F"},{default:a(()=>[t(A,{modelValue:u(e).template_id,"onUpdate:modelValue":s[0]||(s[0]=l=>u(e).template_id=l),placeholder:"\u8BF7\u9009\u62E9"},{default:a(()=>[(p(!0),T(z,null,$(d.templates,(l,U)=>(p(),g(v,{key:U,label:l.name,value:l.id},{default:a(()=>[f(q(l.name),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),t(i,{label:"\u5206\u7C7B\u6807\u9898"},{default:a(()=>[t(V,{modelValue:u(e).title,"onUpdate:modelValue":s[1]||(s[1]=l=>u(e).title=l)},null,8,["modelValue"])]),_:1}),t(i,{label:"\u5206\u7C7B\u56FE\u6807"},{default:a(()=>[t(M,{modelValue:u(e).icon,"onUpdate:modelValue":s[2]||(s[2]=l=>u(e).icon=l),limit:1},null,8,["modelValue"])]),_:1}),t(i,{label:"\u5206\u7C7B\u6392\u5E8F"},{default:a(()=>[t(V,{modelValue:u(e).displayorder,"onUpdate:modelValue":s[3]||(s[3]=l=>u(e).displayorder=l),type:"number"},null,8,["modelValue"])]),_:1}),t(i,null,{default:a(()=>[t(y,{type:"primary",onClick:D},{default:a(()=>[H]),_:1}),t(y,{onClick:m},{default:a(()=>[J]),_:1})]),_:1})]),_:1},8,["model"])]),_:1},8,["modelValue","title"])}}});export{X as _};
