import{_ as L,a5 as $,b as B,r as S,aA as k,o as v,c as f,v as c,x as n,F as C,A as E,O as M,n as h,t as F,J as H,S as J,D as O}from"./index.8d733f79.js";import{h as P}from"./dashboard.62cdb0f4.js";import{u as y}from"./searchStore.0c98fb50.js";const Q={style:{flex:"1",padding:"16px 16px 4px 16px",height:"calc(100% - 40px)"}},R={style:{overflow:"hidden",height:"calc(100% - 6px)",display:"flex","flex-direction":"column"}},U={className:"tableHeader"},V={className:"txt_ellipsis",style:{width:"calc(100% - 256px)"}},j={className:"txt_ellipsis",style:{width:"100px"}},z={className:"txt_ellipsis",style:{width:"156px"}},K=["onClick"],Z=["title"],q={className:"txt_ellipsis",style:{width:"156px"}},G={key:0,class:"noData"},W=$({name:"AlarmTrend"}),X=Object.assign(W,{setup(Y,{expose:b}){const{t:T,locale:ee}=B(),I=e=>H.session.getJSON("enums").alarmLevel.find(s=>+s.key===e).desc,A={11:{label:"\u4E00\u7EA7\u62A5\u8B66",color:"#F5C448"},16:{label:"\u4E8C\u7EA7\u62A5\u8B66",color:"#FF8D1F"},21:{label:"\u4E09\u7EA7\u62A5\u8B66",color:"#8E51DA"},25:{label:"\u56DB\u7EA7\u62A5\u8B66",color:"#D42121"}};let i=null;const _=30;let d=null,t=null;const a=S([]);let p=!1;const{proxy:u}=O();k(()=>{i&&(clearInterval(i),i=null),d&&(clearInterval(d),d=null),t&&(clearInterval(t),t=null)});function g(e){i&&(clearInterval(i),i=null),i=setInterval(()=>{g(e)},10*60*1e3),t&&(clearInterval(t),t=null),document.getElementById("deviceTable_factory")&&(document.getElementById("deviceTable_factory").scrollTop=0),P({factoryId:e}).then(s=>{if(a.value=s.data||[],!s.data||!s.data.length)return;t&&(clearInterval(t),t=null,document.getElementById("deviceTable_factory").scrollTop=0,m("deviceTable_factory",[],"tableList",0));const l=a.value.length;m("deviceTable_factory",a.value,"tableList",l);let r=0;t=setInterval(()=>{p||(r++,r>=_?d||(d=setTimeout(()=>{d=null,r=0,m("deviceTable_factory",a.value,"tableList",l)},1e3)):m("deviceTable_factory",a.value,"tableList",l))},10)}).catch(()=>{})}function m(e,s,l,r){const o=document.getElementById(e);if(!o){clearInterval([`${e}Timer`]);return}if(a.value.length*_<=o.offsetHeight)return;const x=o.scrollHeight-o.offsetHeight;o.scrollTop=Math.ceil(o.scrollTop)+1,Math.ceil(o.scrollTop)-x<=1&&Math.ceil(o.scrollTop-x)>=0&&(s.length<=r*2?a.value=s.concat(s):o.scrollTop-=_*r)}function N(){p=!0}function D(){p=!1}function w(e){u.$router.hasRoute("smartAlarm")?(y().setAiAlarmTab("raw"),y().setJumpAlarmQuery({deviceId:e.deviceId,deviceName:e.deviceName}),u.$router.push("/alarm/process")):u.$router.hasRoute("allStatusAlarm")?(y().setJumpAlarmQuery({status:"raw",deviceId:e.deviceId,deviceName:e.deviceName}),u.$router.push("/alarm/allAlarm")):J.error(T("noZNBJAuth"))}return b({getData:g}),(e,s)=>(v(),f("div",Q,[c("div",R,[c("div",U,[c("div",V,n(e.$t("deviceName")),1),c("div",j,n(e.$t("alarmLevel")),1),c("div",z,n(e.$t("lastAlarmTime")),1)]),c("div",{style:{overflow:"hidden",height:"calc(100% - 34px)"},id:"deviceTable_factory",onMouseover:N,onMouseleave:D},[(v(!0),f(C,null,E(h(a),(l,r)=>(v(),f("div",{style:{display:"flex"},className:"coloumn_td",key:"single_"+r,onClick:o=>w(l)},[c("div",{className:"txt_ellipsis",style:{width:"calc(100% - 256px)"},title:l.deviceName||"-"},n(l.deviceName||"-"),9,Z),c("div",{className:"txt_ellipsis",style:M([{width:"100px"},{color:A[l.level].color}])},n(I(l.level)),5),c("div",q,n(l.lastAlarmTime||"-"),1)],8,K))),128)),!h(a)||!h(a).length?(v(),f("div",G,n(e.$t("noData")),1)):F("",!0)],32)])]))}}),se=L(X,[["__scopeId","data-v-718bcf21"]]);export{se as default};
