From 25831490433a3778f5b87b31a1baba32c8429a0e Mon Sep 17 00:00:00 2001
From: whyczyk <525500596@qq.com>
Date: 星期二, 27 七月 2021 12:00:20 +0800
Subject: [PATCH] 首页轮播图功能添加

---
 src/pages/home/components/preOptionList.vue         |    6 
 src/components/PageHeader.vue                       |   11 
 src/assets/js/newDiagram/index.js                   |   10 
 src/pages/home/topoGraph.vue                        |  127 +++++---
 src/pages/home/topoGraphdiagram/js/diagramStates.js |  687 ++++++++++++++------------------------------
 5 files changed, 319 insertions(+), 522 deletions(-)

diff --git a/src/assets/js/newDiagram/index.js b/src/assets/js/newDiagram/index.js
index c3d3845..2a7ef14 100644
--- a/src/assets/js/newDiagram/index.js
+++ b/src/assets/js/newDiagram/index.js
@@ -30,7 +30,7 @@
 	};
 
 	// 鏄剧ず绾挎潯鐨刬d
-	this.showLineId = true;
+	this.showLineId = false;
 }
 
 // 璁剧疆canvas
@@ -103,10 +103,14 @@
 	console.log('宸茬粡鍋滄鎸佺画鏇存柊');
 };
 
+// 娓呯┖鍔ㄦ�佸浘琛�
+Diagram.prototype._Clear = function () {
+	this.s_ctx.clearRect(0, 0, this.width, this.height);
+	this.f_ctx.clearRect(0, 0, this.width, this.height);
+};
+
 // 鏇存柊鏁翠釜鍥捐〃
 Diagram.prototype._update = function () {
-	// 娓呯┖鍥捐〃
-	//this.f_ctx.clearRect(0, 0, this.width, this.height);
 	let options = this.flushOptions;
 	options.forEach(option => {
 		this.update(option);
diff --git a/src/components/PageHeader.vue b/src/components/PageHeader.vue
index 452ca4b..f3bfc6c 100644
--- a/src/components/PageHeader.vue
+++ b/src/components/PageHeader.vue
@@ -3,7 +3,7 @@
         <div class="headTitle">FMDS | 鐢垫満璇曢獙闆嗕腑娴嬫帶骞冲彴</div>
         <div class="headInfoCon">
             <div class="info">缃戠粶鐘舵��:姝e父</div>
-            <div class="scrollCon"><span v-html="notice"></span></div>
+            <div class="scrollCon"><span class="active" v-html="notice"></span></div>
         </div>
         <div class="headToolsCon">
             <div class="avatar">
@@ -135,11 +135,14 @@
         display: block;
         margin-left: 100%;
         width: 290px;
-        animation: myMove 8s linear infinite;
-        animation-fill-mode: forwards;
         overflow: hidden;
         text-overflow: ellipsis;
         white-space: nowrap;
+    }
+
+    .headInfoCon .scrollCon>span.active {
+        animation: myMove 6s linear 1;
+        animation-fill-mode: forwards;
     }
 
     /*鏂囧瓧鏃犵紳婊氬姩*/
@@ -149,7 +152,7 @@
         }
 
         100% {
-            transform: translateX(-580px);
+            transform: translateX(-290px);
         }
     }
 
diff --git a/src/pages/home/components/preOptionList.vue b/src/pages/home/components/preOptionList.vue
index 8324115..dc770ee 100644
--- a/src/pages/home/components/preOptionList.vue
+++ b/src/pages/home/components/preOptionList.vue
@@ -152,6 +152,7 @@
                         let rs = res.data;
                         if (rs.code == 1) {
                             this.$layer.msg("淇敼鎴愬姛");
+                            this.$emit('change')
                         } else {
                             this.$layer.msg("淇敼澶辫触");
                         }
@@ -167,6 +168,7 @@
                         let rs = res.data;
                         if (rs.code == 1) {
                             this.$layer.msg("淇敼鎴愬姛");
+                            this.$emit('change')
                         } else {
                             this.$layer.msg("淇敼澶辫触");
                         }
@@ -182,6 +184,7 @@
                         let rs = res.data;
                         if (rs.code == 1) {
                             this.$layer.msg("淇敼鎴愬姛");
+                            this.$emit('change')
                         } else {
                             this.$layer.msg("淇敼澶辫触");
                         }
@@ -197,6 +200,7 @@
                         let rs = res.data;
                         if (rs.code == 1) {
                             this.$layer.msg("淇敼鎴愬姛");
+                            this.$emit('change')
                         } else {
                             this.$layer.msg("淇敼澶辫触");
                         }
@@ -212,6 +216,7 @@
                         let rs = res.data;
                         if (rs.code == 1) {
                             this.$layer.msg("淇敼鎴愬姛");
+                            this.$emit('change')
                         } else {
                             this.$layer.msg("淇敼澶辫触");
                         }
@@ -227,6 +232,7 @@
                         let rs = res.data;
                         if (rs.code == 1) {
                             this.$layer.msg("淇敼鎴愬姛");
+                            this.$emit('change')
                         } else {
                             this.$layer.msg("淇敼澶辫触");
                         }
diff --git a/src/pages/home/topoGraph.vue b/src/pages/home/topoGraph.vue
index 5515c37..04ea2d1 100644
--- a/src/pages/home/topoGraph.vue
+++ b/src/pages/home/topoGraph.vue
@@ -374,7 +374,8 @@
         <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">
+                :switch32001="switch32001" :switch32002="switch32002" :switch5200="switch5200" v-if="drawer"
+                @change="changeLoad">
             </pre-option-list>
         </mw-drawer>
     </div>
