import{L as T,ax as L,W as S}from"./index.17037962789732.js";import"./index.170379627897337.js";import"./index.170379627897315.js";import"./index.1703796278973300.js";import"./index.170379627897317.js";import"./index.1703796278973301.js";import"./index.1703796278973302.js";import"./index.170379627897332.js";import"./index.1703796278973303.js";import"./index.170379627897339.js";import"./index.170379627897316.js";import"./index.170379627897314.js";import"./index.1703796278973304.js";import"./index.1703796278973305.js";import"./index.1703796278973306.js";import"./index.170379627897333.js";import{a as A}from"./scene.17037962789732.js";import{g as B,a as C}from"./dashboard.1703796278973.js";import{d as h,k as u,m as k,p as I,o as q,c as J,a as r,z as N,A as i,u as l,b as c,t as f}from"./vue.1703796278973.js";const P={style:{"margin-bottom":"24px"}},Z=h({__name:"index",props:{id:{type:String,default:""}},emits:["close"],setup(n,{emit:m}){const v=n,d=u(0),p=u([]),x={product:"产品",device:"设备",org:"组织",other:"其他"},g=[{dataIndex:"name",fixed:"left",ellipsis:!0,title:"名称"},{dataIndex:"targetType",title:"类型",scopedSlots:!0},{dataIndex:"level",title:"告警级别",scopedSlots:!0},{dataIndex:"state",title:"状态",scopedSlots:!0},{dataIndex:"description",title:"说明",ellipsis:!0}];return k(()=>v.id,a=>{a&&B({terms:[{column:"id$rule-bind-alarm",value:a}]}).then(t=>{t.status===200&&(d.value=t.result||0)})},{immediate:!0}),I(()=>{C().then(a=>{var t;a.status===200&&(p.value=((t=a.result)==null?void 0:t.levels)||[])})}),(a,t)=>{const _=T,b=L,y=S;return q(),J(y,{width:1e3,onCancel:t[0]||(t[0]=e=>m("close")),onOk:t[1]||(t[1]=e=>m("close")),visible:"",title:"关联此场景的告警"},{default:r(()=>[N("div",P,"关联告警数量："+i(l(d)),1),c(b,{columns:g,request:l(A),model:"TABLE",bodyStyle:{padding:0},defaultParams:{sorts:[{name:"createTime",order:"desc"}],terms:[{terms:[{column:"id",value:n.id,termType:"rule-bind-alarm"}]}]}},{level:r(e=>{var o;return[f(i(((o=l(p).find(s=>e.level===s.level))==null?void 0:o.title)||""),1)]}),targetType:r(e=>[f(i(x[e.targetType]),1)]),state:r(e=>{var o,s;return[c(_,{text:(o=e.state)==null?void 0:o.text,status:((s=e.state)==null?void 0:s.value)==="disabled"?"error":"success"},null,8,["text","status"])]}),_:1},8,["request","defaultParams"])]),_:1})}}});export{Z as _};
