Browse Source

评论图

lizhuang 5 years ago
parent
commit
4092e06120

+ 2 - 0
src/utils/bus.js

@@ -0,0 +1,2 @@
+import Vue from 'vue'
+export default new Vue()

+ 34 - 102
src/views/evaluate/evStackedLine.vue

@@ -4,17 +4,46 @@
 
 <script>
 var echarts = require("echarts");
+import bus from '@/utils/bus.js'
 export default {
   data() {
-    return {};
+    return {
+      series:[],
+      ids:[]
+    };
+  },
+  created() {
+    bus.$on('drawLine', list => {
+      this.ids = list
+      this.formatStackArr()
+      console.log('on,list---->', list)
+    })
   },
   mounted() {
-    this.drawItLine();
   },
   props: ["stackArr"],
   methods: {
+    formatStackArr(){
+      this.series = []
+      this.stackArr.forEach(el=>{
+        this.ids.forEach(ele=>{
+          if(ele.id==el.spaceDayRpt.id){
+            let obj = {
+              name: el.spaceDayRpt.spaceLocalName,
+              type: "line",
+              stack: "总量",
+              data: el.tdbList.data.slice(1).map(i=>i[1])
+            }
+            this.series.push(obj)
+          }
+        })
+      })
+      this.drawItLine();
+    },
     drawItLine() {
+  
       let myCharts = echarts.init(document.getElementById("lineCharts"));
+      myCharts.clear()
       var option = {
         title: {
           //   text: "折线图堆叠"
@@ -23,11 +52,11 @@ export default {
           trigger: "axis"
         },
         legend: {
-          data: ["", "", ""],
+          
           icon: "stack",
           right: 28
         },
-        color: ["#0091FF", "#00D6B9", "#FFBA6B"],
+        // color: ["#0091FF", "#00D6B9", "#FFBA6B"],
         grid: {
           left: "3%",
           right: "4%",
@@ -78,104 +107,7 @@ export default {
             }
           }
         },
-        series: [
-          {
-            name: "优衣库",
-            type: "line",
-            stack: "总量",
-            data: [
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0
-            ]
-          },
-          {
-            name: "海底捞",
-            type: "line",
-            stack: "总量",
-            data: [
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0
-            ]
-          },
-          {
-            name: "大玩家",
-            type: "line",
-            stack: "总量",
-            data: [
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0,
-              0
-            ]
-          }
-        ]
+        series: this.series
       };
       myCharts.setOption(option);
     }

+ 2 - 0
src/views/evaluate/evTwoLevelMenu.vue

@@ -80,6 +80,7 @@ import {
   queryTdbDay
 } from "@/api/evaluate/evaluate.js";
 import { queryChillerExecuteInfo } from "@/api/appeal/appeal.js";
+import bus from '@/utils/bus.js'
 
 export default {
   data() {
@@ -150,6 +151,7 @@ export default {
         this.tindoorFillRate = res.tindoorFillRate;
         console.log("室内温度满足率", res);
         let content = res.content;
+        this.stackArr= content
         content.forEach(({ spaceDayRpt }) => {
           if (obj.hasOwnProperty(spaceDayRpt.floorId)) {
             obj[spaceDayRpt.floorId].children.push(spaceDayRpt);

+ 8 - 4
src/views/evaluate/evTwoTable.vue

@@ -6,11 +6,10 @@
     style="width: 100%;z-index:1"
     :row-key="getRowKeys"
     :expand-row-keys="expands"
-    @selection-change="handleSelectionChange"
   >
     <el-table-column type="expand">
       <template slot-scope="props">
-        <el-table :ref="`table${props.row.id}`" :data="props.row.children" style="width: 100%;">
+        <el-table :ref="`table${props.row.id}`" :data="props.row.children" style="width: 100%;" @selection-change="handleSelectionChange">
           <el-table-column type="selection" width="50" align="right"></el-table-column>
           <el-table-column prop label align="right" width="150">
             <template slot-scope="{row}">
@@ -48,11 +47,12 @@
   </el-table>
 </template>
 <script>
+import bus from '@/utils/bus.js'
 export default {
   data() {
     return {
       selected: [],
-      expands: []
+      expands: [],
     };
   },
   props: ["dataList"],
@@ -77,12 +77,16 @@ export default {
     doSelect() {
       this.dataList.forEach(i => {
         i.children.forEach(row => {
-          this.$refs[`table${i.id}`].toggleRowSelection(row)
+          if(!row.isSatisfy){
+             this.$refs[`table${i.id}`].toggleRowSelection(row)
+          }
+         
         })
       })
     },
     handleSelectionChange(val) {
       this.selected = val
+      bus.$emit('drawLine',val)
     },
     getRowKeys(row) {
       return row.id;