Forráskód Böngészése

站点详情跳转传参202107221431

fanghuisheng 4 éve
szülő
commit
9835fb018f

+ 1 - 1
package.json

@@ -4,7 +4,7 @@
     "private": true,
     "scripts": {
         "serve": "vue-cli-service serve",
-        "build": "vue-cli-service build && vue-cli-service build --mode test",
+        "build": "vue-cli-service build || vue-cli-service build --mode test",
         "lint": "vue-cli-service lint"
     },
     "dependencies": {

+ 358 - 240
src/components/SvgComponents.vue

@@ -4,7 +4,7 @@
 <script>
 let importComponents = {};
 export default {
-  props: ["svgInfoData", "svg_color", "svgtype", "text", "fontSize","height"],
+  props: ["svgInfoData", "svg_color", "svgtype", "text", "fontSize", "height"],
   data() {
     return {
       componentTag: "",
@@ -14,16 +14,16 @@ export default {
   watch: {
     text(text) {
       this.editText(text);
-      
     },
-    fontSize(fontSize){
+    fontSize(fontSize) {
       this.font_Size(fontSize);
     },
-    height(height){
+    height(height) {
       this.edit_height(height);
-    }
+    },
   },
   created() {
+    console.log(this.svgInfoData)
     this.svgInfoData.forEach((f) => {
       let componentInfo = {
         template: f.template,
@@ -41,7 +41,7 @@ export default {
   },
   methods: {
     editText(val) {
-      var el = this.$refs.textsss.$el
+      var el = this.$refs.textsss.$el;
       if (el != undefined) {
         // console.log(this.$refs.textsss);
         if (el.nodeName === "text") {
@@ -51,270 +51,388 @@ export default {
       }
     },
     font_Size(val) {
-      var el = this.$refs.textsss.$el
+      var el = this.$refs.textsss.$el;
       if (el != undefined) {
         if (el.nodeName === "text") {
-          var len = el.innerHTML.length
-          el.setAttribute("x" ,-(val/2)*len);
-          el.setAttribute("y" ,val/2);
-          el.setAttribute("font-size" ,val);
+          var len = el.innerHTML.length;
+          el.setAttribute("x", -(val / 2) * len);
+          el.setAttribute("y", val / 2);
+          el.setAttribute("font-size", val);
         }
       }
     },
-    edit_height(val){
-      var el = this.$refs.textsss.$el
+    edit_height(val) {
+      var el = this.$refs.textsss.$el;
+
       if (el != undefined) {
-        var dom = document.getElementById(el.parentNode.id)
-        var title = dom.getAttribute('title')
-        var type = dom.getAttribute('type')
+        var dom = document.getElementById(el.parentNode.id);
+        var title = dom.getAttribute("title");
+        var type = dom.getAttribute("type");
 
-        let rect = dom.getElementsByTagName('rect')[0]
+        let rect = dom.getElementsByTagName("rect")[0];
 
-        let line = dom.getElementsByTagName('line')[0]
-        let line2 = dom.getElementsByTagName('line')[1]
-        let line3 = dom.getElementsByTagName('line')[2]
-        let line4 = dom.getElementsByTagName('line')[3]
+        let line = dom.getElementsByTagName("line")[0];
+        let line2 = dom.getElementsByTagName("line")[1];
+        let line3 = dom.getElementsByTagName("line")[2];
+        let line4 = dom.getElementsByTagName("line")[3];
 
-        let polyline = dom.getElementsByTagName('polyline')[0]
-        let polyline2 = dom.getElementsByTagName('polyline')[1]
+        let polyline = dom.getElementsByTagName("polyline")[0];
+        let polyline2 = dom.getElementsByTagName("polyline")[1];
 
-        let polygon = dom.getElementsByTagName('polygon')[0]
+        let polygon = dom.getElementsByTagName("polygon")[0];
 
-        let ellipse = dom.getElementsByTagName('ellipse')[0]
-        let ellipse2 = dom.getElementsByTagName('ellipse')[1]
+        let ellipse = dom.getElementsByTagName("ellipse")[0];
+        let ellipse2 = dom.getElementsByTagName("ellipse")[1];
 
+        var line_ = dom.getElementsByTagName("line");
+        let polyline_ = dom.getElementsByTagName("polyline");
+        var ellipse_ = dom.getElementsByTagName("ellipse");
+        let polygon_ = dom.getElementsByTagName("polygon");
+        var path_ = dom.getElementsByTagName("path");
+        var x1, y1, x2, y2, points, cx, cy, rx, ry, transform;
 
-        var line_ = dom.getElementsByTagName('line');
-        let polyline_ = dom.getElementsByTagName('polyline');
-        var ellipse_ = dom.getElementsByTagName('ellipse');
-        let polygon_ = dom.getElementsByTagName('polygon');
-        var path_ = dom.getElementsByTagName('path');
-        var x1,y1,x2,y2,points,cx,cy,rx,ry,transform;
+        // console.log(val, el);
 
-        if(val != null && val != ""){
-          if(title === '断路器'){
-            rect.setAttribute("x" ,-val/4);
-            rect.setAttribute("y" ,-val/2);
-            rect.setAttribute("width" ,val/2);
-            rect.setAttribute("height" ,val);
-          }else if (title === '长方形'){
-            rect.setAttribute("x" ,-val/6);
-            rect.setAttribute("y" ,-val/2);
-            rect.setAttribute("width" ,val/3);
-            rect.setAttribute("height" ,val);
-          }else if (title === '竖线'){
-            line.setAttribute("y1",-val/2);
-            line.setAttribute("y2",val/2);
-          }else if (title === '避雷器'){
-            rect.setAttribute("x" ,-val);
-            rect.setAttribute("y" ,-val*2);
-            rect.setAttribute("width" ,(val*2)+1);
-            rect.setAttribute("height" ,val*5);
-            line.setAttribute("y1" ,-val*3);
-            line2.setAttribute("y1" ,val*3);
-            line2.setAttribute("y2" ,val*4);
-          }else if (title === '隔离开关'){
-            line.setAttribute("y1" ,-val);
-            line2.setAttribute("x1" ,-val/2);
-            line2.setAttribute("x2" ,val/3);
-            line3.setAttribute("y1" ,val);
-            line3.setAttribute("x2" ,-val/2);
-            line3.setAttribute("y2" ,val/4);
-            line4.setAttribute("y1" ,val*2);
-            line4.setAttribute("y2" ,val);
-          }else if (title === '横线'){
-            line.setAttribute("x1" ,-val/2);
-            line.setAttribute("x2" ,val/2);
-          }else if (title === '电线开关'){
-            line.setAttribute("y1" ,-val*8);
-            line.setAttribute("y2" ,-val*3);
-            line2.setAttribute("y2" ,-val*3);
-            if(type === 'WireConnectionSvg'){
-              line2.setAttribute("x2" ,0);
-            }else{
-              line2.setAttribute("x2" ,-val*2);
+        if (val != null && val != "") {
+          if (title === "断路器") {
+            rect.setAttribute("x", -val / 4);
+            rect.setAttribute("y", -val / 2);
+            rect.setAttribute("width", val / 2);
+            rect.setAttribute("height", val);
+          } else if (title === "长方形") {
+            rect.setAttribute("x", -val / 6);
+            rect.setAttribute("y", -val / 2);
+            rect.setAttribute("width", val / 3);
+            rect.setAttribute("height", val);
+          } else if (title === "竖线") {
+            line.setAttribute("y1", -val / 2);
+            line.setAttribute("y2", val / 2);
+          } else if (title === "避雷器") {
+            rect.setAttribute("x", -val);
+            rect.setAttribute("y", -val * 2);
+            rect.setAttribute("width", val * 2 + 1);
+            rect.setAttribute("height", val * 5);
+            line.setAttribute("y1", -val * 3);
+            line2.setAttribute("y1", val * 3);
+            line2.setAttribute("y2", val * 4);
+          } else if (title === "隔离开关") {
+            line.setAttribute("y1", -val);
+            line2.setAttribute("x1", -val / 2);
+            line2.setAttribute("x2", val / 3);
+            line3.setAttribute("y1", val);
+            line3.setAttribute("x2", -val / 2);
+            line3.setAttribute("y2", val / 4);
+            line4.setAttribute("y1", val * 2);
+            line4.setAttribute("y2", val);
+          } else if (title === "横线") {
+            line.setAttribute("x1", -val / 2);
+            line.setAttribute("x2", val / 2);
+          } else if (title === "电线开关") {
+            line.setAttribute("y1", -val * 8);
+            line.setAttribute("y2", -val * 3);
+            line2.setAttribute("y2", -val * 3);
+            if (type === "WireConnectionSvg") {
+              line2.setAttribute("x2", 0);
+            } else {
+              line2.setAttribute("x2", -val * 2);
             }
-            line2.setAttribute("y1" ,val*3);
-            line3.setAttribute("y1" ,val*9);
-            line3.setAttribute("y2" ,val*3);
-          }else if (title === '标准电容器'){
-            line.setAttribute("y1" ,-val*4);
-            line.setAttribute("y2" ,-val);
-            line2.setAttribute("x1" ,-val*3);
-            line2.setAttribute("y1" ,-val);
-            line2.setAttribute("x2" ,val*3);
-            line2.setAttribute("y2" ,-val);
-            line3.setAttribute("x1" ,-val*3);
-            line3.setAttribute("y1" ,val);
-            line3.setAttribute("x2" ,val*3);
-            line3.setAttribute("y2" ,val);
-            line4.setAttribute("y1" ,val*4);
-            line4.setAttribute("y2" ,val);
-          }else if (title === '多段向上折线' || title === '多段向下折线'){
+            line2.setAttribute("y1", val * 3);
+            line3.setAttribute("y1", val * 9);
+            line3.setAttribute("y2", val * 3);
+          } else if (title === "标准电容器") {
+            line.setAttribute("y1", -val * 4);
+            line.setAttribute("y2", -val);
+            line2.setAttribute("x1", -val * 3);
+            line2.setAttribute("y1", -val);
+            line2.setAttribute("x2", val * 3);
+            line2.setAttribute("y2", -val);
+            line3.setAttribute("x1", -val * 3);
+            line3.setAttribute("y1", val);
+            line3.setAttribute("x2", val * 3);
+            line3.setAttribute("y2", val);
+            line4.setAttribute("y1", val * 4);
+            line4.setAttribute("y2", val);
+          } else if (title === "多段向上折线" || title === "多段向下折线") {
             var cont;
-            title === '多段向上折线' ? cont = "0,"+val+" "+(val*2-1)+","+-val+" "+(val*4-2)+","+val : cont = "0,"+val+" "+(val*2-1)+","+(val*3+1)+" "+(val*4-2)+","+val
-            polyline.setAttribute("points",cont)
-            polyline.setAttribute("transform","translate("+-(val*2-1)+","+0+")")
-            polyline2.setAttribute("points",cont)
-            polyline2.setAttribute("transform","translate("+-(val*2-1)+","+(val+1)+")")
-          }else if (title === '箭头向上' || title === '箭头向下'){
-            polygon.setAttribute("stroke-width",val)
-          }else if (title === '接地灰白'){
-            var translate = -(val*3)+","+-(val*2)
-            line.setAttribute("x1" ,val*3);
-            line.setAttribute("y1" ,val*3);
-            line.setAttribute("x2" ,val*3);
-            line.setAttribute("transform","translate("+translate+")")
-            line2.setAttribute("y1" ,val*3);
-            line2.setAttribute("x2" ,val*6);
-            line2.setAttribute("y2" ,val*3);
-            line2.setAttribute("transform","translate("+translate+")")
-            line3.setAttribute("x1" ,val*1);
-            line3.setAttribute("y1" ,val*5);
-            line3.setAttribute("x2" ,val*5);
-            line3.setAttribute("y2" ,val*5);
-            line3.setAttribute("transform","translate("+translate+")")
-            line4.setAttribute("x1" ,val*2);
-            line4.setAttribute("y1" ,val*7);
-            line4.setAttribute("x2" ,val*4);
-            line4.setAttribute("y2" ,val*7);
-            line4.setAttribute("transform","translate("+translate+")")
-          }else if (title === '信号灯'){
-            var translate2 = -(val*2+1)+","+-(val*7+1)
-            ellipse.setAttribute("cx" ,(val*2)+1);
-            ellipse.setAttribute("cy" ,(val*7)+1);
-            ellipse.setAttribute("rx" ,val*4);
-            ellipse.setAttribute("ry" ,val*4);
-            ellipse.setAttribute("transform","translate("+translate2+")")
-            
-            line.setAttribute("x1" ,-val-(-3));
-            line.setAttribute("y1" ,val*10);
-            line.setAttribute("x2" ,val*5);
-            line.setAttribute("y2" ,val*5);
-            line.setAttribute("transform","translate("+translate2+")")
-            line2.setAttribute("x1" ,val*5);
-            line2.setAttribute("y1" ,val*10);
-            line2.setAttribute("y2" ,val*5);
-            line2.setAttribute("transform","translate("+translate2+")")
-            
-          }else if (title === '双圆'){
-            ellipse.setAttribute("cy" ,-val*1.5);
-            ellipse.setAttribute("rx" ,val*2);
-            ellipse.setAttribute("ry" ,val*2);
-            ellipse2.setAttribute("cy" ,val*1.5);
-            ellipse2.setAttribute("rx" ,val*2);
-            ellipse2.setAttribute("ry" ,val*2);
-          }else if (title === '电流互感器y' ){
-            ellipse.setAttribute("rx" ,val*2);
-            ellipse.setAttribute("ry" ,val*2);
-            line.setAttribute("x1" ,val);
-            line.setAttribute("y1" ,-val);
-            line2.setAttribute("x1" ,-val);
-            line2.setAttribute("y1" ,-val);
-            line3.setAttribute("y2" ,val);
-          }else if (title === '三相互感器开口'){
-            ellipse.setAttribute("rx" ,val*5);
-            ellipse.setAttribute("ry" ,val*5);
-            line.setAttribute("x1" ,-val);
-            line.setAttribute("y1" ,-val*3);
-            line.setAttribute("x2" ,-val);
-            line.setAttribute("y2" ,val*3);
-            line2.setAttribute("x1" ,-val);
-            line2.setAttribute("y1" ,-val*3);
-            line2.setAttribute("x2" ,val*2);
-            line3.setAttribute("x1" ,val*2);
-            line3.setAttribute("y1" ,val);
-            line3.setAttribute("x2" ,-val);
-            line3.setAttribute("y2" ,val*3);
-          }else if (title === '双绕组变压器' || title === '双绕组变压器B'){
-            for(let i=0;i<ellipse_.length;i++){
-              i == 0 ? cy = -val*4 : cy = val*4
-              cx = 0
-              rx = val*5;
-              ry = val*5;
-              ellipse_[i].setAttribute("cx",cx);
-              ellipse_[i].setAttribute("cy",cy);
-              ellipse_[i].setAttribute("rx",rx);
-              ellipse_[i].setAttribute("ry",ry);
+            title === "多段向上折线"
+              ? (cont =
+                  "0," +
+                  val +
+                  " " +
+                  (val * 2 - 1) +
+                  "," +
+                  -val +
+                  " " +
+                  (val * 4 - 2) +
+                  "," +
+                  val)
+              : (cont =
+                  "0," +
+                  val +
+                  " " +
+                  (val * 2 - 1) +
+                  "," +
+                  (val * 3 + 1) +
+                  " " +
+                  (val * 4 - 2) +
+                  "," +
+                  val);
+            polyline.setAttribute("points", cont);
+            polyline.setAttribute(
+              "transform",
+              "translate(" + -(val * 2 - 1) + "," + 0 + ")"
+            );
+            polyline2.setAttribute("points", cont);
+            polyline2.setAttribute(
+              "transform",
+              "translate(" + -(val * 2 - 1) + "," + (val + 1) + ")"
+            );
+          } else if (title === "箭头向上" || title === "箭头向下") {
+            polygon.setAttribute("stroke-width", val);
+          } else if (title === "接地灰白") {
+            var translate = -(val * 3) + "," + -(val * 2);
+            line.setAttribute("x1", val * 3);
+            line.setAttribute("y1", val * 3);
+            line.setAttribute("x2", val * 3);
+            line.setAttribute("transform", "translate(" + translate + ")");
+            line2.setAttribute("y1", val * 3);
+            line2.setAttribute("x2", val * 6);
+            line2.setAttribute("y2", val * 3);
+            line2.setAttribute("transform", "translate(" + translate + ")");
+            line3.setAttribute("x1", val * 1);
+            line3.setAttribute("y1", val * 5);
+            line3.setAttribute("x2", val * 5);
+            line3.setAttribute("y2", val * 5);
+            line3.setAttribute("transform", "translate(" + translate + ")");
+            line4.setAttribute("x1", val * 2);
+            line4.setAttribute("y1", val * 7);
+            line4.setAttribute("x2", val * 4);
+            line4.setAttribute("y2", val * 7);
+            line4.setAttribute("transform", "translate(" + translate + ")");
+          } else if (title === "信号灯") {
+            var translate2 = -(val * 2 + 1) + "," + -(val * 7 + 1);
+            ellipse.setAttribute("cx", val * 2 + 1);
+            ellipse.setAttribute("cy", val * 7 + 1);
+            ellipse.setAttribute("rx", val * 4);
+            ellipse.setAttribute("ry", val * 4);
+            ellipse.setAttribute("transform", "translate(" + translate2 + ")");
+
+            line.setAttribute("x1", -val - -3);
+            line.setAttribute("y1", val * 10);
+            line.setAttribute("x2", val * 5);
+            line.setAttribute("y2", val * 5);
+            line.setAttribute("transform", "translate(" + translate2 + ")");
+            line2.setAttribute("x1", val * 5);
+            line2.setAttribute("y1", val * 10);
+            line2.setAttribute("y2", val * 5);
+            line2.setAttribute("transform", "translate(" + translate2 + ")");
+          } else if (title === "双圆") {
+            ellipse.setAttribute("cy", -val * 1.5);
+            ellipse.setAttribute("rx", val * 2);
+            ellipse.setAttribute("ry", val * 2);
+            ellipse2.setAttribute("cy", val * 1.5);
+            ellipse2.setAttribute("rx", val * 2);
+            ellipse2.setAttribute("ry", val * 2);
+          } else if (title === "电流互感器y") {
+            ellipse.setAttribute("rx", val * 2);
+            ellipse.setAttribute("ry", val * 2);
+            line.setAttribute("x1", val);
+            line.setAttribute("y1", -val);
+            line2.setAttribute("x1", -val);
+            line2.setAttribute("y1", -val);
+            line3.setAttribute("y2", val);
+          } else if (title === "三相互感器开口") {
+            ellipse.setAttribute("rx", val * 5);
+            ellipse.setAttribute("ry", val * 5);
+            line.setAttribute("x1", -val);
+            line.setAttribute("y1", -val * 3);
+            line.setAttribute("x2", -val);
+            line.setAttribute("y2", val * 3);
+            line2.setAttribute("x1", -val);
+            line2.setAttribute("y1", -val * 3);
+            line2.setAttribute("x2", val * 2);
+            line3.setAttribute("x1", val * 2);
+            line3.setAttribute("y1", val);
+            line3.setAttribute("x2", -val);
+            line3.setAttribute("y2", val * 3);
+          } else if (title === "双绕组变压器" || title === "双绕组变压器B") {
+            for (let i = 0; i < ellipse_.length; i++) {
+              i == 0 ? (cy = -val * 4) : (cy = val * 4);
+              cx = 0;
+              rx = val * 5;
+              ry = val * 5;
+              ellipse_[i].setAttribute("cx", cx);
+              ellipse_[i].setAttribute("cy", cy);
+              ellipse_[i].setAttribute("rx", rx);
+              ellipse_[i].setAttribute("ry", ry);
             }
-            if(title === '双绕组变压器'){
-              points = (val*2)+","+(-val*6)+" 0,"+(-val*2)+" "+(-val*2)+","+(-val*6)
-              polygon_[0].setAttribute("points",points);
-              for(let i=0;i<line_.length;i++){
-                if(i == 0){
+            if (title === "双绕组变压器") {
+              points =
+                val * 2 +
+                "," +
+                -val * 6 +
+                " 0," +
+                -val * 2 +
+                " " +
+                -val * 2 +
+                "," +
+                -val * 6;
+              polygon_[0].setAttribute("points", points);
+              for (let i = 0; i < line_.length; i++) {
+                if (i == 0) {
                   x2 = 0;
-                  y2 = (val*7);
-                }else if (i == 1){
-                  x2 = (-val*2);
-                  y2 = val*2;
-                }else if (i == 2){
-                  x2 = val*2;
-                  y2 = val*2;
+                  y2 = val * 7;
+                } else if (i == 1) {
+                  x2 = -val * 2;
+                  y2 = val * 2;
+                } else if (i == 2) {
+                  x2 = val * 2;
+                  y2 = val * 2;
                 }
                 x1 = 0;
-                y1 = (val*4);
-                line_[i].setAttribute("x1",x1);
-                line_[i].setAttribute("y1",y1);
-                line_[i].setAttribute("x2",x2);
-                line_[i].setAttribute("y2",y2);
+                y1 = val * 4;
+                line_[i].setAttribute("x1", x1);
+                line_[i].setAttribute("y1", y1);
+                line_[i].setAttribute("x2", x2);
+                line_[i].setAttribute("y2", y2);
               }
-            }else{
-              points = (val*2)+","+(val*6)+" 0,"+(val*2)+" "+(-val*2)+","+(val*6)
-              polygon_[0].setAttribute("points",points);
-              line_[0].setAttribute("y1",(-val*4));
-              line_[0].setAttribute("y2",(-val*7));
+            } else {
+              points =
+                val * 2 +
+                "," +
+                val * 6 +
+                " 0," +
+                val * 2 +
+                " " +
+                -val * 2 +
+                "," +
+                val * 6;
+              polygon_[0].setAttribute("points", points);
+              line_[0].setAttribute("y1", -val * 4);
+              line_[0].setAttribute("y2", -val * 7);
 
-              line_[1].setAttribute("y1",(-val*4));
-              line_[1].setAttribute("x2",(val*2));
-              line_[1].setAttribute("y2",-val*2);
+              line_[1].setAttribute("y1", -val * 4);
+              line_[1].setAttribute("x2", val * 2);
+              line_[1].setAttribute("y2", -val * 2);
 
-              line_[2].setAttribute("y1",(-val*4));
-              line_[2].setAttribute("x2",-val*2);
-              line_[2].setAttribute("y2",-val*2);
+              line_[2].setAttribute("y1", -val * 4);
+              line_[2].setAttribute("x2", -val * 2);
+              line_[2].setAttribute("y2", -val * 2);
             }
-          }else if (title === '电容柜'){
-            for(let i=0;i<polyline_.length;i++){
-              i == 0 ? points = (-val*13)+","+(-val*8)+" "+(-val*22)+","+(val*3)+" "+(-val*22)+","+(val*5) :
-              i == 1 ? points = (val*13)+","+(-val*8)+" "+(val*22)+","+(val*3)+" "+(val*22)+","+(val*5) : ''
-              polyline_[i].setAttribute("points",points)
+          } else if (title === "电容柜") {
+            for (let i = 0; i < polyline_.length; i++) {
+              i == 0
+                ? (points =
+                    -val * 13 +
+                    "," +
+                    -val * 8 +
+                    " " +
+                    -val * 22 +
+                    "," +
+                    val * 3 +
+                    " " +
+                    -val * 22 +
+                    "," +
+                    val * 5)
+                : i == 1
+                ? (points =
+                    val * 13 +
+                    "," +
+                    -val * 8 +
+                    " " +
+                    val * 22 +
+                    "," +
+                    val * 3 +
+                    " " +
+                    val * 22 +
+                    "," +
+                    val * 5)
+                : "";
+              polyline_[i].setAttribute("points", points);
             }
-            for(let i=0;i<line_.length;i++){
-              if(i == 0){
-                x1 = val/2; y1 = -val*25; x2 = -val*9.5; y2 = -val*13;
-              }else if (i == 1){
-                x1 = -val/2; y1 = -val*26; x2 = val*9.5; y2 = -val*13;
-              }else if (i == 2){
-                x1 = -val*12; y1 = -val*17; x2 = -val*6; y2 = -val*8;
-              }else if (i == 3){
-                x1 = -val*15; y1 = -val*12; x2 = -val*11; y2 = -val*3;
-              }else if (i == 4){
-                x1 = -val*21; y1 = val*4; x2 = -val*4; y2 = val*4;
-              }else if (i == 5){
-                x1 = -val*5; y1 = -val*2; x2 = -val*5; y2 = val*11;
-              }else if (i == 6){
-                x1 = val*3; y1 = -val*2; x2 = val*3; y2 = val*11;
-              }else if (i == 7){
-                x1 = val*4; y1 = val*4; x2 = val*21; y2 = val*4;
-              }else if (i == 8){
-                x1 = val*14; y1 = -val*12; x2 = val*8; y2 = -val*3;
-              }else if (i == 9){
-                x1 = val*12; y1 = -val*17; x2 = val*6; y2 = -val*8;
+            for (let i = 0; i < line_.length; i++) {
+              if (i == 0) {
+                x1 = val / 2;
+                y1 = -val * 25;
+                x2 = -val * 9.5;
+                y2 = -val * 13;
+              } else if (i == 1) {
+                x1 = -val / 2;
+                y1 = -val * 26;
+                x2 = val * 9.5;
+                y2 = -val * 13;
+              } else if (i == 2) {
+                x1 = -val * 12;
+                y1 = -val * 17;
+                x2 = -val * 6;
+                y2 = -val * 8;
+              } else if (i == 3) {
+                x1 = -val * 15;
+                y1 = -val * 12;
+                x2 = -val * 11;
+                y2 = -val * 3;
+              } else if (i == 4) {
+                x1 = -val * 21;
+                y1 = val * 4;
+                x2 = -val * 4;
+                y2 = val * 4;
+              } else if (i == 5) {
+                x1 = -val * 5;
+                y1 = -val * 2;
+                x2 = -val * 5;
+                y2 = val * 11;
+              } else if (i == 6) {
+                x1 = val * 3;
+                y1 = -val * 2;
+                x2 = val * 3;
+                y2 = val * 11;
+              } else if (i == 7) {
+                x1 = val * 4;
+                y1 = val * 4;
+                x2 = val * 21;
+                y2 = val * 4;
+              } else if (i == 8) {
+                x1 = val * 14;
+                y1 = -val * 12;
+                x2 = val * 8;
+                y2 = -val * 3;
+              } else if (i == 9) {
+                x1 = val * 12;
+                y1 = -val * 17;
+                x2 = val * 6;
+                y2 = -val * 8;
               }
-              line_[i].setAttribute("x1",x1)
-              line_[i].setAttribute("y1",y1)
-              line_[i].setAttribute("x2",x2)
-              line_[i].setAttribute("y2",y2)
+              line_[i].setAttribute("x1", x1);
+              line_[i].setAttribute("y1", y1);
+              line_[i].setAttribute("x2", x2);
+              line_[i].setAttribute("y2", y2);
             }
-          }else if (title === '标准电抗'){
-            path_[0].setAttribute("transform","translate("+(-val*6)+","+(-val*12)+") scale("+(val/3)+")")
-          }else if (title === '发电机'){
-            transform = "translate("+(-val*10)+","+(-val*10)+") scale("+(val/5)+")"
-            ellipse_[0].setAttribute("transform",transform)
-            path_[0].setAttribute("transform",transform)
+          } else if (title === "标准电抗") {
+            path_[0].setAttribute(
+              "transform",
+              "translate(" +
+                -val * 6 +
+                "," +
+                -val * 12 +
+                ") scale(" +
+                val / 3 +
+                ")"
+            );
+          } else if (title === "发电机") {
+            transform =
+              "translate(" +
+              -val * 10 +
+              "," +
+              -val * 10 +
+              ") scale(" +
+              val / 5 +
+              ")";
+            ellipse_[0].setAttribute("transform", transform);
+            path_[0].setAttribute("transform", transform);
           }
         }
       }
-    }
+    },
   },
 };
 </script>

+ 2 - 2
src/router/index.js

@@ -85,8 +85,8 @@ let routes = [
         name: 'power_diagram',
         meta: { title: '配电系统图', name: "测试站点一", type: "menu" },
         component: () =>
-            // import('../views/site/Power_diagram.vue'),
-            import ('../views/site/Power_diagram.vue'),
+            import('../views/site/Power_diagram.vue'),
+            // import ('../views/site/CircuitEdit.vue'),
     },
     // 编辑器页面
     {

+ 220 - 219
src/store/index.js

@@ -2,141 +2,142 @@ import { createStore } from 'vuex'
 
 export default createStore({
     state: {
+        query: null,
         siteId: 1, //公共api请求参数->siteId
         Time_Data: [], //公共api请求参数->Time_Data
         timearr: [], //公共处理开始时间和结束时间中的时间段天数 值存储
         itemStyle: [{
-                normal: {
-                    borderColor: "rgba(0,244,253,1)",
-                    borderWidth: 2,
-                    color: "rgba(6, 68, 83, 1)",
-                    lineStyle: {
-                        width: 2, //折线宽度
-                        color: "rgba(0,244,253,1)",
-                    },
+            normal: {
+                borderColor: "rgba(0,244,253,1)",
+                borderWidth: 2,
+                color: "rgba(6, 68, 83, 1)",
+                lineStyle: {
+                    width: 2, //折线宽度
+                    color: "rgba(0,244,253,1)",
                 },
             },
-            {
-                normal: {
-                    borderColor: "rgba(253,143,0,1)",
-                    borderWidth: 2,
-                    color: "rgba(6, 68, 83, 1)",
-                    lineStyle: {
-                        width: 2, //折线宽度
-                        color: "rgba(253,143,0,1)",
-                    },
+        },
+        {
+            normal: {
+                borderColor: "rgba(253,143,0,1)",
+                borderWidth: 2,
+                color: "rgba(6, 68, 83, 1)",
+                lineStyle: {
+                    width: 2, //折线宽度
+                    color: "rgba(253,143,0,1)",
                 },
             },
-            {
-                normal: {
-                    borderColor: "rgba(0,255,18,1)",
-                    borderWidth: 2,
-                    color: "rgba(6, 68, 83, 1)",
-                    lineStyle: {
-                        width: 2, //折线宽度
-                        color: "rgba(0,255,18,1)",
-                    },
+        },
+        {
+            normal: {
+                borderColor: "rgba(0,255,18,1)",
+                borderWidth: 2,
+                color: "rgba(6, 68, 83, 1)",
+                lineStyle: {
+                    width: 2, //折线宽度
+                    color: "rgba(0,255,18,1)",
                 },
             },
-            {
-                normal: {
-                    borderColor: "rgba(0,255,230,1)",
-                    borderWidth: 2,
-                    color: "rgba(6, 68, 83, 1)",
-                    lineStyle: {
-                        width: 2, //折线宽度
-                        color: "rgba(0,255,230,1)",
-                    },
+        },
+        {
+            normal: {
+                borderColor: "rgba(0,255,230,1)",
+                borderWidth: 2,
+                color: "rgba(6, 68, 83, 1)",
+                lineStyle: {
+                    width: 2, //折线宽度
+                    color: "rgba(0,255,230,1)",
                 },
             },
-            {
-                normal: {
-                    borderColor: "rgba(142,51,255,1)",
-                    borderWidth: 2,
-                    color: "rgba(6, 68, 83, 1)",
-                    lineStyle: {
-                        width: 2, //折线宽度
-                        color: "rgba(142,51,255,1)",
-                    },
+        },
+        {
+            normal: {
+                borderColor: "rgba(142,51,255,1)",
+                borderWidth: 2,
+                color: "rgba(6, 68, 83, 1)",
+                lineStyle: {
+                    width: 2, //折线宽度
+                    color: "rgba(142,51,255,1)",
                 },
             },
-            {
-                normal: {
-                    borderColor: "rgba(77,200,120,1)",
-                    borderWidth: 2,
-                    color: "rgba(6, 68, 83, 1)",
-                    lineStyle: {
-                        width: 2, //折线宽度
-                        color: "rgba(77,200,120,1)",
-                    },
+        },
+        {
+            normal: {
+                borderColor: "rgba(77,200,120,1)",
+                borderWidth: 2,
+                color: "rgba(6, 68, 83, 1)",
+                lineStyle: {
+                    width: 2, //折线宽度
+                    color: "rgba(77,200,120,1)",
                 },
             },
-            {
-                normal: {
-                    borderColor: "rgba(255,47,47,1)",
-                    borderWidth: 2,
-                    color: "rgba(6, 68, 83, 1)",
-                    lineStyle: {
-                        width: 2, //折线宽度
-                        color: "rgba(255,47,47,1)",
-                    },
+        },
+        {
+            normal: {
+                borderColor: "rgba(255,47,47,1)",
+                borderWidth: 2,
+                color: "rgba(6, 68, 83, 1)",
+                lineStyle: {
+                    width: 2, //折线宽度
+                    color: "rgba(255,47,47,1)",
                 },
             },
-            {
-                normal: {
-                    borderColor: "rgba(70,100,255,1)",
-                    borderWidth: 2,
-                    color: "rgba(6, 68, 83, 1)",
-                    lineStyle: {
-                        width: 2, //折线宽度
-                        color: "rgba(70,100,255,1)",
-                    },
+        },
+        {
+            normal: {
+                borderColor: "rgba(70,100,255,1)",
+                borderWidth: 2,
+                color: "rgba(6, 68, 83, 1)",
+                lineStyle: {
+                    width: 2, //折线宽度
+                    color: "rgba(70,100,255,1)",
                 },
             },
-            {
-                normal: {
-                    borderColor: "rgba(255,143,53,1)",
-                    borderWidth: 2,
-                    color: "rgba(6, 68, 83, 1)",
-                    lineStyle: {
-                        width: 2, //折线宽度
-                        color: "rgba(255,143,53,1)",
-                    },
+        },
+        {
+            normal: {
+                borderColor: "rgba(255,143,53,1)",
+                borderWidth: 2,
+                color: "rgba(6, 68, 83, 1)",
+                lineStyle: {
+                    width: 2, //折线宽度
+                    color: "rgba(255,143,53,1)",
                 },
             },
-            {
-                normal: {
-                    borderColor: "rgba(150,150,50,1)",
-                    borderWidth: 2,
-                    color: "rgba(6, 68, 83, 1)",
-                    lineStyle: {
-                        width: 2, //折线宽度
-                        color: "rgba(150,150,50,1)",
-                    },
+        },
+        {
+            normal: {
+                borderColor: "rgba(150,150,50,1)",
+                borderWidth: 2,
+                color: "rgba(6, 68, 83, 1)",
+                lineStyle: {
+                    width: 2, //折线宽度
+                    color: "rgba(150,150,50,1)",
                 },
             },
-            {
-                normal: {
-                    borderColor: "rgba(70,192,255,1)",
-                    borderWidth: 2,
-                    color: "rgba(6, 68, 83, 1)",
-                    lineStyle: {
-                        width: 2, //折线宽度
-                        color: "rgba(70,192,255,1)",
-                    },
+        },
+        {
+            normal: {
+                borderColor: "rgba(70,192,255,1)",
+                borderWidth: 2,
+                color: "rgba(6, 68, 83, 1)",
+                lineStyle: {
+                    width: 2, //折线宽度
+                    color: "rgba(70,192,255,1)",
                 },
             },
-            {
-                normal: {
-                    borderColor: "rgba(20,99,100,1)",
-                    borderWidth: 2,
-                    color: "rgba(6, 68, 83, 1)",
-                    lineStyle: {
-                        width: 2, //折线宽度
-                        color: "rgba(20,99,100,1)",
-                    },
+        },
+        {
+            normal: {
+                borderColor: "rgba(20,99,100,1)",
+                borderWidth: 2,
+                color: "rgba(6, 68, 83, 1)",
+                lineStyle: {
+                    width: 2, //折线宽度
+                    color: "rgba(20,99,100,1)",
                 },
             },
+        },
         ], //公共echarts图表样式
         Time_All: [], //公共时间 返回数组 -> 年月日时分秒 时间戳
 
@@ -148,91 +149,91 @@ export default createStore({
         th_defaultTime: [], //设备监控--->数据报表时间选择器v-model
         fh_defaultTime: [], //设备监控--->运行状态统计时间选择器v-model
         table_list: [{
-                name: "电流",
-                list: [
-                    { name: "A相电流", value: "Ia" },
-                    { name: "B相电流", value: "Ib" },
-                    { name: "C相电流", value: "Ic" },
-                ],
-            },
-            {
-                name: "功率",
-                list: [
-                    { name: "A相有功功率 kW", value: "Pa" },
-                    { name: "A相无功功率 kVar", value: "Qa" },
-                    { name: "B相有功功率 kW", value: "Pb" },
-                    { name: "B相无功功率 kVar", value: "Qb" },
-                    { name: "C相有功功率 kW", value: "Pc" },
-                    { name: "C相无功功率 kVar", value: "Qc" },
-                    { name: "总有功功率 kW", value: "P" },
-                    { name: "总无功功率 kW", value: "Q" },
-                    { name: "实时需量 kW", value: "Demand" },
-                ],
-            },
-            {
-                name: "电度",
-                list: [
-                    { name: "正有功电度 kWh", value: "Epp" },
-                    { name: "负有功电度 kWh", value: "Epn" },
-                    { name: "正无功电度 kvarh", value: "Eqp" },
-                    { name: "负无功电度 kvarh", value: "Eqn" },
-                ],
-            },
-            {
-                name: "电压",
-                list: [
-                    { name: "A相电压 kV", value: "Ua" },
-                    { name: "B相电压 kV", value: "Ub" },
-                    { name: "C相电压 kV", value: "Uc" },
-                    { name: "回路电压 V", value: "Ul" },
-                    { name: "AB线电压 V", value: "Uab" },
-                    { name: "BC线电压 V", value: "Ubc" },
-                    { name: "CA线电压 V", value: "Uca" },
-                ],
-            },
-            {
-                name: "温度 ℃",
-                list: [
-                    { name: "外接温度1", value: "T1" },
-                    { name: "外接温度2", value: "T2" },
-                    { name: "外接温度3", value: "T3" },
-                    { name: "外接温度4", value: "T4" },
-                    { name: "环境温度", value: "DeviceTemp" },
-                ],
-            },
-            {
-                name: "频率 Hz",
-                list: [{ name: "频率", value: "F" }],
-            },
-            {
-                name: "功率因数",
-                list: [
-                    { name: "A相功率因数", value: "COSa" },
-                    { name: "B相功率因数", value: "COSb" },
-                    { name: "C相功率因数", value: "COSc" },
-                    { name: "功率因数", value: "COS" },
-                ],
-            },
-            {
-                name: "谐波电流有效值 A",
-                list: [
-                    { name: "Ia总谐波电流", value: "IHa" },
-                    { name: "Ib总谐波电流", value: "IHa" },
-                    { name: "Ic总谐波电流", value: "IHc" },
-                ],
-            },
-            {
-                name: "通讯参数",
-                list: [{ name: "设备信号强度", value: "SignalIntensity" }],
-            },
-            {
-                name: "电压突变 次",
-                list: [
-                    { name: "电压暂升次数", value: "Upt" },
-                    { name: "电压暂降次数", value: "Udt" },
-                    { name: "电压中断次数", value: "Ust" },
-                ],
-            },
+            name: "电流",
+            list: [
+                { name: "A相电流", value: "Ia" },
+                { name: "B相电流", value: "Ib" },
+                { name: "C相电流", value: "Ic" },
+            ],
+        },
+        {
+            name: "功率",
+            list: [
+                { name: "A相有功功率 kW", value: "Pa" },
+                { name: "A相无功功率 kVar", value: "Qa" },
+                { name: "B相有功功率 kW", value: "Pb" },
+                { name: "B相无功功率 kVar", value: "Qb" },
+                { name: "C相有功功率 kW", value: "Pc" },
+                { name: "C相无功功率 kVar", value: "Qc" },
+                { name: "总有功功率 kW", value: "P" },
+                { name: "总无功功率 kW", value: "Q" },
+                { name: "实时需量 kW", value: "Demand" },
+            ],
+        },
+        {
+            name: "电度",
+            list: [
+                { name: "正有功电度 kWh", value: "Epp" },
+                { name: "负有功电度 kWh", value: "Epn" },
+                { name: "正无功电度 kvarh", value: "Eqp" },
+                { name: "负无功电度 kvarh", value: "Eqn" },
+            ],
+        },
+        {
+            name: "电压",
+            list: [
+                { name: "A相电压 kV", value: "Ua" },
+                { name: "B相电压 kV", value: "Ub" },
+                { name: "C相电压 kV", value: "Uc" },
+                { name: "回路电压 V", value: "Ul" },
+                { name: "AB线电压 V", value: "Uab" },
+                { name: "BC线电压 V", value: "Ubc" },
+                { name: "CA线电压 V", value: "Uca" },
+            ],
+        },
+        {
+            name: "温度 ℃",
+            list: [
+                { name: "外接温度1", value: "T1" },
+                { name: "外接温度2", value: "T2" },
+                { name: "外接温度3", value: "T3" },
+                { name: "外接温度4", value: "T4" },
+                { name: "环境温度", value: "DeviceTemp" },
+            ],
+        },
+        {
+            name: "频率 Hz",
+            list: [{ name: "频率", value: "F" }],
+        },
+        {
+            name: "功率因数",
+            list: [
+                { name: "A相功率因数", value: "COSa" },
+                { name: "B相功率因数", value: "COSb" },
+                { name: "C相功率因数", value: "COSc" },
+                { name: "功率因数", value: "COS" },
+            ],
+        },
+        {
+            name: "谐波电流有效值 A",
+            list: [
+                { name: "Ia总谐波电流", value: "IHa" },
+                { name: "Ib总谐波电流", value: "IHa" },
+                { name: "Ic总谐波电流", value: "IHc" },
+            ],
+        },
+        {
+            name: "通讯参数",
+            list: [{ name: "设备信号强度", value: "SignalIntensity" }],
+        },
+        {
+            name: "电压突变 次",
+            list: [
+                { name: "电压暂升次数", value: "Upt" },
+                { name: "电压暂降次数", value: "Udt" },
+                { name: "电压中断次数", value: "Ust" },
+            ],
+        },
         ], //设备监控--->数据报表->默认tabs数据
         se_tabs: [
             { label: '电流', name: "I" },
@@ -283,24 +284,24 @@ export default createStore({
                 checked_list[i] === "电流" ?
                     checked = "I" :
                     checked_list[i] === "功率" ?
-                    checked = "P" :
-                    checked_list[i] === "电度" ?
-                    checked = "KWh" :
-                    checked_list[i] === "电压" ?
-                    checked = "V" :
-                    checked_list[i] === "温度" ?
-                    checked = "C" :
-                    checked_list[i] === "频率" ?
-                    checked = "HZ" :
-                    checked_list[i] === "功率因数" ?
-                    checked = "PS" :
-                    checked_list[i] === "谐波电流有效值" ?
-                    checked = "RMS" :
-                    checked_list[i] === "通讯参数" ?
-                    checked = "DDB" :
-                    checked_list[i] === "电压突变" ?
-                    checked = "VT" :
-                    ""
+                        checked = "P" :
+                        checked_list[i] === "电度" ?
+                            checked = "KWh" :
+                            checked_list[i] === "电压" ?
+                                checked = "V" :
+                                checked_list[i] === "温度" ?
+                                    checked = "C" :
+                                    checked_list[i] === "频率" ?
+                                        checked = "HZ" :
+                                        checked_list[i] === "功率因数" ?
+                                            checked = "PS" :
+                                            checked_list[i] === "谐波电流有效值" ?
+                                                checked = "RMS" :
+                                                checked_list[i] === "通讯参数" ?
+                                                    checked = "DDB" :
+                                                    checked_list[i] === "电压突变" ?
+                                                        checked = "VT" :
+                                                        ""
                 state.queryType += checked_list.length > 1 ? checked + "," : checked;
             }
             state.queryType = checked_list.length > 1 ? state.queryType.slice(0, state.queryType.length - 1) : state.queryType
@@ -323,7 +324,7 @@ export default createStore({
                 var HH = time[i].getHours() < 10 ? '0' + time[i].getHours() : time[i].getHours()
                 var MM = time[i].getMinutes() < 10 ? '0' + time[i].getMinutes() : time[i].getMinutes()
                 var SS = time[i].getSeconds() < 10 ? '0' + time[i].getSeconds() : time[i].getSeconds()
-                    // console.log(Y + '-' + M + '-' + D + ' ' + HH + ':' + MM + ':' + SS)
+                // console.log(Y + '-' + M + '-' + D + ' ' + HH + ':' + MM + ':' + SS)
                 state.Time_Data.push(Y + '-' + M + '-' + D + ' ' + HH + ':' + MM + ':' + SS)
             }
         },
@@ -347,8 +348,8 @@ export default createStore({
                 k = k + 24 * 60 * 60 * 1000;
             }
             state.timearr = arrTime
-                // return arrTime;
-                // 时间格式处理
+            // return arrTime;
+            // 时间格式处理
             function datetimeparse(timestamp, format, prefix) {
                 if (typeof timestamp == "string") {
                     timestamp = Number(timestamp);
@@ -380,20 +381,20 @@ export default createStore({
                 let YYYY = dateobj.getFullYear();
                 let MM =
                     dateobj.getMonth() > 8 ?
-                    dateobj.getMonth() + 1 :
-                    "0" + (dateobj.getMonth() + 1);
+                        dateobj.getMonth() + 1 :
+                        "0" + (dateobj.getMonth() + 1);
                 let DD =
                     dateobj.getDate() > 9 ? dateobj.getDate() : "0" + dateobj.getDate();
                 let HH =
                     dateobj.getHours() > 9 ? dateobj.getHours() : "0" + dateobj.getHours();
                 let mm =
                     dateobj.getMinutes() > 9 ?
-                    dateobj.getMinutes() :
-                    "0" + dateobj.getMinutes();
+                        dateobj.getMinutes() :
+                        "0" + dateobj.getMinutes();
                 let ss =
                     dateobj.getSeconds() > 9 ?
-                    dateobj.getSeconds() :
-                    "0" + dateobj.getSeconds();
+                        dateobj.getSeconds() :
+                        "0" + dateobj.getSeconds();
                 let output = "";
                 let separator = "/";
                 if (format) {

+ 26 - 4
src/views/CircuitPreview.vue

@@ -11,11 +11,32 @@
         height="100%"
       >
         <defs />
-        <g style="cursor: pointer" v-for="(item, index) in svgLists" :key="item" :id="item.id"
-          @mousedown="MousedownSvg(item.id,index,item.svgPositionX,item.svgPositionY,$event)"
+        <g
+          style="cursor: pointer"
+          v-for="(item, index) in svgLists"
+          :key="item"
+          :id="item.id"
+          @mousedown="
+            MousedownSvg(
+              item.id,
+              index,
+              item.svgPositionX,
+              item.svgPositionY,
+              $event
+            )
+          "
           :title="item.title"
           :type="item.type"
-          :transform="'translate(' +item.svgPositionX +',' +item.svgPositionY +')' +'rotate(' +item.angle +')'"
+          :transform="
+            'translate(' +
+            item.svgPositionX +
+            ',' +
+            item.svgPositionY +
+            ')' +
+            'rotate(' +
+            item.angle +
+            ')'
+          "
         >
           <SvgComponents
             :svg_color="item.svgColor"
@@ -48,6 +69,7 @@ export default {
       editable: false,
     };
   },
+  mounted() {},
   methods: {
     testF() {
       //找出所有断路器
@@ -110,7 +132,7 @@ export default {
   created() {
     let _this = this;
     _this.svgLists = JSON.parse(localStorage.getItem("svginfo"));
-    
+
     //请求接口获取组件
     this.$axios
       .get("/InterfaceReturn.json")

+ 10 - 10
src/views/home/index.vue

@@ -116,8 +116,7 @@ import lineChart from "./components/lineChart";
 import mapStaticTop from "./components/mapStaticTop";
 import triangleChart from "./components/triangleChart";
 
- import markIconPath from '../../assets/images/markIcon.png';
-
+import markIconPath from "../../assets/images/markIcon.png";
 
 // 地图
 import AMap from "AMap";
@@ -284,7 +283,7 @@ export default {
       api.eptrendIcoMonth_api().then((requset) => {
         this.eptrendIco = requset.data;
         console.log("this.eptrendIco");
-        console.log(this.eptrendIco);
+        // console.log(this.eptrendIco);
       });
     },
 
@@ -349,12 +348,11 @@ export default {
     },
 
     addMarker(lnglats) {
-      
       // 创建标点和点击事件
       let markers = lnglats.map((val, ind) => {
         let marker = new AMap.Marker({
           position: new AMap.LngLat(val.longitude, val.latitude),
-          icon:markIconPath,
+          icon: markIconPath,
           //   icon: '//a.amap.com/jsapi_demos/static/demo-center/icons/dir-via-marker.png',
           zIndex: 9,
           extData: {
@@ -363,7 +361,7 @@ export default {
         });
         marker.on("mouseover", async () => {
           // console.log([val.latitude, val.longitude], null, val);
-        await api.siteOne_api({ siteId: val.id }).then((requset) => {
+          await api.siteOne_api({ siteId: val.id }).then((requset) => {
             this.siteOne = requset.data;
           });
 
@@ -397,7 +395,10 @@ export default {
           this.map.clearInfoWindow();
         });
         marker.on("click", async () => {
-          this.$router.push({ path: "/Overview", query: { id: val.id } });
+          localStorage.clear();
+          this.$router.push({ path: "/Overview" });
+          this.$store.commit("increment", val.id);
+          this.$store.state.query = [val.id, val.siteName];
         });
         return marker;
       });
@@ -407,8 +408,9 @@ export default {
 
     // 添加标点
     addMarkerInfo(position, content, value = "") {
+      value;
       // console.log("value");
-      console.log(value);
+      // console.log(value);
       this.map.clearInfoWindow();
       var infoWindow = new AMap.InfoWindow({
         isCustom: true, //使用自定义窗体
@@ -503,6 +505,4 @@ export default {
 #poiInfo {
   background: #fff;
 }
-
-
 </style>

+ 19 - 2
src/views/index.vue

@@ -104,6 +104,8 @@ export default {
           this.name = this.options[i].label;
         }
       }
+      localStorage.clear();
+      localStorage.setItem("Overview", [val, this.name]);
     },
     //下拉列表api请求
     options_api() {
@@ -117,14 +119,18 @@ export default {
     },
   },
   watch: {
+    "$store.state.query"() {
+      this.value = parseInt(this.$store.state.query[0]);
+      this.name = this.$store.state.query[1];
+      localStorage.setItem("Overview", [this.value, this.name]);
+    },
     value(val) {
       this.$store.commit("increment", val);
     },
     $route: function () {
+      var type = this.$route.meta.type;
       var title = this.$route.meta.title;
       var name = this.$route.meta.name;
-      var type = this.$route.meta.type;
-
       this.title = title;
       this.name = name;
       if (type === "index" || name.indexOf("站点") == 2) {
@@ -134,6 +140,17 @@ export default {
           }
         }
       }
+      var getlocal = localStorage.getItem("Overview");
+      if (
+        getlocal != undefined &&
+        getlocal != null &&
+        getlocal != "" &&
+        type !== "index"
+      ) {
+        this.value = parseInt(getlocal.split(",")[0]);
+        this.name = getlocal.split(",")[1];
+        this.$store.state.query = getlocal.split(",");
+      }
       type === "menu" ? (this.home = true) : (this.home = false);
     },
   },

+ 2 - 2
src/views/site/Power_diagram.vue

@@ -142,15 +142,15 @@ export default {
     },
   },
   created() {
+    var _this = this;
     window.addEventListener("beforeunload", (e) => this.test(e));
-    let _this = this;
     _this.svgLists = JSON.parse(localStorage.getItem("svginfo"));
     //请求接口获取组件
+
     this.$axios
       .get("/InterfaceReturn.json")
       .then(function (response) {
         _this.svgInfoData = response.data;
-        // console.log(response.data);
       })
       .catch(function (error) {
         console.log(error);

+ 1 - 1
vue.config.js

@@ -25,7 +25,7 @@ module.exports = {
                 alias: {
                     '@': resolve('src'),
                     '~': process.cwd(),
-                    public: resolve('public'),
+                    // public: resolve('public'),
                     components: resolve('src/components'),
                     util: resolve('src/utils'),
                     store: resolve('src/store'),