@@ -534,7 +535,9 @@
                                         if (res.data.code == 1) {
                                             this.bigPower = res.data.data.rectifierPowerState;
                                             if (this.bigPower == 0) {
-                                                diagramStates(diagram, 'bigPower');
+                                                diagramStates(diagram, 'bigPower', true);
+                                            } else {
+                                                diagramStates(diagram, 'bigPower', false);
                                             }
                                             this.panel4 = res.data.data
                                             this.setDiagramByType()
@@ -550,7 +553,9 @@
                                         if (res.data.code == 1) {
                                             this.eleBoard = res.data.data.switchCloseBusScreen
                                             if (this.eleBoard == 0) {
-                                                diagramStates(diagram, 'eleBoard');
+                                                diagramStates(diagram, 'eleBoard', true);
+                                            } else {
+                                                diagramStates(diagram, 'eleBoard', false);
                                             }
                                             this.panel5 = res.data.data
                                             this.setDiagramByType()
@@ -566,7 +571,9 @@
                                         if (res.data.code == 1) {
                                             this.AFEcabinet = res.data.data.inverterRun
                                             if (this.AFEcabinet == 0) {
-                                                diagramStates(diagram, 'AFEcabinet');
+                                                diagramStates(diagram, 'AFEcabinet', true);
+                                            } else {
+                                                diagramStates(diagram, 'AFEcabinet', false);
                                             }
                                             this.panel7 = res.data.data
                                             this.setDiagramByType()
@@ -582,7 +589,9 @@
                                         if (res.data.code == 1) {
                                             this.waterStation = res.data.data.waterState
                                             if (this.waterStation == 0) {
-                                                diagramStates(diagram, 'waterStation');
+                                                diagramStates(diagram, 'waterStation', true);
+                                            } else {
+                                                diagramStates(diagram, 'waterStation', false);
                                             }
                                             this.panel8 = res.data.data
                                             this.setDiagramByType()
@@ -598,7 +607,9 @@
                                         if (res.data.code == 1) {
                                             this.oilStation = res.data.data.oilState
                                             if (this.oilStation == 0) {
-                                                diagramStates(diagram, 'oilStation');
+                                                diagramStates(diagram, 'oilStation', true);
+                                            } else {
+                                                diagramStates(diagram, 'oilStation', false);
                                             }
                                             this.panel9 = res.data.data
                                             this.setDiagramByType()
@@ -614,7 +625,9 @@
                                         if (res.data.code == 1) {
                                             this.switch5000 = res.data.data.switchClose;
                                             if (this.switch5000 == 1) {
-                                                diagramStates(diagram, 'switch5000');
+                                                diagramStates(diagram, 'switch5000', true);
+                                            } else {
+                                                diagramStates(diagram, 'switch5000', false);
                                             }
                                             this.panel1 = res.data.data
                                             this.setDiagramByType()
@@ -630,7 +643,9 @@
                                         if (res.data.code == 1) {
                                             this.switch32001 = res.data.data.switchClose
                                             if (this.switch32001 == 1) {
-                                                diagramStates(diagram, 'switch32001');
+                                                diagramStates(diagram, 'switch32001', true);
+                                            } else {
+                                                diagramStates(diagram, 'switch32001', false);
                                             }
                                             this.panel2 = res.data.data
                                             this.setDiagramByType()
@@ -646,7 +661,9 @@
                                         if (res.data.code == 1) {
                                             this.switch32002 = res.data.data.switchClose
                                             if (this.switch32002 == 1) {
-                                                diagramStates(diagram, 'switch32002');
+                                                diagramStates(diagram, 'switch32002', true);
+                                            } else {
+                                                diagramStates(diagram, 'switch32002', false);
                                             }
                                             this.panel3 = res.data.data
                                             this.setDiagramByType()
@@ -662,7 +679,9 @@
                                         if (res.data.code == 1) {
                                             this.switch5200 = res.data.data.switchClose
                                             if (this.switch5200 == 1) {
-                                                diagramStates(diagram, 'switch5200');
+                                                diagramStates(diagram, 'switch5200', true);
+                                            } else {
+                                                diagramStates(diagram, 'switch5200', false);
                                             }
                                             this.panel6 = res.data.data
                                             this.setDiagramByType()
@@ -731,58 +750,24 @@
             setDiagramByType() {
                 this.run = "";
                 if (this.speedCabinet == 0) {
-                    diagramStates(diagram, 'speedCabinet');
+                    diagramStates(diagram, 'speedCabinet', true);
                 }
                 if (this.electric == 0) {
-                    diagramStates(diagram, 'electric');
+                    diagramStates(diagram, 'electric', true);
                 }
                 if (this.sensor == 0) {
-                    diagramStates(diagram, 'sensor');
+                    diagramStates(diagram, 'sensor', true);
                 }
                 if (this.dynamometer == 0) {
-                    diagramStates(diagram, 'dynamometer');
+                    diagramStates(diagram, 'dynamometer', true);
                 }
                 if (this.transformer == 0) {
-                    diagramStates(diagram, 'transformer');
+                    diagramStates(diagram, 'transformer', true);
                 }
 
-                if (this.switch5000 == 1) {
-                    this.run = 'run1';
-                }
-                if (this.switch5000 == 1 && this.switch32001 == 1 && this.switch32002 == 1) {
-                    this.run = 'run2';
-                }
-                if (this.switch5000 == 1 && this.switch32001 == 1 && this.switch32002 == 1 && this.bigPower == 1) {
-                    this.run = 'run3';
-                }
-                if (this.switch5000 == 1 && this.switch32001 == 1 && this.switch32002 == 1 && this.bigPower == 1 && this
-                    .eleBoard == 1) {
-                    this.run = 'run4';
-                }
-                if (this.switch5000 == 1 && this.switch32001 == 1 && this.switch32002 == 1 && this.bigPower == 1 && this
-                    .eleBoard == 1 && this.speedCabinet == 1) {
-                    this.run = 'run5';
-                }
-                if (this.switch5000 == 1 && this.switch32001 == 1 && this.switch32002 == 1 && this.bigPower == 1 && this
-                    .eleBoard == 1 && this.speedCabinet == 1 && this.electric == 1) {
-                    this.run = 'run6';
-                }
-                if (this.switch5000 == 1 && this.switch32001 == 1 && this.switch32002 == 1 && this.bigPower == 1 && this
-                    .eleBoard == 1 && this.speedCabinet == 1 && this.electric == 1 && this.sensor == 1) {
-                    this.run = 'run7';
-                }
-                if (this.switch5000 == 1 && this.switch32001 == 1 && this.switch32002 == 1 && this.bigPower == 1 && this
-                    .eleBoard == 1 && this.speedCabinet == 1 && this.electric == 1 && this.sensor == 1 && this
-                    .dynamometer == 1) {
-                    this.run = 'run8';
-                }
-                if (this.switch5000 == 1 && this.switch32001 == 1 && this.switch32002 == 1 && this.bigPower == 1 && this
-                    .eleBoard == 1 && this.speedCabinet == 1 && this.electric == 1 && this.sensor == 1 && this
-                    .dynamometer == 1 && this.AFEcabinet ==
-                    1) {
-                    this.run = 'run9';
-                }
-                if (this.switch5000 == 1 && this.switch32001 == 1 && this.switch32002 == 1 && this.bigPower == 1 && this
+
+                if (this.switch5000 == 1 && this.switch32001 == 1 && this.switch32002 == 1 && this.bigPower ==
+                    1 && this
                     .eleBoard == 1 && this.speedCabinet == 1 && this.electric == 1 && this.sensor == 1 && this
                     .dynamometer == 1 && this.AFEcabinet == 1 && this.transformer == 1) {
                     this.run = 'run10';
@@ -791,8 +776,46 @@
                         this.axis2 = diagram.getZoomLineInfo('line11');
                         this.axis2[0][0] = this.axis2[0][0] - 15;
                     }, 100);
+                } else if (this.switch5000 == 1 && this.switch32001 == 1 && this.switch32002 == 1 && this.bigPower ==
+                    1 && this
+                    .eleBoard == 1 && this.speedCabinet == 1 && this.electric == 1 && this.sensor == 1 && this
+                    .dynamometer == 1) {
+                    this.run = 'run8';
+                } else if (this.switch5000 == 1 && this.switch32001 == 1 && this.switch32002 == 1 && this.bigPower ==
+                    1 && this
+                    .eleBoard == 1 && this.speedCabinet == 1 && this.electric == 1 && this.sensor == 1 && this
+                    .dynamometer == 1 && this.AFEcabinet ==
+                    1) {
+                    this.run = 'run9';
+                } else if (this.switch5000 == 1 && this.switch32001 == 1 && this.switch32002 == 1 && this.bigPower ==
+                    1 && this
+                    .eleBoard == 1 && this.speedCabinet == 1 && this.electric == 1 && this.sensor == 1) {
+                    this.run = 'run7';
+                } else if (this.switch5000 == 1 && this.switch32001 == 1 && this.switch32002 == 1 && this.bigPower ==
+                    1 && this
+                    .eleBoard == 1 && this.speedCabinet == 1 && this.electric == 1) {
+                    this.run = 'run6';
+                } else if (this.switch5000 == 1 && this.switch32001 == 1 && this.switch32002 == 1 && this.bigPower ==
+                    1 && this
+                    .eleBoard == 1 && this.speedCabinet == 1) {
+                    this.run = 'run5';
+                } else if (this.switch5000 == 1 && this.switch32001 == 1 && this.switch32002 == 1 && this.bigPower ==
+                    1 && this
+                    .eleBoard == 1) {
+                    this.run = 'run4';
+                } else if (this.switch5000 == 1 && this.switch32001 == 1 && this.switch32002 == 1 && this.bigPower ==
+                    1) {
+                    this.run = 'run3';
+                } else if (this.switch5000 == 1 && this.switch32001 == 1 && this.switch32002 == 1) {
+                    this.run = 'run2';
+                } else if (this.switch5000 == 1) {
+                    this.run = 'run1';
                 }
                 diagramStates(diagram, this.run);
+            },
+            changeLoad() {
+                this.searchAll()
+                diagram._update()
             }
         },
         mounted() {
diff --git a/src/pages/home/topoGraphdiagram/js/diagramStates.js b/src/pages/home/topoGraphdiagram/js/diagramStates.js
index 4044c9f..74fa1a2 100644
--- a/src/pages/home/topoGraphdiagram/js/diagramStates.js
+++ b/src/pages/home/topoGraphdiagram/js/diagramStates.js
@@ -3,113 +3,116 @@
 let red = "#b370fe";
 let scalcRadius = 7;
 // 鏀剧數鐘舵��
-function diagramStates(diagram, type) {
+function diagramStates(diagram, type, open) {
     // 鏂紑鎵�鏈夌殑寮�鍏�
     // diagram.setOption('km1', 'state', false);
     // diagram.setOption('km2', 'state', false);
     // diagram.setOption('km3', 'state', false);
     // diagram.setOption('km4', 'state', false);
-    // 娓呴櫎鐢垫祦
-    // diagram.del(/^line.*dot$/);
+    console.log()
+    if (type == '') {
+        // 娓呴櫎鐢垫祦
+        diagram.del(/^line.*dot$/);
+    }
     if (type == "run1") {
-        run1Charge(diagram);
+        run1Charge(diagram, open);
     }
 
     if (type == "run2") {
-        run2Charge(diagram);
+        run2Charge(diagram, open);
     }
 
     if (type == "run3") {
-        run3Charge(diagram);
+        run3Charge(diagram, open);
     }
 
     if (type == "run4") {
-        run4Charge(diagram);
+        run4Charge(diagram, open);
     }
 
     if (type == "run5") {
-        run5Charge(diagram);
+        run5Charge(diagram, open);
     }
 
     if (type == "run6") {
-        run6Charge(diagram);
+        run6Charge(diagram, open);
     }
 
     if (type == "run7") {
-        run7Charge(diagram);
+        run7Charge(diagram, open);
     }
 
     if (type == "run8") {
-        run8Charge(diagram);
+        run8Charge(diagram, open);
     }
 
     if (type == "run9") {
-        run9Charge(diagram);
+        run9Charge(diagram, open);
     }
 
     if (type == "run10") {
-        run10Charge(diagram);
+        run10Charge(diagram, open);
     }
 
     if (type == "bigPower") {
-        bigPowerCharge(diagram);
+        bigPowerCharge(diagram, open);
     }
 
     if (type == "eleBoard") {
-        eleBoardCharge(diagram);
+        eleBoardCharge(diagram, open);
     }
 
     if (type == "speedCabinet") {
-        speedCabinetCharge(diagram);
+        speedCabinetCharge(diagram, open);
     }
 
     if (type == "electric") {
-        electricCharge(diagram);
+        electricCharge(diagram, open);
     }
 
     if (type == "sensor") {
-        sensorCharge(diagram);
+        sensorCharge(diagram, open);
     }
 
     if (type == "dynamometer") {
-        dynamometerCharge(diagram);
+        dynamometerCharge(diagram, open);
     }
 
     if (type == "AFEcabinet") {
-        AFEcabinetCharge(diagram);
+        AFEcabinetCharge(diagram, open);
     }
 
     if (type == "transformer") {
-        transformerCharge(diagram);
+        transformerCharge(diagram, open);
     }
 
     if (type == "waterStation") {
-        waterStationCharge(diagram);
+        waterStationCharge(diagram, open);
     }
 
     if (type == "oilStation") {
-        oilStationCharge(diagram);
+        oilStationCharge(diagram, open);
     }
 
     if (type == "switch5000") {
-        switch5000Charge(diagram);
+        switch5000Charge(diagram, open);
     }
 
     if (type == "switch32001") {
-        switch32001Charge(diagram);
+        switch32001Charge(diagram, open);
     }
 
     if (type == "switch32002") {
-        switch32002Charge(diagram);
+        switch32002Charge(diagram, open);
     }
 
     if (type == "switch5200") {
-        switch5200Charge(diagram);
+        switch5200Charge(diagram, open);
     }
 }
 
 // 杩愯鐘舵��1
-function run1Charge(diagram) {
+function run1Charge(diagram, open) {
     // 绾挎潯1
     let line1 = diagram.getOption('line1').points;
     // 绾挎潯2
@@ -125,7 +128,7 @@
 }
 
 // 杩愯鐘舵��2
-function run2Charge(diagram) {
+function run2Charge(diagram, open) {
     // 绾挎潯1
     let line1 = diagram.getOption('line1').points;
     // 绾挎潯2
@@ -180,7 +183,7 @@
     // });
 }
 
-function run3Charge(diagram) {
+function run3Charge(diagram, open) {
 
     // 绾挎潯1
     let line1 = diagram.getOption('line1').points;
@@ -263,7 +266,7 @@
     });
 }
 
-function run4Charge(diagram) {
+function run4Charge(diagram, open) {
 
     // 绾挎潯1
     let line1 = diagram.getOption('line1').points;
@@ -358,7 +361,7 @@
     });
 }
 
-function run5Charge(diagram) {
+function run5Charge(diagram, open) {
 
     // 绾挎潯1
     let line1 = diagram.getOption('line1').points;
@@ -464,7 +467,7 @@
     });
 }
 
-function run6Charge(diagram) {
+function run6Charge(diagram, open) {
 
     // 绾挎潯1
     let line1 = diagram.getOption('line1').points;
@@ -583,7 +586,7 @@
 
 }
 
-function run7Charge(diagram) {
+function run7Charge(diagram, open) {
 
     // 绾挎潯1
     let line1 = diagram.getOption('line1').points;
@@ -713,7 +716,7 @@
     });
 }
 
-function run8Charge(diagram) {
+function run8Charge(diagram, open) {
 
     // 绾挎潯1
     let line1 = diagram.getOption('line1').points;
@@ -854,7 +857,7 @@
     });
 }
 
-function run9Charge(diagram) {
+function run9Charge(diagram, open) {
 
     // 绾挎潯1
     let line1 = diagram.getOption('line1').points;
@@ -1007,7 +1010,7 @@
     });
 }
 
-function run10Charge(diagram) {
+function run10Charge(diagram, open) {
 
     // 绾挎潯1
     let line1 = diagram.getOption('line1').points;
@@ -1205,459 +1208,217 @@
 }
 
 
-function bigPowerCharge(diagram) {
-    //澶у姛鐜囨暣娴佺數婧�
-    let Image2 = diagram.getOption('img2');
-    diagram.ripples({
-        id: 'ripples1',
-        flush: true,
-        color: red,
-        point: [Image2.point[0] + Image2.width / 2, Image2.point[1] + Image2.height / 2],
-        maxRadius: Image2.width > Image2.height ? (Image2.width / 2) + 15 : (Image2.height / 2) + 15,
-        minRadius: Image2.width > Image2.height ? Image2.width / 4 : Image2.height / 4,
-        radius: Image2.width > Image2.height ? Image2.width / 2 : Image2.height / 2,
-    })
-    // let line18 = diagram.getOption('line18').points;
-    // diagram.moveDot({
-    //     id: 'line18_dot',
-    //     fillStyle: springGreen,
-    //     strokeStyle: springGreen,
-    //     radius: scalcRadius,
-    //     flush: true,
-    //     points: [
-    //         [line18[0][0] - 35, line18[0][1]],
-    //         [line18[1][0] + 35, line18[1][1]]
-    //     ],
-    // });
+function bigPowerCharge(diagram, open) {
+    if (open) {
+        //澶у姛鐜囨暣娴佺數婧�
+        let Image2 = diagram.getOption('img2');
+        diagram.ripples({
+            id: 'ripples1',
+            flush: true,
+            color: red,
+            point: [Image2.point[0] + Image2.width / 2, Image2.point[1] + Image2.height / 2],
+            maxRadius: Image2.width > Image2.height ? (Image2.width / 2) + 15 : (Image2.height / 2) + 15,
+            minRadius: Image2.width > Image2.height ? Image2.width / 4 : Image2.height / 4,
+            radius: Image2.width > Image2.height ? Image2.width / 2 : Image2.height / 2,
+        })
+    } else {
+        diagram.del(/^ripples1$/);
+    }
 }
 
-function eleBoardCharge(diagram) {
-    //鐩存祦涓婚厤鐢垫澘
-    let Image3 = diagram.getOption('img3');
-    diagram.ripples({
-        id: 'ripples2',
-        flush: true,
-        color: red,
-        point: [Image3.point[0] + Image3.width / 2, Image3.point[1] + Image3.height / 2],
-        maxRadius: Image3.width > Image3.height ? (Image3.width / 2) + 15 : (Image3.height / 2) + 15,
-        minRadius: Image3.width > Image3.height ? Image3.width / 4 : Image3.height / 4,
-        radius: Image3.width > Image3.height ? Image3.width / 2 : Image3.height / 2,
-    })
-    // let line18 = diagram.getOption('line18').points;
-    // let line19 = diagram.getOption('line19').points;
-    // let line20 = diagram.getOption('line20').points;
-    // let line21 = diagram.getOption('line21').points;
-
-    // diagram.moveDot({
-    //     id: 'line21_dot',
-    //     fillStyle: springGreen,
-    //     strokeStyle: springGreen,
-    //     radius: scalcRadius,
-    //     flush: true,
-    //     points: [
-    //         [line18[0][0] - 35, line21[1][1]],
-    //         [line21[0][0], line21[0][1]],
-    //     ],
-    // });
-    // diagram.moveDot({
-    //     id: 'line20_dot',
-    //     fillStyle: springGreen,
-    //     strokeStyle: springGreen,
-    //     radius: scalcRadius,
-    //     flush: true,
-    //     points: [
-    //         [line20[1][0], line20[1][1]],
-    //         [line20[0][0], line20[0][1]],
-    //     ],
-    // });
-    // diagram.moveDot({
-    //     id: 'line19_dot',
-    //     fillStyle: springGreen,
-    //     strokeStyle: springGreen,
-    //     radius: scalcRadius,
-    //     flush: true,
-    //     points: [
-    //         [line19[0][0], line19[0][1]],
-    //         [line19[1][0] + 35, line19[1][1]],
-    //     ],
-    // });
+function eleBoardCharge(diagram, open) {
+    if (open) {
+        //鐩存祦涓婚厤鐢垫澘
+        let Image3 = diagram.getOption('img3');
+        diagram.ripples({
+            id: 'ripples2',
+            flush: true,
+            color: red,
+            point: [Image3.point[0] + Image3.width / 2, Image3.point[1] + Image3.height / 2],
+            maxRadius: Image3.width > Image3.height ? (Image3.width / 2) + 15 : (Image3.height / 2) + 15,
+            minRadius: Image3.width > Image3.height ? Image3.width / 4 : Image3.height / 4,
+            radius: Image3.width > Image3.height ? Image3.width / 2 : Image3.height / 2,
+        })
+    } else {
+        diagram.del(/^ripples2$/);
+    }
 }
 
-function speedCabinetCharge(diagram) {
-    //鐩存祦璋冮�熸煖
-    let Image4 = diagram.getOption('img4');
-    diagram.ripples({
-        id: 'ripples3',
-        flush: true,
-        color: red,
-        point: [Image4.point[0] + Image4.width / 2, Image4.point[1] + Image4.height / 2],
-        maxRadius: Image4.width > Image4.height ? (Image4.width / 2) + 15 : (Image4.height / 2) + 15,
-        minRadius: Image4.width > Image4.height ? Image4.width / 4 : Image4.height / 4,
-        radius: Image4.width > Image4.height ? Image4.width / 2 : Image4.height / 2,
-    })
-
-    // let line22 = diagram.getOption('line22').points;
-    // let line23 = diagram.getOption('line23').points;
-    // let line24 = diagram.getOption('line24').points;
-    // let line25 = diagram.getOption('line25').points;
-    // let line26 = diagram.getOption('line26').points;
-
-    // diagram.moveDot({
-    //     id: 'line26_dot',
-    //     fillStyle: springGreen,
-    //     strokeStyle: springGreen,
-    //     radius: scalcRadius,
-    //     flush: true,
-    //     points: [
-    //         [line26[1][0] - 35, line26[1][1]],
-    //         [line26[0][0], line26[0][1]],
-    //     ],
-    // });
-    // diagram.moveDot({
-    //     id: 'line25_dot',
-    //     fillStyle: springGreen,
-    //     strokeStyle: springGreen,
-    //     radius: scalcRadius,
-    //     flush: true,
-    //     points: [
-    //         [line25[1][0], line25[1][1]],
-    //         [line25[0][0], line25[0][1]],
-    //     ],
-    // });
-    // diagram.moveDot({
-    //     id: 'line24_dot',
-    //     fillStyle: springGreen,
-    //     strokeStyle: springGreen,
-    //     radius: scalcRadius,
-    //     flush: true,
-    //     points: [
-    //         [line24[1][0], line24[1][1]],
-    //         [line24[0][0], line24[0][1]],
-    //     ],
-    // });
-    // diagram.moveDot({
-    //     id: 'line23_dot',
-    //     fillStyle: springGreen,
-    //     strokeStyle: springGreen,
-    //     radius: scalcRadius,
-    //     flush: true,
-    //     points: [
-    //         [line23[1][0], line23[1][1]],
-    //         [line23[0][0], line23[0][1]],
-    //     ],
-    // });
-    // diagram.moveDot({
-    //     id: 'line22_dot',
-    //     fillStyle: springGreen,
-    //     strokeStyle: springGreen,
-    //     radius: scalcRadius,
-    //     flush: true,
-    //     points: [
-    //         [line22[0][0], line22[0][1]],
-    //         [line22[1][0] + 35, line22[1][1]],
-    //     ],
-    // });
+function speedCabinetCharge(diagram, open) {
+    if (open) {
+        //鐩存祦璋冮�熸煖
+        let Image4 = diagram.getOption('img4');
+        diagram.ripples({
+            id: 'ripples3',
+            flush: true,
+            color: red,
+            point: [Image4.point[0] + Image4.width / 2, Image4.point[1] + Image4.height / 2],
+            maxRadius: Image4.width > Image4.height ? (Image4.width / 2) + 15 : (Image4.height / 2) + 15,
+            minRadius: Image4.width > Image4.height ? Image4.width / 4 : Image4.height / 4,
+            radius: Image4.width > Image4.height ? Image4.width / 2 : Image4.height / 2,
+        })
+    } else {
+        diagram.del(/^ripples3$/);
+    }
 }
 
-function electricCharge(diagram) {
-    //鐢垫満
-    let Image5 = diagram.getOption('img5');
-    diagram.ripples({
-        id: 'ripples4',
-        flush: true,
-        color: red,
-        point: [Image5.point[0] + Image5.width / 2, Image5.point[1] + Image5.height / 2],
-        maxRadius: Image5.width > Image5.height ? (Image5.width / 2) + 15 : (Image5.height / 2) + 15,
-        minRadius: Image5.width > Image5.height ? Image5.width / 4 : Image5.height / 4,
-        radius: Image5.width > Image5.height ? Image5.width / 2 : Image5.height / 2,
-    })
-
-    // let line27 = diagram.getOption('line27').points;
-    // let line28 = diagram.getOption('line28').points;
-
-    // diagram.moveDot({
-    //     id: 'line28_dot',
-    //     fillStyle: springGreen,
-    //     strokeStyle: springGreen,
-    //     radius: scalcRadius,
-    //     flush: true,
-    //     points: [
-    //         [line28[1][0], line28[1][1] + 35],
-    //         [line28[0][0], line28[0][1]],
-    //     ],
-    // });
-    // diagram.moveDot({
-    //     id: 'line27_dot',
-    //     fillStyle: springGreen,
-    //     strokeStyle: springGreen,
-    //     radius: scalcRadius,
-    //     flush: true,
-    //     points: [
-    //         [line27[0][0], line27[0][1]],
-    //         [line27[1][0] + 35, line27[1][1]],
-    //     ],
-    // });
-    // let line30 = diagram.getOption('line30').points;
-    // let line31 = diagram.getOption('line31').points;
-    // let line29 = diagram.getOption('line29').points;
-
-    // diagram.moveDot({
-    //     id: 'line30_dot',
-    //     fillStyle: springGreen,
-    //     strokeStyle: springGreen,
-    //     radius: scalcRadius,
-    //     flush: true,
-    //     points: [
-    //         [line30[1][0] - 35, line30[1][1]],
-    //         [line30[0][0], line30[0][1]],
-    //     ],
-    // });
-    // diagram.moveDot({
-    //     id: 'line31_dot',
-    //     fillStyle: springGreen,
-    //     strokeStyle: springGreen,
-    //     radius: scalcRadius,
-    //     flush: true,
-    //     points: [
-    //         [line31[0][0], line31[0][1]],
-    //         [line31[1][0], line31[1][1] - 35],
-    //     ],
-    // });
-    //闇囧姩娴嬭瘯鍣�
-    let Image14 = diagram.getOption('img14');
-    diagram.ripples({
-        id: 'ripples14',
-        flush: true,
-        color: red,
-        point: [Image14.point[0] + Image14.width / 2, Image14.point[1] + Image14.height / 2],
-        maxRadius: Image14.width > Image14.height ? (Image14.width / 2) + 15 : (Image14.height / 2) + 15,
-        minRadius: Image14.width > Image14.height ? Image14.width / 4 : Image14.height / 4,
-        radius: Image14.width > Image14.height ? Image14.width / 2 : Image14.height / 2,
-    })
-    // diagram.moveDot({
-    //     id: 'line29_dot',
-    //     fillStyle: springGreen,
-    //     strokeStyle: springGreen,
-    //     radius: scalcRadius,
-    //     flush: true,
-    //     points: [
-    //         [line29[1][0], line29[1][1] + 35],
-    //         [line29[0][0], line29[0][1] - 35],
-    //     ],
-    // });
+function electricCharge(diagram, open) {
+    if (open) {
+        //鐢垫満
+        let Image5 = diagram.getOption('img5');
+        diagram.ripples({
+            id: 'ripples4',
+            flush: true,
+            color: red,
+            point: [Image5.point[0] + Image5.width / 2, Image5.point[1] + Image5.height / 2],
+            maxRadius: Image5.width > Image5.height ? (Image5.width / 2) + 15 : (Image5.height / 2) + 15,
+            minRadius: Image5.width > Image5.height ? Image5.width / 4 : Image5.height / 4,
+            radius: Image5.width > Image5.height ? Image5.width / 2 : Image5.height / 2,
+        })
+        //闇囧姩娴嬭瘯鍣�
+        let Image14 = diagram.getOption('img14');
+        diagram.ripples({
+            id: 'ripples14',
+            flush: true,
+            color: red,
+            point: [Image14.point[0] + Image14.width / 2, Image14.point[1] + Image14.height / 2],
+            maxRadius: Image14.width > Image14.height ? (Image14.width / 2) + 15 : (Image14.height / 2) + 15,
+            minRadius: Image14.width > Image14.height ? Image14.width / 4 : Image14.height / 4,
+            radius: Image14.width > Image14.height ? Image14.width / 2 : Image14.height / 2,
+        })
+    } else {
+        diagram.del(/^ripples4$/);
+        diagram.del(/^ripples14$/);
+    }
 }
 
-function sensorCharge(diagram) {
-    //鎵煩浼犳劅鍣�
-    let Image7 = diagram.getOption('img7');
-    diagram.ripples({
-        id: 'ripples5',
-        flush: true,
-        color: red,
-        point: [Image7.point[0] + Image7.width / 2, Image7.point[1] + Image7.height / 2],
-        maxRadius: Image7.width > Image7.height ? (Image7.width / 2) + 15 : (Image7.height / 2) + 15,
-        minRadius: Image7.width > Image7.height ? Image7.width / 4 : Image7.height / 4,
-        radius: Image7.width > Image7.height ? Image7.width / 2 : Image7.height / 2,
-    })
-    // let line32 = diagram.getOption('line32').points;
-    // diagram.moveDot({
-    //     id: 'line32_dot',
-    //     fillStyle: springGreen,
-    //     strokeStyle: springGreen,
-    //     radius: scalcRadius,
-    //     flush: true,
-    //     points: [
-    //         [line32[1][0], line32[1][1] + 35],
-    //         [line32[0][0], line32[0][1] - 35],
-    //     ],
-    // });
+function sensorCharge(diagram, open) {
+    if (open) {
+        //鎵煩浼犳劅鍣�
+        let Image7 = diagram.getOption('img7');
+        diagram.ripples({
+            id: 'ripples5',
+            flush: true,
+            color: red,
+            point: [Image7.point[0] + Image7.width / 2, Image7.point[1] + Image7.height / 2],
+            maxRadius: Image7.width > Image7.height ? (Image7.width / 2) + 15 : (Image7.height / 2) + 15,
+            minRadius: Image7.width > Image7.height ? Image7.width / 4 : Image7.height / 4,
+            radius: Image7.width > Image7.height ? Image7.width / 2 : Image7.height / 2,
+        })
+    } else {
+        diagram.del(/^ripples5$/);
+    }
 }
 
-function dynamometerCharge(diagram) {
-    //娴嬪姛鏈�
-    let Image8 = diagram.getOption('img8');
-    diagram.ripples({
-        id: 'ripples6',
-        flush: true,
-        color: red,
-        point: [Image8.point[0] + Image8.width / 2, Image8.point[1] + Image8.height / 2],
-        maxRadius: Image8.width > Image8.height ? (Image8.width / 2) + 15 : (Image8.height / 2) + 15,
-        minRadius: Image8.width > Image8.height ? Image8.width / 4 : Image8.height / 4,
-        radius: Image8.width > Image8.height ? Image8.width / 2 : Image8.height / 2,
-    })
-    // let line35 = diagram.getOption('line35').points;
-    // let line34 = diagram.getOption('line34').points;
-    // let line33 = diagram.getOption('line33').points;
-    // diagram.moveDot({
-    //     id: 'line35_dot',
-    //     fillStyle: springGreen,
-    //     strokeStyle: springGreen,
-    //     radius: scalcRadius,
-    //     flush: true,
-    //     points: [
-    //         [line35[1][0] + 35, line35[1][1]],
-    //         [line35[0][0], line35[0][1]],
-    //     ],
-    // });
-    // diagram.moveDot({
-    //     id: 'line34_dot',
-    //     fillStyle: springGreen,
-    //     strokeStyle: springGreen,
-    //     radius: scalcRadius,
-    //     flush: true,
-    //     points: [
-    //         [line34[1][0], line34[1][1]],
-    //         [line34[0][0], line34[0][1]],
-    //     ],
-    // });
-    // diagram.moveDot({
-    //     id: 'line33_dot',
-    //     fillStyle: springGreen,
-    //     strokeStyle: springGreen,
-    //     radius: scalcRadius,
-    //     flush: true,
-    //     points: [
-    //         [line33[1][0], line33[1][1]],
-    //         [line33[0][0] - 35, line33[0][1]],
-    //     ],
-    // });
+function dynamometerCharge(diagram, open) {
+    if (open) {
+        //娴嬪姛鏈�
+        let Image8 = diagram.getOption('img8');
+        diagram.ripples({
+            id: 'ripples6',
+            flush: true,
+            color: red,
+            point: [Image8.point[0] + Image8.width / 2, Image8.point[1] + Image8.height / 2],
+            maxRadius: Image8.width > Image8.height ? (Image8.width / 2) + 15 : (Image8.height / 2) + 15,
+            minRadius: Image8.width > Image8.height ? Image8.width / 4 : Image8.height / 4,
+            radius: Image8.width > Image8.height ? Image8.width / 2 : Image8.height / 2,
+        })
+    } else {
+        diagram.del(/^ripples6$/);
+    }
 }
 
-function AFEcabinetCharge(diagram) {
-    //鍙橀鏌�
-    let Image9 = diagram.getOption('img9');
-    diagram.ripples({
-        id: 'ripples7',
-        flush: true,
-        color: red,
-        point: [Image9.point[0] + Image9.width / 2, Image9.point[1] + Image9.height / 2],
-        maxRadius: Image9.width > Image9.height ? (Image9.width / 2) + 15 : (Image9.height / 2) + 15,
-        minRadius: Image9.width > Image9.height ? Image9.width / 4 : Image9.height / 4,
-        radius: Image9.width > Image9.height ? Image9.width / 2 : Image9.height / 2,
-    })
-    // let line36 = diagram.getOption('line36').points;
-    // let line37 = diagram.getOption('line37').points;
-    // let line38 = diagram.getOption('line38').points;
-    // diagram.moveDot({
-    //     id: 'line38_dot',
-    //     fillStyle: springGreen,
-    //     strokeStyle: springGreen,
-    //     radius: scalcRadius,
-    //     flush: true,
-    //     points: [
-    //         [line38[1][0] + 35, line38[1][1]],
-    //         [line38[0][0], line38[0][1]],
-    //     ],
-    // });
-    // diagram.moveDot({
-    //     id: 'line37_dot',
-    //     fillStyle: springGreen,
-    //     strokeStyle: springGreen,
-    //     radius: scalcRadius,
-    //     flush: true,
-    //     points: [
-    //         [line37[1][0], line37[1][1]],
-    //         [line37[0][0], line37[0][1]],
-    //     ],
-    // });
-    // diagram.moveDot({
-    //     id: 'line36_dot',
-    //     fillStyle: springGreen,
-    //     strokeStyle: springGreen,
-    //     radius: scalcRadius,
-    //     flush: true,
-    //     points: [
-    //         [line36[1][0], line36[1][1]],
-    //         [line36[0][0] - 35, line36[0][1]],
-    //     ],
-    // });
+function AFEcabinetCharge(diagram, open) {
+    if (open) {
+        //鍙橀鏌�
+        let Image9 = diagram.getOption('img9');
+        diagram.ripples({
+            id: 'ripples7',
+            flush: true,
+            color: red,
+            point: [Image9.point[0] + Image9.width / 2, Image9.point[1] + Image9.height / 2],
+            maxRadius: Image9.width > Image9.height ? (Image9.width / 2) + 15 : (Image9.height / 2) + 15,
+            minRadius: Image9.width > Image9.height ? Image9.width / 4 : Image9.height / 4,
+            radius: Image9.width > Image9.height ? Image9.width / 2 : Image9.height / 2,
+        })
+    } else {
+        diagram.del(/^ripples7$/);
+    }
 }
 
-function transformerCharge(diagram) {
-    //鍙樺帇鍣�
-    let Image10 = diagram.getOption('img10');
-    diagram.ripples({
-        id: 'ripples8',
-        flush: true,
-        color: red,
-        point: [Image10.point[0] + Image10.width / 2, Image10.point[1] + Image10.height / 2],
-        maxRadius: Image10.width > Image10.height ? (Image10.width / 2) + 15 : (Image10.height / 2) + 15,
-        minRadius: Image10.width > Image10.height ? Image10.width / 4 : Image10.height / 4,
-        radius: Image10.width > Image10.height ? Image10.width / 2 : Image10.height / 2,
-    })
-}
-
-function waterStationCharge(diagram) {
-    //渚涙按绔�
-    let Image11 = diagram.getOption('img11');
-    diagram.ripples({
-        id: 'ripples9',
-        flush: true,
-        color: red,
-        point: [Image11.point[0] + Image11.width / 2, Image11.point[1] + Image11.height / 2],
-        maxRadius: Image11.width > Image11.height ? (Image11.width / 2) + 15 : (Image11.height / 2) + 15,
-        minRadius: Image11.width > Image11.height ? Image11.width / 4 : Image11.height / 4,
-        radius: Image11.width > Image11.height ? Image11.width / 2 : Image11.height / 2,
-    })
-
-    // let line16 = diagram.getOption('line16').points;
-    // diagram.moveDot({
-    //     id: 'line16_dot',
-    //     fillStyle: springGreen,
-    //     strokeStyle: springGreen,
-    //     radius: scalcRadius,
-    //     flush: true,
-    //     points: [line16[0],
-    //         [line16[1][0] + 35, line16[1][1]]
-    //     ],
-    // });
-}
-
-function oilStationCharge(diagram) {
-    //渚涙补绔�
-    let Image12 = diagram.getOption('img12');
-    diagram.ripples({
-        id: 'ripples10',
-        flush: true,
-        color: red,
-        point: [Image12.point[0] + Image12.width / 2, Image12.point[1] + Image12.height / 2],
-        maxRadius: Image12.width > Image12.height ? (Image12.width / 2) + 15 : (Image12.height / 2) + 15,
-        minRadius: Image12.width > Image12.height ? Image12.width / 4 : Image12.height / 4,
-        radius: Image12.width > Image12.height ? Image12.width / 2 : Image12.height / 2,
-    })
-
-    // let line17 = diagram.getOption('line17').points;
-    // diagram.moveDot({
-    //     id: 'line17_dot',
-    //     fillStyle: springGreen,
-    //     strokeStyle: springGreen,
-    //     radius: scalcRadius,
-    //     flush: true,
-    //     points: [line17[0],
-    //         [line17[1][0] + 35, line17[1][1]]
-    //     ],
-    // });
+function transformerCharge(diagram, open) {
+    if (open) {
+        //鍙樺帇鍣�
+        let Image10 = diagram.getOption('img10');
+        diagram.ripples({
+            id: 'ripples8',
+            flush: true,
+            color: red,
+            point: [Image10.point[0] + Image10.width / 2, Image10.point[1] + Image10.height / 2],
+            maxRadius: Image10.width > Image10.height ? (Image10.width / 2) + 15 : (Image10.height / 2) + 15,
+            minRadius: Image10.width > Image10.height ? Image10.width / 4 : Image10.height / 4,
+            radius: Image10.width > Image10.height ? Image10.width / 2 : Image10.height / 2,
+        })
+    } else {
+        diagram.del(/^ripples8$/);
+    }
 
 }
 
-function switch5000Charge(diagram) {
+function waterStationCharge(diagram, open) {
+    if (open) {
+        //渚涙按绔�
+        let Image11 = diagram.getOption('img11');
+        diagram.ripples({
+            id: 'ripples9',
+            flush: true,
+            color: red,
+            point: [Image11.point[0] + Image11.width / 2, Image11.point[1] + Image11.height / 2],
+            maxRadius: Image11.width > Image11.height ? (Image11.width / 2) + 15 : (Image11.height / 2) + 15,
+            minRadius: Image11.width > Image11.height ? Image11.width / 4 : Image11.height / 4,
+            radius: Image11.width > Image11.height ? Image11.width / 2 : Image11.height / 2,
+        })
+    } else {
+        diagram.del(/^ripples9$/);
+    }
+}
+
+function oilStationCharge(diagram, open) {
+    if (open) {
+        //渚涙补绔�
+        let Image12 = diagram.getOption('img12');
+        diagram.ripples({
+            id: 'ripples10',
+            flush: true,
+            color: red,
+            point: [Image12.point[0] + Image12.width / 2, Image12.point[1] + Image12.height / 2],
+            maxRadius: Image12.width > Image12.height ? (Image12.width / 2) + 15 : (Image12.height / 2) + 15,
+            minRadius: Image12.width > Image12.height ? Image12.width / 4 : Image12.height / 4,
+            radius: Image12.width > Image12.height ? Image12.width / 2 : Image12.height / 2,
+        })
+    } else {
+        diagram.del(/^ripples10$/);
+    }
+}
+
+function switch5000Charge(diagram, open) {
     // 鎵撳紑寮�鍏�
-    diagram.setOption('km1', 'state', true);
+    diagram.setOption('km1', 'state', open);
 }
 
-function switch32001Charge(diagram) {
+function switch32001Charge(diagram, open) {
     // 鎵撳紑寮�鍏�
-    diagram.setOption('km2', 'state', true);
+    diagram.setOption('km2', 'state', open);
 }
 
-function switch32002Charge(diagram) {
+function switch32002Charge(diagram, open) {
     // 鎵撳紑寮�鍏�
-    diagram.setOption('km3', 'state', true);
+    diagram.setOption('km3', 'state', open);
 }
 
-function switch5200Charge(diagram) {
+function switch5200Charge(diagram, open) {
     // 鎵撳紑寮�鍏�
-    diagram.setOption('km4', 'state', true);
+    diagram.setOption('km4', 'state', open);
 }
 
 

--
Gitblit v1.9.1