소스 검색

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

xushili 3 년 전
부모
커밋
7eaf525c7b

+ 79 - 81
package-lock.json

@@ -3272,6 +3272,63 @@
           "integrity": "sha1-/q7SVZc9LndVW4PbwIhRpsY1IPo=",
           "dev": true
         },
+        "ansi-styles": {
+          "version": "4.3.0",
+          "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
+          "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
+          "dev": true,
+          "optional": true,
+          "requires": {
+            "color-convert": "^2.0.1"
+          }
+        },
+        "chalk": {
+          "version": "4.1.1",
+          "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz",
+          "integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==",
+          "dev": true,
+          "optional": true,
+          "requires": {
+            "ansi-styles": "^4.1.0",
+            "supports-color": "^7.1.0"
+          }
+        },
+        "color-convert": {
+          "version": "2.0.1",
+          "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+          "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+          "dev": true,
+          "optional": true,
+          "requires": {
+            "color-name": "~1.1.4"
+          }
+        },
+        "color-name": {
+          "version": "1.1.4",
+          "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+          "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+          "dev": true,
+          "optional": true
+        },
+        "has-flag": {
+          "version": "4.0.0",
+          "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+          "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+          "dev": true,
+          "optional": true
+        },
+        "loader-utils": {
+          "version": "2.0.0",
+          "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz",
+          "integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==",
+          "dev": true,
+          "optional": true,
+          "requires": {
+            "big.js": "^5.2.2",
+            "emojis-list": "^3.0.0",
+            "json5": "^2.1.2"
+          }
+        },
         "ssri": {
           "version": "8.0.1",
           "resolved": "https://registry.nlark.com/ssri/download/ssri-8.0.1.tgz?cache=0&sync_timestamp=1621364735533&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fssri%2Fdownload%2Fssri-8.0.1.tgz",
@@ -3280,6 +3337,28 @@
           "requires": {
             "minipass": "^3.1.1"
           }
+        },
+        "supports-color": {
+          "version": "7.2.0",
+          "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
+          "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
+          "dev": true,
+          "optional": true,
+          "requires": {
+            "has-flag": "^4.0.0"
+          }
+        },
+        "vue-loader-v16": {
+          "version": "npm:vue-loader@16.2.0",
+          "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.2.0.tgz",
+          "integrity": "sha512-TitGhqSQ61RJljMmhIGvfWzJ2zk9m1Qug049Ugml6QP3t0e95o0XJjk29roNEiPKJQBEi8Ord5hFuSuELzSp8Q==",
+          "dev": true,
+          "optional": true,
+          "requires": {
+            "chalk": "^4.1.0",
+            "hash-sum": "^2.0.0",
+            "loader-utils": "^2.0.0"
+          }
         }
       }
     },
@@ -17548,87 +17627,6 @@
         }
       }
     },
-    "vue-loader-v16": {
-      "version": "npm:vue-loader@16.2.0",
-      "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.2.0.tgz",
-      "integrity": "sha512-TitGhqSQ61RJljMmhIGvfWzJ2zk9m1Qug049Ugml6QP3t0e95o0XJjk29roNEiPKJQBEi8Ord5hFuSuELzSp8Q==",
-      "dev": true,
-      "optional": true,
-      "requires": {
-        "chalk": "^4.1.0",
-        "hash-sum": "^2.0.0",
-        "loader-utils": "^2.0.0"
-      },
-      "dependencies": {
-        "ansi-styles": {
-          "version": "4.3.0",
-          "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
-          "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
-          "dev": true,
-          "optional": true,
-          "requires": {
-            "color-convert": "^2.0.1"
-          }
-        },
-        "chalk": {
-          "version": "4.1.1",
-          "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz",
-          "integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==",
-          "dev": true,
-          "optional": true,
-          "requires": {
-            "ansi-styles": "^4.1.0",
-            "supports-color": "^7.1.0"
-          }
-        },
-        "color-convert": {
-          "version": "2.0.1",
-          "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
-          "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
-          "dev": true,
-          "optional": true,
-          "requires": {
-            "color-name": "~1.1.4"
-          }
-        },
-        "color-name": {
-          "version": "1.1.4",
-          "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
-          "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
-          "dev": true,
-          "optional": true
-        },
-        "has-flag": {
-          "version": "4.0.0",
-          "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
-          "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
-          "dev": true,
-          "optional": true
-        },
-        "loader-utils": {
-          "version": "2.0.0",
-          "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz",
-          "integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==",
-          "dev": true,
-          "optional": true,
-          "requires": {
-            "big.js": "^5.2.2",
-            "emojis-list": "^3.0.0",
-            "json5": "^2.1.2"
-          }
-        },
-        "supports-color": {
-          "version": "7.2.0",
-          "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
-          "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
-          "dev": true,
-          "optional": true,
-          "requires": {
-            "has-flag": "^4.0.0"
-          }
-        }
-      }
-    },
     "vue-style-loader": {
       "version": "4.1.3",
       "resolved": "https://registry.npm.taobao.org/vue-style-loader/download/vue-style-loader-4.1.3.tgz",

+ 18 - 14
src/App.vue

@@ -1,31 +1,35 @@
 <template>
-  <TitleBar/>
-  <CenterPage/>
-  <StatusBar/>
+  <TitleBar />
+  <CenterPage />
+  <StatusBar />
 </template>
 
 <script>
-import TitleBar from './components/TitleBar.vue'
-import CenterPage from './components/CenterPage.vue'
-import StatusBar from './components/StatusBar.vue'
-
+import TitleBar from "./components/TitleBar.vue";
+import CenterPage from "./components/CenterPage.vue";
+import StatusBar from "./components/StatusBar.vue";
+import WebSocket from "./assets/script/webSocket";
 
 export default {
-  name: 'App',
+  name: "App",
   components: {
     TitleBar,
     CenterPage,
     StatusBar,
   },
-  created:function(){
-    console.log("你好");
-  }
-}
+  props: {
+
+  },
+  created: function () {
+    var msbridge = new WebSocket.messagebridge();
+    msbridge.onmessage=onmessage;
+  },
+};
 </script>
 
 <style scoped>
