浏览代码

Merge branch 'master' of http://47.100.37.243:10080/ZHOU/yunsu.git

wutt 5 年之前
父节点
当前提交
86542928e8
共有 2 个文件被更改,包括 62 次插入64 次删除
  1. 1 11
      ys_int/src/routes.js
  2. 61 53
      ys_int/src/views/detection/maintenance.vue

+ 1 - 11
ys_int/src/routes.js

@@ -22,16 +22,6 @@ import comp from './views/base/comp.vue'
 import factory from './views/base/factory.vue'
 import allocation from './views/base/allocation.vue'
 
-import i18n from './i18n/i18n';
-
-var navigation = {};
-
-// if(i18n.locale == "en-US") {
-//     navigation = require('./i18n/lang/en').default.navigation;
-// } else {
-//     navigation = require('./i18n/lang/zh').default.navigation;
-// }
-
 let routes = [
     {
         path: '/login',
@@ -120,4 +110,4 @@ let routes = [
     }
 ];
 
-export default routes;
+export default routes;

+ 61 - 53
ys_int/src/views/detection/maintenance.vue

@@ -513,14 +513,49 @@
                 },
                 res => {
                     if (res.code == "ok") {
+                        var cycle = res.data.cycle,
+                        runtime = res.data.runtime,
+                        xData = [], 
+                        avg = [],
+                        max = [],
+                        min = [],
+                        the = [],
+                        sData = [];
+
+                        var num = 0;
+                        for(var i in cycle) {
+                            xData.push(i);
+                            max.push(cycle[i].maxCycle/1000);
+                            min.push(cycle[i].minCycle/1000);
+                            avg.push(cycle[i].avgCycle/1000);
+                            the.push(cycle[i].theoryCycle/1000);
+                            if(runtime.length == 0) {
+                                sData.push({value: 0 , color: "#009ad6"})
+                            } else {
+                                for(var j in runtime) {
+                                    if(i == j) {
+                                        if(num%2 == 0) {
+                                            sData.push({value: runtime[j].runtime , color: "#009ad6"});
+                                        } else {
+                                            sData.push({value: runtime[j].runtime , color: "#98F898"});
+                                        }
+                                        break
+                                    }
+                                }
+                            }
+                            num++;
+                        }
+
+                        let myChart = this.echarts.init(document.getElementById("myChart2"));
+                        this.echarts2 = myChart;
                         var option = {
                             tooltip: {
                                 trigger: 'axis'
                             },
                             legend: {
-                                data:[this.$t('runTest.maxOpenCycle'),this.$t('runTest.minOpenCycle'),this.$t('runTest.avgOpenCycle'),this.$t('runTest.theoryCycle'),this.$t('runTest.openNum')],
+                                data:[this.$t('runTest.maxOpenCycle'),this.$t('runTest.minOpenCycle'),this.$t('runTest.avgOpenCycle'),this.$t('runTest.theoryCycle')],//,this.$t('runTest.openNum')
                                 x: '30%',
-                                y: '-5'
+                                y: '-4'
                             },
                             toolbox: {
                                 right: '20',
@@ -548,12 +583,12 @@
                             xAxis: [
                                 {
                                     type: 'category',
-                                    data: [],
+                                    data: xData,
                                 },
                                 {
                                     gridIndex: 1,
                                     type: 'category',
-                                    data: []
+                                    data: xData
                                 }
                             ],
                             yAxis: [
@@ -605,7 +640,7 @@
                                 {
                                     name: this.$t('runTest.maxOpenCycle'),
                                     type: 'line',
-                                    data:[],
+                                    data: max,
                                     itemStyle : { 
                                         normal : { 
                                             color: "#d93a49", //改变折线点的颜色
@@ -618,7 +653,7 @@
                                 {
                                     name: this.$t('runTest.minOpenCycle'),
                                     type:'line',
-                                    data:[],
+                                    data: min,
                                     itemStyle : { 
                                         normal : { 
                                             color: "#67E0E3", //改变折线点的颜色
@@ -631,7 +666,7 @@
                                 {
                                     name: this.$t('runTest.avgOpenCycle'),
                                     type: 'line',
-                                    data:[],
+                                    data: avg,
                                     itemStyle : { 
                                         normal : { 
                                             color: "#7fb80e", //改变折线点的颜色
@@ -644,7 +679,7 @@
                                 {
                                     name: this.$t('runTest.theoryCycle'),
                                     type: 'line',
-                                    data:[],
+                                    data: the,
                                     itemStyle : { 
                                         normal : { 
                                             color: "#f58220", //改变折线点的颜色
@@ -657,16 +692,25 @@
                                 {
                                     name: this.$t('runTest.openNum'),
                                     type: 'bar',
-                                    barWidth : 30,
+                                    barWidth : '60%',
                                     xAxisIndex: 1,
                                     yAxisIndex: 1,
-                                    data: [],
+                                    data: sData,
                                     itemStyle : { 
                                         normal : { 
-                                            color: "#009ad6", //改变折线点的颜色
-                                            lineStyle:{ 
-                                                color: "#009ad6" //改变折线颜色
-                                            } 
+                                            color: function(params) {
+                                                var colorItem = ['#009ad6','#9FE6B8', '#FFDB5C'];
+                                                var currentItem = 0;
+                                                var colorList=[];
+                                                for(var i = 0 ; i < sData.length;i++){
+                                                    colorList.push(colorItem[currentItem]);
+                                                    currentItem ++;
+                                                    if(currentItem > 2) {
+                                                        currentItem = 0;
+                                                    }
+                                                }
+                                                return colorList[params.dataIndex]
+                                            }//: "#009ad6", //改变折线点的颜色
                                         } 
                                     },
                                     label: {
@@ -679,42 +723,9 @@
                                     }
                                 }
                             ]
-                        },
-                        cycle = res.data.cycle,
-                        runtime = res.data.runtime,
-                        xData = [], 
-                        avg = [],
-                        max = [],
-                        min = [],
-                        the = [],
-                        sData = [];
-
-                        for(var i in cycle) {
-                            xData.push(i);
-                            max.push(cycle[i].maxCycle/1000);
-                            min.push(cycle[i].minCycle/1000);
-                            avg.push(cycle[i].avgCycle/1000);
-                            the.push(cycle[i].theoryCycle/1000);
-                            if(runtime.length == 0) {
-                                sData.push(0)
-                            } else {
-                                for(var j in runtime) {
-                                    if(i == j) {
-                                        sData.push(runtime[j].runtime);
-                                        break
-                                    }
-                                }
-                            }
-                        }
-                        option.xAxis[0].data = xData;
-                        option.xAxis[1].data = xData;
-                        option.series[0].data = max;
-                        option.series[1].data = min;
-                        option.series[2].data = avg;
-                        option.series[3].data = the;
-                        option.series[4].data = sData;
-
-                        this.drawEchart(2,JSON.stringify(option));
+                        };
+                        // this.drawEchart(2,JSON.stringify(option));
+                        myChart.setOption(option);
                     } else {
                         this.$message({
                             message: res.msg,
@@ -731,9 +742,6 @@
             },
             
             drawEchart(type,option) {
-                let myChart = this.echarts.init(document.getElementById("myChart2"));
-                this.echarts2 = myChart;
-                myChart.setOption(JSON.parse(option));
             },
 
             changeOpen(type) {