panxiandiao_i 5 rokov pred
rodič
commit
2a23256c93
1 zmenil súbory, kde vykonal 59 pridanie a 35 odobranie
  1. 59 35
      src/views/quality/qualityMeasurement.vue

+ 59 - 35
src/views/quality/qualityMeasurement.vue

@@ -510,10 +510,36 @@ export default {
       curIndex: 1,
       pageSize: 10,
       total: 0,
+      totalOneEcharts: '',
+      totalOneEchartsMount: '',
+      totalOneEchartsRate: '',
+      totalOneEchartsOnline: '',
       dealWithBusinessDate: [],
       timeInterval: [new Date().getTime() - 7 * 24 * 60 * 60 * 1000, new Date().getTime()]
     }
   },
+  computed: {
+    isClosed() {
+      return this.$store.state.app.sidebar.opened
+    }
+  },
+  watch: {
+    isClosed(New, old) {
+      setTimeout(() => {
+        const myEvent = new Event('resize')
+        window.dispatchEvent(myEvent)
+      }, 230)
+      // // console.log(New)
+      // // console.log(this.totalOneEcharts, this.totalOneEchartsMount, this.totalOneEchartsRate, this.totalOneEchartsOnline)
+      // // window.addEventListener('resize', () => {
+      // this.totalOneEcharts.resize()
+      // this.totalOneEchartsMount.resize()
+      // console.log(1)
+      // this.totalOneEchartsRate.resize()
+      // this.totalOneEchartsOnline.resize()
+      // })
+    }
+  },
   created() {
     this._initBusinessTreeAndBeginInfo()
   },
