Files
UniversalTestSoftware/client/nginx/html/js/chunk-8a5550be.802d2acc.js

2 lines
31 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-8a5550be"],{"0aa2":function(t,e){t.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAADmSURBVCiRpc69SgNBFIbhd8borARBUEkEWzsREW/IRkxhHY0SDotCthK2kFh4Q1YpxELBgDaCFv5Es4nsjI0IppqDX3eKl+fAP2YARCTB1erR1Sh5FNkujIhUbFK/B5bjzfDki4UVOxhUnS4EMEvOPVcNQNo5b0FYVdT99v5uqgMnfYDjrLvlfViLjazl+qjZuDR5nruXz5l3YFqBlr4o5+3tz6F8uPx9W07O1q01m7Gp91M9Odzp6cBJHyDtdE+BjegqhKv2QWPPZNnF3Ch8vWnVip9dtMPhwwdwo2zvxuP+qxb8s283uEdmKy96OQAAAABJRU5ErkJggg=="},"2e76":function(t,e,a){"use strict";a.r(e);var s=function(){var t=this,e=t._self._c;return e("div",{staticClass:"box-content"},[e("div",{staticClass:"big-box",class:{shrink:t.dialogVisible}},[e("div",{staticClass:"center-top-box"},[e("div",{staticClass:"center-top-list"},[t._l(t.dataTopList,(function(s,i){return e("div",{key:i,staticClass:"center-items",class:t.centerActive===i?"acitem":"",on:{click:function(e){return t.centerClick(s,i)}}},[e("p",{staticClass:"items-box"},[t._v(t._s(s.dataBoardName))]),e("el-dropdown",{staticClass:"ml15",attrs:{trigger:"click"},nativeOn:{click:function(t){t.stopPropagation()}}},[e("img",{staticClass:"icons pointer",attrs:{src:a("0aa2"),alt:""}}),e("el-dropdown-menu",{attrs:{slot:"dropdown"},slot:"dropdown"},[e("el-dropdown-item",{nativeOn:{click:function(e){return t.editTelemeterClick(s,i)}}},[t._v("重命名")]),e("el-dropdown-item",{nativeOn:{click:function(e){return t.deleteTelemeterClick(s)}}},[t._v("删除")])],1)],1)],1)})),e("div",{staticClass:"add-center",on:{click:function(e){return e.stopPropagation(),t.telemeterAdd()}}},[e("img",{staticStyle:{width:"20px",height:"20px"},attrs:{src:a("9b8d")}})])],2)]),e("div",{staticClass:"telemeter-box"},[e("div",{staticClass:"telemeter-left"},[e("el-tree",{ref:"leftTree",staticClass:"mt10",attrs:{"default-expanded-keys":t.firstLevelKeys,"node-key":"webKey",data:t.leftTDList,"expand-on-click-node":!1,props:t.defaultLeftProps,"show-checkbox":"","default-checked-keys":t.checkedList},on:{check:t.changeCheck,"check-change":t.leftHandleChange},scopedSlots:t._u([{key:"default",fn:function({node:a,data:s}){return e("span",{staticClass:"custom-tree-node"},[e("span",{staticClass:"mr10"},[a.level>2&&t.dataBoardType?e("el-color-picker",{attrs:{size:"mini"},on:{change:function(e){return t.changeColorOrLeftRight(s)}},model:{value:s.legendColor,callback:function(e){t.$set(s,"legendColor",e)},expression:"data.legendColor"}}):t._e()],1),e("span",{staticClass:"mr10"},[t._v(" "+t._s(1==a.level?s.channelName:2==a.level?s.protocolName:s.parameter))]),a.level>2&&t.dataBoardType?e("span",{staticClass:"leftOrRight"},[e("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"曲线图左y轴",placement:"top-start"}},[e("i",{staticClass:"el-icon-caret-left",style:{color:1==s.isLeftYaxis?s.legendColor:"#909399",fontSize:"24px",marginRight:"-9px"},on:{click:function(e){return t.changeLeftRight(1,s)}}})]),e("span",{staticClass:"line",style:{backgroundColor:s.legendColor}}),e("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"曲线图右y轴",placement:"top-start"}},[e("i",{staticClass:"el-icon-caret-right",style:{color:0==s.isLeftYaxis?s.legendColor:"#909399",fontSize:"24px",marginLeft:"-14px"},on:{click:function(e){return t.changeLeftRight(0,s)}}})])],1):t._e()])}}])})],1),e("div",{staticClass:"telemeter-right"},[e("div",[e("el-form",{staticClass:"form-top",attrs:{model:t.modelForm,size:"small",inline:!0}},[e("el-form-item",{attrs:{label:"时间范围"}},[e("el-date-picker",{staticStyle:{width:"350px"},attrs:{clearable:"",type:"datetimerange","value-format":"yyyy-MM-dd HH:mm:ss","range-separator":"至","start-placeholder":"开始日期","end-placeholder":"结束日期"},on:{change:t.timeChange},model:{value:t.modelForm.value,callback:function(e){t.$set(t.modelForm,"value",e)},expression:"modelForm.value"}})],1),e("el-form-item",{attrs:{label:"每秒数据量"}},[e("el-select",{staticStyle:{width:"80px"},attrs:{placeholder:"请选择"},on:{change:t.changedataNum},model:{value:t.modelForm.dataNum,callback:function(e){t.$set(t.modelForm,"dataNum",e)},expression:"modelForm.dataNum"}},t._l(t.dataSize,(function(t){return e("el-option",{key:t.label,attrs:{label:t.label,value:t.value}})})),1)],1),e("el-form-item",{attrs:{label:"回放速度"}},[e("el-select",{staticStyle:{width:"80px"},attrs:{placeholder:"请选择"},on:{change:t.changeUpdateDataForm},model:{value:t.modelForm.speed,callback:function(e){t.$set(t.modelForm,"speed",e)},expression:"modelForm.speed"}},t._l(t.playbackSpeed,(function(t){return e("el-option",{key:t.label,attrs:{label:t.label,value:t.value}})})),1)],1),e("el-form-item",[t.isStartPayBack?e("el-button",{attrs:{type:"danger",size:"small"},on:{click:t.isEnd}},[t._v("停止回放 ")]):e("el-button",{attrs:{type:"success",size:"small"},on:{click:t.isStart}},[t._v("开始回放")]),e("el-button",{attrs:{type:"primary",size:"small"},on:{click:t.updateFWClick}},[t._v("设置Y轴")]),e("el-dropdown",{staticClass:"ml10",attrs:{trigger:"click"},nativeOn:{click:function(t){t.stopPropagation()}}},[e("el-button",{attrs:{type:"warning",size:"small"}},[t._v("导出数据")]),e("el-dropdown-menu",{attrs:{slot:"dropdown"},slot:"dropdown"},[e("el-dropdown-item",{nativeOn:{click:function(e){return t.exportDataReplay(1)}}},[t._v("解析数据")]),e("el-dropdown-item",{nativeOn:{click:function(e){return t.exportDataReplay(2)}}},[t._v("原数据")]),e("el-dropdown-item",{nativeOn:{click:function(e){return t.exportHistory()}}},[t._v("导出历史")])],1)],1),e("el-button",{staticClass:"ml10",attrs:{type:"danger",size:"small"},on:{click:t.deleteDataReplay}},[t._v("清除数据 ")])],1)],1)],1),2==t.dataBoardType||1==t.dataBoardType?e("div",{class:2==t.dataBoardType?"line-box1":"line-box"},[e("div",{ref:"chartContainer",staticClass:"chart-container"})]):t._e(),2==t.dataBoardType||0==t.dataBoardType?e("el-table",{staticClass:"mt10",staticStyle:{width:"99%","border-radius":"10px"},attrs:{height:t.tableHeight,"header-cell-style":{fontWeight:400,background:"#F0F5FC",color:"#333333"},data:t.tableData,border:"",size:"mini"}},[e("el-table-column",{attrs:{prop:"name",label:"指标名称",width:""}}),e("el-table-column",{attrs:{prop:"sourceValue",label:"源数据",width:""},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v(" "+t._s(e.row.sourceValue)+" ")]}}],null,!1,3586988395)}),e("el-table-column",{attrs:{prop:"phyValue",label:"物理解析值",width:""},scopedSlots:t._u([{key:"default",fn:function(a){return[a.row.phyValue&&!isNaN(a.row.phyValue)&&"number"===typeof Number(a.row.phyValue)?e("span",[t._v(t._s(Number(a.row.phyValue).toFixed(3)))]):e("span",[t._v(t._s(a.row.phyValue?a.row.phyValue:""))])]}}],null,!1,2557657020)}),e("el-table-column",{attrs:{prop:"phyUnit",label:"物理单位",width:""}}),e("el-table-column",{attrs:{prop:"timePart",label:"时间",width:""}})],1):t._e()],1)])]),t.dialogVisible?e("div",{staticClass:"content-right2 mt10"},[e("div",{staticClass:"channel-box"},[e("div",{staticClass:"form-title dialog"},[e("p",{},[t._v(t._s(1===t.leftRight?"添加数据看板":2===t.leftRight?"设置Y轴范围":"重命名"))]),e("p",{staticClass:"pointer",on:{click:t.cancelClick}},[t._v("×")])]),1===t.leftRight?e("div",{},[e("div",{staticClass:"mt20"},[e("p",{staticClass:"right-form-name mb10"},[t._v("看板名称 ")]),e("el-input",{staticStyle:{width:"230px"},attrs:{placeholder:"请输入"},model:{value:t.kbForm.dataBoardName,callback:function(e){t.$set(t.kbForm,"dataBoardName",e)},expression:"kbForm.dataBoardName"}})],1),e("div",{staticClass:"mt15"},[e("p",{staticClass:"right-form-name"},[t._v("显示形式 ")]),e("el-radio-group",{model:{value:t.kbForm.dataBoardType,callback:function(e){t.$set(t.kbForm,"dataBoardType",e)},expression:"kbForm.dataBoardType"}},[e("el-radio",{attrs:{label:0}},[t._v("表格")]),e("el-radio",{attrs:{label:1}},[t._v("曲线")]),e("el-radio",{attrs:{label:2}},[t._v("表格和曲线")])],1)],1),e("div",{staticClass:"mt15"},[e("p",{staticClass:"right-form-name"},[t._v("数据通道 ")]),e("el-tree",{ref:"tree",attrs:{data:t.channelList,props:t.defaultProps,"show-checkbox":""},on:{check:t.handleCheck},scopedSlots:t._u([{key:"default",fn:function({node:a}){return[3==a.level?e("span",{staticClass:"tree-node-label"},[e("span",{staticClass:"label-text"},[t._v(t._s(a.label))])]):e("span",{},[t._v(t._s(a.label))])]}}],null,!1,719713948)})],1),e("div",{staticClass:"sure-btn"},[e("el-button",{on:{click:t.kbCancelClick}},[t._v("取 消")]),e("el-button",{attrs:{type:"primary"},on:{click:t.kbSure}},[t._v("确 定")])],1)]):t._e(),2==t.leftRight?e("div",{},[e("div",{staticClass:"mt15"},[e("p",{staticClass:"right-form-name"},[t._v("Y轴 ")]),e("el-radio-group",{model:{value:t.fwForm.leftOrRight,callback:function(e){t.$set(t.fwForm,"leftOrRight",e)},expression:"fwForm.leftOrRight"}},[e("el-radio",{attrs:{label:1}},[t._v("左侧Y轴")]),e("el-radio",{attrs:{label:2}},[t._v("右侧Y轴")])],1)],1),e("div",{staticClass:"mt20"},[e("p",{staticClass:"right-form-name mb10"},[t._v("最小值 ")]),e("el-input",{staticStyle:{width:"230px"},attrs:{placeholder:"请输入",type:"number"},model:{value:t.fwForm.min,callback:function(e){t.$set(t.fwForm,"min",t._n(e))},expression:"fwForm.min"}})],1),e("div",{staticClass:"mt20"},[e("p",{staticClass:"right-form-name mb10"},[t._v("最大值 ")]),e("el-input",{staticStyle:{width:"230px"},attrs:{placeholder:"请输入",type:"number"},model:{value:t.fwForm.max,callback:function(e){t.$set(t.fwForm,"max",t._n(e))},expression:"fwForm.max"}})],1),e("div",{staticClass:"sure-btn"},[e("el-button",{on:{click:t.cancelClick}},[t._v("取 消")]),e("el-button",{attrs:{type:"primary"},on:{click:t.fwSure}},[t._v("确 定")])],1)]):t._e(),3==t.leftRight?e("div",{},[e("div",{staticClass:"mt20"},[e("p",{staticClass:"right-form-name mb10"},[t._v("看板名称 ")]),e("el-input",{staticStyle:{width:"230px"},attrs:{placeholder:"请输入"},model:{value:t.kbForm.dataBoardName,callback:function(e){t.$set(t.kbForm,"dataBoardName",e)},expression:"kbForm.dataBoardName"}})],1),e("div",{staticClass:"sure-btn"},[e("el-button",{on:{click:t.kbCancelClick}},[t._v("取 消")]),e("el-button",{attrs:{type:"primary"},on:{click:t.kbEidtSure}},[t._v("确 定")])],1)]):t._e(),4==t.leftRight?e("div",{},[e("div",{staticClass:"mt20"},[e("p",{staticClass:"right-form-name mb10"},[t._v("自定义条数 ")]),e("el-input",{staticStyle:{width:"230px"},attrs:{placeholder:"请输入"},model:{value:t.dataNum,callback:function(e){t.dataNum=t._n(e)},expression:"dataNum"}})],1),e("div",{staticClass:"sure-btn"},[e("el-button",{on:{click:t.dataNumCancelClick}},[t._v("取 消")]),e("el-button",{attrs:{type:"primary"},on:{click:t.dataNumEidtSure}},[t._v("确 定")])],1)]):t._e()])]):t._e(),e("el-dialog",{attrs:{title:"导出历史",visible:t.showHistory,width:"70%"},on:{"update:visible":function(e){t.showHistory=e}}},[e("el-table",{staticStyle:{"border-radius":"10px"},attrs:{data:t.historyData}},[e("el-table-column",{attrs:{property:"createTime",label:"操作时间",width:"170px"},scopedSlots:t._u([{key:"default",fn:function(a){return[e("p",[t._v(t._s(t.dateFormat(a.row.createTime,"yyyy-MM-dd HH:mm:ss")))])]}}])}),e("el-table-column",{attrs:{property:"startTime",label:"查询起始时间",width:"170px"},scopedSlots:t._u([{key:"default",fn:function(a){return[e("p",[t._v(t._s(t.dateFormat(a.row.startTime,"yyyy-MM-dd HH:mm:ss")))])]}}])}),e("el-table-column",{attrs:{property:"endTime",label:"查询起始时间",width:"170px"},scopedSlots:t._u([{key:"default",fn:function(a){return[e("p",[t._v(t._s(t.dateFormat(a.row.endTime,"yyyy-MM-dd HH:mm:ss")))])]}}])}),e("el-table-column",{attrs:{property:"channelName",label:"通道"}}),e("el-table-column",{attrs:{property:"protocolName",label:"协议"}}),e("el-table-column",{attrs:{property:"type",label:"数据类型"},scopedSlots:t._u([{key:"default",fn:function(a){return[e("p",[t._v(t._s(1===a.row.type?"解析数据":"原始数据"))])]}}])}),e("el-table-column",{attrs:{label:"文件路径",width:"90px"},scopedSlots:t._u([{key:"default",fn:function(a){return[e("a",{directives:[{name:"show",rawName:"v-show",value:2===a.row.state,expression:"scope.row.state === 2"}],staticClass:"cp",attrs:{href:"/universaltestsoftware_client_api/api/dataBoard/fileDownLoad?filePath="+encodeURIComponent(a.row.downloadUrl),download:a.row.downloadUrl}},[t._v("点击下载")])]}}])}),e("el-table-column",{attrs:{property:"address",label:"状态",width:"90px"},scopedSlots:t._u([{key:"default",fn:function(a){return[e("span",{class:2===a.row.state?"green":-1===a.row.state?"red":"warning"},[t._v(t._s(2===a.row.state?"生成成功":-1===a.row.state?"生成失败":"生成中"))])]}}])})],1)],1)],1)},i=[],l=(a("14d9"),a("e9f5"),a("910d"),a("7d54"),a("ab43"),a("1e70"),a("79a4"),a("c1a1"),a("8b00"),a("a4e7"),a("1e5a"),a("72c3"),a("f58c")),o=a("365c"),r=a("02c7"),n=a("e550"),c=a("0428"),d={components:{linechartEcharts:l["a"]},data(){return{connectionSymbol:c["a"],tableHeight:200,checkedList:[],dialogVisible:!1,leftRight:1,centerActive:0,defaultProps:{label:"label",children:"boardListVos"},defaultLeftProps:{label:"label",children:"children"},kbForm:{dataBoardName:"",dataBoardType:1,dataType:1},kbList:[],modelForm:{startTime:"",endTime:"",value:[],dataNum:1,speed:1},isStartPayBack:!1,dataSize:[{label:"1条",value:1},{label:"2条",value:2},{label:"3条",value:3},{label:"4条",value:4},{label:"5条",value:5},{label:"6条",value:6},{label:"7条",value:7},{label:"8条",value:8},{label:"9条",value:9},{label:"10条",value:10}],dataNum:null,playbackSpeed:[{label:"1×",value:1},{label:"2x",value:2},{label:"4x",value:4},{label:"8x",value:8},{label:"16x",value:16},{label:"32x",value:32}],fwForm:{resource:1,leftOrRight:1},channelList:[],dataTopList:[],leftTDList:[],tableData:[],chart:null,leftData:[],dataBoardId:"",leftArr:[],timeArr:[],seriesData:[],websocket:null,reconnectTimer:null,reconnectInterval:3e3,maxReconnectAttempts:10,reconnectAttempts:0,message:"",connectionStatus:"未连接",dataBoardType:-1,tabsMap:new Map,channelMap:new Map,firstLevelKeys:[],showHistory:!1,historyData:[]}},mounted(){this.getTreeChannel(),this.getAllData(),window.addEventListener("resize",this.handleResize),n["a"].$on("protocolChanged",this.handleRefreshBoard)},beforeDestroy(){window.removeEventListener("resize",this.handleResize),n["a"].$off("protocolChanged"),this.chart&&this.chart.dispose(),this.clearReconnectTimer(),this.disconnect(!0)},watch:{dialogVisible(t){this.$nextTick(()=>{setTimeout(()=>{this.chart&&this.chart.resize()},300)})}},methods:{exportHistory(){Object(r["d"])({current:1}).then(t=>{if(1===t.code){let e=t.data||{};this.historyData=e.records||[]}}),this.showHistory=!0},dateFormat(t,e){let a=new Date(t);if(!t)return"";e||(e="yyyy-MM-dd HH:mm:ss");let s=function(t){return(t<10?"0":"")+t};return e.replace(/yyyy|MM|dd|HH|mm|ss/g,(function(t){switch(t){case"yyyy":return s(a.getFullYear());case"MM":return s(a.getMonth()+1);case"mm":return s(a.getMinutes());case"dd":return s(a.getDate());case"HH":return s(a.getHours());case"ss":return s(a.getSeconds())}}))},handleRefreshBoard(){this.getAllData()},deleteDataReplay(){this.modelForm.startTime?this.modelForm.endTime?Object(r["a"])({...this.modelForm,dataBoardId:this.dataTopList[this.centerActive].dataBoardId}).then(t=>{1==t.code&&this.$message.success("删除成功")}):this.$message.error("请选择结束时间"):this.$message.error("请选择开始时间")},exportDataReplay(t){if(!this.modelForm.startTime)return void this.$message.error("请选择开始时间");if(!this.modelForm.endTime)return void this.$message.error("请选择结束时间");if(this.checkedList.length<1)return void this.$message.error(1===t?"请选择字段":"请选择通道");let e=[];e=this.getProtocolIds(),e=e.filter(t=>t);let a=[];a=this.checkedList.map(t=>{let e="";return t.includes(this.connectionSymbol)&&(e=t.split(this.connectionSymbol)[t.split(this.connectionSymbol).length-1]),e}),a=a.filter(t=>t),Object(r["c"])({...this.modelForm,dataBoardId:this.dataTopList[this.centerActive].dataBoardId,param:[...a],exportType:t,protocolIds:[...e]}).then(t=>{1==t.code&&this.$message.info("后台下载中,可在“导出历史”中查看及下载")})},getProtocolIds(){let t=[],e=this.tabsMap.get(this.dataTopList[this.centerActive].dataBoardId),a=e.perTabLeftTree;return this.checkedList.forEach(e=>{if(e.includes(this.connectionSymbol)){let s=e.split(this.connectionSymbol)[0],i=this.getProtocolId(s,a);t.push(i)}}),[...t]},getProtocolId(t,e){let a="";return e.forEach(e=>{e.children.forEach(e=>{e.protocolName==t&&(a=e.protocolId)})}),a},calcTableHeight(){0===this.dataBoardType?this.tableHeight=200:2===this.dataBoardType&&(this.tableHeight=window.innerHeight-160)},changeColorOrLeftRight(t){Object(r["k"])({...t}).then(t=>{1==t.code&&this.getAllData(1)})},changeLeftRight(t,e){e.isLeftYaxis=t-0,Object(r["k"])({...e}).then(t=>{1==t.code&&this.getAllData(1)})},timestampToTime(t){if(!t||t<0)return"";const e=10===String(t).length?1e3*t:t,a=new Date(e),s=a.getFullYear(),i=String(a.getMonth()+1).padStart(2,"0"),l=String(a.getDate()).padStart(2,"0"),o=String(a.getHours()).padStart(2,"0"),r=String(a.getMinutes()).padStart(2,"0"),n=String(a.getSeconds()).padStart(2,"0");return`${s}-${i}-${l} ${o}:${r}:${n}`},initChart(){this.chart=this.$echarts.init(this.$refs.chartContainer),this.chart.on("legendselectchanged",t=>{this.handleLegendClick(t)}),2!=this.dataBoardType&&1!=this.dataBoardType||this.$nextTick(()=>{this.updataCharts(!0)})},handleLegendClick(t){console.log(t,"params");let e=t.selected,a=[];for(const i in e)e.hasOwnProperty(i)&&!0===e[i]&&a.push(i);let s=this.tabsMap.get(this.dataTopList[this.centerActive].dataBoardId);s.checkedLeftList=a,this.tabsMap.set(this.dataTopList[this.centerActive].dataBoardId,s),this.$nextTick(()=>{this.$refs.leftTree.setCheckedKeys(a)})},updataCharts(t){if(!this.dataTopList||this.dataTopList.length<1)return;let e=this.tabsMap.get(this.dataTopList[this.centerActive].dataBoardId),a=e.minYAxisRight||null,s=e.maxYAxisRight||null,i=e.maxYAxisLeft||null,l=e.minYAxisLeft||null,o=e.perTabLeftTree,r=e.iconsList,n=e.colorsList,c=[],d=[],h=[];o.forEach(t=>{t.children&&t.children.length>0&&t.children.forEach(t=>{h=[...h,t.children];let e=this.channelMap.get(t.channelId+"#"+this.dataTopList[this.centerActive].dataBoardId+"#"+t.protocolId);e?(c=c.concat(e.timeArr),c=Array.from(new Set(c)),d=d.concat(e.seriesData)):(c=[],d=[])})});const m={color:n,tooltip:{trigger:"axis",axisPointer:{type:"cross",label:{backgroundColor:"#6a7985"}},formatter:function(t){let e=`<div style="font-weight: bold; margin-bottom: 6px;">${t[0].name}</div>`;for(let a=0;a<t.length;a+=2){let s='<div style="display: flex; justify-content: space-between; margin: 3px 0;">';t[a]&&(s+=`<span style="display: flex; align-items: center;">\n <span style="display: inline-block; width: 10px; height: 10px; border-radius: 50%; background-color: ${t[a].color}; margin-right: 6px;"></span>\n ${t[a].seriesName}: ${t[a].value}\n </span>`),t[a+1]&&(s+=`<span style="display: flex; align-items: center; margin-left: 15px;">\n <span style="display: inline-block; width: 10px; height: 10px; border-radius: 50%; background-color: ${t[a+1].color}; margin-right: 6px;"></span>\n ${t[a+1].seriesName}: ${t[a+1].value}\n </span>`),s+="</div>",e+=s}return e}},legend:{data:r,left:"100"},xAxis:[{type:"category",boundaryGap:!1,data:c}],yAxis:[{type:"value",name:"",position:"right",axisLine:{show:!0},axisLabel:{formatter:"{value}"},min:a,max:s},{type:"value",name:"",position:"left",axisLine:{show:!0},axisLabel:{formatter:"{value}"},min:l,max:i}],dataZoom:[{show:!0,height:15,xAxisIndex:[0],bottom:30,handleIcon:"path://M306.1,413c0,2.2-1.8,4-4,4h-59.8c-2.2,0-4-1.8-4-4V200.8c0-2.2,1.8-4,4-4h59.8c2.2,0,4,1.8,4,4V413z",handleSize:"110%",handleStyle:{color:"#d3dee5"},textStyle:{color:"#fff"},borderColor:"#90979c"},{type:"inside"}],series:d};this.isStartPayBack&&this.chart.setOption(m,t)},handleResize(){this.chart&&this.chart.resize(),this.calcTableHeight()},centerClick(t,e){this.centerActive=e,this.dataBoardType=t.dataBoardType;let a=this.tabsMap.get(this.dataTopList[this.centerActive].dataBoardId);this.modelForm=a.modelForm,this.isStartPayBack=a.isStartPayBack,this.renderLeftTree(),2!=this.dataBoardType&&1!=this.dataBoardType||this.$nextTick(()=>{this.initChart(),setTimeout(()=>{this.chart&&this.chart.resize()},300)}),this.tableData=[]},renderLeftTree(){this.leftTDList=this.tabsMap.get(this.dataTopList[this.centerActive].dataBoardId).perTabLeftTree,this.checkedList=this.tabsMap.get(this.dataTopList[this.centerActive].dataBoardId).checkedLeftList,this.firstLevelKeys=this.leftTDList.map(t=>t.webKey)},changeCheck(t,e){console.log(t,e);let a=this.tabsMap.get(this.dataTopList[this.centerActive].dataBoardId);if(a.checkedLeftList=e.checkedKeys,this.checkedList=e.checkedKeys,this.tabsMap.set(this.dataTopList[this.centerActive].dataBoardId,a),t.children&&t.children.length>0)t.children.forEach(a=>{if(a.children&&a.children.length>0)a.children.forEach(a=>{let s=e.checkedKeys.includes(t.webKey);this.legendSelectcChange(a.webKey,s)});else{let s=e.checkedKeys.includes(t.webKey);this.legendSelectcChange(a.webKey,s)}});else{let a=e.checkedKeys.includes(t.webKey);this.legendSelectcChange(t.webKey,a)}},legendSelectcChange(t,e){e?this.chart.dispatchAction({type:"legendSelect",name:t}):this.chart.dispatchAction({type:"legendUnSelect",name:t})},leftHandleChange(t,e){},async getAllData(t){try{const e=await Object(r["f"])({dataType:1});if(1===(null===e||void 0===e?void 0:e.code)){let a=e.data||[];if(0===a.length)return void(this.leftTDList=[]);a.forEach((t,e)=>{let a=this.processLeftData(t.dataBoardChannelList),s=[],i=[],l=[];console.log(t.dataBoardChannelList,"item.dataBoardChannelList"),t.dataBoardChannelList.forEach(t=>{let e=[],a=[],s=[];t.protocolNameList.forEach(t=>{t.parameterList.forEach(t=>{e.push(t.parameter),a.push(t.parameter),s.push(t.legendColor)})}),i=i.concat(a),l=l.concat(s)});let o={startTime:"",endTime:"",value:[],dataNum:10,speed:1};this.tabsMap.get(t.dataBoardId)||this.tabsMap.set(t.dataBoardId,{modelForm:o,isStartPayBack:!1,minYAxisLeft:null,maxYAxisLeft:null,maxYAxisRight:null,minYAxisRight:null,colorsList:l,perTabLeftTree:a,checkedLeftList:s,iconsList:i})}),this.dataTopList=a,2==t?this.centerClick(this.dataTopList[this.dataTopList.length-1],this.dataTopList.length-1):(this.renderLeftTree(),this.dataBoardType=this.dataTopList[this.centerActive].dataBoardType,(2==this.dataBoardType||1==this.dataBoardType&&!this.chart)&&this.$nextTick(()=>{this.initChart()}),this.getConnect())}}catch(e){console.error("获取数据失败:",e),this.dataTopList=[],this.leftTDList=[]}},processLeftData(t){return t.map(t=>{let e=t.protocolNameList?[...t.protocolNameList]:[];return t.parameter=t.channelName,e=e.map(t=>{let e=[];return e=t.parameterList.map(t=>({...t,webKey:t.protocolName+this.connectionSymbol+t.parameter})),{...t,children:e,parameter:t.protocolName,webKey:t.protocolName}}),{...t,label:t.channelName,children:e,webKey:t.channelId}})},getTreeChannel(){Object(o["t"])().then(t=>{if(1==t.code){let e=t.data||[];(null===e||void 0===e?void 0:e.length)>0&&(e.forEach(t=>{var e;t.label=t.serverName,null===(e=t.boardListVos)||void 0===e||e.forEach(t=>{var e;t.label=t.boardName,null===(e=t.boardListVos)||void 0===e||e.forEach(t=>{t.label=t.channelName})})}),this.channelList=e||[])}})},editTelemeterClick(t,e){this.leftRight=3,this.kbForm.dataBoardName=t.dataBoardName,this.dataBoardId=t.dataBoardId,this.dialogVisible=!0},deleteTelemeterClick(t){let e=this;this.$confirm("确定删除该条数据?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(()=>{Object(r["g"])({dataBoardId:t.dataBoardId}).then(t=>{1===t.code&&(e.$message.success("删除成功!"),e.centerActive=0,e.getAllData())})}).catch(()=>{})},cancelClick(){this.dialogVisible=!1},telemeterAdd(){this.leftRight=1,this.dialogVisible=!0},kbEidtSure(){let t={dataBoardName:this.kbForm.dataBoardName,dataBoardId:this.dataBoardId,dataType:1,channelList:[]};Object(r["h"])(t).then(t=>{1==t.code&&(this.$message.success("操作成功!"),this.getAllData(),this.kbCancelClick())})},handleCheck(){const t=this.$refs.tree.getCheckedNodes();this.kbList=t.filter(t=>!t.boardListVos||0===t.boardListVos.length)},handleCheckChange(t,e,a){},kbCancelClick(){this.dialogVisible=!1,this.kbList=[],this.kbForm.dataBoardName="",this.kbForm.dataBoardType=1},kbSure(){let t={...this.kbForm,channelList:this.kbList};Object(r["h"])(t).then(t=>{1===t.code&&(this.$message.success("操作成功!"),this.getAllData(2),this.kbCancelClick(),this.kbForm.dataBoardName="",this.kbForm.dataBoardType=1)})},updateFWClick(){this.leftRight=2,this.fwForm.leftOrRight=1,this.fwForm.min=null,this.fwForm.max=null,this.fwForm={...this.fwForm},this.dialogVisible=!0},fwSure(){let t=this.tabsMap.get(this.dataTopList[this.centerActive].dataBoardId);1==this.fwForm.leftOrRight?(t.minYAxisLeft=this.fwForm.min,t.maxYAxisLeft=this.fwForm.max,this.tabsMap.set(this.dataTopList[this.centerActive].dataBoardId,t)):2==this.fwForm.leftOrRight&&(t.minYAxisRight=this.fwForm.min,t.maxYAxisRight=this.fwForm.max,this.tabsMap.set(this.dataTopList[this.centerActive].dataBoardId,t)),this.dialogVisible=!1,2!=this.dataBoardType&&1!=this.dataBoardType||this.$nextTick(()=>{this.updataCharts(!1)})},getConnect(){if(!this.websocket||this.websocket.readyState!==WebSocket.OPEN&&this.websocket.readyState!==WebSocket.CONNECTING)try{const t="https:"===window.location.protocol?"wss:":"ws:",e=window.location.host,a=`${t}//${e}/universaltestsoftware_client_api/ws/playback`;this.websocket=new WebSocket(a),this.websocket.onopen=()=>{this.reconnectAttempts=0,this.connectionStatus="已连接",this.clearReconnectTimer()},this.websocket.onmessage=t=>{const e=t.data;let a=JSON.parse(e),s=[],i=a.channelId+"#"+a.dataBoardId+"#"+a.protocolId,l=a.timestamp;var o=new Date(l),r=this.timestampToTime(o);let n=a.filedParseDataList||[],c=[],d=[];if(this.channelMap.get(i)){let t=this.channelMap.get(i);d=t.timeArr,d.push(r),c=t.seriesData}else d.push(r);n=n.map((t,e)=>({...t,timePart:r}));let h=this.tabsMap.get(a.dataBoardId),m=h.perTabLeftTree||[],p=[],u=this.getProtocolName(a.channelId,a.protocolId,m);if(a.dataBoardId==this.dataTopList[this.centerActive].dataBoardId){s=[...n];let t=s.filter(t=>this.checkedList.includes(u+this.connectionSymbol+t.readName));t.forEach(t=>{let e=this.tableData.filter(e=>e.name==u+this.connectionSymbol+t.readName)||[];e.length<1?this.tableData.push({...t,name:u+this.connectionSymbol+t.readName}):(this.tableData.forEach((a,s)=>{a.name==u+this.connectionSymbol+e[0].readName&&this.$set(this.tableData,s,{...t,name:u+this.connectionSymbol+t.readName})}),this.tableData=[...this.tableData])})}m.forEach(t=>{t.channelId==a.channelId&&(p=t.parameterList)}),0==c.length?n.forEach((t,e)=>{c.push({name:u+this.connectionSymbol+t.readName,type:"line",stack:"Total",emphasis:{focus:"series"},showSymbol:!1,data:[t.phyValue?Number(t.phyValue).toFixed(3):""],yAxisIndex:p&&p.length>0?p[e].isLeftYaxis:1})}):c=c.map((t,e)=>{let a=p&&p.length>0?p[e].isLeftYaxis:1,s=n[e].phyValue?Number(n[e].phyValue).toFixed(3):"";return{...t,data:[...t.data,s],yAxisIndex:a}});let b={timeArr:Array.from(new Set(d)),seriesData:c};this.channelMap.set(i,b),2!=this.dataBoardType&&1!=this.dataBoardType||this.$nextTick(()=>{this.updataCharts(!1)})},this.websocket.onclose=t=>{this.connectionStatus="已断开",this.addSystemMessage(`连接已关闭 (代码: ${t.code}, 原因: ${t.reason||"未知"})`),this.manualDisconnect||this.maxReconnectAttempts&&!(this.reconnectAttempts<this.maxReconnectAttempts)||this.scheduleReconnect()},this.websocket.onerror=t=>{this.connectionStatus="连接错误",this.addSystemMessage("连接发生错误: "+(t.message||"未知错误")),console.error("WebSocket错误:",t),this.manualDisconnect||this.maxReconnectAttempts&&!(this.reconnectAttempts<this.maxReconnectAttempts)||this.scheduleReconnect()}}catch(t){this.connectionStatus="连接失败",this.addSystemMessage("连接失败: "+t.message),console.error("连接异常:",t),this.manualDisconnect||this.maxReconnectAttempts&&!(this.reconnectAttempts<this.maxReconnectAttempts)||this.scheduleReconnect()}},getProtocolName(t,e,a){let s="";return a.forEach(a=>{a.channelId==t&&a.children.forEach(t=>{t.protocolId==e&&(s=t.protocolName)})}),s},disconnect(t=!1){if(this.manualDisconnect=t,this.websocket.readyState!==WebSocket.CLOSED&&this.websocket.readyState!==WebSocket.CLOSING)try{this.websocket&&(this.websocket.close(1e3,t?"手动关闭":"正常关闭"),this.websocket=null),this.connectionStatus="已断开",t&&this.addSystemMessage("已手动断开连接")}catch(e){console.error("断开连接异常:",e),this.addSystemMessage("断开连接时发生错误")}},scheduleReconnect(){if(this.clearReconnectTimer(),this.maxReconnectAttempts&&this.reconnectAttempts>=this.maxReconnectAttempts)return void this.addSystemMessage(`已达到最大重连次数(${this.maxReconnectAttempts}),请手动重试`);this.reconnectAttempts++;const t=this.reconnectAttempts,e=this.reconnectInterval;this.addSystemMessage(`将在 ${e/1e3} 秒后进行第 ${t} 次重连...`),this.reconnectTimer=setTimeout(()=>{this.addSystemMessage(`正在进行第 ${t} 次重连...`),this.getConnect()},e)},clearReconnectTimer(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)},addSystemMessage(t){this.$message(t)},timeChange(t){t?(this.modelForm.startTime=t[0],this.modelForm.endTime=t[1]):(this.modelForm.startTime="",this.modelForm.endTime="",this.modelForm.value=[]),this.changeUpdateDataForm()},changedataNum(){-1==this.modelForm.dataNum?(this.leftRight=4,this.dataNum=null,this.dialogVisible=!0):this.changeUpdateDataForm()},dataNumCancelClick(){this.dataNum=null,this.dialogVisible=!1},dataNumEidtSure(){this.modelForm.dataNum=this.dataNum,this.dialogVisible=!1,this.dataNum=null,this.changeUpdateDataForm()},isStart(){let t=this.tabsMap.get(this.dataTopList[this.centerActive].dataBoardId);this.modelForm.pageSize=this.modelForm.dataNum*this.modelForm.speed,Object(r["i"])({...this.modelForm,dataBoardId:this.dataTopList[this.centerActive].dataBoardId}).then(e=>{if(1==e.code){t.isStartPayBack=!0,this.isStartPayBack=!0,this.tabsMap.set(this.dataTopList[this.centerActive].dataBoardId,t),this.tableData=[];let e=t.perTabLeftTree;e.forEach(t=>{t.children&&t.children.length>0&&t.children.forEach(t=>{let e={timeArr:[],seriesData:[]};this.channelMap.set(t.channelId+"#"+this.dataTopList[this.centerActive].dataBoardId+"#"+t.protocolId,e)})}),this.updataCharts(!1)}})},isEnd(){let t={dataBoardId:this.dataTopList[this.centerActive].dataBoardId},e=this.tabsMap.get(this.dataTopList[this.centerActive].dataBoardId);Object(r["j"])(t).then(t=>{1==t.code&&(e.isStartPayBack=!1,this.isStartPayBack=!1,this.tabsMap.set(this.dataTopList[this.centerActive].dataBoardId,e))})},changeUpdateDataForm(){let t=this.tabsMap.get(this.dataTopList[this.centerActive].dataBoardId);t.modelForm=JSON.parse(JSON.stringify(this.modelForm)),this.tabsMap.set(this.dataTopList[this.centerActive].dataBoardId,t),this.modelForm.pageSize=this.modelForm.dataNum*this.modelForm.speed;let e={...this.modelForm,dataBoardId:this.dataTopList[this.centerActive].dataBoardId};Object(r["l"])({...e}).then(e=>{1==e.code&&(t.isStartPayBack?this.isEnd():this.tabsMap.set(this.dataTopList[this.centerActive].dataBoardId,t))})}}},h=d,m=(a("a496"),a("2877")),p=Object(m["a"])(h,s,i,!1,null,"383b11f1",null);e["default"]=p.exports},9493:function(t,e,a){},a496:function(t,e,a){"use strict";a("9493")}}]);
//# sourceMappingURL=chunk-8a5550be.802d2acc.js.map