Browse Source

驾驶舱模块日发电量、72小时功率趋势图chart点击查看大图功能完成

yangxiao 3 years ago
parent
commit
37c0db4755
2 changed files with 27 additions and 27 deletions
  1. 5 26
      src/views/Home/Home.vue
  2. 22 1
      src/views/Home/components/power-review.vue

+ 5 - 26
src/views/Home/Home.vue

@@ -38,7 +38,7 @@
         <Row type="flex">
           <Col :span="24">
             <com-panel title="计划电量完成情况" sub-title="(单位:万KWh)">
-              <power-plan :data="planData" :title="planBtnName" :showSingle="powerplanShowSingle" :id="wpId" @chartClick="showDownChart" />
+              <power-plan :data="planData" :title="planBtnName" :showSingle="powerplanShowSingle" :id="wpId" @chartClick="showDoneChart" />
             </com-panel>
           </Col>
         </Row>
@@ -69,7 +69,7 @@
           </template>
           <template v-slot:default>
             <!-- 日发电量 -->
-            <multiple-bar-chart :list="DayPower.value" :units="DayPower.units" height="12.963vh" :showLegend="true" />
+            <multiple-bar-chart :list="DayPower.value" :units="DayPower.units" height="12.963vh" :showLegend="true" @click="showDoneChart({ data:DayPower, dialogTitle:'日发电量', dialogType: 'doneLineChart' })" />
           </template>
         </toolbar-panel>
       </Col>
@@ -94,7 +94,7 @@
           </div>
         </template>
         <template v-slot:default>
-          <multiple-line-chart :list="Powertrend.value" :units="Powertrend.units" height="12.963vh" />
+          <multiple-line-chart :list="Powertrend.value" :units="Powertrend.units" height="12.963vh" @click="showPowerChart({ data:Powertrend, dialogTitle:'72小时功率趋势图', dialogType: 'powerLineChart' })" />
         </template>
       </toolbar-panel>
       </Col>
@@ -729,33 +729,12 @@ export default {
       this.dialogTitle = res.dialogTitle;
       this.dialogType = res.dialogType;
 
-      let powerLineChartData = {
-        // 图表所用单位
-        units: [""],
-        value: [],
-      };
-
-      res.data.forEach((pEle,pIndex)=>{
-        powerLineChartData.value.push({
-          title: pEle[0].name,
-          yAxisIndex: 0,
-          value: [],
-        });
-
-        pEle.forEach(cEle=>{
-          powerLineChartData.value[pIndex].value.push({
-            text: new Date(cEle.time).formatDate("hh:mm:ss"),
-            value: cEle.value1
-          });
-        });
-      });
-
-      this.powerLineChartData = powerLineChartData;
+      this.powerLineChartData = res.data;
       this.dialogShow = true;
     },
 
     // 显示计划电量完成情况图表
-    showDownChart(res){
+    showDoneChart(res){
       this.dialogTitle = res.dialogTitle;
       this.dialogType = res.dialogType;
 

+ 22 - 1
src/views/Home/components/power-review.vue

@@ -56,7 +56,28 @@ export default {
             targetName
           },
           success (res) {
-            that.$emit("chartClick", { dialogTitle, dialogType, data: res.data });
+            let powerLineChartData = {
+              // 图表所用单位
+              units: [""],
+              value: [],
+            };
+
+            res.data.forEach((pEle,pIndex)=>{
+              powerLineChartData.value.push({
+                title: pEle[0].name,
+                yAxisIndex: 0,
+                value: [],
+              });
+
+              pEle.forEach(cEle=>{
+                powerLineChartData.value[pIndex].value.push({
+                  text: new Date(cEle.time).formatDate("hh:mm:ss"),
+                  value: cEle.value1
+                });
+              });
+            });
+
+            that.$emit("chartClick", { dialogTitle, dialogType, data: powerLineChartData });
           }
         });
     }