import{I as w,r as I,a5 as q,av as B,aw as F,l as J,F as P,W as R}from"./index.17037962789732.js";import"./index.170379627897337.js";import"./index.170379627897315.js";import"./index.170379627897318.js";import"./index.170379627897319.js";import"./index.1703796278973302.js";import"./index.170379627897327.js";import"./index.170379627897316.js";import"./index.170379627897317.js";import"./index.170379627897314.js";import{a as U,b as A,s as D}from"./notificationSubscription.1703796278973.js";import"./default.1703796278973.js";import"./index.1703796278973299.js";import{d as E,k as s,o as M,c as O,a as i,b as o,u as a}from"./vue.1703796278973.js";import{aN as S}from"./index.17037962789733.js";const te=E({__name:"EditDialog",props:{visible:{type:Boolean},data:null},emits:["ok","update:visible"],setup(b,{emit:u}){const _=b,m=s(!1),C={subscribeName:"",topicConfig:{},notice:[1]},p=s(),t=s({...C,..._.data}),j=()=>{p.value&&p.value.validate().then(()=>{m.value=!0,D(t.value).then(l=>{l.status===200&&(S.success("操作成功"),u("ok"),u("update:visible",!1))}).finally(()=>m.value=!1)})},f=s([]),d=s([]);k();function k(){U().then(l=>{l.status===200&&(f.value=l.result.map(e=>({label:e.name,value:e.id})).filter(e=>e.value==="alarm"))}),A().then(l=>{l.status===200&&(d.value=l.result.map(e=>({label:e.name,value:e.id})))})}function x(l,e){t.value.topicConfig={alarmConfigId:l.join(","),alarmConfigName:e.map(c=>c.label).join(",")}}return(l,e)=>{const c=w,r=I,v=q,g=B,L=F,N=J,y=P,h=R;return M(),O(h,{visible:"",title:_.data.id?"编辑":"新增",width:"865px",confirmLoading:a(m),onOk:j,onCancel:e[3]||(e[3]=n=>u("update:visible",!1))},{default:i(()=>[o(y,{model:a(t),layout:"vertical",ref_key:"formRef",ref:p},{default:i(()=>[o(r,{label:"名称",name:"subscribeName",rules:[{required:!0,message:"请输入名称"},{max:64,message:"最多可输入64个字符"}]},{default:i(()=>[o(c,{value:a(t).subscribeName,"onUpdate:value":e[0]||(e[0]=n=>a(t).subscribeName=n),placeholder:"请输入名称"},null,8,["value"])]),_:1}),o(L,{gutter:24},{default:i(()=>[o(g,{span:12},{default:i(()=>[o(r,{label:"类型",name:"topicProvider",rules:[{required:!0,message:"请选择类型"}]},{default:i(()=>[o(v,{value:a(t).topicProvider,"onUpdate:value":e[1]||(e[1]=n=>a(t).topicProvider=n),placeholder:"请选择类型",options:a(f)},null,8,["value","options"])]),_:1})]),_:1}),o(g,{span:12},{default:i(()=>[o(r,{label:"告警规则",name:["topicConfig","alarmConfigId"],rules:[{required:!0,message:"请选择告警规则"}]},{default:i(()=>{var n;return[o(v,{value:(n=a(t).topicConfig.alarmConfigId)==null?void 0:n.split(","),options:a(d),placeholder:"请选择告警规则",mode:"multiple",onChange:x},null,8,["value","options"])]}),_:1})]),_:1})]),_:1}),o(r,{name:"notice",label:"通知方式",rules:[{required:!0,message:"请选择通知方式"}]},{default:i(()=>[o(N,{value:a(t).notice,"onUpdate:value":e[2]||(e[2]=n=>a(t).notice=n),name:"checkboxgroup",options:[{label:"站内通知",value:1}]},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1},8,["title","confirmLoading"])}}});export{te as _};
