import{u as k}from"./useInstance.233fbdde.js";import{az as r,d as q,a6 as E,s as v,r as y,b as x,p as B,c as m,e as S,k as w,i as a,h as l,u,a2 as P,m as C,E as F}from"./index.0308b213.js";const L=e=>r.request({url:"addon/store_category.store_category_template/list",params:e}),M=e=>r.request({url:"addon/store_category.store_category_template/delete",method:"POST",data:e}),N=e=>r.request({url:"addon/store_category.store_category_template/detail",params:e}),O=e=>r.request({url:"addon/store_category.store_category_template/edit",method:"POST",data:e}),G=e=>r.request({url:"addon/store_category.store_category_template/add",method:"POST",data:e}),R=C("\u63D0\u4EA4"),U=C("\u53D6\u6D88"),$=q({props:{modelValue:{type:Boolean,default:!1},id:{default:0}},emits:["update:modelValue","onClose"],setup(e,{emit:p}){const s=e;E();const{global:A}=k();let V=v(()=>Number(s.id)>0);const i=y(!1),_=y(),t=x({id:"",name:""}),h=()=>{t.id>0?O(t).then(o=>{F({message:"\u7F16\u8F91\u6A21\u677F\u6210\u529F",type:"success"}),n()}):G(t).then(o=>{F({message:"\u65B0\u589E\u6A21\u677F\u6210\u529F",type:"success"}),n()})};B(()=>s.modelValue,o=>{i.value=o,o&&s.id&&(t.id=s.id,D())});const D=()=>{N({id:s.id}).then(o=>{t.name=o.name||""})},n=()=>{p("update:modelValue",!1),p("onClose"),A.$resetForm(_.value,t)};return(o,d)=>{const T=m("el-input"),f=m("el-form-item"),g=m("el-button"),b=m("el-dialog");return S(),w(b,{modelValue:i.value,"onUpdate:modelValue":d[1]||(d[1]=c=>i.value=c),title:u(V)?"\u7F16\u8F91\u6A21\u677F":"\u6DFB\u52A0\u6A21\u677F",width:"50%","destroy-on-close":"",onClose:n},{default:a(()=>[l(u(P),{ref_key:"formRef",ref:_,model:u(t),"inline-message":!0,"label-width":"160px"},{default:a(()=>[l(f,{label:"\u6A21\u677F\u540D\u79F0"},{default:a(()=>[l(T,{modelValue:u(t).name,"onUpdate:modelValue":d[0]||(d[0]=c=>u(t).name=c)},null,8,["modelValue"])]),_:1}),l(f,null,{default:a(()=>[l(g,{type:"primary",onClick:h},{default:a(()=>[R]),_:1}),l(g,{onClick:n},{default:a(()=>[U]),_:1})]),_:1})]),_:1},8,["model"])]),_:1},8,["modelValue","title"])}}});export{$ as _,M as d,L as g};