-@import './assets/style/main.css';
- /*#app {
+@import "./assets/style/main.css";
+/*#app {
    font-family: Avenir, Helvetica, Arial, sans-serif;
   -webkit-font-smoothing: antialiased;
   -moz-osx-font-smoothing: grayscale;

+ 25 - 3
src/assets/script/WEBSocket.js

@@ -1,6 +1,12 @@
+export default {
+    name:"WebSocket",
+    messagebridge
+}
+
 class messagebridge{
+    ws;
     constructor(){
-        
+        this.ws = new websocket("ws://18.6.30.63:8011/wisdom");
     }
 }
 
@@ -10,9 +16,25 @@ class websocket{
     construtor(url){
         this.url=url;
         this.webSocket=new WebSocket(url);
-        this.webSocket.onopen=this.webSocketOnOpen;
+        this.webSocket.onopen=this.onopen;
+        this.webSocket.onmessage=this.onmessage;
+        this.webSocket.onerror=this.onerror;
+        this.websocket.onclose=this.onclose;
     }
-    webSocketOnOpen(){
+    /* websocket打开 */
+    onopen(){
         console.log("websocket连接成功!")
     }
+    /* websocket获得消息 */
+    onmessage(d){
+        console.log("得到消息"+d);
+    }
+    /* websocket发生错误 */
+    onerror(){
+
+    }
+    /* websocket关闭 */
+    onclose(){
+
+    }
 }

+ 2 - 1
src/background.js

@@ -25,11 +25,12 @@ async function createWindow() {
     frame:false,
     fullscreen:true,
     webPreferences: {
-      
+
       // Use pluginOptions.nodeIntegration, leave this alone
       // See nklayman.github.io/vue-cli-plugin-electron-builder/guide/security.html#node-integration for more info
       nodeIntegration: true,
       contextIsolation: false,
+      enableRemoteModule: true
     }
   })
 

+ 36 - 1
src/components/StatusBar.vue

@@ -2,7 +2,10 @@
 <template>
     <div class='status-bar'>
         <el-row>
-            <el-col :span="16"></el-col>
+            <el-col :span="16">
+                <span style="color: white">系统时间:</span>
+                <span style="color: white">{{currentTime}}</span>
+            </el-col>
             <el-col :span="8">
                 <el-popover placement="top-start" :width="400" trigger="hover">
                     <template #reference>
@@ -73,6 +76,8 @@
                 defectNum: 0,
                 malfunctionNum: 0,
                 accidentNum: 0,
+                statusTimer: "",
+                currentTime: "",
                 gridData: [{
                     date: '2016-05-02',
                     name: '王小虎',
@@ -91,6 +96,36 @@
                     address: '上海市普陀区金沙江路 1518 弄'
                 }]
             }
+        },
+        mounted() {
+            let that = this
+            this.statusTimer = setInterval(function () {
+                that.currentTime =
+                    new Date().getFullYear() +
+                    "-" +
+                    that.appendZero((new Date().getMonth() + 1)) +
+                    "-" +
+                    that.appendZero(new Date().getDate()) +
+                    " " +
+                    that.appendZero(new Date().getHours()) +
+                    ":" +
+                    that.appendZero(new Date().getMinutes()) +
+                    ": " +
+                    that.appendZero(new Date().getSeconds());
+            }, 1000)
+        },
+        beforeDestory() {
+            clearInterval(this.statusTimer)
+            this.statusTimer = null;
+        },
+        methods: {
+            appendZero(obj) {
+                if (obj < 10) {
+                    return "0" + obj
+                } else {
+                    return obj
+                }
+            }
         }
     }
 </script>

