{"remainingRequest":"D:\\jenkins\\workspace\\sfz-lh-fvue\\node_modules\\thread-loader\\dist\\cjs.js!D:\\jenkins\\workspace\\sfz-lh-fvue\\node_modules\\babel-loader\\lib\\index.js!D:\\jenkins\\workspace\\sfz-lh-fvue\\node_modules\\cache-loader\\dist\\cjs.js??ref--0-0!D:\\jenkins\\workspace\\sfz-lh-fvue\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\sfz-lh-fvue\\src\\views\\BigScreen\\homePage.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\sfz-lh-fvue\\src\\views\\BigScreen\\homePage.vue","mtime":1715713737026},{"path":"D:\\jenkins\\workspace\\sfz-lh-fvue\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\sfz-lh-fvue\\node_modules\\thread-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\sfz-lh-fvue\\node_modules\\babel-loader\\lib\\index.js","mtime":315532800000},{"path":"D:\\jenkins\\workspace\\sfz-lh-fvue\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\sfz-lh-fvue\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["import \"core-js/modules/es6.regexp.replace\";\nimport \"core-js/modules/es6.regexp.split\";\nimport \"core-js/modules/es6.function.name\";\nimport \"core-js/modules/web.dom.iterable\";\nimport _toConsumableArray from \"D:/jenkins/workspace/sfz-lh-fvue/node_modules/@babel/runtime/helpers/esm/toConsumableArray\";\nimport _defineProperty from \"D:/jenkins/workspace/sfz-lh-fvue/node_modules/@babel/runtime/helpers/esm/defineProperty\";\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\nimport headline from \"./headline.vue\";\nimport iframeComp from \"./3DModel/iframeComp.vue\";\nimport threeDModel from \"./3DModel/modelIndex.vue\";\nimport * as echarts from 'echarts';\nimport VueSeamlessScroll from 'vue-seamless-scroll';\nimport commonAPI from '@/api/bigScreen/common.js';\nimport moment from 'moment';\nimport utils from '@/utils'; // import player from '@/views/Normal/components/videoPlayerDH.vue'\n\nimport player from '@/views/Normal/components/videoPlayerHK.vue';\nimport deviceAPI from '@/api/DeviceManagement/device.js';\nexport default {\n components: {\n headline: headline,\n threeDModel: threeDModel,\n VueSeamlessScroll: VueSeamlessScroll,\n iframeComp: iframeComp,\n player: player\n },\n name: 'homePage',\n data: function data() {\n var _ref;\n\n return _ref = {\n modelType: 'T',\n // T - threeJS U - UE\n showDataPage: true,\n wrapperName: 'dialog-video-container',\n test: [],\n tollStationId: '',\n pageQuery: {\n pageBean: {\n page: 1,\n pageSize: -1\n },\n querys: [{\n group: 'main',\n operation: 'EQUAL',\n parentGroup: '',\n property: 'toll_station_id_',\n relation: 'AND',\n value: ''\n }]\n },\n actualityMoney: 0,\n //当日通讯费\n carFlow: 0,\n //当日车流量\n responseName: '',\n //值班人员\n responseTel: '',\n //值班电话\n laneDataTotal: 0,\n // 车道总数\n laneDataETC: 0,\n //ETC车道\n laneDataMixin: 0,\n //混合车道\n onlineDevice: 0,\n //在线设备\n offlineDevice: 0,\n //离线设备\n faultDevice: 0,\n //故障设备\n onlineRate: 0,\n //设备在线率\n transitTimeTotal: 0,\n // 通行时间 单位秒\n transitTime: {\n minute: '00',\n second: '00'\n },\n transactionRate: {\n int: '00',\n decimal: '00'\n },\n carType: [],\n // 车辆类型字典\n pieChart: null,\n pieData: [],\n pieOption: null,\n gaugeChart: null,\n // 设备在线率\n gaugeData: [{\n value: 0\n }],\n gaugeOption: null,\n curIndex: 0,\n loadObj: {\n scrollListData: false,\n scrollFaultData: false,\n laneData: false,\n gauge: false,\n pieData: false\n },\n loadingColor: 'rgba(6, 46, 106, 0.01)',\n scrollheader: [{\n name: '时间',\n width: '34%'\n }, {\n name: '车道',\n width: '20%'\n }, {\n name: '车牌',\n width: '22%'\n }, {\n name: '金额',\n width: '24%'\n }],\n scrollListData: [],\n // 设备列表\n activeBtn: 'video',\n showDevice: false,\n btnType: [],\n checkListLane: [],\n // 车道选择\n checkListDevice: [],\n // 设备选择\n activeDeviceList: [],\n //选中设备和车道\n laneData: [{\n id: 1,\n laneName: '出口-车道-ETC车道1',\n status: 'normal'\n }, {\n id: 2,\n laneName: '出口-车道-ETC车道2',\n status: 'normal'\n }, {\n id: 3,\n laneName: '出口-车道-混合车道1',\n status: 'normal'\n }, {\n id: 4,\n laneName: '出口-车道-混合车道2',\n status: 'normal'\n }, {\n id: 5,\n laneName: '入口-车道-ETC车道1',\n status: 'normal'\n }, {\n id: 6,\n laneName: '入口-车道-ETC车道2',\n status: 'normal'\n }, {\n id: 7,\n laneName: '入口-车道-混合车道1',\n status: 'normal'\n }, {\n id: 8,\n laneName: '入口-车道-混合车道2',\n status: 'normal'\n }],\n //车道运行数据\n deviceFaultData: []\n }, _defineProperty(_ref, \"gaugeChart\", null), _defineProperty(_ref, \"activeVideo\", null), _defineProperty(_ref, \"videoDialog\", false), _defineProperty(_ref, \"reconnectCount\", 0), _ref;\n },\n computed: {\n optionSingleHeightTime: function optionSingleHeightTime() {\n return {\n step: 0.5\n };\n }\n },\n created: function created() {\n this.tollStationId = sessionStorage.getItem('tollStationId');\n this.heartCheckFun();\n this.initWebSocket();\n },\n mounted: function mounted() {\n var _this = this;\n\n this.getData();\n this.btnType = utils.getDictItemsFromCache('sblx');\n\n if (this.$route.query && this.$route.query.videoIP) {\n // let cameraCode = this.$route.query.cameraCode\n // ? this.$route.query.cameraCode\n // : 1\n // let data = {\n // ip: this.$route.query.videoIP,\n // cameraCode: cameraCode,\n // }\n var queryData = {\n pageBean: {\n page: 1,\n pageSize: -1,\n showTotal: true\n },\n querys: [{\n group: 'main',\n operation: 'EQUAL',\n parentGroup: '',\n property: 'ip',\n relation: 'AND',\n value: this.$route.query.videoIP\n }]\n };\n deviceAPI.queryDeviceList(queryData).then(function (res) {\n console.log(res, res.state, 'cameraCode');\n\n if (res.state) {\n var rows = res.value && res.value.rows;\n var data = rows[0];\n\n if (data && data.ip) {\n _this.handlePlay(data);\n } else {\n _this.$message.warning('获取摄像机数据视频失败!');\n }\n } else {\n _this.$message.warning('获取摄像机数据视频失败!');\n }\n }).catch(function (err) {\n _this.$message.warning('获取摄像机数据视频失败!' + err);\n });\n }\n },\n activated: function activated() {// 组件keepalive 页面显示时重新加载数据\n // this.initDevice()\n },\n methods: {\n handleShowType: function handleShowType() {\n this.showDataPage = !this.showDataPage;\n },\n handleModelType: function handleModelType() {\n if (this.modelType == 'T') {\n this.modelType = 'U';\n } else {\n this.modelType = 'T';\n }\n },\n getDictName: function getDictName(code, value) {\n return utils.getDictName(code, value);\n },\n handlePlay: function handlePlay(device) {\n var _this2 = this;\n\n this.activeVideo = device;\n this.videoDialog = true;\n this.$nextTick(function () {\n _this2.$refs.player.getVideoURL(device.cameraCode);\n });\n },\n handleVideoDialogClose: function handleVideoDialogClose() {\n var _this3 = this;\n\n this.$nextTick(function () {\n _this3.$refs.player.stop();\n });\n this.videoDialog = false;\n },\n initDevice: function initDevice() {\n this.showDevice = false;\n this.checkListLane = []; // 车道选择\n\n this.checkListDevice = []; // 设备选择\n\n this.activeDeviceList = []; //选中设备和车道\n },\n changeDeviceList: function changeDeviceList() {\n this.activeDeviceList = [].concat(_toConsumableArray(this.checkListLane), _toConsumableArray(this.checkListDevice));\n this.$refs.model.changeDevice(this.activeDeviceList);\n },\n initPieData: function initPieData() {\n var _this4 = this;\n\n this.carType = utils.getDictItemsFromCache('cllx');\n this.pieData = [];\n this.carType.forEach(function (item) {\n _this4.pieData.push({\n value: 0,\n name: item.name,\n dictValue: item.value\n });\n });\n },\n getData: function getData() {\n this.tollStationId = sessionStorage.getItem('tollStationId');\n var tollStationData = this.qs.stringify({\n id: this.tollStationId\n });\n this.pageQuery.querys[0].value = this.tollStationId;\n this.initPieData();\n this.getLeftData1(tollStationData); // 通行费车流量\n\n this.getLaneData(); // 车道数量统计\n\n this.successRate(tollStationData); // 交易成功率\n\n this.getCarTypeData(tollStationData); // 车辆分类\n\n this.getCarList(); // 车辆记录\n\n this.getDeviceData(); // 设备统计\n\n this.getLaneState(); // 车道运行情况\n\n this.getDeviceFaultData(); //设备运行情况\n },\n getDataLeft: function getDataLeft() {\n this.tollStationId = sessionStorage.getItem('tollStationId');\n var tollStationData = this.qs.stringify({\n id: this.tollStationId\n });\n this.pageQuery.querys[0].value = this.tollStationId;\n this.initPieData();\n this.getLeftData1(tollStationData); // 通行费车流量\n\n this.getLaneData(); // 车道数量统计\n\n this.successRate(tollStationData); // 交易成功率\n\n this.getCarTypeData(tollStationData); // 车辆分类\n\n this.getCarList(); // 车辆记录\n },\n getDataRight: function getDataRight() {\n console.log(11);\n this.tollStationId = sessionStorage.getItem('tollStationId');\n var tollStationData = this.qs.stringify({\n id: this.tollStationId\n });\n this.pageQuery.querys[0].value = this.tollStationId;\n this.getDeviceData(); // 设备统计\n\n this.getLaneState(); // 车道运行情况\n\n this.getDeviceFaultData(); //设备运行情况\n },\n // 通行费车流量\n getLeftData1: function getLeftData1(data) {\n var _this5 = this;\n\n this.carFlow = 0;\n this.actualityMoney = 0;\n commonAPI.getChargeAndCarFlow(data).then(function (res) {\n if (res.value && res.value.length) {\n _this5.actualityMoney = res.value[0].money ? res.value[0].money : 0;\n _this5.carFlow = res.value[0].carAmount ? res.value[0].carAmount : 0;\n }\n });\n },\n // 车道\n getLaneData: function getLaneData() {\n var _this6 = this;\n\n this.laneDataETC = 0;\n this.laneDataMixin = 0;\n this.laneDataTotal = 0;\n commonAPI.getLaneData(this.pageQuery).then(function (res) {\n if (res.value) {\n res.value.forEach(function (item) {\n if (item.type && item.type == 1) {\n _this6.laneDataETC = item.amount;\n }\n\n if (item.type && item.type == 2) {\n _this6.laneDataMixin = item.amount;\n }\n\n if (item.totalAmount) {\n _this6.laneDataTotal = item.totalAmount;\n }\n });\n }\n });\n },\n // 交易成功率\n successRate: function successRate(data) {\n var _this7 = this;\n\n this.transactionRate.int = '00';\n this.transactionRate.decimal = '00';\n commonAPI.getSuccessRate(data).then(function (res) {\n if (res.value && res.value.identityRate) {\n var tempData = (res.value.identityRate + '').split('.');\n _this7.transactionRate.int = tempData[0] ? tempData[0] + '' : '00';\n _this7.transactionRate.decimal = tempData[1] ? tempData[1] + '' : '00';\n }\n });\n },\n // 车辆分类\n getCarTypeData: function getCarTypeData(data) {\n var _this8 = this;\n\n this.loadObj.pieData = true;\n commonAPI.getCarTypeData(data).then(function (res) {\n if (res.value && res.value.length) {\n res.value.forEach(function (item) {\n _this8.pieData.forEach(function (type) {\n if (item.carType && type.dictValue == item.carType) {\n type.value = item.amount;\n }\n });\n });\n }\n\n _this8.loadObj.pieData = false;\n\n _this8.drawPieChart();\n });\n },\n // 车辆记录\n getCarList: function getCarList() {\n var _this9 = this;\n\n this.loadObj.scrollListData = true;\n this.scrollListData = [];\n var queryData = {\n pageBean: {\n page: 1,\n pageSize: 100\n },\n querys: [{\n group: 'main',\n operation: 'EQUAL',\n parentGroup: '',\n property: 'toll_station_id_',\n relation: 'AND',\n value: this.tollStationId\n }],\n sorter: [{\n direction: 'DESC',\n property: 'endTime'\n }]\n };\n commonAPI.getCarList(queryData).then(function (res) {\n if (res.value) {\n _this9.scrollListData = res.value.rows || [];\n _this9.loadObj.scrollListData = false;\n }\n });\n },\n // 设备运行情况\n getDeviceData: function getDeviceData() {\n var _this10 = this;\n\n this.onlineDevice = 0;\n this.offlineDevice = 0;\n this.faultDevice = 0;\n this.onlineRate = 0;\n this.gaugeData = [{\n value: 0\n }];\n commonAPI.getDeviceData(this.pageQuery).then(function (res) {\n if (res.value) {\n res.value.forEach(function (item) {\n if (item.status && item.status == 1) {\n _this10.onlineDevice = item.amount;\n }\n\n if (item.status && item.status == 2) {\n _this10.offlineDevice = item.amount;\n }\n\n if (item.status && item.status == 3) {\n _this10.faultDevice = item.amount;\n }\n\n if (item.totalAmount) {\n _this10.onlineRate = (_this10.onlineDevice / item.totalAmount).toFixed(4);\n _this10.gaugeData = [{\n value: _this10.onlineRate\n }];\n }\n });\n }\n\n _this10.drawGaugeeChart();\n });\n },\n // 车道运行情况\n getLaneState: function getLaneState() {\n var _this11 = this;\n\n this.loadObj.laneData = true;\n var tollStationData = this.qs.stringify({\n tollStationId: this.tollStationId\n });\n commonAPI.getLaneState(tollStationData).then(function (res) {\n if (res.value && res.value.length) {\n _this11.laneData = res.value;\n }\n }).finally(function () {\n _this11.loadObj.laneData = false;\n });\n },\n // 设备运行情况\n getDeviceFaultData: function getDeviceFaultData() {\n var _this12 = this;\n\n this.loadObj.scrollFaultData = true;\n this.deviceFaultData = [];\n var data = {\n pageBean: {\n page: 1,\n pageSize: 100\n },\n querys: [{\n group: 'main',\n operation: 'EQUAL',\n parentGroup: '',\n property: 'toll_station_id_',\n relation: 'AND',\n value: this.tollStationId\n }, {\n group: 'main',\n operation: 'EQUAL',\n parentGroup: '',\n property: 'state_',\n relation: 'AND',\n value: 0\n }],\n sorter: [{\n direction: 'DESC',\n property: 'hitchDate'\n }]\n };\n commonAPI.getDeviceFaultData(data).then(function (res) {\n if (res.value && res.value.rows) {\n _this12.deviceFaultData = res.value.rows;\n }\n }).finally(function () {\n _this12.loadObj.scrollFaultData = false;\n });\n },\n getDeviceList: function getDeviceList() {\n var _this13 = this;\n\n this.loadObj.scrollListData = true;\n this.scrollListData = [];\n commonAPI.getDeviceList(this.pageQuery).then(function (res) {\n if (res.value) {\n _this13.scrollListData = res.value.rows || [];\n }\n }).finally(function () {\n _this13.loadObj.scrollListData = false;\n });\n },\n formatStatus: function formatStatus(status) {\n var label;\n\n if (status == 1) {\n label = '正常';\n } else if (status == 2) {\n label = '离线';\n } else if (status == 3) {\n label = '故障';\n }\n\n return label;\n },\n handleBtnChang: function handleBtnChang(key) {\n this.activeBtn = key;\n },\n drawPieChart: function drawPieChart() {\n var _this14 = this;\n\n // chart 已存在则为更新数据\n if (this.pieChart) {\n this.pieOption.series[0].data = this.pieData;\n this.pieChart.setOption(this.pieOption);\n } else {\n // chart 不存在则为初始化数据和图表\n this.pieChart = echarts.init(document.getElementById('pie-chart'));\n this.pieOption = {\n title: {\n text: this.pieData[0].value + ' 辆',\n subtext: this.pieData[0].name,\n x: 'center',\n y: '36%',\n textStyle: {\n color: '#fff',\n fontSize: '16px',\n lineHeight: 5\n },\n subtextStyle: {\n color: '#fff',\n fontSize: '12px'\n }\n },\n color: ['#3399FF', '#FD9854', '#55EDB0', '#F4DE79'],\n tooltip: {\n trigger: 'item',\n backgroundColor: 'rgba(13, 79, 145, 0.9)',\n borderColor: '#3399FF',\n confine: true,\n textStyle: {\n color: '#fff'\n },\n formatter: '{a}
{b} : {c}辆 ({d}%)'\n },\n series: [{\n name: '车辆类型',\n type: 'pie',\n radius: ['65%', '86%'],\n center: ['50%', '50%'],\n data: this.pieData,\n label: {\n show: false\n },\n startAngle: 180,\n itemStyle: {\n borderColor: '#4d5664',\n //'#1c2838',\n borderWidth: 4\n }\n }]\n };\n this.pieOption && this.pieChart.setOption(this.pieOption);\n window.addEventListener('resize', function () {\n return _this14.pieChart.resize();\n });\n this.intervalPie();\n }\n\n this.pieChart.dispatchAction({\n type: 'highlight',\n seriesIndex: 0,\n dataIndex: this.curIndex\n });\n },\n drawGaugeeChart: function drawGaugeeChart() {\n var _this15 = this;\n\n // chart 已存在则为更新数据\n if (this.gaugeChart) {\n this.gaugeOption.series[0].data = this.gaugeData;\n this.gaugeChart.setOption(this.gaugeOption);\n } else {\n // chart 不存在则为初始化数据和图表\n this.gaugeChart = echarts.init(document.getElementById('gauge'));\n this.gaugeOption = {\n series: [{\n type: 'gauge',\n startAngle: 225,\n endAngle: -45,\n center: ['50%', '50%'],\n radius: '80%',\n min: 0,\n max: 1,\n axisLine: {\n lineStyle: {\n width: 8,\n color: [[1, '#3d4953']]\n }\n },\n itemStyle: {\n color: '#49cc97'\n },\n progress: {\n show: true,\n roundCap: false,\n width: 8\n },\n pointer: {\n show: false\n },\n axisTick: {\n show: false\n },\n splitLine: {\n show: false\n },\n axisLabel: {\n show: false\n },\n title: {\n offsetCenter: [0, '-10%'],\n fontSize: 20\n },\n detail: {\n fontSize: 26,\n offsetCenter: [0, 0],\n valueAnimation: true,\n formatter: function formatter(value) {\n return (value * 100).toFixed(2) + '%';\n },\n color: 'inherit'\n },\n data: this.gaugeData\n }]\n };\n this.gaugeOption && this.gaugeChart.setOption(this.gaugeOption);\n window.addEventListener('resize', function () {\n return _this15.gaugeChart.resize();\n });\n }\n },\n intervalPie: function intervalPie() {\n var _this16 = this;\n\n setInterval(function () {\n _this16.pieChart.dispatchAction({\n type: 'downplay',\n seriesIndex: 0,\n dataIndex: _this16.curIndex\n });\n\n _this16.curIndex++;\n\n if (_this16.curIndex >= _this16.pieData.length) {\n _this16.curIndex = 0;\n }\n\n _this16.pieChart.dispatchAction({\n type: 'highlight',\n seriesIndex: 0,\n dataIndex: _this16.curIndex\n }); // 故障统计跟随变化统计数量已经名称\n\n\n _this16.pieOption.title.text = _this16.pieData[_this16.curIndex].value + ' 辆';\n _this16.pieOption.title.subtext = _this16.pieData[_this16.curIndex].name;\n _this16.pieOption && _this16.pieChart.setOption(_this16.pieOption);\n }, 5000);\n },\n // websocket 刷新数据\n heartCheckFun: function heartCheckFun() {\n var _this17 = this;\n\n //心跳检测,每30秒心跳一次\n this.heartCheck = {\n timeout: 1000 * 30,\n timeoutObj: null,\n serverTimeoutObj: null,\n reset: function reset() {\n clearTimeout(_this17.timeoutObj);\n\n _this17.heartCheck.start();\n\n return _this17;\n },\n start: function start() {\n _this17.timeoutObj = setTimeout(function () {\n //这里发送一个心跳,后端收到后,返回一个心跳消息,\n //onmessage拿到返回的心跳就说明连接正常\n _this17.websocketSend('{\"messageType\":\"ping\",\"message\":\"web\"}');\n\n console.info('客户端发送心跳');\n }, _this17.timeout);\n }\n };\n },\n websocketOnclose: function websocketOnclose(e) {\n console.log('connection closed (' + e.code + ')');\n this.reconnect();\n },\n websocketSend: function websocketSend(text) {\n // 数据发送\n try {\n this.websock.send(text);\n } catch (err) {\n console.log('send failed (' + err.code + ')');\n }\n },\n reconnect: function reconnect() {\n var _this18 = this;\n\n if (this.lockReconnect) return;\n this.lockReconnect = true; //没连接上会一直重连,设置延迟避免请求过多,重试3次结束链接\n\n if (this.reconnectCount < 3) {\n setTimeout(function () {\n console.info('尝试重连...');\n\n _this18.initWebSocket();\n\n _this18.lockReconnect = false;\n _this18.reconnectCount++;\n console.log(_this18.reconnectCount, 'this.reconnectCount');\n }, 5000);\n }\n },\n initWebSocket: function initWebSocket() {\n // WebSocket与普通的请求所用协议有所不同,ws等同于http,wss等同于https\n var url = window.context.WebSocket.replace('https://', 'wss://').replace('http://', 'ws://') + '/websocket';\n console.log(url, 'url');\n this.websock = new WebSocket(url);\n this.websock.onopen = this.websocketOnopen;\n this.websock.onerror = this.websocketOnerror;\n this.websock.onmessage = this.websocketOnmessage;\n this.websock.onclose = this.websocketOnclose;\n },\n websocketOnopen: function websocketOnopen() {\n console.log('WebSocket连接成功');\n this.heartCheck.start();\n },\n websocketOnerror: function websocketOnerror(e) {\n console.log(e, 'WebSocket连接发生错误');\n this.reconnect();\n },\n websocketOnmessage: function websocketOnmessage(e) {\n var data = JSON.parse(e.data); //解析对象 eval('(' + e.data + ')');\n\n console.log('-----接收消息-------', e.data, data); // 请求数据刷新\n\n if (data['Station_Trans'] == 'Station_Trans') {\n this.getDataLeft();\n }\n\n if (data['Station_Device'] == 'Station_Device') {\n this.getDataRight();\n } // 模型触发视频播放\n\n\n if (data && data.cameraCode) {\n this.handlePlay(data);\n }\n\n this.heartCheck.reset();\n }\n }\n};",null]}