From aaa8ffcb83ce577612d1c88a295db0e12f87a83c Mon Sep 17 00:00:00 2001
From: he wei <858544502@qq.com>
Date: 星期五, 14 四月 2023 14:21:07 +0800
Subject: [PATCH] U 首页修改

---
 src/views/home/home-admin.vue |  151 +++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 130 insertions(+), 21 deletions(-)

diff --git a/src/views/home/home-admin.vue b/src/views/home/home-admin.vue
index a3606b0..ced0c62 100644
--- a/src/views/home/home-admin.vue
+++ b/src/views/home/home-admin.vue
@@ -27,6 +27,16 @@
         <div class="label">璐熻浇鐔旀柇:</div>
         <div class="value">{{ sum.fusing }}</div>
       </div>
+      <!-- 鍋滅數鏀剧數 -->
+      <div class="item cur-pointer" @click="getJcdisBatt">
+        <div class="label">鍋滅數鏀剧數:</div>
+        <div class="value">{{ sum.jcdisNum }}</div>
+      </div>
+      <!-- 骞村害宸叉牳瀹� -->
+      <div class="item cur-pointer" v-if="isMain" @click="getHrYeardisBatt">
+        <div class="label">骞村害宸叉牳瀹�:</div>
+        <div class="value">{{ sum.hrdisNum }}</div>
+      </div>
       <!-- 鎸夐挳 -->
       <div class="btn-grp">
         <div class="loop-time" v-if="!isMain">
@@ -54,6 +64,8 @@
                   <div class="row">
                     <template v-for="(card, idx) in item.slice(0, 4)">
                       <card class="item" :key="'card_' + idx" v-if="card" :title="card.title" :vol="card.stationType"
+                        @showinfo="showInfo(card)"
+                        :problem="!!card.pwrinf.exceptionCause"
                         :is-node="!!card.nodeStation">
                         <info :data="card"></info>
                       </card>
@@ -63,6 +75,8 @@
                   <div class="row">
                     <template v-for="(card, idx) in item.slice(4)">
                       <card class="item" :key="'card1_' + idx" v-if="card" :title="card.title" :vol="card.stationType"
+                        @showinfo="showInfo(card)"
+                        :problem="!!card.pwrinf.exceptionCause"
                         :is-node="!!card.nodeStation">
                         <info :data="card"></info>
                       </card>
@@ -164,7 +178,10 @@
           <!-- <div class="btn" @click="view">鏌ョ湅</div> -->
         </div>
         <div class="res-wrap">
-          <card class="item" :title="resCard.title" :vol="resCard.stationType" :is-node="!!resCard.nodeStation">
+          <card class="item" :title="resCard.title" :vol="resCard.stationType" 
+          :problem="!!resCard.pwrinf && !!resCard.pwrinf.exceptionCause"
+          @showinfo="showInfo(resCard)"
+          :is-node="!!resCard.nodeStation">
             <info :data="resCard" v-if="resCard.stationId"></info>
             <div v-else class="empty">璇烽�夋嫨瑕佹煡鐪嬬殑鏈烘埧</div>
           </card>
@@ -175,7 +192,7 @@
       </div>
     </el-dialog>
     <!--  -->
-    <el-dialog :title="listTitle" width="500px" :visible.sync="listVisible" :close-on-click-modal="false" top="0"
+    <el-dialog :title="listTitle" width="700px" :visible.sync="listVisible" :close-on-click-modal="false" top="0"
       class="dialog-center" :modal-append-to-body="false">
       <el-table height="400" :data="tableData" :show-header="false" style="width: 100%">
         <el-table-column type="index" width="50">
@@ -188,6 +205,7 @@
         </el-table-column>
       </el-table>
     </el-dialog>
+    <power-remarks :visible.sync="powerRemarksDialog" v-if="powerRemarksDialog" :num="pwrNum"></power-remarks>
   </div>
 </template>
 
@@ -197,12 +215,15 @@
 import cardBox from '@/components/bigScreenPage/big_screen_card';
 import MapChart from "@/components/myCharts/MapChart.vue";
 import MapMarkList from "@/components/mapMarkList.vue";
+import PowerRemarks from "@/views/dataMager/components/powerRemarks.vue";
 
 import Timeout from '@/assets/js/tools/Timeout';
 import formatSeconds from '@/assets/js/tools/formatSeconds';
 import {
   searchAcdcModError,
-  searchFuse
+  searchFuse,
+  getJcdisBatt,
+  getHrYeardisBatt,
 } from './js/api';
 
 import createWs from "@/assets/js/websocket";