+ 7 - 6
src/components/TitleBar.vue

@@ -80,13 +80,14 @@
 </template>
 
 <script>
-import TitleBarCard from './area/mainwindow/TitleBarCard.vue'
-export default{
-    name:"TitleBar",
-    components:{
-        TitleBarCard,
+    import TitleBarCard from './area/mainwindow/TitleBarCard.vue'
+
+    export default {
+        name: "TitleBar",
+        components: {
+            TitleBarCard,
+        }
     }
-}
 </script>
 
 

+ 24 - 1
src/components/area/gy-card.vue

@@ -2,7 +2,7 @@
 <template>
     <transition>
         <div :class='areaClass' @mouseover="hover = true"
-             @mouseleave="hover = false">
+             @mouseleave="hover = false" @contextmenu="rightClick">
             <div :class="headerClass" @dblclick="gyCardDbClick">
                 <div :class='circleClass'></div>
                 <span class="gy-card-title">{{ title }}</span>
@@ -98,6 +98,29 @@
                 } else {
                     this.big = true
                 }
+            },
+            rightClick() {
+                const {remote} = window.require('electron');
+                const {Menu, MenuItem} = remote
+                const menu = new Menu()
+                menu.append(new MenuItem({
+                    label: 'test1',
+                    click: function () {
+                        console.info("右键test1")
+                    }
+                }))
+                menu.append(new MenuItem({type: 'separator'}));
+                menu.append(new MenuItem({
+                    label: 'test2',
+                    click: function () {
+                        console.info("右键test2")
+                    }
+                }))
+                // window.addEventListener('contextmenu', (e) => {
+                //     e.preventDefault();
+                //     menu.popup({window: remote.getCurrentWindow()})
+                // }, false)
+                menu.popup(remote.getCurrentWindow())
             }
         }
     }

+ 49 - 5
src/components/area/windturbine/WindturbineMinCard.vue

@@ -1,6 +1,6 @@
 /* 风机矩阵小卡片 */
 <template>
-    <div :class="cardStyle">
+    <div :class="cardStyle" @click="sigSelectClick">
         <el-row>
             <div :class="leftStyle">
                 <el-row>
@@ -31,12 +31,25 @@
         props: {
             status: String,
         },
+        data() {
+            return {
+                sigSelect: false
+            }
+        },
         computed: {
             cardStyle: function () {
-                return "card-style-" + this.status;
+                if (this.sigSelect) {
+                    return "card-style-select-" + this.status;
+                } else {
+                    return "card-style-" + this.status;
+                }
             },
             leftStyle: function () {
-                return "card-left-style-" + this.status;
+                if (this.sigSelect) {
+                    return "card-left-style-select-" + this.status;
+                } else {
+                    return "card-left-style-" + this.status;
+                }
             },
             rightStyle: function () {
                 return "card-right-style-" + this.status;
@@ -51,6 +64,17 @@
                 return "card-content-style-" + this.status;
             }
         },
+        methods: {
+            sigSelectClick() {
+                let sigSelect = this.sigSelect
+                if (sigSelect) {
+                    this.sigSelect = false
+                } else {
+                    this.sigSelect = true
+                }
+                // todo retun id,父组件中接收id
+            }
+        }
     };
 </script>
 <style scoped>
@@ -64,6 +88,16 @@
         display: inline-block;
     }
 
+    .card-style-select-1 {
+        position: relative;
+        width: 116px;
+        height: 50px;
+        border: 2px solid #4952a6;
+        background-color: rgba(200, 10, 10, 0.3);
+        box-sizing: border-box;
+        display: inline-block;
+    }
+
     .card-left-style-1 {
         position: relative;
         width: 25px;
@@ -74,6 +108,16 @@
         display: inline-block;
     }
 
+    .card-left-style-select-1 {
+        position: relative;
+        width: 25px;
+        height: 41px;
+        background-color: rgba(200, 40, 40, 0.5);
+        box-sizing: border-box;
+        margin: 3px;
+        display: inline-block;
+    }
+
     .card-right-style-1 {
         position: relative;
         width: calc(116px - 4px - 6px - 25px);
@@ -92,7 +136,7 @@
 
     .card-title2-style-1 {
         margin-top: 2px;
-        font-size: 10px;
+        font-size: 12px;
         width: 100%;
         text-align: center;
     }
@@ -100,6 +144,6 @@
     .card-content-style-1 {
         width: 100%;
         text-align: right;
-        font-size: 5px;
+        font-size: 12px;
     }
 </style>

+ 1 - 1
src/main.js

@@ -1,4 +1,4 @@
-import { createApp } from 'vue'
+import {createApp} from 'vue'
 import ElementPlus from 'element-plus';
 import 'element-plus/lib/theme-chalk/index.css';
 import App from './App.vue';