import{u as q}from"./useInstance.233fbdde.js";import{g as z,b as H,a as J,c as K,e as Q,d as W,f as X}from"./index.6dd89ec0.js";import{a as Y,b as Z,c as ee}from"./index.1fb8c4e1.js";import{d as te,a6 as le,s as oe,b as n,r as j,p as D,c as p,e as d,k as r,i as s,h as u,u as a,A as g,f as C,j as x,m as i,t as S,F as U,a2 as se,E as b}from"./index.0308b213.js";const ae=i("\u6307\u5B9A\u5546\u6237"),ue=i("\u6839\u636E\u4EE3\u7406"),de=i("\u6839\u636E\u5546\u5708"),ie=i("\u5F00\u542F"),ne=i("\u5173\u95ED"),re=i("\u63D0\u4EA4"),pe=i("\u53D6\u6D88"),ge=te({props:{modelValue:{type:Boolean,default:!1},id:null},emits:["update:modelValue","onClose"],setup(G,{emit:L}){const _=G,{OpPlatform:v}=le(),{global:I}=q();let M=oe(()=>Number(_.id)>0);n({list:[]});let y=n({list:[]});const V=j(!1),w=j(),e=n({id:"",add_type:1,agentid:"",sid:"",is_open:1}),E=n({list:[]}),A=n({list:[]}),h=n({list:[]}),F=n({list:[]});D(()=>e.add_type,t=>{t==1&&E.list.length==0&&z().then(l=>{console.log("res",l),e.sid=[],E.list=l,F.list=l}),t==2&&A.list.length==0&&H().then(l=>{console.log("res",l),e.sid=[],A.list=l,F.list=l}),t==3&&h.list.length==0&&J().then(l=>{console.log("res",l),e.sid=[],h.list=l,F.list=l})},{immediate:!0});const O=()=>{v.value=="shangpu"?e.id>0?Q(e).then(t=>{b({message:"\u7F16\u8F91\u6210\u529F",type:"success"}),m()}):W(e).then(t=>{b({message:"\u65B0\u589E\u6210\u529F",type:"success"}),m()}):e.id>0?Y(e).then(t=>{b({message:"\u7F16\u8F91\u6210\u529F",type:"success"}),m()}):Z(e).then(t=>{b({message:"\u65B0\u589E\u6210\u529F",type:"success"}),m()})};D(()=>_.modelValue,t=>{V.value=t,t&&_.id&&(e.id=_.id,T())});const N=()=>{v.value=="shangpu"?X({agentid:e.agentid}).then(t=>{y.list=t}):ee({}).then(t=>{y.list=t})};N(),D(()=>e.agentid,t=>{t&&(t!=e.agentid&&(e.sid=""),y.list=[],N())},{immediate:!0}),n({list:[]});const T=()=>{K({id:_.id}).then(t=>{t=t.data,e.agentid=t.agentid,e.sid=t.sid,e.is_open=t.is_open,e.add_type=1})},m=()=>{L("update:modelValue",!1),L("onClose"),I.$resetForm(w.value,e)};return(t,l)=>{const c=p("el-radio"),P=p("el-radio-group"),f=p("el-form-item"),k=p("el-checkbox"),B=p("el-checkbox-group"),R=p("el-button"),$=p("el-dialog");return d(),r($,{modelValue:V.value,"onUpdate:modelValue":l[5]||(l[5]=o=>V.value=o),title:a(M)?"\u67E5\u770B\u8BBE\u7F6E":"\u65B0\u589E\u8BBE\u7F6E",width:"70%","destroy-on-close":"",onClose:m},{default:s(()=>[u(a(se),{ref_key:"formRef",ref:w,model:a(e),"inline-message":!0,"label-width":"160px"},{default:s(()=>[_.id?g("",!0):(d(),r(f,{key:0,label:"\u6DFB\u52A0\u65B9\u5F0F"},{default:s(()=>[u(P,{modelValue:a(e).add_type,"onUpdate:modelValue":l[0]||(l[0]=o=>a(e).add_type=o)},{default:s(()=>[u(c,{label:1},{default:s(()=>[ae]),_:1}),u(c,{label:2},{default:s(()=>[ue]),_:1}),u(c,{label:3},{default:s(()=>[de]),_:1})]),_:1},8,["modelValue"])]),_:1})),a(e).add_type==1?(d(),r(f,{key:1,label:"\u9009\u62E9\u5546\u6237"},{default:s(()=>[u(B,{modelValue:a(e).sid,"onUpdate:modelValue":l[1]||(l[1]=o=>a(e).sid=o)},{default:s(()=>[(d(!0),C(U,null,x(a(E).list,o=>(d(),r(k,{key:o.id,label:o.id},{default:s(()=>[i(S(o.title),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])]),_:1})):g("",!0),a(e).add_type==2?(d(),r(f,{key:2,label:"\u9009\u62E9\u5546\u6237"},{default:s(()=>[u(B,{modelValue:a(e).sid,"onUpdate:modelValue":l[2]||(l[2]=o=>a(e).sid=o)},{default:s(()=>[(d(!0),C(U,null,x(a(A).list,o=>(d(),r(k,{key:o.id,label:o.id},{default:s(()=>[i(S(o.title),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])]),_:1})):g("",!0),a(e).add_type==3?(d(),r(f,{key:3,label:"\u9009\u62E9\u5546\u6237"},{default:s(()=>[u(B,{modelValue:a(e).sid,"onUpdate:modelValue":l[3]||(l[3]=o=>a(e).sid=o)},{default:s(()=>[(d(!0),C(U,null,x(a(h).list,o=>(d(),r(k,{key:o.id,label:o.id},{default:s(()=>[i(S(o.title),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])]),_:1})):g("",!0),u(f,{label:"\u5F00\u5173"},{default:s(()=>[u(P,{modelValue:a(e).is_open,"onUpdate:modelValue":l[4]||(l[4]=o=>a(e).is_open=o)},{default:s(()=>[u(c,{label:1},{default:s(()=>[ie]),_:1}),u(c,{label:0},{default:s(()=>[ne]),_:1})]),_:1},8,["modelValue"])]),_:1}),u(f,null,{default:s(()=>[u(R,{type:"primary",onClick:O},{default:s(()=>[re]),_:1}),u(R,{onClick:m},{default:s(()=>[pe]),_:1})]),_:1})]),_:1},8,["model"])]),_:1},8,["modelValue","title"])}}});export{ge as _};
