import{u as N}from"./useInstance.233fbdde.js";import{A as S}from"./index.1d26a072.js";import{g as j,h as G,i as P,j as z}from"./index.565ea1db.js";import{b as I,c as M,d as O,e as R}from"./index.ad00c928.js";import{d as T,a6 as $,r as _,b as q,p as D,c as n,e as r,k as E,i as s,h as o,u,A as H,f as J,j as K,F as Q,a2 as W,m as b,E as c}from"./index.0308b213.js";const X=b("\u63D0\u4EA4"),Y=b("\u53D6\u6D88"),ue=T({props:{modelValue:{type:Boolean,default:!1},id:{default:0},areas:{default:[]}},emits:["update:modelValue","onClose"],setup(F,{emit:V}){const v=F,{global:h}=N(),{OpPlatform:i}=$(),f=_(!1),C=_();let e=q({id:0,plate_no:"",agentid:"",status:0});const g=_([]),B=a=>{i.value==="agent"?R(a).then(t=>{e.plate_no=t.data.plate_no,e.agentid=t.data.agentid,e.status=t.data.status,e.sid=t.data.sid,p()}):z(a).then(t=>{e.plate_no=t.data.plate_no,e.agentid=t.data.agentid,e.status=t.data.status,e.sid=t.data.sid,p()})};D(()=>v.modelValue,a=>{f.value=a});const p=()=>{i.value==="agent"?I().then(a=>{g.value=a}):j(e.agentid).then(a=>{g.value=a})},y=()=>{e.id>0?i.value==="agent"?M(e).then(()=>{c({message:"\u4FEE\u6539\u6258\u76D8\u6570\u636E\u6210\u529F",type:"success"}),d()}):G(e).then(()=>{c({message:"\u4FEE\u6539\u6258\u76D8\u6570\u636E\u6210\u529F",type:"success"}),d()}):i.value==="agent"?O(e).then(()=>{c({message:"\u65B0\u589E\u6258\u76D8\u6570\u636E\u6210\u529F",type:"success"}),d()}):P(e).then(()=>{c({message:"\u65B0\u589E\u6258\u76D8\u6570\u636E\u6210\u529F",type:"success"}),d()})};D(()=>v.id,a=>{e.id=a,a?B(a):p()},{immediate:!0});const d=()=>{V("update:modelValue",!1),V("onClose"),h.$resetForm(C.value,e)};return(a,t)=>{const m=n("el-form-item"),k=n("el-option"),w=n("el-select"),x=n("el-input"),U=n("el-switch"),A=n("el-button"),L=n("el-dialog");return r(),E(L,{modelValue:f.value,"onUpdate:modelValue":t[4]||(t[4]=l=>f.value=l),title:F.id?"\u7F16\u8F91\u6258\u76D8":"\u65B0\u589E\u6258\u76D8",width:"50%",onClose:d},{default:s(()=>[o(u(W),{model:u(e),"label-width":"120px"},{default:s(()=>[u(i)==="shangpu"?(r(),E(m,{key:0,class:"tn-el-form-item",label:"\u4EE3\u7406\u533A\u57DF"},{default:s(()=>[o(u(S),{modelValue:u(e).agentid,"onUpdate:modelValue":t[0]||(t[0]=l=>u(e).agentid=l),onChange:p},null,8,["modelValue"])]),_:1})):H("",!0),o(m,{label:"\u5E97\u94FA"},{default:s(()=>[o(w,{modelValue:u(e).sid,"onUpdate:modelValue":t[1]||(t[1]=l=>u(e).sid=l),placeholder:"\u8BF7\u9009\u62E9\u5E97\u94FA",clearable:"",filterable:""},{default:s(()=>[(r(!0),J(Q,null,K(g.value,l=>(r(),E(k,{key:l.id,label:l.title,value:l.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),o(m,{label:"\u6258\u76D8\u53F7"},{default:s(()=>[o(x,{modelValue:u(e).plate_no,"onUpdate:modelValue":t[2]||(t[2]=l=>u(e).plate_no=l),placeholder:"\u8BF7\u8F93\u5165\u6258\u76D8\u53F7"},null,8,["modelValue"])]),_:1}),o(m,{label:"\u72B6\u6001"},{default:s(()=>[o(U,{modelValue:u(e).status,"onUpdate:modelValue":t[3]||(t[3]=l=>u(e).status=l),size:"large",width:60,"inline-prompt":"","active-text":"\u5F00\u542F","inactive-text":"\u5173\u95ED","active-color":"#00C5A1","active-value":1,"inactive-value":0},null,8,["modelValue"])]),_:1}),o(m,null,{default:s(()=>[o(A,{type:"primary",onClick:y},{default:s(()=>[X]),_:1}),o(A,{onClick:d},{default:s(()=>[Y]),_:1})]),_:1})]),_:1},8,["model"])]),_:1},8,["modelValue","title"])}}});export{ue as _};
