From b72618fe9cfc46e7de0e38f51ba2440b86f08794 Mon Sep 17 00:00:00 2001
From: whyczyk <525500596@qq.com>
Date: 星期一, 26 七月 2021 17:17:31 +0800
Subject: [PATCH] 首页拓扑图修改

---
 src/pages/home/topoGraph.vue |  109 ++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 69 insertions(+), 40 deletions(-)

diff --git a/src/pages/home/topoGraph.vue b/src/pages/home/topoGraph.vue
index b8e0c6d..5515c37 100644
--- a/src/pages/home/topoGraph.vue
+++ b/src/pages/home/topoGraph.vue
@@ -2,6 +2,7 @@
     <div class="contentBox">
         <div class="tipTitle">绯荤粺鎷撴墤</div>
         <div class="diagram-con">
+            <el-button type="primary" size="mini" class="editBtn" @click="drawer=true">鍓嶇疆鏉′欢璁剧疆</el-button>
             <div class="diagram-stc" ref="static"></div>
             <div class="diagram-flush" ref="flush"></div>
             <axis :position="axis1" v-if="axis1.length>0"></axis>
@@ -369,6 +370,13 @@
                 </div>
             </diagram-panel>
         </transition>
+
+        <mw-drawer :visible.sync="drawer">
+            <pre-option-list :bigPower="bigPower" :eleBoard="eleBoard" :AFEcabinet="AFEcabinet"
+                :waterStation="waterStation" :oilStation="oilStation" :switch5000="switch5000"
+                :switch32001="switch32001" :switch32002="switch32002" :switch5200="switch5200" v-if="drawer">
+            </pre-option-list>
+        </mw-drawer>
     </div>
 </template>
 
@@ -376,6 +384,8 @@
     import gridCircuitDiagram from "@/pages/home/topoGraphdiagram/js/gridCircuitDiagram"
     import diagramStates from '@/pages/home/topoGraphdiagram/js/diagramStates'
     import DiagramPanel from '@/components/smallModule/DiagramPanel.vue';
+    import MwDrawer from "@/components/smallModule/mwDrawer";
+    import PreOptionList from "@/pages/home/components/preOptionList";
     import {
         deviceStateAllStatus,
         centralMonitorSysInfoByDevId,
@@ -383,7 +393,7 @@
         centralMonitorSysSTInfoByDevId,
         afeInverterInfoByDeviceId,
         WaterCommInfoByDevId,
-        OilCommInfoByDevId
+        OilCommInfoByDevId,
     } from "./topoGraphdiagram/js/api"
     import Axis from '@/components/smallModule/axis.vue';
     let diagram;
