Browse Source

Merge branch 'master' of http://49.4.49.126:3000/GYEE_R.D/neic

xushili 3 years ago
parent
commit
4bb22fc318
1 changed files with 25 additions and 15 deletions
  1. 25 15
      src/components/area/ControlArea.vue

+ 25 - 15
src/components/area/ControlArea.vue

@@ -106,7 +106,7 @@ export default {
       var vs = [{ key: "/topic/suggestion", action: this.suggestion }];
       mb.register(vs);
     },
-    suggestion(msg,headers) {
+    suggestion(msg, headers) {
       var val = JSON.parse(msg);
       var tp = headers["operate-type"];
       if (tp == "UnMaintain") {
@@ -136,20 +136,20 @@ export default {
     },
 
     /* 更新推荐数据 */
-    updateSuggestion(ll,val) {
+    updateSuggestion(ll, val) {
       var lls = new Array();
-      for(var v1 in ll){
+      for (var v1 in ll) {
         var v2 = val[ll[v1]];
-        if(typeof(v2)==='undefined'){
+        if (typeof v2 === "undefined") {
           lls.push(v1);
         }
       }
-      for(var v3 in lls){
-        ll.splice(v3,1);
+      for (var v3 in lls) {
+        ll.splice(v3, 1);
       }
-      for(var v in val){
+      for (var v in val) {
         var vl = val[v];
-        if(!ll.includes(vl.windturbineId)){
+        if (!ll.includes(vl.windturbineId)) {
           ll.push(vl.windturbineId);
         }
       }
@@ -225,12 +225,12 @@ export default {
     menuClicked(msg) {
       var bd = BackgroundData.getInstance();
       if (!bd.LoginUser) {
-        this.$confirm("控制风机前需要登录!", "请登录", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning",
-        });
-        //bd.showdialog("提示", "请登录:", "在控制之前需要先登录!");
+        this.$notify({
+            title: "请登录",
+            message: "控制风机需要先登录!",
+            type: 'warning',
+            position: 'bottom-right'
+          });
         return;
       }
       if (msg.type == "lock") {
@@ -274,12 +274,22 @@ export default {
     },
 
     controlClick(isAuto) {
-      this.IsAutoControl = isAuto;
+      var bd = BackgroundData.getInstance();
       if (isAuto) {
+        if (!bd.LoginUser) {
+          this.$notify({
+            title: "请登录",
+            message: "切换为自动控制需要先登录!",
+            type: 'warning',
+            position: 'bottom-right'
+          });
+          return;
+        }
         this.AutoSendTimer = setInterval(this.AutoSend, 60000);
       } else {
         clearInterval(this.AutoSendTimer);
       }
+      this.IsAutoControl = isAuto;
     },
 
     /* 自动发送命令 */