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