From 1b95362f703fb5ec56632233dff44a1bddeff0a6 Mon Sep 17 00:00:00 2001 From: xiangxy Date: Mon, 1 Aug 2022 14:21:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/DeviceScreen.vue | 251 +++---------------------------------- 1 file changed, 14 insertions(+), 237 deletions(-) diff --git a/src/pages/DeviceScreen.vue b/src/pages/DeviceScreen.vue index b66176d..f8a742d 100644 --- a/src/pages/DeviceScreen.vue +++ b/src/pages/DeviceScreen.vue @@ -220,6 +220,7 @@ export default { data () { return { interTime: this.$store.getters.setTime, + timer1: null, timer2: null, timer4: null, timeOut1: null, @@ -347,15 +348,14 @@ export default { // array1: [{material_code: '001'}, {material_code: '001'}, {material_code: '001'}, {material_code: '001'}, {material_code: '001'}, {material_code: '001'}], // array2: [{material_code: '01'}, {material_code: '01'}, {material_code: '01'}, {material_code: '01'}], array1: [], - array2: [], - num: 800 + array2: [] } }, computed: { defaultOption1 () { return { step: 0.4, // 数值越大速度滚动越快 - limitMoveNum: this.num, // 开始无缝滚动的数据量 this.dataList.length + limitMoveNum: 5, // 开始无缝滚动的数据量 this.dataList.length hoverStop: true, // 是否开启鼠标悬停stop direction: 1, // 0向下 1向上 2向左 3向右 openWatch: true, // 开启数据实时监控刷新dom @@ -377,22 +377,17 @@ export default { } } }, - // created () { - // this.updateTime() - // this.timer = window.setInterval(this.updateTime, 1000) - // } - // beforeDestroy () { - // this.$once('hook:beforeDestroy', () => { - // clearInterval(this.timer) - // }) - // } created () { this.refresh() }, beforeDestroy () { this.$once('hook:beforeDestroy', () => { + clearInterval(this.timer1) clearInterval(this.timer2) - clearInterval(this.timer4) + clearInterval(this.interTime) + clearInterval(this.timeOut1) + clearInterval(this.timeOut2) + clearInterval(this.timeOut3) }) }, methods: { @@ -406,13 +401,16 @@ export default { this._deviceStatusList() // 中grid this._deviceErrorNum() this._deviceErrorInfo() // 右grid - this._errCensus() }, refresh () { this.initData() + this._errCensus() // 右下 this.timer2 = setInterval(() => { this.initData() }, this.interTime) + this.timer1 = setInterval(() => { + this._errCensus() + }, 60000) }, fontSize (res) { const clientWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth @@ -1199,18 +1197,6 @@ export default { borderColor: '#ffffff', containLabel: true }, - // legend: { - // top: 0, - // right: 0, - // textStyle: { - // color: '#ffffff', - // fontSize: 12, - // lineHeight: 20 - // }, - // itemGap: 20, - // itemHeight: 8, - // data: ['总库存'] - // }, xAxis: { type: 'category', axisTick: { @@ -1228,7 +1214,6 @@ export default { rotate: 50 }, data: names - // data: names.length >= 7 ? names.slice(0, 7) : names }, yAxis: { axisTick: { @@ -1284,7 +1269,6 @@ export default { }, // data: [100, 51, 90, 41, 91, 61, 51] data: total, - // data: total.length >= 7 ? total.slice(0, 7) : total, label: { show: true, position: 'top', @@ -1308,180 +1292,7 @@ export default { window.addEventListener('resize', () => { this.myCharts02.resize() }) - // if (names.length > 7) { - // let t = 1 - // let stotal = total.slice(0, 7) - // let snames = names.slice(0, 7) - // this.timer4 = setInterval(() => { - // stotal.shift() - // stotal.push(total[t + 6]) - // snames.shift() - // snames.push(names[t + 6]) - // this.myCharts02.setOption({ - // xAxis: { - // data: snames - // }, - // series: [ - // {data: stotal} - // ] - // }) - // if (t + 7 < names.length) { - // t++ - // } else { - // t = -6 - // } - // }, 2000) - // } }, - // setEchart002 () { - // // 左3 - // let total = [] - // let names = [] - // let max = 0 - // this.chartData1.map(el => { - // total.push(el.teep) - // names.push(el.workprocedure_name) - // max = Math.max(max, Number(el.teep)) - // }) - // let option = { - // grid: { - // top: 30, - // left: 0, - // right: 0, - // bottom: 0, - // borderColor: '#ffffff', - // containLabel: true - // }, - // // legend: { - // // top: 0, - // // right: 0, - // // textStyle: { - // // color: '#ffffff', - // // fontSize: 12, - // // lineHeight: 20 - // // }, - // // itemGap: 20, - // // itemHeight: 8, - // // data: ['总库存'] - // // }, - // xAxis: { - // type: 'category', - // axisTick: { - // show: false - // }, - // axisLine: { - // lineStyle: { - // color: '#8FABBF ', - // fontSize: 14, - // lineHeight: 14 - // } - // }, - // axisLabel: { - // color: '#8FABBF ', - // rotate: 50 - // }, - // // data: names - // data: names.length >= 7 ? names.slice(0, 7) : names - // }, - // yAxis: { - // axisTick: { - // show: false - // }, - // axisLine: { - // lineStyle: { - // color: '#909399' - // } - // }, - // // axisLabel: { - // // color: '#909399' - // // }, - // axisLabel: { - // formatter: '{value} %', - // textStyle: { - // color: '#8FABBF', - // fontSize: 14 - // } - // }, - // splitLine: { - // show: false, - // lineStyle: { - // type: [8, 4], - // dashOffset: 4, - // color: '#8FABBF', - // opacity: 0.2 - // } - // }, - // max: max - // }, - // series: [ - // { - // type: 'bar', - // barWidth: 8, - // itemStyle: { - // normal: { - // show: true, - // color: new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [ - // { - // offset: 0, - // color: '#0E90FD', - // opacity: 1 - // }, - // { - // offset: 1, - // color: 'rgba(96,112,128,0.10)', - // opacity: 0.1 - // } - // ]), - // borderWidth: 0 - // } - // }, - // // data: [100, 51, 90, 41, 91, 61, 51] - // // data: total, - // data: total.length >= 7 ? total.slice(0, 7) : total, - // label: { - // show: true, - // position: 'top', - // // distance: 5, - // // fontSize: 12, - // textStyle: { - // color: '#8FABBF', - // fontSize: 14 - // }, - // formatter: function (data) { - // return data.value + '%' - // } - // } - // } - // ] - // } - // let echart = document.getElementById('echart_d02') - // this.myCharts02 = this.$echarts.init(echart) - // this.myCharts02.setOption(option) - // if (names.length > 7) { - // let t = 1 - // let stotal = total.slice(0, 7) - // let snames = names.slice(0, 7) - // this.timer4 = setInterval(() => { - // stotal.shift() - // stotal.push(total[t + 6]) - // snames.shift() - // snames.push(names[t + 6]) - // this.myCharts02.setOption({ - // xAxis: { - // data: snames - // }, - // series: [ - // {data: stotal} - // ] - // }) - // if (t + 7 < names.length) { - // t++ - // } else { - // t = -6 - // } - // }, 2000) - // } - // }, setEchart10 () { // 右3 let total = [] @@ -1498,7 +1309,7 @@ export default { show: false, // 为true滚动条出现 type: 'slider', // type:'inside',滚动条在最下面,鼠标点击滚动 startValue: 0, // 从头开始。 - endValue: 6 // end百分比显示范围,endValue具体显示几个数值 + endValue: 9 // end百分比显示范围,endValue具体显示几个数值 } ], grid: { @@ -1526,7 +1337,6 @@ export default { rotate: 50 }, data: names - // data: names.length >= 7 ? names.slice(0, 7) : names }, yAxis: { axisTick: { @@ -1576,7 +1386,6 @@ export default { }, // data: [100, 51, 90, 41, 91, 61, 51] data: total - // data: total.length >= 7 ? total.slice(0, 7) : total } ] } @@ -1587,30 +1396,6 @@ export default { window.addEventListener('resize', () => { this.myCharts10.resize() }) - // if (names.length > 7) { - // let t = 1 - // let stotal = total.slice(0, 7) - // let snames = names.slice(0, 7) - // this.timer4 = setInterval(() => { - // stotal.shift() - // stotal.push(total[t + 6]) - // snames.shift() - // snames.push(names[t + 6]) - // this.myCharts10.setOption({ - // xAxis: { - // data: snames - // }, - // series: [ - // {data: stotal} - // ] - // }) - // if (t + 7 < names.length) { - // t++ - // } else { - // t = -6 - // } - // }, 2000) - // } }, autoMove (option, type) { if (type === 1) { @@ -1640,7 +1425,7 @@ export default { if (type === 3) { this.timeOut3 = setInterval(() => { if (Number(option.dataZoom[0].endValue) === option.series[0].data.length - 1) { - option.dataZoom[0].endValue = 6 + option.dataZoom[0].endValue = 9 option.dataZoom[0].startValue = 0 } else { option.dataZoom[0].endValue = option.dataZoom[0].endValue + 1 @@ -1681,7 +1466,6 @@ export default { async _deviceUseRate () { let res = await deviceUseRate() if (res.code === '1') { - // console.log(res.result) this.chartData1 = res.result if (res.result.length) { clearInterval(this.timeOut2) @@ -1696,7 +1480,6 @@ export default { async _oeeAndTeep () { let res = await oeeAndTeep() if (res.code === '1') { - // console.log(res.result) this.data03 = res.result this.setEchart03() // 中1 } else { @@ -1707,7 +1490,6 @@ export default { async _queryDeviceByWork () { let res = await queryDeviceByWork() if (res.code === '1') { - // console.log(res.result) this.xData = [] this.yData = [] this.taskDate = [] @@ -1730,7 +1512,6 @@ export default { async _deviceCensus () { let res = await deviceCensus() if (res.code === '1') { - // console.log(res.result) this.data05_d0 = [] this.data05_d1 = [] this.data05_d2 = [] @@ -1752,7 +1533,6 @@ export default { async _deviceStatusList () { let res = await deviceStatusList() if (res.code === '1') { - // console.log(res.result) // let colors = ['#2D7CEB', '#07E083', '#00D5FF', '#CC6060', '#fc0'] res.result.map((e, i) => { if (e.device_status === '02') { @@ -1782,7 +1562,6 @@ export default { if (res.code === '1') { this.data06_d0 = [] this.data06_d1 = [] - // console.log(res.result) res.result.map((e, i) => { this.data06_d0.push(e.device_name) this.data06_d1.push(e.err_num) @@ -1796,7 +1575,6 @@ export default { async _deviceErrorInfo () { let res = await deviceErrorInfo() if (res.code === '1') { - // console.log(res.result) this.array2 = res.result } else { this.Dialog(res.desc) @@ -1806,7 +1584,6 @@ export default { async _errCensus () { let res = await errCensus() if (res.code === '1') { - // console.log(res.result) this.chartData2 = res.result if (res.result.length) { clearInterval(this.timeOut3)