import{u as k}from"./useInstance.233fbdde.js";import{e as y,a as U,g as L,b as N}from"./index.76faad0e.js";import{b as P}from"./index.ad00c928.js";import{d as S,a6 as z,r as p,b as G,p as v,c as n,e as I,k as M,i as o,h as l,u,a2 as O,m as D,E as F}from"./index.0308b213.js";const R=D("\u63D0\u4EA4"),T=D("\u53D6\u6D88"),J=S({props:{modelValue:{type:Boolean,default:!1},id:{default:0},areas:{default:[]}},emits:["update:modelValue","onClose"],setup(c,{emit:r}){const f=c,{global:h}=k(),{OpPlatform:b}=z(),d=p(!1),A=p();let e=G({id:0,plate_no:"",agentid:"",status:1});const _=p([]),C=t=>{L(t).then(a=>{e.plate_no=a.data.plate_no,e.agentid=a.data.agentid,e.status=a.data.status,e.sid=a.data.sid,g()})};v(()=>f.modelValue,t=>{d.value=t});const g=()=>{b.value==="agent"?P().then(t=>{_.value=t}):N(e.agentid).then(t=>{_.value=t})},E=()=>{e.id>0?y(e).then(()=>{F({message:"\u4FEE\u6539\u6258\u76D8\u6570\u636E\u6210\u529F",type:"success"}),i()}):U(e).then(()=>{F({message:"\u65B0\u589E\u6258\u76D8\u6570\u636E\u6210\u529F",type:"success"}),i()})};v(()=>f.id,t=>{e.id=t,t?C(t):g()},{immediate:!0});const i=()=>{r("update:modelValue",!1),r("onClose"),h.$resetForm(A.value,e)};return(t,a)=>{const w=n("el-input"),m=n("el-form-item"),x=n("el-switch"),V=n("el-button"),B=n("el-dialog");return I(),M(B,{modelValue:d.value,"onUpdate:modelValue":a[2]||(a[2]=s=>d.value=s),title:c.id?"\u7F16\u8F91\u6258\u76D8":"\u65B0\u589E\u6258\u76D8",width:"50%",onClose:i},{default:o(()=>[l(u(O),{model:u(e),"label-width":"120px"},{default:o(()=>[l(m,{label:"\u6258\u76D8\u53F7"},{default:o(()=>[l(w,{modelValue:u(e).plate_no,"onUpdate:modelValue":a[0]||(a[0]=s=>u(e).plate_no=s),placeholder:"\u8BF7\u8F93\u5165\u6258\u76D8\u53F7"},null,8,["modelValue"])]),_:1}),l(m,{label:"\u72B6\u6001"},{default:o(()=>[l(x,{modelValue:u(e).status,"onUpdate:modelValue":a[1]||(a[1]=s=>u(e).status=s),size:"large",width:60,"inline-prompt":"","active-text":"\u7A7A\u95F2","inactive-text":"\u4F7F\u7528","active-color":"#00C5A1","active-value":1,"inactive-value":0},null,8,["modelValue"])]),_:1}),l(m,null,{default:o(()=>[l(V,{type:"primary",onClick:E},{default:o(()=>[R]),_:1}),l(V,{onClick:i},{default:o(()=>[T]),_:1})]),_:1})]),_:1},8,["model"])]),_:1},8,["modelValue","title"])}}});export{J as _};
