import{_ as $,a5 as O,bM as N,b as W,r as l,ah as F,o as D,y as P,q as g,v as L,p as y,n as s,s as C,P as x,x as w,aH as R,c as X,t as j,Z,ai as T,S as Q,bL as J,l as K,bv as ee,bH as te}from"./index.8d733f79.js";import{E as ae}from"./el-date-picker-panel.089dbe6d.js";import{q as oe}from"./deviceAnalysis.ce7ce4e7.js";import"./panel-time-pick.b2dd8e75.js";import"./index.28f6da25.js";const ie={style:{"margin-bottom":"12px"}},ne={id:"trendChart",class:"chartContent","element-loading-background":"rgba(0,0,0,0)"},re={key:0,class:"aa"},le=O({name:"trend"}),se=Object.assign(le,{setup(de,{expose:M}){const u=N(),{t:Y}=W(),k=[new Date(2e3,1,1,0,0,0),new Date(2e3,2,1,23,59,59)],H={backgroundColor:"#004584",style:{color:"#EAF2FF"},borderColor:"#004584",shadow:!1,useHTML:!0,shared:!0,shape:"rect"},E={tickLength:4,gridLineDashStyle:"Dash",gridLineColor:"#445775",lineColor:"#445775",gridLineWidth:1,minorGridLineWidth:1,minorTickColor:"rgba(68,87,117,0.3)",minorTickInterval:"auto",minorGridLineColor:"rgba(68,87,117,0.3)",minorGridLineDashStyle:"Dash",crosshair:{color:"#93B3E0",dashStyle:"dash",zIndex:77,width:1},type:"datetime",dateTimeLabelFormats:{millisecond:"%H:%M:%S",second:"%H:%M:%S",minute:"%H:%M",hour:"%H:%M",day:"%m-%d",month:"%Y-%m",year:"%Y"}},S={title:{text:null},lineColor:"#445775",gridLineDashStyle:"Dash",gridLineColor:"rgba(68,87,117,0.3)",gridLineWidth:1,minorGridLineWidth:1,minorTickColor:"rgba(68,87,117,0.3)",minorTickInterval:"auto",minorGridLineColor:"rgba(68,87,117,0.3)",minorGridLineDashStyle:"Dash",labels:{style:{color:"#93B3E0"}}},d=l(!1),t=F({alarmMetric:"",axial:"",diagnoseMetric:"",frequencyLowerLimit:"",frequencyUpperLimit:"",startTime:"",endTime:"",pointId:""}),o=l(""),A=l(null);let m;const p=l(!1),c=l(!1),q=e=>Z(()=>new Date(e).getTime()<new Date().getTime()-180*24*60*60*1e3||new Date(e).getTime()>new Date().getTime());function V(e,a){d.value=!0,p.value=!1,m=e.deviceId,t.pointId=e.pointId,t.alarmMetric=e.alarmMetric,t.axial=e.axial,t.diagnoseMetric=e.diagnoseMetric,t.frequencyLowerLimit=e.frequencyLowerLimit||"",t.frequencyUpperLimit=e.frequencyUpperLimit||"",A.value=a,u.deviceAlarmTrendTimes[m]?(o.value=u.deviceAlarmTrendTimes[m],t.startTime=o.value[0],t.endTime=o.value[1],h()):b()}const I=()=>{t.startTime=o.value[0],t.endTime=o.value[1],h(1)},b=()=>{t.startTime=T(new Date().getTime()-7*24*60*60*1e3).format("YYYY-MM-DD HH:mm:ss"),t.endTime=T(new Date).format("YYYY-MM-DD HH:mm:ss"),o.value=[t.startTime,t.endTime],h()};function h(e){if(new Date(t.endTime).getTime()-new Date(t.startTime).getTime()>15*24*60*60*1e3){Q.error(Y("queryTimeRange15"));return}e===1&&u.setDeviceAlarmTrendTimes(m,o.value),i&&i.container&&i.destroy(),c.value=!0,oe(t).then(a=>{if(c.value=!1,!a.data||!a.data.length){p.value=!0;return}const r=a.data.map(n=>[new Date(n.time).getTime(),Number(n.value)]);B(r)})}let i;function B(e){i=J.chart("trendChart",{colors:["#1CEC9C"],title:{useHTML:!0,text:"",align:"left",x:-8,y:6,style:{color:"#A9C1E0",fontSize:"15px"}},time:{useUTC:!1},chart:{backgroundColor:"transparent",marginTop:40,marginBottom:20,zoomType:"x",animation:!1,events:{click(){}}},boost:{useGPUTranslations:!0},exporting:{enabled:!1},yAxis:{...S},xAxis:{...E,lineColor:e.length?"#445775":"transparent",labels:{y:16,style:{color:"#93B3E0",fontSize:"12px"}}},credits:{enabled:!1},legend:{enabled:!1},tooltip:{...H,formatter(){return`${T(this.x).format("YYYY-MM-DD HH:mm:ss")}, ${this.y}`}},plotOptions:{series:{label:{connectorAllowed:!1},marker:{lineWidth:0,width:8,height:8,symbol:"circle",radius:2},cursor:"pointer"}},series:[{data:e}]}),setTimeout(()=>{z()},0)}let v,_;function z(){const e=i.container;e.addEventListener("mousedown",a=>{v=a.clientX,_=a.clientY}),e.addEventListener("mouseup",a=>{const r=a.clientX-v,n=a.clientY-_;r<0&&n<0?(i.xAxis[0].zoomEnabled=!1,i.zoomOut()):i.xAxis[0].zoomEnabled=!0})}return M({showModal:V}),(e,a)=>{const r=ae,n=K,G=ee,U=te;return D(),P(G,{title:e.$t("trendChart"),modelValue:s(d),"onUpdate:modelValue":a[1]||(a[1]=f=>C(d)?d.value=f:null),width:"800px","align-center":"","append-to-body":""},{default:g(()=>[L("div",ie,[y(r,{modelValue:s(o),"onUpdate:modelValue":a[0]||(a[0]=f=>C(o)?o.value=f:null),type:"datetimerange","start-placeholder":e.$t("startTime"),"end-placeholder":e.$t("endTime"),"value-format":"YYYY-MM-DD HH:mm:ss","disabled-date":q,"default-time":k,clearable:!1},null,8,["modelValue","start-placeholder","end-placeholder"]),y(n,{type:"primary",onClick:I,style:{"margin-left":"16px"}},{default:g(()=>[x(w(e.$t("query")),1)]),_:1}),y(n,{type:"primary",plain:"",onClick:b},{default:g(()=>[x(w(e.$t("reset")),1)]),_:1})]),R(L("div",ne,null,512),[[U,s(c)]]),s(p)&&!s(c)?(D(),X("div",re,"\u6682\u65E0\u6570\u636E")):j("",!0)]),_:1},8,["title","modelValue"])}}}),fe=$(se,[["__scopeId","data-v-d731eb86"]]);export{fe as default};