@@ -391,9 +401,13 @@
         components: {
             DiagramPanel,
             Axis,
+            MwDrawer,
+            PreOptionList
         },
         data() {
             return {
+                type: 'kz',
+                drawer: false,
                 axis1: [],
                 axis2: [],
                 text1Pos: [],
@@ -514,142 +528,150 @@
                         this.deviceList.map(item => {
                             switch (item.position) {
                                 case 5: // 澶у姛鐜囩數婧�
-                                    this.bigPower = item.commStatus;
-                                    if (this.bigPower == 0) {
-                                        diagramStates(diagram, 'bigPower');
-                                    }
                                     rectifierPowerInfoByDevId({
                                         devId: item.deviceId
                                     }).then((res) => {
                                         if (res.data.code == 1) {
+                                            this.bigPower = res.data.data.rectifierPowerState;
+                                            if (this.bigPower == 0) {
+                                                diagramStates(diagram, 'bigPower');
+                                            }
                                             this.panel4 = res.data.data
+                                            this.setDiagramByType()
                                         }
                                     }).catch((err) => {
                                         console.log(err)
                                     });
                                     break;
                                 case 6: // 鐩存祦涓婚厤鐢垫澘
-                                    this.eleBoard = item.commStatus
-                                    if (this.eleBoard == 0) {
-                                        diagramStates(diagram, 'eleBoard');
-                                    }
                                     centralMonitorSysSTInfoByDevId({
                                         devId: item.deviceId
                                     }).then((res) => {
                                         if (res.data.code == 1) {
+                                            this.eleBoard = res.data.data.switchCloseBusScreen
+                                            if (this.eleBoard == 0) {
+                                                diagramStates(diagram, 'eleBoard');
+                                            }
                                             this.panel5 = res.data.data
+                                            this.setDiagramByType()
                                         }
                                     }).catch((err) => {
                                         console.log(err)
                                     });
                                     break;
-                                case 8: // AFE鍙橀
-                                    this.AFEcabinet = item.commStatus
-                                    if (this.AFEcabinet == 0) {
-                                        diagramStates(diagram, 'AFEcabinet');
-                                    }
+                                case 7: // AFE鍙橀
                                     afeInverterInfoByDeviceId({
                                         devId: item.deviceId
                                     }).then((res) => {
                                         if (res.data.code == 1) {
+                                            this.AFEcabinet = res.data.data.inverterRun
+                                            if (this.AFEcabinet == 0) {
+                                                diagramStates(diagram, 'AFEcabinet');
+                                            }
                                             this.panel7 = res.data.data
+                                            this.setDiagramByType()
                                         }
                                     }).catch((err) => {
                                         console.log(err)
                                     });
                                     break;
                                 case 9: // 姘寸珯
-                                    this.waterStation = item.commStatus
-                                    if (this.waterStation == 0) {
-                                        diagramStates(diagram, 'waterStation');
-                                    }
                                     WaterCommInfoByDevId({
                                         devId: item.deviceId
                                     }).then((res) => {
                                         if (res.data.code == 1) {
+                                            this.waterStation = res.data.data.waterState
+                                            if (this.waterStation == 0) {
+                                                diagramStates(diagram, 'waterStation');
+                                            }
                                             this.panel8 = res.data.data
+                                            this.setDiagramByType()
                                         }
                                     }).catch((err) => {
                                         console.log(err)
                                     });
                                     break;
                                 case 10: // 娌圭珯
-                                    this.oilStation = item.commStatus
-                                    if (this.oilStation == 0) {
-                                        diagramStates(diagram, 'oilStation');
-                                    }
                                     OilCommInfoByDevId({
                                         devId: item.deviceId
                                     }).then((res) => {
                                         if (res.data.code == 1) {
+                                            this.oilStation = res.data.data.oilState
+                                            if (this.oilStation == 0) {
+                                                diagramStates(diagram, 'oilStation');
+                                            }
                                             this.panel9 = res.data.data
+                                            this.setDiagramByType()
                                         }
                                     }).catch((err) => {
                                         console.log(err)
                                     });
                                     break;
                                 case 1: // 5000KV寮�鍏�
-                                    this.switch5000 = item.commStatus;
-                                    if (this.switch5000 == 1) {
-                                        diagramStates(diagram, 'switch5000');
-                                    }
                                     centralMonitorSysInfoByDevId({
                                         devId: item.deviceId
                                     }).then((res) => {
                                         if (res.data.code == 1) {
+                                            this.switch5000 = res.data.data.switchClose;
+                                            if (this.switch5000 == 1) {
+                                                diagramStates(diagram, 'switch5000');
+                                            }
                                             this.panel1 = res.data.data
+                                            this.setDiagramByType()
                                         }
                                     }).catch((err) => {
                                         console.log(err)
                                     });
                                     break;
                                 case 2: // 3200KV1寮�鍏�
-                                    this.switch32001 = item.commStatus
-                                    if (this.switch32001 == 1) {
-                                        diagramStates(diagram, 'switch32001');
-                                    }
                                     centralMonitorSysInfoByDevId({
                                         devId: item.deviceId
                                     }).then((res) => {
                                         if (res.data.code == 1) {
+                                            this.switch32001 = res.data.data.switchClose
+                                            if (this.switch32001 == 1) {
+                                                diagramStates(diagram, 'switch32001');
+                                            }
                                             this.panel2 = res.data.data
+                                            this.setDiagramByType()
                                         }
                                     }).catch((err) => {
                                         console.log(err)
                                     });
                                     break;
                                 case 3: // 3200KV2寮�鍏�
-                                    this.switch32002 = item.commStatus
-                                    if (this.switch32002 == 1) {
-                                        diagramStates(diagram, 'switch32002');
-                                    }
                                     centralMonitorSysInfoByDevId({
                                         devId: item.deviceId
                                     }).then((res) => {
-                                        if (res.data.code == 0) {
+                                        if (res.data.code == 1) {
+                                            this.switch32002 = res.data.data.switchClose
+                                            if (this.switch32002 == 1) {
+                                                diagramStates(diagram, 'switch32002');
+                                            }
                                             this.panel3 = res.data.data
+                                            this.setDiagramByType()
                                         }
                                     }).catch((err) => {
                                         console.log(err)
                                     });
                                     break;
                                 case 4: // 5200KV寮�鍏�
-                                    this.switch5200 = item.commStatus
-                                    if (this.switch5200 == 1) {
-                                        diagramStates(diagram, 'switch5200');
-                                    }
                                     centralMonitorSysInfoByDevId({
                                         devId: item.deviceId
                                     }).then((res) => {
                                         if (res.data.code == 1) {
+                                            this.switch5200 = res.data.data.switchClose
+                                            if (this.switch5200 == 1) {
+                                                diagramStates(diagram, 'switch5200');
+                                            }
                                             this.panel6 = res.data.data
+                                            this.setDiagramByType()
                                         }
                                     }).catch((err) => {
                                         console.log(err)
                                     });
                                     break;
                             }
-                            this.setDiagramByType()
                         })
                     }
                 }).catch((err) => {
@@ -870,6 +892,13 @@
         position: relative;
     }
 
+    .diagram-con .editBtn {
+        position: absolute;
+        right: 20px;
+        top: 20px;
+        z-index: 15;
+    }
+
     .panel7 .panel-item .label {
         width: 100px;
         text-align: right;

--
Gitblit v1.9.1