Эх сурвалжийг харах

看板-当日生产明细是否显示UPPH 动态调整

xiaost 1 жил өмнө
parent
commit
79799024d3

+ 153 - 8
src/components/packageechart/bottom/bottomLeft2Chart/chart.vue

@@ -18,7 +18,9 @@ export default {
   data () {
     return {
       timing :null,
-      options:{
+      showuphlabel:true,
+      options:null,
+      option1:{
         tooltip: {
           trigger: 'axis',
           axisPointer: {
@@ -138,11 +140,11 @@ export default {
               normal: {
                 barBorderRadius: 6,
                 color:  "rgba(156,107,211,0.8)"
-               /* color: new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [
-                  { offset: 0, color: "rgba(156,107,211,0.8)" },
-                  { offset: 0.2, color: "rgba(156,107,211,0.5)" },
-                  { offset: 1, color: "rgba(156,107,211,0.2)" }
-                ])*/
+                /* color: new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [
+                   { offset: 0, color: "rgba(156,107,211,0.8)" },
+                   { offset: 0.2, color: "rgba(156,107,211,0.5)" },
+                   { offset: 1, color: "rgba(156,107,211,0.2)" }
+                 ])*/
               }
             },
             emphasis: {
@@ -170,6 +172,139 @@ export default {
           }
         ]
       },
+      option2:{
+        tooltip: {
+          trigger: 'axis',
+          axisPointer: {
+            type: 'shadow'
+          }
+        },
+        legend: {
+          textStyle: {
+            fontSize: 18
+          },
+          itemWidth: 29,
+          itemHeight: 19
+        },
+        grid: {
+          left: '3%',
+          right: '4%',
+          bottom: '3%',
+          containLabel: true
+        },
+        xAxis: [
+          {
+            type: 'category',
+            data:[],
+            axisLabel: {
+              fontSize: 16,
+              fontWeight: "bold"
+            }
+          }
+        ],
+        yAxis: [
+          {
+            type: 'value',
+            max:500,
+            axisLabel: {
+              fontSize: 16
+            }
+          },
+          {
+            type: 'value',
+            name: 'rate',
+            min: 0,
+            max: 100,
+            interval: 20,
+            nameTextStyle: {
+              fontSize: 20
+            },
+            axisLabel: {
+              formatter: '{value}%',
+              fontSize: 16
+            }
+          }
+
+        ],
+        series: [
+          {
+            name: '投入',
+            type: 'bar',
+            barWidth: 15,
+            emphasis: {
+              focus: 'series'
+            },
+            data:[],
+            label: {
+              show: true,
+              position: 'top',
+              fontSize:14,
+              fontWeight: "bold"
+            },
+          },
+          {
+            name: '产出',
+            type: 'bar',
+            barWidth: 15,
+            stack: 'Ad',
+            emphasis: {
+              focus: 'series'
+            },
+            data:[],
+            label: {
+              show: true,
+              position: 'inside',
+              fontSize:14,
+              fontWeight: "bold"
+            },
+          },
+          {
+            name: '不良',
+            type: 'bar',
+            stack: 'Ad',
+            barWidth: 10,
+            data:[],
+            //data: [12, 22, 32, 12, 32, 12, 32],
+            emphasis: {
+              focus: 'series'
+            }
+          },
+          {
+            name: '良率%',
+            type: 'line',
+            data:[],
+            yAxisIndex: 1,
+            symbolSize: 8,
+            label: {
+              show: true,
+              position: 'top',
+              color:'#fff'
+            },
+            tooltip: {
+              valueFormatter: function (value) {
+                return value + '%';
+              }
+            },
+            lineStyle: {
+              width: 4
+            },
+            itemStyle: {
+              normal: {
+                barBorderRadius: 6,
+                color:  "rgba(156,107,211,0.8)"
+                /* color: new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [
+                   { offset: 0, color: "rgba(156,107,211,0.8)" },
+                   { offset: 0.2, color: "rgba(156,107,211,0.5)" },
+                   { offset: 1, color: "rgba(156,107,211,0.2)" }
+                 ])*/
+              }
+            },
+            emphasis: {
+              focus: 'series'
+            }
+          }
+        ]
+      },
     };
   },
   components: {
@@ -181,7 +316,14 @@ export default {
       default: () => ({})
     },
   },
-
+  created() {
+    if(sessionStorage.getItem('li_code') == '所有' ){
+      this.options = this.option2;
+    }else{
+      this.options = this.option1;
+    }
+    console.log(this);
+  },
   mounted() {
     this.getdata();
     this.refreshdata();
@@ -242,8 +384,11 @@ export default {
             this.options.series[1].data = series1;
             this.options.series[2].data = series2;
             this.options.series[3].data = series3;
-            this.options.series[4].data = series4;
+            if(this.options.series[4]) {
+              this.options.series[4].data = series4;
+            }
             this.options.yAxis[0].max = (maxnumber*1.2).toFixed();
+            this.setOption(this.options);
                        /*let myChart = this.$children[0].chart;
                        myChart.setOption({
                           xAxis: {