xushining 3 년 전
부모
커밋
649e20d302

+ 47 - 19
src/assets/script/BackgroundData.js

@@ -108,6 +108,7 @@ export default class BackgroundData {
         this.windturbineControl = this.windturbineControl.bind(this);
         this.marking = this.marking.bind(this);
         this.removeMarked = this.removeMarked.bind(this);
+        
 
         this.refreshTPData();
         this.refreshAlarmData();
@@ -292,33 +293,60 @@ export default class BackgroundData {
     }
 
     /* 风机控制 */
-    windturbineControl(windturbines,isLockOrUnlock) {
-        var pairs={};
+    windturbineControl(windturbines, isLockOrUnlock) {
+        var pairs = {};
         for (var ind in windturbines) {
             var wb = windturbines[ind];
             var ct = {
-                windturbineId:wb.windturbineId,
-                stationId:wb.stationId,
-                projectId:wb.projectId,
-                modelId:wb.modelId,
-                controlType:wb.controlType,
-                lockType:wb.lockType,
-                userName:this.LoginUser.userName,
-                userId:this.LoginUser.id,
+                windturbineId: wb.windturbineId,
+                stationId: wb.stationId,
+                projectId: wb.projectId,
+                modelId: wb.modelId,
+                controlType: wb.controlType,
+                lockType: wb.lockType,
+                userName: this.LoginUser.userName,
+                userId: this.LoginUser.id,
             };
-            pairs[ct.windturbineId]=ct;
+            pairs[ct.windturbineId] = ct;
         }
-        axios.post(`http://${config.calcUrl}/api/control/send?isLockOrUnlock=${isLockOrUnlock}`,pairs)
-        .then(msg=>{
-            console.log(msg);
-        })
-        .catch(err=>{
-            this.showdialog("错误","风机控制出现错误",err.message);
-            console.log(err);
-        });
+        axios.post(`http://${config.calcUrl}/api/control/send?isLockOrUnlock=${isLockOrUnlock}`, pairs)
+            .then(msg => {
+                console.log(msg);
+            })
+            .catch(err => {
+                this.showdialog("错误", "风机控制出现错误", err.message);
+                console.log(err);
+            });
         console.log(isLockOrUnlock);
     }
 
+    /* 系统控制风机,自动下发命令 */
+    windturbineControlSystem(windturbines) {
+        var pairs = {};
+        for (var ind in windturbines) {
+            var wb = windturbines[ind];
+            var ct = {
+                windturbineId: wb.windturbineId,
+                stationId: wb.stationId,
+                projectId: wb.projectId,
+                modelId: wb.modelId,
+                controlType: wb.controlType,
+                lockType: wb.lockType,
+                userName: 'system',
+                userId: 0,
+            };
+            pairs[ct.windturbineId] = ct;
+        }
+        axios.post(`http://${config.calcUrl}/api/control/send?isLockOrUnlock=false`, pairs)
+            .then(msg => {
+                console.log(msg);
+            })
+            .catch(err => {
+                this.showdialog("错误", "风机控制出现错误", err.message);
+                console.log(err);
+            });
+    }
+
     /* 标记 */
     marking(windturbines) {
         for (var v in windturbines) {

+ 43 - 47
src/components/area/AlarmArea.vue

@@ -6,27 +6,20 @@
     circle-style="green"
     content-style="25"
   >
-    <table class="ToolBar">
-      
-      <tr>
-        
-        <td width="150px">时间</td>
-        <td idth="400px">描述</td>
-        <td width="50px">确认</td>
-        
-      </tr>
-      
-    </table>
-
-    <table class="Tables">
-      <tr v-for="v in values" :key="v">
-        <div>
-        <td width="150px">{{ v.lastUpdateTime }}</td>
-        <td width="400px">{{ v.alertText }}</td>
-        <td width="50px"><input type="checkbox" disabled="disabled"/></td>
-        </div>
-      </tr>
-    </table>
+    <div>
+      <table class="table-main">
+        <tr>
+          <td width="150px">时间</td>
+          <td idth="400px">描述</td>
+          <td width="50px">确认</td>
+        </tr>
+        <tr v-for="v in values" :key="v">
+          <td width="150px">{{ v.lastUpdateTime }}</td>
+          <td width="400px">{{ v.alertText }}</td>
+          <td width="50px"><input type="checkbox" disabled="disabled" /></td>
+        </tr>
+      </table>
+    </div>
   </gy-card>
 </template>
 
@@ -37,9 +30,7 @@ export default {
   created: function () {
     this.initData();
   },
-  props: {
-      
-  },
+  props: {},
   data() {
     return {
       values: new Array(),
@@ -55,7 +46,11 @@ export default {
       var val = JSON.parse(msg);
       this.values = new Array();
       for (var v in val) {
-        this.values.push(val[v]);
+        var vl = val[v];
+        if (vl.stationId != "QS_FDC" && vl.category1 == "FJ") {
+          vl.alertText = vl.windturbineName + "-" + vl.alertText;
+        }
+        this.values.push(vl);
       }
       console.log(val);
     },
@@ -63,29 +58,30 @@ export default {
 };
 </script>
 <style scoped>
-div{
-  background: #292929;
+tr {
   line-height: 1.5;
+  background: #1e1e1e;
+  margin-bottom: 2px;
+  border-radius: 5px;
 }
-td,tr{
-  
-  line-height: 1.5;
-}
-.ToolBar{
-position:absolute;
-right:12px;
-width:596px;
-text-align:center;
-z-index:2;
-font-size:14px;
-height: 28px;
-margin-top:-2px;
-background: #292929;
-}
-.Tables{
-  font-size:14px;
-  width:600px;
-  padding-top: 28px;
-text-align:center;
+/* .ToolBar {
+  position: absolute;
+  right: 12px;
+  width: 586px;
+  text-align: center;
+  z-index: 2;
+  font-size: 14px;
+  height: 28px;
+  margin: 5px;
+  background: #1e1e1e;
+} */
+.table-main {
+  font-size: 14px;
+  width: 600px;
+  text-align: center;
+  background: #000000;
+  margin: 5px;
+  border-collapse:separate;
+  border-spacing:0px 5px;
 }
 </style>

+ 57 - 7
src/components/area/ControlArea.vue

@@ -76,9 +76,7 @@ export default {
   components: {
     ControlMatrixCard,
   },
-  props: {
-    
-  },
+  props: {},
   computed: {
     buttonLeftStyle: function () {
       return this.IsAutoControl ? "button-unselected" : "button-selected";
@@ -99,7 +97,7 @@ export default {
         unmaintain: { key: "待取消维护", value: [] },
         reset: { key: "待复位", value: [] },
       },
-      IsAutoControl:false,
+      IsAutoControl: false,
     };
   },
   methods: {
@@ -110,7 +108,25 @@ export default {
     },
     suggestion(msg) {
       var val = JSON.parse(msg);
-      for (var vv in val) {
+      var tp = this.getSuggestionType(val);
+      if (tp == null) return;
+      if (tp == "UnMaintain") {
+        this.updateSuggestion(this.ls.unmaintain.value, val);
+      } else if (tp == "Start") {
+        //推荐启动
+        this.updateSuggestion(this.ls.start.value, val);
+      } else if (tp == "Stop") {
+        // 推荐停机
+        this.updateSuggestion(this.ls.stop.value, val);
+      } else if (tp == "Reset") {
+        // 推荐复位
+        this.updateSuggestion(this.ls.reset.value, val);
+      } else if (tp == "Maintain") {
+        // 推荐维护
+        this.updateSuggestion(this.ls.maintain.value, val);
+      }
+
+      /* for (var vv in val) {
         var v = val[vv];
         var windturbineId = v.windturbineId;
         if (v.adviceOperateStyle == "UnMaintain") {
@@ -138,8 +154,38 @@ export default {
             this.ls.maintain.value.push(windturbineId);
           }
         }
+      } */
+    },
+
+    /* 获取推荐类型 */
+    getSuggestionType(val) {
+      if (typeof val === "undefined") return null;
+      for (var v in val) {
+        return val[v].adviceOperateStyle;
       }
+      return null;
     },
+
+    /* 更新推荐数据 */
+    updateSuggestion(ll,val) {
+      var lls = new Array();
+      for(var v1 in ll){
+        var v2 = val[ll[v1]];
+        if(typeof(v2)==='undefined'){
+          lls.push(v1);
+        }
+      }
+      for(var v3 in lls){
+        ll.splice(v3,1);
+      }
+      for(var v in val){
+        var vl = val[v];
+        if(!ll.includes(vl.windturbineId)){
+          ll.push(vl.windturbineId);
+        }
+      }
+    },
+
     /* 右键菜单 */
     contextmenu() {
       const { remote } = require("electron");
@@ -210,7 +256,11 @@ export default {
     menuClicked(msg) {
       var bd = BackgroundData.getInstance();
       if (!bd.LoginUser) {
-        this.$confirm("控制风机前需要登录!","请登录",{confirmButtonText:'确定',cancelButtonText:'取消',type:'warning'});
+        this.$confirm("控制风机前需要登录!", "请登录", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning",
+        });
         //bd.showdialog("提示", "请登录:", "在控制之前需要先登录!");
         return;
       }
@@ -271,7 +321,7 @@ export default {
       console.log("自动发送命令 " + ls.length);
       if (ls.length <= 0) return;
       var bd = BackgroundData.getInstance();
-      bd.windturbineControl(ls, false);
+      bd.windturbineControlSystem(ls, false);
     },
   },
 };

+ 13 - 0
src/components/area/windturbine/control/ControlMatrixCard.vue

@@ -115,6 +115,7 @@ export default {
     "$store.getters.windturbinelist": {
       deep: true,
       handler: function (json) {
+        var val = {};
         this.datas.value.forEach((item) => {
           var data = json[item];
           var active = undefined;
@@ -126,6 +127,7 @@ export default {
               break;
             }
           }
+          val[item]=0;
           var obj = {
             active: active,
             status: status,
@@ -141,6 +143,17 @@ export default {
           // 替换实时刷新的值
           this.values.splice(i, 1, obj);
         });
+
+        var lls = new Array();
+        for(var i1 = 0;i1<this.values.length;++i1){
+          var vvv = this.values[i1];
+          if(typeof(val[vvv.windturbineId])==='undefined'){
+            lls.push(i1);
+          }
+        }
+        for(var v2 in lls){
+          this.values.splice(v2,1);
+        }
       },
     },
   },

+ 13 - 3
src/components/area/windturbine/problem/ProblemMatrixCard.vue

@@ -118,14 +118,24 @@ export default {
 
     clear(vs){
       var ll = new Array();
-      for(var v in this.values){
+      this.values.forEach((item)=>{
+        var it = vs[item.windturbineId];
+        if(typeof(it)==="undefined"){
+          ll.push(item);
+        }
+      });
+      /* for(var v in this.values){
         var it = vs[this.values[v].windturbineId];
         if(typeof(it)==="undefined"){
           ll.push(v);
         }
-      }
+      } */
       for(var v1 in ll){
-        this.values.splice(v1-1,1);
+        // todo 这里有问题
+        //this.values.splice(v1-1,1);
+        var ind = this.values.indexOf(ll[v1]);
+        if(ind<0)continue;
+        this.values.splice(ind,1);
       }
     }
   },