Przeglądaj źródła

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

xushili 3 lat temu
rodzic
commit
4a50fca38b

+ 9 - 5
src/assets/script/BackgroundData.js

@@ -292,7 +292,7 @@ export default class BackgroundData {
     }
 
     /* 风机控制 */
-    windturbineControl(windturbines) {
+    windturbineControl(windturbines,isLockOrUnlock) {
         var pairs={};
         for (var ind in windturbines) {
             var wb = windturbines[ind];
@@ -308,10 +308,14 @@ export default class BackgroundData {
             };
             pairs[ct.windturbineId]=ct;
         }
-        var heads={
-
-        };
-        console.log(heads);
+        axios.post(`http://${config.calcUrl}/api/control/send?isLockOrUnlock=${isLockOrUnlock}`,pairs)
+        .then(msg=>{
+            console.log(msg);
+        })
+        .catch(err=>{
+            console.log(err);
+        });
+        console.log(isLockOrUnlock);
     }
 
     /* 标记 */

+ 1 - 1
src/components/TitleBar.vue

@@ -188,7 +188,7 @@
             <br> -->
             <el-button v-if="!isLogin" class="loginoption" @click="userClick">登&emsp;录</el-button>
             <br v-if="!isLogin">
-            <el-button class="loginoption" @click="logout">注&emsp;销</el-button>
+            <el-button v-if="isLogin" class="loginoption" @click="logout">注&emsp;销</el-button>
           </div>
         </el-popover>
 

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

@@ -7,17 +7,63 @@
     content-style="44"
     @contextmenu="contextmenu"
   >
-    <ControlMatrixCard title="待启动" :datas="ls.start" ref="start"></ControlMatrixCard>
-    <ControlMatrixCard title="待停机" :datas="ls.stop" ref="stop"></ControlMatrixCard>
-    <ControlMatrixCard title="待维护" :datas="ls.maintain" ref="maintain"></ControlMatrixCard>
-    <ControlMatrixCard title="待取消维护" :datas="ls.unmaintain" ref="unmaintain"></ControlMatrixCard>
-    <ControlMatrixCard title="待复位" :datas="ls.reset" ref="reset"></ControlMatrixCard>
-    <el-button style="z-index:2;position:absolute;bottom:10px;right:10px;background: #292929;font-size:15px;width:90px;border:none;color:rgb(220,220,220);" size="small" @click="menuClicked({type:'marking'})">发送</el-button>
+    <ControlMatrixCard
+      title="待启动"
+      :datas="ls.start"
+      :operateStyle="1"
+      ref="start"
+    ></ControlMatrixCard>
+    <ControlMatrixCard
+      title="待停机"
+      :datas="ls.stop"
+      :operateStyle="2"
+      ref="stop"
+    ></ControlMatrixCard>
+    <ControlMatrixCard
+      title="待维护"
+      :datas="ls.maintain"
+      :operateStyle="6"
+      ref="maintain"
+    ></ControlMatrixCard>
+    <ControlMatrixCard
+      title="待取消维护"
+      :datas="ls.unmaintain"
+      :operateStyle="8"
+      ref="unmaintain"
+    ></ControlMatrixCard>
+    <ControlMatrixCard
+      title="待复位"
+      :datas="ls.reset"
+      :operateStyle="5"
+      ref="reset"
+    ></ControlMatrixCard>
+    <el-button
+      style="
+        z-index: 2;
+        position: absolute;
+        bottom: 10px;
+        right: 10px;
+        background: #292929;
+        font-size: 15px;
+        width: 90px;
+        border: none;
+        color: rgb(220, 220, 220);
+      "
+      size="small"
+      @click="menuClicked({ type: 'send' })"
+      >发送</el-button
+    >
   </gy-card>
-  <el-button-group style="z-index:3;position:absolute;top:16px;left:120px;">
-      <el-button style="background: black;font-size:14px;width:80px;border:none;color:rgb(220,220,220);" size="mini" round>自动</el-button>
-      <el-button style="background: #202020;font-size:14px;width:80px;border:none;color:rgb(220,220,220);" size="mini" round>手动</el-button>
-    </el-button-group>
+  <el-button-group
+    style="z-index: 3; position: absolute; top: 16px; left: 120px"
+  >
+    <el-button :class="buttonLeftStyle" size="mini" @click="controlClick(false)"
+      >手动</el-button
+    >
+    <el-button :class="buttonRightStyle" size="mini" @click="controlClick(true)"
+      >自动</el-button
+    >
+  </el-button-group>
 </template>
 
 <script>
@@ -30,6 +76,17 @@ export default {
   components: {
     ControlMatrixCard,
   },
+  props: {
+    
+  },
+  computed: {
+    buttonLeftStyle: function () {
+      return this.IsAutoControl ? "button-unselected" : "button-selected";
+    },
+    buttonRightStyle: function () {
+      return this.IsAutoControl ? "button-selected" : "button-unselected";
+    },
+  },
   created: function () {
     this.initData();
   },
@@ -42,14 +99,13 @@ export default {
         unmaintain: { key: "待取消维护", value: [] },
         reset: { key: "待复位", value: [] },
       },
+      IsAutoControl:false,
     };
   },
   methods: {
     initData: function () {
       var mb = MessageBridge.getInstance();
-      var vs = [
-        { key: "/topic/suggestion", action: this.suggestion },
-      ];
+      var vs = [{ key: "/topic/suggestion", action: this.suggestion }];
       mb.register(vs);
     },
     suggestion(msg) {
@@ -101,37 +157,40 @@ export default {
             {
               label: "检修",
               click() {
-                that.menuClicked({ type: "lock", value: 8 });
+                that.menuClicked({ type: "lock", value: "CheckLock" });
               },
             },
             {
               label: "故障维修",
               click() {
-                that.menuClicked({ type: "lock", value: 7 });
+                that.menuClicked({ type: "lock", value: "FaultLock" });
               },
             },
             {
               label: "场内受累检修",
               click() {
-                that.menuClicked({ type: "lock", value: 2 });
+                that.menuClicked({ type: "lock", value: "StationCheckLock" });
               },
             },
             {
               label: "场内受累故障",
               click() {
-                that.menuClicked({ type: "lock", value: 3 });
+                that.menuClicked({ type: "lock", value: "StationFaulLock" });
               },
             },
             {
               label: "场外受累电网",
               click() {
-                that.menuClicked({ type: "lock", value: 4 });
+                that.menuClicked({
+                  type: "lock",
+                  value: "StationPowerLineLock",
+                });
               },
             },
             {
               label: "场外受累天气",
               click() {
-                that.menuClicked({ type: "lock", value: 5 });
+                that.menuClicked({ type: "lock", value: "StationWeatherLock" });
               },
             },
           ],
@@ -156,22 +215,29 @@ export default {
       }
       if (msg.type == "lock") {
         // 挂牌
+        var los = this.getSelectedItems();
+        for (var id in los) {
+          los[id].lockType = msg.value;
+        }
+        bd.windturbineControl(los, true);
       } else if (msg.type == "send") {
         // 发送
+        var vs = this.getSelectedItems(true);
+        bd.windturbineControl(vs, false);
       } else if (msg.type == "marking") {
         // 标注
-        var vs = this.getSelectedItems();
-        bd.marking(vs);
+        var vvs = this.getSelectedItems();
+        bd.marking(vvs);
       }
       this.clearSelected();
     },
 
     /* 获取选中的项目,isControl:是否是控制 */
-    getSelectedItems(isControl){
+    getSelectedItems(isControl) {
       var ls = new Array();
       this.$refs.start.outputSelectedItems(ls);
       this.$refs.stop.outputSelectedItems(ls);
-      if(isControl) return ls;
+      if (isControl) return ls;
       this.$refs.maintain.outputSelectedItems(ls);
       this.$refs.unmaintain.outputSelectedItems(ls);
       this.$refs.reset.outputSelectedItems(ls);
@@ -179,15 +245,49 @@ export default {
     },
 
     /* 清除所有选择 */
-    clearSelected(){
+    clearSelected() {
       this.$refs.start.clearSelected();
       this.$refs.stop.clearSelected();
       this.$refs.maintain.clearSelected();
       this.$refs.unmaintain.clearSelected();
       this.$refs.reset.clearSelected();
-    }
+    },
+
+    controlClick(isAuto) {
+      this.IsAutoControl = isAuto;
+      if (isAuto) {
+        this.AutoSendTimer = setInterval(this.AutoSend, 60000);
+      } else {
+        clearInterval(this.AutoSendTimer);
+      }
+    },
+
+    /* 自动发送命令 */
+    AutoSend() {
+      var ls = new Array();
+      this.$refs.start.outputAllItems(ls);
+      this.$refs.stop.outputAllItems(ls);
+      console.log("自动发送命令 " + ls.length);
+      if (ls.length <= 0) return;
+      var bd = BackgroundData.getInstance();
+      bd.windturbineControl(ls, false);
+    },
   },
 };
 </script>
 <style scoped>
+.button-selected {
+  background: black;
+  font-size: 14px;
+  width: 80px;
+  border: none;
+  color: rgb(220, 220, 220);
+}
+.button-unselected {
+  background: #202020;
+  font-size: 14px;
+  width: 80px;
+  border: none;
+  color: rgb(220, 220, 220);
+}
 </style>

+ 13 - 10
src/components/area/ProblemArea.vue

@@ -57,37 +57,37 @@ export default {
             {
               label: "检修",
               click() {
-                that.menuClicked({ type: "lock", value: 8 });
+                that.menuClicked({ type: "lock", value: "CheckLock" });
               },
             },
             {
               label: "故障维修",
               click() {
-                that.menuClicked({ type: "lock", value: 7 });
+                that.menuClicked({ type: "lock", value: "FaultLock" });
               },
             },
             {
               label: "场内受累检修",
               click() {
-                that.menuClicked({ type: "lock", value: 2 });
+                that.menuClicked({ type: "lock", value: "StationCheckLock" });
               },
             },
             {
               label: "场内受累故障",
               click() {
-                that.menuClicked({ type: "lock", value: 3 });
+                that.menuClicked({ type: "lock", value: "StationFaulLock" });
               },
             },
             {
               label: "场外受累电网",
               click() {
-                that.menuClicked({ type: "lock", value: 4 });
+                that.menuClicked({ type: "lock", value: "StationPowerLineLock" });
               },
             },
             {
               label: "场外受累天气",
               click() {
-                that.menuClicked({ type: "lock", value: 5 });
+                that.menuClicked({ type: "lock", value: "StationWeatherLock" });
               },
             },
           ],
@@ -95,7 +95,7 @@ export default {
         {
           label: "取消挂牌",
           click() {
-            that.menuClicked({ type: "unlock" });
+            that.menuClicked({ type: "lock",value:"UnLock" });
           },
         },
       ];
@@ -112,8 +112,11 @@ export default {
       }
       if (msg.type == "lock") {
         // 挂牌
-      } else if (msg.type == "unlock") {
-        // 取消挂牌
+        var los = this.getSelectedItems();
+        for(var id in los){
+          los[id].lockType=msg.value;
+        }
+        bd.windturbineControl(los,true);
       } else if (msg.type == "marking") {
         // 标注
         var vs = this.getSelectedItems();
@@ -122,7 +125,7 @@ export default {
       this.clearSelected();
     },
 
-    /* 获取选中的项目,isControl:是否是控制 */
+    /* 获取选中的项目 */
     getSelectedItems(){
       var ls = new Array();
       this.$refs.malfunction.outputSelectedItems(ls);

+ 36 - 3
src/components/area/windturbine/control/ControlMatrixCard.vue

@@ -45,19 +45,21 @@
 <script>
 export default {
   name: "ControlMatrixCard",
-  props: { title: String, datas: Object },
+  props: { title: String, datas: Object, operateStyle: Number },
   data() {
     return {
       values: [],
     };
   },
-  created() {},
+  created() {
+    //this.CheckTimer = setInterval(this.checkCard,2000);
+  },
   methods: {
     // 点击卡片事件
     onSelectHandler(item) {
       item.active = !item.active;
     },
-    
+
     /* 获取选中的项目 */
     getSelectedItems() {
       var ls = new Array();
@@ -77,10 +79,37 @@ export default {
       });
     },
 
+    /* 导出所有的项目 */
+    outputAllItems(ls) {
+      this.values.forEach((item) => {
+        ls.push(item);
+      });
+    },
+
     /* 清除选中的项目 */
     clearSelected() {
       this.values.forEach((item) => (item.active = false));
     },
+
+    /* checkCard(){
+      var st = 2;// 待机
+      if(this.operateStyle==2){
+        st = 4;
+      }else if(this.operateStyle==1){
+        st = 2;
+      }else{
+        return;
+      }
+      var ll = new Array();
+      for(var vvs in this.values){
+        if(this.values[vvs].status!=st){
+          ll.push(vvs);
+        }
+      }
+      for(var it in ll){
+        this.values.splice(it,1);
+      }
+    }, */
   },
   watch: {
     "$store.getters.windturbinelist": {
@@ -104,6 +133,10 @@ export default {
             windSpeed: data.windSpeed,
             rollSpeed: data.rollSpeed,
             windturbineId: item,
+            modelId: data.modelId,
+            projectId: data.projectId,
+            stationId: data.stationId,
+            controlType: this.operateStyle,
           };
           // 替换实时刷新的值
           this.values.splice(i, 1, obj);

+ 17 - 0
src/components/area/windturbine/problem/ProblemMatrixCard.vue

@@ -114,21 +114,38 @@ export default {
         }
       }
       return false;
+    },
+
+    clear(vs){
+      var ll = new Array();
+      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);
+      }
     }
   },
   watch: {
     "$store.getters.windturbinelist": {
       deep: true,
       handler: function (json) {
+        var vs = {};
         for (var id in json) {
           var val = json[id];
           if (val.status == this.type) {
             this.addCard(val);
+            vs[val.windturbineId]=0;
           }
           if (this.type < 0 && val.lockValue) {
             this.addCard(val);
+            vs[val.windturbineId]=0;
           }
         }
+        this.clear(vs);
       },
     },
   },