import{_ as O,b as K,r as $,J as N,$ as z,o as m,c as _,v as p,p as i,q as d,F as A,A as S,n as M,P as C,x as u,t as k,y as I,O as v,C as G,cG as H,cH as j,bM as E,S as Q,ak as W,cp as X,l as Y,cq as Z,br as ee,D as te}from"./index.8d733f79.js";import{E as ae}from"./el-input-number.60463ef8.js";import{g as re}from"./setValue.1d09ba51.js";import le from"./chartChangeRateOrTrend.099c4326.js";import"./index.28f6da25.js";import"./el-date-picker-panel.089dbe6d.js";import"./panel-time-pick.b2dd8e75.js";import"./deviceAnalysis.ce7ce4e7.js";const ne={style:{height:"100%"}},oe={class:"sub-title",style:{"margin-bottom":"13px"}},se={key:0},ie={key:0},de={style:{display:"inline-block",width:"16px","vertical-align":"middle"}},ce={__name:"trendAlarm",setup(ue,{expose:L}){const{proxy:w}=te(),{t:D}=K(),P=$("trend"),h=$([]),T={alarmMetrics:N.session.getJSON("enums").alarmMetric,diagnoseMetrics:N.session.getJSON("enums").diagnoseMetric},x=$(),U=(e,a)=>{var l;return((l=e.find(f=>f.diagnoseMetric===a))==null?void 0:l.tableData)||[]},F=e=>{var a;return(a=T.alarmMetrics.find(l=>l.key===e))==null?void 0:a.desc},R=e=>{var a;return(a=T.diagnoseMetrics.find(l=>l.key===e))==null?void 0:a.desc},B=e=>!e.fourValue&&!e.threeValue&&!e.twoValue&&!e.oneValue,g=$(),q=({row:e})=>{const a={};return a.backgroundColor=e.id===g.value?"#003166":"",a},y=(e,a)=>{const l={},f=a?e[a]&&e.isAlarm:e.isAlarm;return l.color=f?"#FF2D2D":"",l},J=e=>{w.$refs.chartTrendRef.showModal(e,"trendAlarm")};return L({getPointAlarmConfig:(e,a)=>{g.value=a,h.value=[],x.value=e.pointType;const l=E().pushThresholdList.find(o=>o.key===`${e.pointId}_trendAlarm`);if(l){h.value=l.data;return}const f={pointId:e.pointId,alarmType:P.value,querySource:"message_inhibition"};re(f).then(o=>{if(!o.data.length){h.value=[],Q.error(D("noData"));return}const n=o.data,c=[];for(let r=0;r<n.length;r++)if(c.length===0)c.push({alarmMetric:n[r].alarmMetric,alarmMetricName:n[r].metricName,alarmMetricUnit:n[r].alarmMetricUnit,data:[n[r]]});else{const V=c.findIndex(s=>s.alarmMetric===n[r].alarmMetric);V>=0?c[V].data.push(n[r]):c.push({alarmMetric:n[r].alarmMetric,alarmMetricName:n[r].metricName,alarmMetricUnit:n[r].alarmMetricUnit,data:[n[r]]})}c.forEach(r=>{r.diagnoseMetricActive=r.data[0].diagnoseMetric}),console.log("\u5904\u7406\u540E\u7684\u62A5\u8B66\u8BBE\u7F6E\u6570\u636E",c),h.value=c,E().setPushThreshold(`${e.pointId}_trendAlarm`,h.value),setTimeout(()=>{w.$refs[`${g.value}_inputRef`]&&w.$refs[`${g.value}_inputRef`][0]&&w.$refs[`${g.value}_inputRef`][0].focus()},200)})}}),(e,a)=>{const l=z("Check"),f=W,o=X,n=Y,c=ae,r=Z,V=ee;return m(),_(A,null,[p("div",ne,[i(V,null,{default:d(()=>[(m(!0),_(A,null,S(M(h),s=>(m(),_("div",{key:s,style:{"margin-bottom":"20px"}},[p("div",oe,[C(u(e.$t("metric"))+": "+u(F(s.alarmMetric)||s.alarmMetricName)+" ",1),s.alarmMetricUnit?(m(),_("span",se,"("+u(s.alarmMetricUnit)+")",1)):k("",!0)]),s.diagnoseMetricActive?(m(),_("div",ie,[(m(!0),_(A,null,S(s.data,t=>(m(),_("div",{class:"customCheck",key:t.diagnoseMetric},[p("div",de,[t.diagnoseMetric===s.diagnoseMetricActive?(m(),I(f,{key:0},{default:d(()=>[i(l)]),_:1})):k("",!0)]),C(" "+u(R(t.diagnoseMetric)),1)]))),128))])):k("",!0),i(r,{data:U(s.data,s.diagnoseMetricActive),style:{width:"100%"},"row-style":q},{default:d(()=>[M(x)===1?(m(),I(o,{key:0,prop:"axial",label:e.$t("direction"),"min-width":"60px"},{default:d(t=>[p("span",{style:v(y(t.row))},u(t.row.axial),5)]),_:1},8,["label"])):k("",!0),i(o,{prop:"referPeriod",label:e.$t("referenceStandards"),width:"80px"},{default:d(t=>[i(n,{link:"",type:"primary",onClick:b=>J(t.row)},{default:d(()=>[C(u(e.$t("trendChart")),1)]),_:2},1032,["onClick"])]),_:1},8,["label"]),i(o,{prop:"pushThreshold",label:e.$t("pushThreshold"),"min-width":"120px"},{default:d(t=>[i(c,{ref_for:!0,ref:`${t.row.id}_inputRef`,style:{width:"100%"},modelValue:t.row.pushThreshold,"onUpdate:modelValue":b=>t.row.pushThreshold=b,step:.01,onMousewheel:a[0]||(a[0]=G(()=>{},["prevent"])),max:1e3,min:0,controls:!1,onKeydown:a[1]||(a[1]=b=>M(H)(b,2)),onPaste:a[2]||(a[2]=b=>M(j)(b,2)),disabled:B(t.row)},null,8,["modelValue","onUpdate:modelValue","step","disabled"])]),_:1},8,["label"]),i(o,{prop:"fourValue",label:e.$t("alarmLevel4"),"min-width":"80px"},{default:d(t=>[p("span",{style:v(y(t.row,"fourValue"))},u(t.row.fourValue||"-"),5)]),_:1},8,["label"]),i(o,{prop:"threeValue",label:e.$t("alarmLevel3"),"min-width":"80px"},{default:d(t=>[p("span",{style:v(y(t.row,"threeValue"))},u(t.row.threeValue||"-"),5)]),_:1},8,["label"]),i(o,{prop:"twoValue",label:e.$t("alarmLevel2"),"min-width":"80px"},{default:d(t=>[p("span",{style:v(y(t.row,"twoValue"))},u(t.row.twoValue||"-"),5)]),_:1},8,["label"]),i(o,{prop:"oneValue",label:e.$t("alarmLevel1"),"min-width":"80px"},{default:d(t=>[p("span",{style:v(y(t.row,"oneValue"))},u(t.row.oneValue||"-"),5)]),_:1},8,["label"])]),_:2},1032,["data"])]))),128))]),_:1})]),i(M(le),{ref:"chartTrendRef"},null,512)],64)}}},ve=O(ce,[["__scopeId","data-v-dcdb4234"]]);export{ve as default};
