Files
UniversalTestSoftware/client/nginx/html/js/chunk-680637a4.76ec1040.js

2 lines
25 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-680637a4"],{3497: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("div",{staticClass:"items-box"},[t._v(t._s(s.dataBoardName))]),e("el-dropdown",{staticClass:"ml15",attrs:{trigger:"click"},nativeOn:{click:function(t){t.stopPropagation()}}},[t.centerActive===i?e("img",{staticClass:"icons pointer",attrs:{src:a("38d8"),alt:""}}):e("img",{staticClass:"icons pointer",attrs:{src:a("67a0"),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:{"node-key":"webKey",data:t.leftTDList,"expand-on-click-node":!1,props:t.defaultLeftProps,"show-checkbox":"","empty-text":"暂无协议参数","default-checked-keys":t.checkedList,"default-expanded-keys":t.firstLevelKeys},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",{staticClass:"fw-btn"},[e("el-button",{attrs:{type:"success"},on:{click:t.dataStatisticsClick}},[t._v("解析统计")]),2==t.dataBoardType||1==t.dataBoardType?e("el-button",{attrs:{type:"primary"},on:{click:t.updateFWClick}},[t._v("设置Y轴 ")]):t._e()],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:"200","show-overflow-tooltip":""}}),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&&t.numberPhyTypeList.includes(a.row.phyType)?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,1729430923)}),e("el-table-column",{attrs:{prop:"phyUnit",label:"物理单位",width:"100"}}),e("el-table-column",{attrs:{prop:"timePart",label:"时间",width:"200"}})],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()])]):t._e(),e("el-dialog",{attrs:{title:"数据解析统计",visible:t.showChannelDataStatisticsDialog,width:"60%","before-close":t.channelDataStatisticsDialogClose},on:{"update:visible":function(e){t.showChannelDataStatisticsDialog=e}}},[e("div",[e("div",{staticClass:"center-top-box"},[e("div",{staticClass:"center-top-list"},t._l(t.channelDataStatisticsList,(function(a,s){return e("div",{key:a.channelId,staticClass:"center-items",class:t.channelDataStatisticsIndex===s?"acitem":"",on:{click:function(e){return t.channelDataStatisticsItemClick(a,s)}}},[e("div",{staticClass:"items-box"},[t._v(t._s(a.channelName))])])})),0)]),e("div",{staticStyle:{"margin-top":"15px",display:"flex","align-items":"center","justify-content":"space-between"}},[t.channelDataStatisticsList.length>0?e("div",{staticStyle:{color:"white"}},[t._v(" 累计已接收字节数:"+t._s(t.channelDataStatisticsList[t.channelDataStatisticsIndex].dataByteCount)+" ")]):t._e(),e("div",[e("el-button",{attrs:{type:"danger"},on:{click:t.dataStatisticsClearClick}},[t._v("清除统计")])],1)]),e("el-table",{staticStyle:{width:"100%","margin-top":"15px"},attrs:{data:t.protocolStatisticsList,height:"450"}},[e("el-table-column",{attrs:{type:"index",label:"序号",width:"60"}}),e("el-table-column",{attrs:{prop:"protocolName",label:"协议名称"}}),e("el-table-column",{attrs:{prop:"parseCount",label:"解析命中次数",width:"180"}})],1)],1)])],1)},i=[],n=(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"),l=a("02c7"),c=a("e550"),r=a("0428"),h={components:{linechartEcharts:n["a"]},data(){return{connectionSymbol:r["a"],tableHeight:200,checkedList:[],dialogVisible:!1,leftRight:1,centerActive:0,defaultProps:{label:"label",children:"boardListVos"},defaultLeftProps:{label:"label",children:"children"},kbForm:{dataBoardName:"",dataBoardType:0,dataType:0},kbList:[],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,numberPhyTypeList:["int","float","double"],firstLevelKeys:[],channelDataStatisticsList:[],showChannelDataStatisticsDialog:!1,channelDataStatisticsIndex:0,protocolStatisticsList:[]}},mounted(){this.getTreeChannel(),this.getAllData(),window.addEventListener("resize",this.handleResize),c["a"].$on("protocolChanged",this.handleRefreshBoard)},beforeDestroy(){window.removeEventListener("resize",this.handleResize),c["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:{calcTableHeight(){0===this.dataBoardType?this.tableHeight=200:2===this.dataBoardType&&(this.tableHeight=window.innerHeight-160)},handleRefreshBoard(){this.getAllData()},changeColorOrLeftRight(t){Object(l["k"])({...t}).then(t=>{1==t.code&&this.getAllData(1)})},changeLeftRight(t,e){e.isLeftYaxis=t-0,Object(l["k"])({...e}).then(t=>{1==t.code&&this.getAllData(1)})},timestampToTime(t){10===t.toString().length&&(t*=1e3);const e=new Date(t),a=String(e.getHours()).padStart(2,"0"),s=String(e.getMinutes()).padStart(2,"0"),i=String(e.getSeconds()).padStart(2,"0"),n=String(e.getMilliseconds()).padStart(3,"0");return`${a}:${s}:${i}.${n}`},formatTimestamp(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"),n=String(a.getDate()).padStart(2,"0"),o=String(a.getHours()).padStart(2,"0"),l=String(a.getMinutes()).padStart(2,"0"),c=String(a.getSeconds()).padStart(2,"0");String(a.getMilliseconds()).padStart(3,"0");return`${s}-${i}-${n} ${o}:${l}:${c}`},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,n=e.minYAxisLeft||null,o=e.perTabLeftTree,l=e.iconsList,c={};l.forEach(t=>{e.checkedLeftList.includes(t)?c[t]=!0:c[t]=!1});let r=e.colorsList,h=[],d=[],p=[];o.forEach(t=>{t.children&&t.children.length>0&&t.children.forEach(t=>{p=[...p,t.children];let e=this.channelMap.get(t.channelId+"#"+t.protocolId);e?(h=h.concat(e.timeArr),h=Array.from(new Set(h)),d=d.concat(e.seriesData)):(h=[],d=[])})});const m={color:r,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:l,selected:c,left:"100",type:"scroll"},xAxis:[{type:"category",boundaryGap:!1,data:h}],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:n,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.chart.setOption(m,t)},handleResize(){this.chart&&this.chart.resize(),this.calcTableHeight()},centerClick(t,e){this.centerActive=e,this.dataBoardType=t.dataBoardType,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(l["f"])({dataType:0});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=[],n=[];t.dataBoardChannelList.forEach(t=>{let e=[],a=[],s=[];t.protocolNameList.forEach(t=>{t.parameterList.forEach(t=>{e.push(t.protocolName+this.connectionSymbol+t.parameter),a.push(t.protocolName+this.connectionSymbol+t.parameter),s.push(t.legendColor)})}),i=i.concat(a),n=n.concat(s)}),this.tabsMap.set(t.dataBoardId,{minYAxisLeft:null,maxYAxisLeft:null,maxYAxisRight:null,minYAxisRight:null,colorsList:n,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.leftTDList.length>0&&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(l["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:0,channelList:[]};Object(l["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=0},kbSure(){let t={...this.kbForm,channelList:this.kbList};Object(l["h"])(t).then(t=>{1==t.code&&(this.$message.success("操作成功!"),this.getAllData(2),this.kbCancelClick())})},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/data`;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);console.log(a,"websocketwebsocketwebsocketwebsocketwebsocket");let s=a.channelId,i=a.protocolId,n=a.filedParseDataList||[];n=n.map((t,e)=>({...t,id:s+t.readName,timePart:this.formatTimestamp(a.timestamp)}));let o=[],l=[],c=[],r=this.channelMap.get(s+"#"+i);r?(l=r.timeArr,l.push(this.formatTimestamp(a.timestamp)),o=r.seriesData):l.push(this.formatTimestamp(a.timestamp));let h=this.tabsMap.get(this.dataTopList[this.centerActive].dataBoardId),d=h.perTabLeftTree||[],p=[],m=this.getProtocolName(s,i,d);d.forEach(t=>{if(t.channelId==s){p=t.parameterList,c=[...n];let e=c.filter(t=>this.checkedList.includes(m+this.connectionSymbol+t.readName));e.forEach(t=>{let e=this.tableData.filter(e=>e.name==m+this.connectionSymbol+t.readName)||[];e.length<1?this.tableData.push({...t,name:m+this.connectionSymbol+t.readName}):(this.tableData.forEach((a,s)=>{a.name==m+this.connectionSymbol+e[0].readName&&this.$set(this.tableData,s,{...t,name:m+this.connectionSymbol+t.readName})}),this.tableData=[...this.tableData])})}}),0==o.length?n.forEach((t,e)=>{o.push({name:m+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})}):o=o.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 g={timeArr:Array.from(new Set(l)),seriesData:o};this.channelMap.set(s+"#"+i,g),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)},dataStatisticsClick(){this.getChannelDataStatistics(),this.showChannelDataStatisticsDialog=!0},channelDataStatisticsItemClick(t,e){this.channelDataStatisticsIndex=e},getChannelDataStatistics(){let t=this.dataTopList[this.centerActive];Object(l["e"])({dataBoardId:t.dataBoardId}).then(e=>{if(1===e.code){this.channelDataStatisticsList=e.data||[];let a=t.dataBoardChannelList||[],s=new Map;a.forEach(t=>{s.set(t.channelId,t)}),this.channelDataStatisticsList.forEach(t=>{let e=new Map;if(s.has(t.channelId)){let a=s.get(t.channelId);t.channelName=a.channelName;let i=a.protocolNameList||[];i.forEach(t=>{e.set(t.protocolId,t)})}let a=this.channelDataStatisticsList[this.channelDataStatisticsIndex];t.channelId===a.channelId&&(this.protocolStatisticsList=t.protocolStatisticsList||[],this.protocolStatisticsList.forEach(t=>{if(e.has(t.protocolId)){let a=e.get(t.protocolId);t.protocolName=a.protocolName}}))}),setTimeout(()=>{this.showChannelDataStatisticsDialog&&this.getChannelDataStatistics()},500)}})},dataStatisticsClearClick(){this.$confirm("确定清除该通道接收流量统计及绑定协议解析命中次数?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(()=>{let t=this.channelDataStatisticsList[this.channelDataStatisticsIndex];Object(l["b"])({channelId:t.channelId}).then(t=>{1===t.code&&this.$message.success("清除成功")})}).catch(()=>{})},channelDataStatisticsDialogClose(){this.showChannelDataStatisticsDialog=!1}}},d=h,p=(a("ad9d"),a("2877")),m=Object(p["a"])(d,s,i,!1,null,"81f86158",null);e["default"]=m.exports},"38d8":function(t,e){t.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAApSURBVDiNY2AY8oARxvj//78bSRoZGXcxMDAwMNHCVfQFo2EwGgZUAQCcUQwKiaJQdAAAAABJRU5ErkJggg=="},"67a0":function(t,e){t.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAAqSURBVDiNY2AY8oARxth89H8DKRp9rRkbGBgYGJho4Sr6gtEwGA0DqgAAcZEMCq+lKRgAAAAASUVORK5CYII="},ad9d:function(t,e,a){"use strict";a("eaad")},eaad:function(t,e,a){}}]);
//# sourceMappingURL=chunk-680637a4.76ec1040.js.map