import{_ as a}from"./index105.js?v=1761009159";import{u as t,V as e,p as s,P as l,M as o,l as n,j as c,_ as i}from"./utils-lib.js?v=1761009159";import{_ as r}from"./index.vue_vue_type_script_setup_true_lang5.js?v=1761009159";import{_ as d}from"./index114.js?v=1761009159";import{c as p,r as u,o as m,e as _,aD as g,aS as f,C as v,q as b,H as y,v as x,x as w,B as h,I as j,y as k,Q as D,z as C,F as z,b0 as M,A as q,K as H,D as O,G as V}from"./base-lib.js?v=1761009159";import{u as S}from"./column.js?v=1761009159";import{an as T,ao as U,ap as I}from"./config.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";import"./index106.js?v=1761009159";const J={class:"p-[2rem]"},L={class:"p-[2rem]"},N={class:"item"},R={key:0,class:"border border-light rounded-base max-h-[20rem] overflow-y-auto"},A={key:0,class:"w-[50%]"},B={key:1,class:"w-[50%]"},F={class:"w-[50%] truncate"},G={key:1,class:"box"},K={class:"item"},P=["innerHTML"],Q=i(p({__name:"record",props:{compData:{default:()=>{}}},setup(i){const p=i,{push:Q}=t(),E=u({}),W=u(!1),X=u([]),Y=u(!1),Z=u([]),$=m({page:1,size:10,total:0}),aa=async a=>{try{await s({title:"清空记录【".concat(p.compData.title,"】"),content:"您真的要清空【".concat(p.compData.title,"】的所有告警记录吗？")}),await l({loading:"正在清空记录，请稍后...",request:T({task_id:p.compData.id,record_ids:JSON.stringify([a.id])}),message:!0}),ta()}catch(t){}},ta=async()=>{try{await l({loading:Y,request:I({task_id:p.compData.id,page:$.page,size:$.size}),success:({data:a})=>{Z.value=a.data.list,$.total=a.data.count}})}catch(a){}},ea=[{label:"发送时间",render:a=>_("span",null,[e(a.create_time)])},{label:"发送状态",render:a=>{let t=a.result.stop_msg;if(a.do_send){const e=Object.values(a.result.send_data).reduce((a,t)=>("number"==typeof t&&1===t?a.success++:"string"==typeof t&&a.fail++,a),{success:0,fail:0});t="发送成功"+e.success+"次，发送失败"+e.fail+"次"}return g(f,{popperClass:"softTooltip",effect:"light",enterable:!1,placement:"top-end",content:t},()=>g("span",{class:a.do_send?"text-primary":"text-danger"},a.do_send?"已发送":"未发送"))}},{label:"告警详情",render:a=>_("span",{class:"bt-link",onClick:()=>(a=>{E.value=a;let t=o.load("正在获取告警详情，请稍后...");try{const t=new Map([["wx_account","微信公众号"],["feishu","飞书"],["mail","邮箱"],["sms","短信通知"],["dingding","钉钉"],["weixin","企业微信"],["webhook","自定义消息通道"]]),e=Object.entries(a.result.send_data).map(a=>{const e=a.at(0),s=Q.value.config.find(a=>a.id===e);return{result:1===a.at(1),resultMsg:1===a.at(1)?"发送成功":a.at(1),accounts:{title:t.get(null==s?void 0:s.sender_type)||"",account:null==s?void 0:s.data.title}}});X.value=e,W.value=!0}catch(e){}finally{t.close()}})(a)},[v("点击查看")])},S([{onClick:async a=>{try{await s({title:"删除记录",content:"您真的要删除这条告警记录吗？"}),await l({loading:"正在删除记录，请稍后...",request:U({task_id:p.compData.id,record_ids:JSON.stringify([a.id])}),message:!0}),ta()}catch(t){}},title:"删除"}])];return b(()=>ta()),(t,e)=>{const s=V,l=n,o=d,i=r,p=c,u=a,m=y("bt-loading");return x(),w("div",J,[_(u,null,{"header-left":h(()=>[_(s,{onClick:aa},{default:h(()=>e[3]||(e[3]=[v("清空记录",-1)])),_:1,__:[3]})]),content:h(()=>[j(_(l,{ref:"alarmRecordRef",column:ea,data:k(Z),description:"记录为空","max-height":"42rem"},null,8,["data"]),[[m,k(Y)],[m,"正在获取告警记录，请稍候...","title"]])]),"footer-right":h(()=>[_(o,{total:k($).total,page:k($).page,"onUpdate:page":e[0]||(e[0]=a=>k($).page=a),row:k($).size,"onUpdate:row":e[1]||(e[1]=a=>k($).size=a),onChange:ta},null,8,["total","page","row"])]),popup:h(()=>[_(p,{modelValue:k(W),"onUpdate:modelValue":e[2]||(e[2]=a=>D(W)?W.value=a:null),area:48,title:"告警详情"},{default:h(()=>[C("div",L,[C("div",N,[e[5]||(e[5]=C("div",{class:"title"},"发送情况",-1)),k(X).length>0?(x(),w("div",R,[e[4]||(e[4]=C("div",{class:"table-box"},[C("span",{class:"w-[50%]"},"发送账号"),C("span",{class:"w-[50%]"},"发送结果")],-1)),(x(!0),w(z,null,M(k(X),(a,t)=>(x(),w("div",{class:"table-box",key:t},[a.accounts.account&&a.accounts.title?(x(),w("span",A,q("".concat(a.accounts.account,"(").concat(a.accounts.title,")")),1)):(x(),w("span",B,q("".concat(a.accounts.title)),1)),C("span",F,[_(i,{popperClass:"w-[400px]",placement:"left",class:H(a.result?"text-primary":"text-danger"),text:a.resultMsg},null,8,["class","text"])])]))),128))])):O("",!0),0==k(X).length?(x(),w("div",G,q(k(E).result.stop_msg),1)):O("",!0)]),C("div",K,[e[6]||(e[6]=C("div",{class:"title"},"告警信息",-1)),C("div",{class:"box",innerHTML:k(E).send_data.msg_list.join("<br>")},null,8,P)])])]),_:1},8,["modelValue"])]),_:1})])}}}),[["__scopeId","data-v-14c26f62"]]);export{Q as default};