@@ -212,6 +233,8 @@
   mixins: [WSMixin],
   data() {
     return {
+      pwrNum: '',
+      powerRemarksDialog: false,
       slideName: "slide-left",
       tableData: [],
       listTitle: '鐩稿叧绔欑偣',
@@ -232,7 +255,9 @@
         discharg: 0,
         float: 0,
         fault: 0,
-        fusing: 0
+        fusing: 0,
+        jcdisNum: 0,
+        hrdisNum: 0,
       },
       // 鏄惁涓昏鍥�
       isMain: true,
@@ -271,7 +296,8 @@
     card,
     info,
     cardBox,
-    MapChart
+    MapChart,
+    PowerRemarks,
   },
   watch: {
     isMain(n) {
@@ -321,13 +347,17 @@
         data,
         errmap,
         fusemap,
-        stationNum
+        stationNum,
+        hrdisNum,
+        jcdisNum,
       } = res.data2;
       this.sum.station = stationNum;
-      this.sum.discharg = battState.batt1;
-      this.sum.float = battState.batt2;
+      this.sum.discharg = battState.batt3;
+      this.sum.float = battState.batt1;
       this.sum.fault = errmap.err1;
       this.sum.fusing = fusemap.fuse1;
+      this.sum.hrdisNum = hrdisNum;
+      this.sum.jcdisNum = jcdisNum;
 
       data.forEach((v) => {
         v.acdc = v.acdc || {
@@ -346,6 +376,10 @@
           dcoutVol: 0,
           dcoutCurr: 0,
         };
+        v.pwrinf = v.pwrinf || {
+          num: -1,
+          routeNum: 1,
+        };
       });
 
       this.stationList = data;
@@ -360,7 +394,8 @@
     format(data) {
       let {
         acdc,
-        sgbList
+        sgbList,
+        pwrinf,
       } = data;
       let battList = sgbList.map((v) => {
         return {
@@ -375,12 +410,21 @@
       });
       battList.splice(2);
       let battAlm = battList.reduce((t, v) => t + v.battAlm * 1, 0);
+      let isOne = 1 == pwrinf.routeNum;
+      let acinA = acdc.acin1Vola + '/' + acdc.acin2Vola + '&nbsp;(V)&emsp;&emsp;' + acdc.acin1Curra + '&nbsp;(A)',
+        acinB = acdc.acin1Volb + '/' + acdc.acin2Volb + '&nbsp;(V)&emsp;&emsp;' + acdc.acin1Currb + '&nbsp;(A)',
+        acinC = acdc.acin1Volc + '/' + acdc.acin2Volc + '&nbsp;(V)&emsp;&emsp;' + acdc.acin1Currc + '&nbsp;(A)';
+      if (isOne) {
+        acinA = acdc.acin1Vola + '&nbsp;(V)&emsp;&emsp;' + acdc.acin1Curra + '&nbsp;(A)';
+        acinB = acdc.acin1Volb + '&nbsp;(V)&emsp;&emsp;' + acdc.acin1Currb + '&nbsp;(A)';
+        acinC = acdc.acin1Volc + '&nbsp;(V)&emsp;&emsp;' + acdc.acin1Currc + '&nbsp;(A)';
+      }
       return {
         ...data,
         battList,
-        acinA: acdc.acin1Vola + '/' + acdc.acin2Vola + '&nbsp;(V)&emsp;&emsp;' + acdc.acin1Curra + '/' + acdc.acin2Curra + '&nbsp;(A)',
-        acinB: acdc.acin1Volb + '/' + acdc.acin2Volb + '&nbsp;(V)&emsp;&emsp;' + acdc.acin1Currb + '/' + acdc.acin2Currb + '&nbsp;(A)',
-        acinC: acdc.acin1Volc + '/' + acdc.acin2Volc + '&nbsp;(V)&emsp;&emsp;' + acdc.acin1Currc + '/' + acdc.acin2Currc + '&nbsp;(A)',
+        acinA,
+        acinB,
+        acinC,
         dcout: acdc.dcoutVol + '&nbsp;(V)&emsp;&emsp;' + acdc.dcoutCurr + '&nbsp;(A)',
         battAlm
       }
@@ -398,12 +442,14 @@
           stationName3,
           stationName5,
           stationType,
-          nodeStation
+          nodeStation,
+          pwrinf,
         } = v;
         v.sgbList.forEach(item => {
           list.push({
             battInf: item,
             acdc,
+            pwrinf,
             devAlm,
             pwrAlm,
             stationId,
@@ -515,7 +561,7 @@
     goToWarn(type) {
       let mapStation = this.mapStation;
       let search = '?province=' + mapStation.stationName1 + '&city=' + mapStation.stationName2 + '&county=' + mapStation.stationName5 +
-        '&home=' + mapStation.stationName3 + "&stationName=" + mapStation.stationName+'&fromType=fromIndex';
+        '&home=' + mapStation.stationName3 + "&stationName=" + mapStation.stationName + '&fromType=fromIndex';
       // 1-鐢垫簮鍛婅 2-璁惧鍛婅 3-鐢垫睜鍛婅
       switch (type) {
         case 1:
@@ -586,17 +632,79 @@
         "&home=" +
         obj.stationName3 +
         "&batt=" +
-        (obj.battGroupId ? obj.battGroupId : obj.powerDeviceId) +
-        // list缁勪欢閲嶈浇
-        "&listReload=1";
-      this.$router.push("/dataTest/movingRingSystem/" + search);
+        (obj.battGroupId ? obj.battGroupId : obj.powerDeviceId);
+      // list缁勪欢閲嶈浇
+      // "&listReload=1";
+      let url = '';
+      if (obj.isHis) {
+        url = '/dataTest/history' + search;
+      } else {
+        url = "/dataTest/movingRingSystem/" + search + "&listReload=1";
+      }
+      this.$router.push(url);
       this.listVisible = false;
       // if (obj.powerDeviceId) {
       //   this.$router.push("/dataTest/movingRingSystem/ele-info/" + obj.powerDeviceId);
       // } else {
       //   this.$router.push("/dataTest/movingRingSystem/" + search);
       // }
-    }
+    },
+    // 骞村害鏍稿鐢垫睜缁�
+    getHrYeardisBatt() {
+      if (this.sum.hrdisNum == 0) {
+        this.$message.success('娌℃湁鐩稿叧鐢垫睜缁�');
+        return false;
+      }
+      this.listTitle = '鏈勾搴﹀凡鏍稿鏀剧數鐢垫睜缁勫垪琛�';
+      this.tableData = [];
+      let loading = this.$layer.loading();
+      getHrYeardisBatt().then((res) => {
+        let { code, data, data2 } = res.data;
+        if (code && data) {
+          this.$layer.close(loading);
+          this.listVisible = true;
+          this.tableData = data2.map(v => {
+            v.isHis = true;
+            v.stationName = v.stationName + ' ' + v.battGroupName;
+            return v;
+          });
+        } else {
+          this.$layer.close(loading);
+          this.$message.error('鏌ヨ澶辫触');
+        }
+      }).catch((err) => {
+        this.$message.error('寮傚父');
+        console.log(err);
+      });
+    },
+    // 瀹炴椂鍋滅數鏀剧數鐢垫睜缁勫垪琛�
+    getJcdisBatt() {
+      if (this.sum.jcdisNum == 0) {
+        this.$message.success('娌℃湁鐩稿叧绔欑偣');
+        return false;
+      }
+      this.listTitle = '瀹炴椂鍋滅數鏀剧數绔欑偣鍒楄〃';
+      this.tableData = [];
+      let loading = this.$layer.loading();
+      getJcdisBatt().then((res) => {
+        let { code, data, data2 } = res.data;
+        if (code && data) {
+          this.$layer.close(loading);
+          this.listVisible = true;
+          this.tableData = data2;
+        } else {
+          this.$layer.close(loading);
+          this.$message.error('鏌ヨ澶辫触');
+        }
+      }).catch((err) => {
+        this.$message.error('寮傚父');
+        console.log(err);
+      });
+    },
+    showInfo(obj) {
+      this.pwrNum = obj.pwrinf.num;
+      this.powerRemarksDialog = true;
+    },
   },
   mounted() {
 
@@ -627,7 +735,7 @@
       align-items: center;
 
       &:not(:first-child) {
-        margin-left: 4.4em;
+        margin-left: 1.4em;
       }
 
       .label {
@@ -930,11 +1038,12 @@
     margin-right: 8px;
   }
 }
+
 .row {
   .value {
     &.cur-pointer {
       cursor: pointer;
     }
   }
- }
+}
 </style>

--
Gitblit v1.9.1