xushining 3 роки тому
батько
коміт
e99b765399

+ 13 - 0
src/assets/script/BackgroundData.js

@@ -104,6 +104,8 @@ export default class BackgroundData {
         this.refreshRecommendData = this.refreshRecommendData.bind(this);
         this.onRDMessage = this.onRDMessage.bind(this);
         this.showdialog = this.showdialog.bind(this);
+        this.windturbineControl=this.windturbineControl.bind(this);
+        this.marking=this.marking.bind(this);
 
         this.refreshTPData();
         this.refreshAlarmData();
@@ -287,6 +289,17 @@ export default class BackgroundData {
         });
     }
 
+    /* 风机控制 */
+    windturbineControl(windturbines){
+        console.log(windturbines);
+    }
+
+    marking(windturbines){
+        for(var v in windturbines){
+            this.Marks.push({title:windturbines[v].windturbineId});
+        }
+    }
+
     /* 单例 */
     static getInstance() {
         if (!BackgroundData.instance) {

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

@@ -5,14 +5,14 @@
     area-style="control"
     circle-style="green"
     content-style="44"
+    @contextmenu="contextmenu"
   >
-    <ControlMatrixCard title="待启动" :datas="ls.start"></ControlMatrixCard>
-    <ControlMatrixCard title="待停机" :datas="ls.stop"></ControlMatrixCard>
-    <ControlMatrixCard title="待维护" :datas="ls.maintain"></ControlMatrixCard>
-    <ControlMatrixCard title="待取消维护" :datas="ls.unmaintain"></ControlMatrixCard>
-    <ControlMatrixCard title="待复位" :datas="ls.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">发送</el-button>
-    
+    <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>
   </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>
@@ -23,6 +23,7 @@
 <script>
 import ControlMatrixCard from "./windturbine/control/ControlMatrixCard.vue";
 import MessageBridge from "../../assets/script/MessageBridge";
+import BackgroundData from "../../assets/script/BackgroundData";
 
 export default {
   name: "ControlArea",
@@ -83,6 +84,108 @@ export default {
         }
       }
     },
+    /* 右键菜单 */
+    contextmenu() {
+      const { remote } = require("electron");
+      var that = this;
+      const menuTemplate = [
+        {
+          label: "发送",
+          click() {
+            that.menuClicked({ type: "send" });
+          },
+        },
+        {
+          label: "挂牌",
+          submenu: [
+            {
+              label: "检修",
+              click() {
+                that.menuClicked({ type: "lock", value: 8 });
+              },
+            },
+            {
+              label: "故障维修",
+              click() {
+                that.menuClicked({ type: "lock", value: 7 });
+              },
+            },
+            {
+              label: "场内受累检修",
+              click() {
+                that.menuClicked({ type: "lock", value: 2 });
+              },
+            },
+            {
+              label: "场内受累故障",
+              click() {
+                that.menuClicked({ type: "lock", value: 3 });
+              },
+            },
+            {
+              label: "场外受累电网",
+              click() {
+                that.menuClicked({ type: "lock", value: 4 });
+              },
+            },
+            {
+              label: "场外受累天气",
+              click() {
+                that.menuClicked({ type: "lock", value: 5 });
+              },
+            },
+          ],
+        },
+        {
+          label: "标注",
+          click() {
+            that.menuClicked({ type: "marking" });
+          },
+        },
+      ];
+      const menu = remote.Menu.buildFromTemplate(menuTemplate);
+
+      menu.popup(remote.getCurrentWindow());
+    },
+
+    menuClicked(msg) {
+      var bd = BackgroundData.getInstance();
+      if (!bd.LoginUser) {
+        bd.showdialog("提示", "控制出现错误:", "未登录");
+        return;
+      }
+      if (msg.type == "lock") {
+        // 挂牌
+      } else if (msg.type == "send") {
+        // 发送
+      } else if (msg.type == "marking") {
+        // 标注
+        var vs = this.getSelectedItems();
+        bd.marking(vs);
+      }
+      this.clearSelected();
+    },
+
+    /* 获取选中的项目,isControl:是否是控制 */
+    getSelectedItems(isControl){
+      var ls = new Array();
+      this.$refs.start.outputSelectedItems(ls);
+      this.$refs.stop.outputSelectedItems(ls);
+      if(isControl) return ls;
+      this.$refs.maintain.outputSelectedItems(ls);
+      this.$refs.unmaintain.outputSelectedItems(ls);
+      this.$refs.reset.outputSelectedItems(ls);
+      return ls;
+    },
+
+    /* 清除所有选择 */
+    clearSelected(){
+      this.$refs.start.clearSelected();
+      this.$refs.stop.clearSelected();
+      this.$refs.maintain.clearSelected();
+      this.$refs.unmaintain.clearSelected();
+      this.$refs.reset.clearSelected();
+    }
   },
 };
 </script>

+ 1 - 0
src/components/area/LabelArea.vue

@@ -24,6 +24,7 @@ export default{
     },
     methods:{
         refreshData(){
+            this.values=new Array();
             this.values=BackgroundData.getInstance().Marks;
         },
     }

+ 23 - 1
src/components/area/windturbine/control/ControlMatrixCard.vue

@@ -95,6 +95,29 @@ export default {
         if (item.windturbineId == windturbineId) item.active = !active;
       });
     },
+    /* 获取选中的项目 */
+    getSelectedItems() {
+      var ls = new Array();
+      this.values.forEach((item) => {
+        if (item.active) {
+          ls.push(item);
+        }
+      });
+      return ls;
+    },
+    /* 将选中的项目填充到数组中 */
+    outputSelectedItems(ls) {
+      this.values.forEach((item) => {
+        if (item.active) {
+          ls.push(item);
+        }
+      });
+    },
+
+    /* 清除选中的项目 */
+    clearSelected() {
+      this.values.forEach((item) => (item.active = false));
+    },
   },
   components: {
     // ControlWindCard,
@@ -231,7 +254,6 @@ export default {
   border-left: 2px dashed rgb(05, 187, 76);
 }
 
-
 /* ***********颜色************ */
 /* *********************** */
 /*  最外层卡片选中和未选中 */