@@ -524,6 +550,7 @@ export default {
     // 点击头部导航栏显示默认数据
     async _initBusinessTreeAndBeginInfo() {
       this.loadingOnlineProcess = true
+      // console.log(this.$store.state.app.sidebar.opened)
       await getBusiness().then(res => {
         res.code === 0 ? this.businessData = res.data : this.errorFun(res.msg)
         const processFunc = (arr) => { // modules和child
@@ -639,11 +666,11 @@ export default {
               [pauseArr[0]]: this.visualizationData[index].totalOnlineNum
             }))
             this.$nextTick(() => {
-              const totalOneEcharts = echarts.init(document.getElementById('comparatorBetween'))
-              const totalOneEchartsMount = echarts.init(document.getElementById('comparatorMountBetween'))
-              const totalOneEchartsRate = echarts.init(document.getElementById('comparatorRateBetween'))
+              this.totalOneEcharts = echarts.init(document.getElementById('comparatorBetween'))
+              this.totalOneEchartsMount = echarts.init(document.getElementById('comparatorMountBetween'))
+              this.totalOneEchartsRate = echarts.init(document.getElementById('comparatorRateBetween'))
               // const totalOneEchartsOnline = echarts.init(document.getElementById('comparatorOnlineBetween'))
-              totalOneEcharts.setOption({
+              this.totalOneEcharts.setOption({
                 legend: {},
                 tooltip: {},
                 grid: { containLabel: true },
@@ -659,7 +686,7 @@ export default {
                   { type: 'bar' }
                 ]
               })
-              totalOneEchartsMount.setOption({
+              this.totalOneEchartsMount.setOption({
                 legend: {},
                 tooltip: {},
                 grid: { containLabel: true },
@@ -677,7 +704,7 @@ export default {
                   { type: 'bar' }
                 ]
               })
-              totalOneEchartsRate.setOption({
+              this.totalOneEchartsRate.setOption({
                 legend: {},
                 tooltip: {},
                 grid: { containLabel: true },
@@ -695,12 +722,11 @@ export default {
                   { type: 'bar' }
                 ]
               })
-              window.onresize = () => {
-                totalOneEcharts.resize()
-                totalOneEchartsMount.resize()
-                totalOneEchartsRate.resize()
-              // totalOneEchartsOnline.resize()
-              }
+              window.addEventListener('resize', () => {
+                this.totalOneEcharts.resize()
+                this.totalOneEchartsMount.resize()
+                this.totalOneEchartsRate.resize()
+              })
             })
           }
           if (resProblem.data === null || resProblem.data.length === 0) {
@@ -720,8 +746,8 @@ export default {
             // this.seriesDeal[0].type = 'line'
             // this.seriesDeal[0].data = pauseArr
             this.$nextTick(() => {
-              const totalOneEchartsOnline = echarts.init(document.getElementById('comparatorOnlineBetween'))
-              totalOneEchartsOnline.setOption({
+              this.totalOneEchartsOnline = echarts.init(document.getElementById('comparatorOnlineBetween'))
+              this.totalOneEchartsOnline.setOption({
                 legend: {},
                 tooltip: {},
                 grid: { containLabel: true },
@@ -737,9 +763,9 @@ export default {
                   { type: 'bar' }
                 ]
               })
-              window.onresize = () => {
-                totalOneEchartsOnline.resize()
-              }
+              window.addEventListener('resize', () => {
+                this.totalOneEchartsOnline.resize()
+              })
             })
           }
         } else {
@@ -781,11 +807,11 @@ export default {
               data: this.visualizationData.map(eachData => eachData.totalOnlineNum)
             }))
             this.$nextTick(() => {
-              const totalOneEcharts = echarts.init(document.getElementById('totalShow'))
-              const totalOneEchartsMount = echarts.init(document.getElementById('totalShowMount'))
-              const totalOneEchartsRate = echarts.init(document.getElementById('totalShowRate'))
+              this.totalOneEcharts = echarts.init(document.getElementById('totalShow'))
+              this.totalOneEchartsMount = echarts.init(document.getElementById('totalShowMount'))
+              this.totalOneEchartsRate = echarts.init(document.getElementById('totalShowRate'))
               // const totalOneEchartsOnline = echarts.init(document.getElementById('totalShowOnline'))
-              totalOneEcharts.setOption({
+              this.totalOneEcharts.setOption({
                 tooltip: { trigger: 'axis' },
                 legend: { data: pauseArr },
                 grid: { containLabel: true },
@@ -793,7 +819,7 @@ export default {
                 yAxis: { type: 'value' },
                 series: this.seriesDeal
               })
-              totalOneEchartsMount.setOption({
+              this.totalOneEchartsMount.setOption({
                 tooltip: { trigger: 'axis' },
                 legend: { data: pauseArrOthersMount },
                 grid: { containLabel: true },
@@ -801,7 +827,7 @@ export default {
                 yAxis: { type: 'value' },
                 series: this.seriesDealOthersMount
               })
-              totalOneEchartsRate.setOption({
+              this.totalOneEchartsRate.setOption({
                 tooltip: { trigger: 'axis' },
                 legend: { data: pauseArrOthersMountRate },
                 grid: { containLabel: true },
@@ -809,12 +835,11 @@ export default {
                 yAxis: { type: 'value' },
                 series: this.seriesDealOthersRate
               })
-              window.onresize = () => {
-                totalOneEcharts.resize()
-                totalOneEchartsMount.resize()
-                totalOneEchartsRate.resize()
-              // totalOneEchartsOnline.resize()
-              }
+              window.addEventListener('resize', () => {
+                this.totalOneEcharts.resize()
+                this.totalOneEchartsMount.resize()
+                this.totalOneEchartsRate.resize()
+              })
             })
           }
           if (resProblem.data === null || resProblem.data.length === 0) {
@@ -835,8 +860,8 @@ export default {
             // this.seriesDeal[0].type = 'line'
             // this.seriesDeal[0].data = pauseArr
             this.$nextTick(() => {
-              const totalOneEchartsOnline = echarts.init(document.getElementById('totalShowOnline'))
-              totalOneEchartsOnline.setOption({
+              this.totalOneEchartsOnline = echarts.init(document.getElementById('totalShowOnline'))
+              this.totalOneEchartsOnline.setOption({
                 tooltip: { trigger: 'axis' },
                 legend: { data: pauseArrOnline },
                 grid: { containLabel: true },
@@ -844,9 +869,9 @@ export default {
                 yAxis: { type: 'value' },
                 series: this.seriesDealOthersOnline
               })
-              window.onresize = () => {
-                totalOneEchartsOnline.resize()
-              }
+              window.addEventListener('resize', () => {
+                this.totalOneEchartsOnline.resize()
+              })
             })
           }
         } else {
@@ -1003,7 +1028,6 @@ export default {
         return
       } else if ((this.pauseKey === 0 && this.activeIndexSecondary === 'third') || (this.pauseKey === 3 && this.activeIndexSecondary === 'third')) {
         this.guild = this.treeGuide(this.dealWithBusinessDate, this.pauseTreeNode.id, this.pauseTreeNode.type).join('/')
-        console.log(1)
         this.visualizationDataGet()
         return
       } else if ((this.pauseKey === 0 && this.activeIndexSecondary === 'forth') || (this.pauseKey === 3 && this.activeIndexSecondary === 'forth')) {