import{u as v}from"./useInstance.233fbdde.js";import{A as k}from"./index.1d26a072.js";import{az as i,aa as m,d as U,a6 as $,r as b,b as N,p as B,c as g,e as D,k as E,i as n,h as u,u as l,A as q,a2 as L,m as V,E as c}from"./index.0308b213.js";const K=e=>i.get("addon/mealbox.meal_area/list",{params:e}),P=e=>i.get(`addon/mealbox.meal_area/detail?id=${e}`),z=e=>i.post("addon/mealbox.meal_area/add",e),I=e=>i.post("addon/mealbox.meal_area/edit",e),Q=e=>i.post("addon/mealbox.meal_area/delete",{id:e}),W=e=>m.get("agent/plugin.mealbox.meal_area/list",{params:e}),O=e=>m.get(`agent/plugin.mealbox.meal_area/detail?id=${e}`),R=e=>m.post("agent/plugin.mealbox.meal_area/add",e),S=e=>m.post("agent/plugin.mealbox.meal_area/edit",e),X=e=>m.post("agent/plugin.mealbox.meal_area/delete",{id:e}),T=V("\u63D0\u4EA4"),j=V("\u53D6\u6D88"),Y=U({props:{modelValue:{type:Boolean,default:!1},id:{default:0}},emits:["update:modelValue","onClose"],setup(e,{emit:f}){const _=e,{global:h}=v(),{OpPlatform:p}=$(),A=b(!1),M=b();let a=N({id:0,name:"",agentid:"",weigh:0});const w=o=>{p.value==="agent"?O(o).then(t=>{a.name=t.data.name,a.agentid=t.data.agentid,a.weigh=t.data.weigh}):P(o).then(t=>{a.name=t.data.name,a.agentid=t.data.agentid,a.weigh=t.data.weigh})};B(()=>_.modelValue,o=>{A.value=o});const y=()=>{a.id>0?p.value==="agent"?S(a).then(()=>{c({message:"\u4FEE\u6539\u533A\u57DF\u6570\u636E\u6210\u529F",type:"success"}),d()}):I(a).then(()=>{c({message:"\u4FEE\u6539\u533A\u57DF\u6570\u636E\u6210\u529F",type:"success"}),d()}):p.value==="agent"?R(a).then(()=>{c({message:"\u65B0\u589E\u533A\u57DF\u6570\u636E\u6210\u529F",type:"success"}),d()}):z(a).then(()=>{c({message:"\u65B0\u589E\u533A\u57DF\u6570\u636E\u6210\u529F",type:"success"}),d()})};B(()=>_.id,o=>{a.id=o,o&&w(o)},{immediate:!0});const d=()=>{f("update:modelValue",!1),f("onClose"),h.$resetForm(M.value,a)};return(o,t)=>{const r=g("el-form-item"),F=g("el-input"),x=g("el-button"),C=g("el-dialog");return D(),E(C,{modelValue:A.value,"onUpdate:modelValue":t[3]||(t[3]=s=>A.value=s),title:e.id?"\u7F16\u8F91\u533A\u57DF":"\u65B0\u589E\u533A\u57DF",width:"50%",onClose:d},{default:n(()=>[u(l(L),{model:l(a),"label-width":"120px"},{default:n(()=>[l(p)==="shangpu"?(D(),E(r,{key:0,class:"tn-el-form-item",label:"\u4EE3\u7406\u533A\u57DF"},{default:n(()=>[u(l(k),{modelValue:l(a).agentid,"onUpdate:modelValue":t[0]||(t[0]=s=>l(a).agentid=s)},null,8,["modelValue"])]),_:1})):q("",!0),u(r,{label:"\u533A\u57DF\u540D\u79F0"},{default:n(()=>[u(F,{modelValue:l(a).name,"onUpdate:modelValue":t[1]||(t[1]=s=>l(a).name=s),placeholder:"\u8BF7\u8F93\u5165\u533A\u57DF\u540D\u79F0"},null,8,["modelValue"])]),_:1}),u(r,{label:"\u6392\u5E8F"},{default:n(()=>[u(F,{modelValue:l(a).weigh,"onUpdate:modelValue":t[2]||(t[2]=s=>l(a).weigh=s),placeholder:"\u8BF7\u8F93\u5165\u6392\u5E8F"},null,8,["modelValue"])]),_:1}),u(r,null,{default:n(()=>[u(x,{type:"primary",onClick:y},{default:n(()=>[T]),_:1}),u(x,{onClick:d},{default:n(()=>[j]),_:1})]),_:1})]),_:1},8,["model"])]),_:1},8,["modelValue","title"])}}});export{Y as _,K as a,Q as b,X as d,W as g};
