import{u as w}from"./useInstance.233fbdde.js";import{g as N,e as P,a as U,d as R}from"./classify.a92ceae9.js";import{d as j,s as I,b as p,r as V,p as M,c as n,e as c,k as B,i as o,h as a,u,f as T,j as $,F as q,a2 as z,m as b,E}from"./index.0308b213.js";const G=b("\u63D0\u4EA4"),H=b("\u53D6\u6D88"),S=j({props:{modelValue:{type:Boolean,default:!1},id:null},emits:["update:modelValue","onClose"],setup(A,{emit:_}){const i=A,{global:F}=w();let h=I(()=>Number(i.id)>0),f=p({list:[]});(()=>{N().then(e=>{console.log("res",e),f.list=e})})();const r=V(!1),g=V(),t=p({id:"",title:"",parent_id:""}),k=()=>{t.id>0?P(t).then(e=>{E({message:"\u7F16\u8F91\u6210\u529F",type:"success"}),d()}):U(t).then(e=>{E({message:"\u65B0\u589E\u6210\u529F",type:"success"}),d()})};M(()=>i.modelValue,e=>{r.value=e,e&&i.id&&(t.id=i.id,y())}),p({list:[]});const y=()=>{R({id:i.id}).then(e=>{e=e.data,t.id=e.id,t.title=e.title,t.parent_id=e.parent_id})},d=()=>{_("update:modelValue",!1),_("onClose"),F.$resetForm(g.value,t)};return(e,s)=>{const v=n("el-input"),m=n("el-form-item"),D=n("el-option"),x=n("el-select"),C=n("el-button"),L=n("el-dialog");return c(),B(L,{modelValue:r.value,"onUpdate:modelValue":s[2]||(s[2]=l=>r.value=l),title:u(h)?"\u67E5\u770B\u5206\u7C7B":"\u65B0\u589E\u5206\u7C7B",width:"70%","destroy-on-close":"",onClose:d},{default:o(()=>[a(u(z),{ref_key:"formRef",ref:g,model:u(t),"inline-message":!0,"label-width":"160px"},{default:o(()=>[a(m,{label:"\u5206\u7C7B\u6807\u9898"},{default:o(()=>[a(v,{modelValue:u(t).title,"onUpdate:modelValue":s[0]||(s[0]=l=>u(t).title=l),placeholder:"\u5206\u7C7B\u6807\u9898"},null,8,["modelValue"])]),_:1}),a(m,{label:"\u4E0A\u7EA7\u5206\u7C7B"},{default:o(()=>[a(x,{modelValue:u(t).parent_id,"onUpdate:modelValue":s[1]||(s[1]=l=>u(t).parent_id=l),placeholder:"\u8BF7\u9009\u62E9\u4E0A\u7EA7\u5206\u7C7B"},{default:o(()=>[(c(!0),T(q,null,$(u(f).list,l=>(c(),B(D,{key:l.id,label:l.title,value:l.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),a(m,null,{default:o(()=>[a(C,{type:"primary",onClick:k},{default:o(()=>[G]),_:1}),a(C,{onClick:d},{default:o(()=>[H]),_:1})]),_:1})]),_:1},8,["model"])]),_:1},8,["modelValue","title"])}}});export{S as _};
