Browse Source

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

# Conflicts:
#	src/components/area/windturbine/MatrixCard.vue
chenminghua 3 years ago
parent
commit
962a879006

+ 9 - 2
package-lock.json

@@ -4339,6 +4339,14 @@
       "integrity": "sha1-1h9G2DslGSUOJ4Ta9bCUeai0HFk=",
       "dev": true
     },
+    "axios": {
+      "version": "0.21.1",
+      "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz",
+      "integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==",
+      "requires": {
+        "follow-redirects": "^1.10.0"
+      }
+    },
     "babel-eslint": {
       "version": "10.1.0",
       "resolved": "https://registry.npm.taobao.org/babel-eslint/download/babel-eslint-10.1.0.tgz",
@@ -9356,8 +9364,7 @@
     "follow-redirects": {
       "version": "1.14.1",
       "resolved": "https://registry.nlark.com/follow-redirects/download/follow-redirects-1.14.1.tgz",
-      "integrity": "sha1-2RFN7Qoc/dM04WTmZirQK/2R/0M=",
-      "dev": true
+      "integrity": "sha1-2RFN7Qoc/dM04WTmZirQK/2R/0M="
     },
     "for-in": {
       "version": "1.0.2",

+ 1 - 0
package.json

@@ -18,6 +18,7 @@
   },
   "main": "background.js",
   "dependencies": {
+    "axios": "^0.21.1",
     "core-js": "^3.6.5",
     "electron-squirrel-startup": "^1.0.0",
     "element-plus": "^1.0.2-beta.48",

BIN
src/assets/img/RecommendedArea/guznzhu_bg_01.png


BIN
src/assets/img/main_window/kingshi.png


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

@@ -0,0 +1,278 @@
+import axios from 'axios';
+import { config } from '../../config';
+
+export default class BackgroundData {
+    /* 当前登录用户 */
+    LoginUser;
+    /* 标题栏数据 */
+    TopPoint = [
+        {
+            pointName: "TotalPower",// 实时总功率
+            pointTag: "JSFW.NX_GD_XXX_XX_XX_XXX_XXX_CI0135",
+            value: 0
+        }, {
+            pointName: "DailyPowerGeneration",// 日发电量
+            pointTag: "JSFW.NX_GD_XXX_XX_XX_XXX_XXX_CI0088",
+            value: 0
+        }, {
+            pointName: "GridPower",// 上网电量
+            pointTag: "JSFW.NX_GD_XXX_XX_XX_XXX_XXX_CI0136",
+            value: 0
+        }, {
+            pointName: "MonthlyPowerGeneration",// 月发电量
+            pointTag: "JSFW.NX_GD_XXX_XX_XX_XXX_XXX_CI0146",
+            value: 0
+        }, {
+            pointName: "AnnualPowerGeneration",// 年发电量
+            pointTag: "JSFW.NX_GD_XXX_XX_XX_XXX_XXX_CI0037",
+            value: 0
+        },
+    ];
+    /* 推荐区数据 */
+    Recommends = {
+        "DWK": {
+            stationName: "大武口光伏电站",
+            content: "通讯中断",
+            createTime: this.formatDate(new Date("2021-04-15 8:17:59"), 'YY-MM-DD hh:mm'),
+            isActive: true,
+        },
+        "NSSFCJSFW.NX_GD_NSSF_XX_XX_XXX_XXX_CI0263": {
+            stationName: "牛首山风电场",
+            content: "限电",
+            createTime: new Date(),
+            isActive: false,
+        },
+        "QSFCJSFW.NX_GD_QSF_XX_XX_XXX_XXX_CI0263": {
+            stationName: "青山风电场",
+            content: "限电",
+            createTime: new Date(),
+            isActive: false,
+        },
+
+        "SBQFCJSFW.NX_GD_SBQF_XX_XX_XXX_XXX_CI0263": {
+            stationName: "石板泉一期",
+            content: "限电",
+            createTime: new Date(),
+            isActive: false,
+        },
+        "MHSFCJSFW.NX_GD_MHSF_XX_XX_XXX_XXX_CI0263": {
+            stationName: "麻黄山风电场",
+            content: "限电",
+            createTime: new Date(),
+            isActive: false,
+        },
+        "XSFCJSFW.NX_GD_XSF_XX_XX_XXX_XXX_CI0263": {
+            stationName: "香山风电场",
+            content: "限电",
+            createTime: new Date(),
+            isActive: false,
+        },
+        "SLAGC.NX_GD_QSF_DQ_P1_L1_001_DI0165": {
+            stationName: "青山三期",
+            content: "限电",
+            createTime: new Date(),
+            isActive: false,
+        },
+        "SBQFCJSFW.NX_GD_SBQF_XX_XX_XXX_XXX_CI026X": {
+            stationName: "石板泉二三四期",
+            content: "限电",
+            createTime: new Date(),
+            isActive: false,
+        },
+    };
+    /* 隐患数据 */
+    HiddenProblems = new Array();
+    /* 缺陷数据 */
+    Defects = new Array();
+    /* 故障数据 */
+    Failure = new Array();
+    /* 事故数据 */
+    Accidents = new Array();
+    constructor() {
+        this.refreshTPData = this.refreshTPData.bind(this);
+        this.onTPMessage = this.onTPMessage.bind(this);
+        this.refreshAlarmData = this.refreshAlarmData.bind(this);
+        this.onHiddenProblemsMessage = this.onHiddenProblemsMessage.bind(this);
+        this.formatDate = this.formatDate.bind(this);
+        this.onDefectsMessage = this.onDefectsMessage.bind(this);
+        this.onAccidentsMessage = this.onAccidentsMessage.bind(this);
+        this.isContains = this.isContains.bind(this);
+        this.refreshRecommendData = this.refreshRecommendData.bind(this);
+        this.onRDMessage = this.onRDMessage.bind(this);
+
+        this.refreshTPData();
+        this.refreshAlarmData();
+        this.refreshRecommendData();
+
+        this.refreshTPTimer = setInterval(this.refreshTPData, 3000);// 标题栏数据
+        this.refreshAlarmTimer = setInterval(this.refreshAlarmData, 10000);// 报警数据
+        this.refreshRecommendTimer = setInterval(this.refreshRecommendData, 3000);// 推荐数据
+    }
+
+    /* 数据刷新 */
+    refreshTPData() {
+        // http://192.168.10.18:8011/ts
+        var val = '';
+        for (var v in this.TopPoint) {
+            val += this.TopPoint[v].pointTag + ',';
+        }
+        axios.get(`http://${config.adapterUrl}/ts/latest?keys=${val}`)
+            .then(this.onTPMessage)
+            .catch(err =>
+                console.log(err)
+            );
+    }
+
+    /* 刷新推荐信息 */
+    refreshRecommendData() {
+        var val = '';
+        for (var v in this.Recommends) {
+            val += v + ',';
+        }
+        axios.get(`http://${config.adapterUrl}/ts/latest?keys=${val}`)
+            .then(this.onRDMessage)
+            .catch(err =>
+                console.log(err)
+            );
+    }
+
+    /* 刷新报警信息 */
+    refreshAlarmData() {
+        // http://192.168.10.18:8075/alarm
+        // 1、读取一天内的所有open的4级custom报警,作为隐患数据ar
+        var enddt = new Date();
+        var tm = enddt.getTime();
+        enddt = new Date(tm + 900000);
+        var startdt = new Date(tm - 86400000);
+        axios.get(`http://${config.shardingUrl}/alarm/snap/page?pagenum=1&pagesize=500&category1=custom&rank=4&isopened=1&starttime=${this.formatDate(startdt)}&endtime=${this.formatDate(enddt)}`)
+            .then(this.onHiddenProblemsMessage)
+            .catch(err =>
+                console.log(err)
+            );
+        // 2、读取一天内所有的open的windturbine报警,以故障结尾的报警填充到故障,其他的填充到缺陷
+        axios.get(`http://${config.shardingUrl}/alarm/snap/page?pagenum=1&pagesize=500&category1=windturbine&isopened=1&starttime=${this.formatDate(startdt)}&endtime=${this.formatDate(enddt)}`)
+            .then(this.onDefectsMessage)
+            .catch(err =>
+                console.log(err)
+            );
+        // 3、读取一天内所有open的升压站(SYZ)报警,包含关键字“跳闸”,“开关”,“刀闸”,“断路器”字符的报警信息填充到事故列表
+        axios.get(`http://${config.shardingUrl}/alarm/snap/page?pagenum=1&pagesize=500&category1=SYZ&isopened=1&starttime=${this.formatDate(startdt)}&endtime=${this.formatDate(enddt)}`)
+            .then(this.onAccidentsMessage)
+            .catch(err =>
+                console.log(err)
+            );
+    }
+
+    /* 获得故障数据 */
+    onAccidentsMessage(msg) {
+        if (!msg.data) return;
+        this.Accidents = new Array();
+        for (var v in msg.data.records) {
+            var val = msg.data.records[v];
+            if (this.isContains(val.alertText, ["跳闸", "开关", "刀闸", "断路器", "合位", "分位"])) {
+                this.Accidents.push(val);
+            } else {
+                if (val.rank == "5") {
+                    this.Failure.push(val);
+                } else {
+                    this.Defects.push(val);
+                }
+            }
+        }
+    }
+
+    /* 获得缺陷数据 */
+    onDefectsMessage(msg) {
+        if (!msg.data) return;
+        this.Defects = new Array();
+        this.Failure = new Array();
+        for (var v in msg.data.records) {
+            var val = msg.data.records[v];
+            if (val.alertText.indexOf("故障") > 0) {
+                this.Failure.push(val);
+            } else {
+                this.Defects.push(val);
+            }
+        }
+    }
+
+    /* 获得隐患数据 */
+    onHiddenProblemsMessage(msg) {
+        if (!msg.data) return;
+        this.HiddenProblems = msg.data.records;
+    }
+
+    /* 获得标题栏数据 */
+    onTPMessage(msg) {
+        if (!msg.data) return;
+        for (var v in this.TopPoint) {
+            var val = this.TopPoint[v];
+            val.value = msg.data[val.pointTag].doubleValue;
+        }
+    }
+
+    /* 获得推荐信息数据 */
+    onRDMessage(msg) {
+        if (!msg.data) return;
+        for (var v in msg.data) {
+            var isact = false;
+            if (!msg.data[v].doubleValue) {
+                isact = msg.data[v].booleanValue
+            } else {
+                isact = msg.data[v].doubleValue != 0;
+            }
+            if (isact && !this.Recommends[v].isActive) {
+                this.Recommends[v].createTime = this.formatDate(new Date(), 'YY-MM-DD hh:mm');
+            }
+            this.Recommends[v].isActive = isact;
+        }
+    }
+
+    /* 格式化时间 */
+    formatDate(time, format = 'YY-MM-DD hh:mm:ss') {
+        var date = new Date(time);
+
+        var year = date.getFullYear(),
+            month = date.getMonth() + 1,//月份是从0开始的
+            day = date.getDate(),
+            hour = date.getHours(),
+            min = date.getMinutes(),
+            sec = date.getSeconds();
+        var preArr = Array.apply(null, Array(10)).map(function (elem, index) {
+            return '0' + index;
+        });
+
+        var newTime = format.replace(/YY/g, year)
+            .replace(/MM/g, preArr[month] || month)
+            .replace(/DD/g, preArr[day] || day)
+            .replace(/hh/g, preArr[hour] || hour)
+            .replace(/mm/g, preArr[min] || min)
+            .replace(/ss/g, preArr[sec] || sec);
+
+        return newTime;
+    }
+
+    /* 判断一个字符串中是否包含第二个字符串列表中的字符 */
+    isContains(str, strs) {
+        for (var v in strs) {
+            if (str.indexOf(strs[v]) > 0) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    login(uname,psd,action){
+        axios.get(`http://${config.calcUrl}/user/login?userName=${uname}&psd=${psd}`)
+        .then(action)
+        .catch(err=>console.log(err));
+    }
+
+    /* 单例 */
+    static getInstance() {
+        if (!BackgroundData.instance) {
+            BackgroundData.instance = new BackgroundData();
+        }
+        return BackgroundData.instance;
+    }
+}

+ 3 - 2
src/assets/script/MessageBridge.js

@@ -1,4 +1,5 @@
 import Stomp from 'stompjs'
+import {config} from '../../config';
 
 export default class MessageBridge {
   observers;// 观察者
@@ -14,9 +15,9 @@ export default class MessageBridge {
 
     this.observers = new Array();
 
-    this.calcSocket = new WebSocket("ws://192.168.10.18:8099/wisdom_service", this.onmessage, ["/topic/suggestion", "/topic/sync-command-result", "/topic/fault-count",
+    this.calcSocket = new WebSocket(`ws://${config.calcUrl}/wisdom_service`, this.onmessage, ["/topic/suggestion", "/topic/sync-command-result", "/topic/fault-count",
       "/topic/alarm-count", "/topic/fault-popup", "/topic/popup-remove", "/topic/heartbeat-data"]);
-    this.adapterSocket = new WebSocket("ws://192.168.10.18:8011/wisdom", this.onmessage, ["/topic/windturbine", "/topic/pv"]);
+    this.adapterSocket = new WebSocket(`ws://${config.adapterUrl}/wisdom`, this.onmessage, ["/topic/windturbine", "/topic/pv"]);
   }
 
   /* 单例 */

+ 72 - 57
src/components/StatusBar.vue

@@ -1,12 +1,12 @@
 /* 状态栏 */
 <template>
-  <div class="status-bar">
+  <div class="status-bar" onselectstart="return false">
     <el-row>
-      <el-col :span="19" style="margin-top: 5px">
+      <el-col :span="18" style="margin-top: 5px">
         <span style="color: white; margin-left: 20px">系统时间:</span>
         <span style="color: white">{{ currentTime }}</span>
       </el-col>
-      <el-col :span="5" style="margin-top: 5px">
+      <el-col :span="6" style="margin-top: 5px">
         <el-popover
           placement="top-start"
           :width="521"
@@ -25,11 +25,12 @@
               <span>{{ hiddenDangerNum }}</span>
             </div>
           </template>
+          <el-scrollbar>
           <el-table
-            :data="gridData"
+            :data="hiddenDangerData"
             border
             border-color="rgb(36,36,36)"
-            max-height="750px"
+            max-height="650px"
             :header-cell-style="{
               background: 'Black',
               color: 'rgb(220,220,220)',
@@ -38,24 +39,25 @@
             :cell-style="{ background: 'Black', color: 'rgb(220,220,220)',}"
           >
             <el-table-column
-              width="100"
-              property="date"
+              width="160"
+              property="lastUpdateTime"
               label="时间"
               align="center"
             ></el-table-column>
             <el-table-column
-              width="120"
-              property="name"
+              width="110"
+              property="windturbineId"
               label="设备"
               align="center"
             ></el-table-column>
             <el-table-column
-              width="300"
-              property="address"
+              width="250"
+              property="alertText"
               label="故障信息"
               align="center"
             ></el-table-column>
           </el-table>
+          </el-scrollbar>
         </el-popover>
         <el-popover placement="top-start"
           :width="521"
@@ -73,10 +75,10 @@
             </div>
           </template>
           <el-table
-            :data="gridData"
+            :data="defectData"
             border
             border-color="rgb(36,36,36)"
-            max-height="750px"
+            max-height="650px"
             :header-cell-style="{
               background: 'Black',
               color: 'rgb(220,220,220)',
@@ -84,20 +86,20 @@
             }"
             :cell-style="{ background: 'Black', color: 'rgb(220,220,220)',}">
             <el-table-column
-              width="100"
-              property="date"
+              width="160"
+              property="lastUpdateTime"
               label="时间"
               align="center"
             ></el-table-column>
             <el-table-column
-              width="120"
-              property="name"
+              width="110"
+              property="windturbineId"
               label="设备"
               align="center"
             ></el-table-column>
             <el-table-column
-              width="300"
-              property="address"
+              width="250"
+              property="alertText"
               label="故障信息"
               align="center"
             ></el-table-column>
@@ -120,10 +122,10 @@
             </div>
           </template>
           <el-table
-            :data="gridData"
+            :data="malfunctionData"
             border
             border-color="rgb(36,36,36)"
-            max-height="750px"
+            max-height="650px"
             :header-cell-style="{
               background: 'Black',
               color: 'rgb(220,220,220)',
@@ -131,20 +133,20 @@
             }"
             :cell-style="{ background: 'Black', color: 'rgb(220,220,220)',}">
             <el-table-column
-              width="100"
-              property="date"
+              width="160"
+              property="lastUpdateTime"
               label="时间"
               align="center"
             ></el-table-column>
             <el-table-column
-              width="120"
-              property="name"
+              width="110"
+              property="stationName"
               label="设备"
               align="center"
             ></el-table-column>
             <el-table-column
-              width="300"
-              property="address"
+              width="250"
+              property="alertText"
               label="故障信息"
               align="center"
             ></el-table-column>
@@ -167,10 +169,10 @@
             </div>
           </template>
           <el-table
-            :data="gridData"
+            :data="accidentData"
             border
             border-color="rgb(36,36,36)"
-            max-height="750px"
+            max-height="650px"
             :header-cell-style="{
               background: 'Black',
               color: 'rgb(220,220,220)',
@@ -178,20 +180,20 @@
             }"
             :cell-style="{ background: 'Black', color: 'rgb(220,220,220)',}">
             <el-table-column
-              width="100"
-              property="date"
+              width="160"
+              property="lastUpdateTime"
               label="时间"
               align="center"
             ></el-table-column>
             <el-table-column
-              width="120"
-              property="name"
+              width="110"
+              property="stationName"
               label="设备"
               align="center"
             ></el-table-column>
             <el-table-column
-              width="300"
-              property="address"
+              width="250"
+              property="alertText"
               label="故障信息"
               align="center"
             ></el-table-column>
@@ -203,6 +205,7 @@
 </template>
 
 <script>
+import BackgroundData from '../assets/script/BackgroundData'
 export default {
   data() {
     return {
@@ -212,28 +215,11 @@ export default {
       accidentNum: 0,
       statusTimer: "",
       currentTime: "",
-      gridData: [
-        {
-          date: "2016-05-02",
-          name: "王小虎",
-          address: "上海市普陀区金沙江路 1518 弄",
-        },
-        {
-          date: "2016-05-04",
-          name: "王小虎",
-          address: "上海市普陀区金沙江路 1518 弄",
-        },
-        {
-          date: "2016-05-01",
-          name: "王小虎",
-          address: "上海市普陀区金沙江路 1518 弄",
-        },
-        {
-          date: "2016-05-03",
-          name: "王小虎",
-          address: "上海市普陀区金沙江路 1518 弄",
-        },
-      ],
+
+      hiddenDangerData:new Array(),
+      defectData:new Array(),
+      malfunctionData:new Array(),
+      accidentData:new Array(),
     };
   },
   mounted() {
@@ -257,6 +243,9 @@ export default {
     clearInterval(this.statusTimer);
     this.statusTimer = null;
   },
+  created() {
+    this.refreshTimer = setInterval(this.refreshData, 2000);
+  },
   methods: {
     appendZero(obj) {
       if (obj < 10) {
@@ -265,11 +254,35 @@ export default {
         return obj;
       }
     },
+    refreshData(){
+      var bd = BackgroundData.getInstance();
+      this.hiddenDangerNum = bd.HiddenProblems.length;
+      this.defectNum = bd.Defects.length;
+      this.malfunctionNum = bd.Failure.length;
+      this.accidentNum = bd.Accidents.length;
+
+      this.hiddenDangerData = bd.HiddenProblems;
+      this.defectData = bd.Defects;
+      this.malfunctionData = bd.Failure;
+      this.accidentData = bd.Accidents;
+      if(this.accidentData.length<=0){
+        this.accidentData=[{lastUpdateTime:"-",stationName:"-",alertText:"-"}];
+      }
+    }
   },
 };
 </script>
 
 <style scoped>
+/deep/ .el-table__body-wrapper::-webkit-scrollbar {
+  width: 8px;
+  background-color: black;
+}
+
+/deep/ .el-table__body-wrapper::-webkit-scrollbar-thumb  {
+  background-color: #292929;
+  border-radius: 6px;
+}
 span {
   font-size: 13px;
 }
@@ -317,4 +330,6 @@ span {
 .status-label.accident {
   color: #af3e3d;
 }
+
+
 </style>

+ 118 - 54
src/components/TitleBar.vue

@@ -1,6 +1,6 @@
 /* 标题栏 */
 <template>
-  <div class="title-bar">
+  <div class="title-bar" onselectstart="return false">
     <el-row>
       <el-col :span="2">
         <img
@@ -17,10 +17,9 @@
             width="21%"
             :before-close="handleClose"
             :show-close="false"
-            
           >
             <el-form :model="form">
-              <el-form-item label="" :label-width="formLabelWidth">
+              <el-form-item :label="loginMessage" :label-width="formLabelWidth">
               </el-form-item>
               <el-form-item label="用户名:" :label-width="formLabelWidth">
                 <el-input
@@ -33,7 +32,7 @@
               </el-form-item>
               <el-form-item label="密&emsp;码:" :label-width="formLabelWidth">
                 <el-input
-                  v-model="form.name"
+                  v-model="form.psd"
                   autocomplete="off"
                   type="text"
                   placeholder="密&emsp;码"
@@ -41,7 +40,11 @@
                   show-password
                 ></el-input>
               </el-form-item>
-              <el-form-item label="验证码:" :label-width="formLabelWidth" style="display:none;">
+              <el-form-item
+                label="验证码:"
+                :label-width="formLabelWidth"
+                style="display: none"
+              >
                 <el-input
                   v-model="form.name"
                   autocomplete="off"
@@ -57,10 +60,15 @@
             </el-form>
             <template #footer>
               <span class="dialog-footer">
-                <el-button @click="dialogVisible = false" style="background-color: rgb(100,100,100);color: rgb(220, 220, 220);">取 消</el-button>
-                <el-button type="primary" @click="dialogVisible = false"
-                  >登 录</el-button
+                <el-button
+                  @click="dialogVisible = false"
+                  style="
+                    background-color: rgb(100, 100, 100);
+                    color: rgb(220, 220, 220);
+                  "
+                  >取 消</el-button
                 >
+                <el-button type="primary" @click="login">登 录</el-button>
               </span>
             </template>
           </el-dialog>
@@ -73,7 +81,7 @@
               <TitleBarCard
                 title="装机容量"
                 unit="MW"
-                value="734"
+                :value="installedCapacity"
               ></TitleBarCard>
             </li>
           </ul>
@@ -86,7 +94,7 @@
               <TitleBarCard
                 title="实时功率"
                 unit="MW"
-                value="34.01"
+                :value="totalPower"
               ></TitleBarCard>
             </li>
           </ul>
@@ -99,7 +107,7 @@
               <TitleBarCard
                 title="日发电量"
                 unit="kWh"
-                value="33,96"
+                :value="dailyPowerGeneration"
               ></TitleBarCard>
             </li>
           </ul>
@@ -112,7 +120,7 @@
               <TitleBarCard
                 title="上网电量"
                 unit="kWh"
-                value="38.96"
+                :value="gridPower"
               ></TitleBarCard>
             </li>
           </ul>
@@ -125,7 +133,7 @@
               <TitleBarCard
                 title="月发电量"
                 unit="kWh"
-                value="6197.87"
+                :value="monthlyPowerGeneration"
               ></TitleBarCard>
             </li>
           </ul>
@@ -138,7 +146,7 @@
               <TitleBarCard
                 title="年发电量"
                 unit="kWh"
-                value="69843.02"
+                :value="annualPowerGeneration"
               ></TitleBarCard>
             </li>
           </ul>
@@ -151,7 +159,7 @@
               <TitleBarCard
                 title="月利用小时"
                 unit="小时"
-                value="84.44"
+                :value="monthlyUtilizationHours"
               ></TitleBarCard>
             </li>
           </ul>
@@ -164,7 +172,7 @@
               <TitleBarCard
                 title="年利用小时"
                 unit="小时"
-                value="951.54"
+                :value="annualUtilizationHours"
               ></TitleBarCard>
             </li>
           </ul>
@@ -172,33 +180,16 @@
       </el-col>
 
       <el-col :span="1.6">
-        <!-- <div class="admin"  style="position: absolute;right: 70px;">
-            <p>管理员</p>
-          </div> -->
-        <el-button
+        <div @click="userClick" style="top: 18px; right: 100px; color: #ffffff; position: absolute" >{{usreName}}</div>
+        <!-- <el-button
           type="text"
           @click="dialogVisible = true"
-          class="admin"
-          style="position: absolute; right: 66px">管理员</el-button>
+          style="top:9px;right: 85px;color: #ffffff;position: absolute;">管理员</el-button> -->
       </el-col>
 
       <el-col :span="1">
         <div style="margin-top: 7px; position: absolute; right: 10px">
-          <button
-            class="closeButton"
-            style="
-              font-size: 30px;
-              color: white;
-              background: rgb(41, 41, 41);
-              width: 44px;
-              height: 44px;
-              border-radius: 8px;
-              border: none;
-            "
-            v-on:click="mainClose"
-          >
-            ×
-          </button>
+          <button class="closeButton" v-on:click="mainClose">×</button>
         </div>
       </el-col>
     </el-row>
@@ -207,6 +198,7 @@
 
 <script>
 import TitleBarCard from "./area/mainwindow/TitleBarCard.vue";
+import BackgroundData from "../assets/script/BackgroundData";
 
 export default {
   name: "TitleBar",
@@ -219,30 +211,99 @@ export default {
       dialogFormVisible: false,
       form: {
         name: "",
-        date1: "",
-        date2: "",
-        delivery: false,
-        type: [],
-        resource: "",
-        desc: "",
+        psd: "",
       },
+      usreName:"未登录...",
+      loginMessage: "", // 登录提示
       formLabelWidth: "120px",
+      totalPower: 0, // 实时功率
+      dailyPowerGeneration: 0, // 日发电量
+      gridPower: 0, // 上网电量
+      monthlyPowerGeneration: 0, // 月发电量
+      annualPowerGeneration: 0, // 年发电量
+      installedCapacity: 734, // 装机容量
     };
   },
+  computed: {
+    monthlyUtilizationHours: function () {
+      // 月利用小时数
+      return (
+        (this.monthlyPowerGeneration * 10) /
+        this.installedCapacity
+      ).toFixed(2);
+    },
+    annualUtilizationHours: function () {
+      // 年利用小时数
+      return (
+        (this.annualPowerGeneration * 10) /
+        this.installedCapacity
+      ).toFixed(2);
+    },
+  },
+  created() {
+    this.refreshTimer = setInterval(this.refreshData, 2000);
+  },
   methods: {
     handleClose(done) {
       done();
     },
     mainClose() {
-      //remote.getCurrentWindow().close();
-    }
-  }
+      const { remote } = require("electron");
+      remote.getCurrentWindow().destroy();
+    },
+    refreshData() {
+      // todo 计算发电量的时候没有考虑光伏的,后续完善
+      var bd = BackgroundData.getInstance();
+      var val = bd.TopPoint;
+      for (var v in val) {
+        var pt = val[v];
+        if (pt.pointName == "TotalPower") {
+          this.totalPower = pt.value.toFixed(2);
+        } else if (pt.pointName == "DailyPowerGeneration") {
+          this.dailyPowerGeneration = pt.value.toFixed(2);
+        } else if (pt.pointName == "GridPower") {
+          this.gridPower = pt.value.toFixed(2);
+        } else if (pt.pointName == "MonthlyPowerGeneration") {
+          this.monthlyPowerGeneration = pt.value.toFixed(2);
+        } else if (pt.pointName == "AnnualPowerGeneration") {
+          this.annualPowerGeneration = pt.value.toFixed(2);
+        }
+      }
+    },
+
+    /* 登录 */
+    login() {
+      var bd = BackgroundData.getInstance();
+      bd.login(this.form.name,this.form.psd,this.onLoged);
+    },
+
+    onLoged(msg){
+      if(!msg.data){
+        this.loginMessage="登录出现错误,请重新登录";
+        return;
+      }
+      var user = msg.data;
+      if(!user.isValid){
+        this.loginMessage=user.message;
+        return;
+      }
+      BackgroundData.getInstance().LoginUser=user;
+      this.usreName=user.name;
+      this.dialogVisible = false;
+      this.loginMessage='';
+      this.form.name=this.form.psd='';
+    },
+
+    /* 用户点击 */
+    userClick() {
+      this.dialogVisible = true;
+    },
+  },
 };
 </script>
 
 
 <style scoped>
-
 .title-bar {
   height: 6vh;
   background-color: #000000;
@@ -254,13 +315,6 @@ export default {
   position: relative;
   top: 33%;
 }
-.admin {
-  color: #ffffff;
-  position: relative;
-  /* margin-left: 10px;
-  padding: 0; */
-  padding: 22px;
-}
 .titleinfo {
   background-color: rgb(20, 20, 20);
   height: auto;
@@ -270,4 +324,14 @@ export default {
   margin-bottom: 5px;
   margin-left: -9px;
 }
+
+.closeButton {
+  font-size: 30px;
+  color: white;
+  background: rgb(41, 41, 41);
+  width: 44px;
+  height: 44px;
+  border-radius: 8px;
+  border: none;
+}
 </style>

+ 87 - 3
src/components/area/AlarmArea.vue

@@ -1,6 +1,90 @@
 /* 告警区 */
 <template>
-    <gy-card title="告警区" area-style="alarm" circle-style="green" content-style="25">
-        <div>动态内容</div>
-    </gy-card>
+  <gy-card
+    title="告警区"
+    area-style="alarm"
+    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>
+  </gy-card>
 </template>
+
+<script>
+import MessageBridge from "../../assets/script/MessageBridge";
+export default {
+  name: "AlarmArea",
+  created: function () {
+    this.initData();
+  },
+  props: {
+      
+  },
+  data() {
+    return {
+      values: new Array(),
+    };
+  },
+  methods: {
+    initData() {
+      var mb = MessageBridge.getInstance();
+      var vs = [{ key: "/topic/fault-popup", action: this.faultMessage }];
+      mb.register(vs);
+    },
+    faultMessage(msg) {
+      var val = JSON.parse(msg);
+      this.values = new Array();
+      for (var v in val) {
+        this.values.push(val[v]);
+      }
+      console.log(val);
+    },
+  },
+};
+</script>
+<style scoped>
+div{
+  background: #292929;
+}
+td{
+  
+  padding:auto;
+}
+.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;
+}
+</style>

+ 1 - 1
src/components/area/CheckArea.vue

@@ -1,6 +1,6 @@
 /* 校验区 */
 <template>
     <gy-card title="校验区" area-style="check" circle-style="green" content-style="44">
-        <div>动态内容</div>
+        <div></div>
     </gy-card>
 </template>

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

@@ -1,6 +1,8 @@
 /* 标注区 */
 <template>
     <gy-card title="标注区" area-style="label" circle-style="yellow" content-style="25">
-        <div>动态内容</div>
+        <div>
+            
+        </div>
     </gy-card>
 </template>

+ 42 - 6
src/components/area/RecommendedArea.vue

@@ -6,25 +6,61 @@
     circle-style="green"
     content-style="37"
   >
-    <div>动态内容</div>
+  <table v-for="vl in values" :key="vl">
+    
+      <tr>{{vl.stationName}}</tr>
+      <tr>{{vl.content}}</tr>
+      <tr>{{vl.createTime}}</tr>
+    
+  </table>
+    
   </gy-card>
 </template>
 
 <script>
+import BackgroundData from "../../assets/script/BackgroundData";
 export default {
   name: "RecommendedArea",
   props: ["datas"],
   data() {
     return {
-      
+      values: new Array(),
     };
   },
-  mounted() {
-    
+  created() {
+    this.initData();
   },
-  watch: {
-    
+  mounted() {},
+  watch: {},
+  methods: {
+    initData() {
+      setInterval(this.refreshData, 2000);
+    },
+    refreshData() {
+      var bd = BackgroundData.getInstance();
+      var ll = new Array();
+      for (var v in bd.Recommends) {
+        if (bd.Recommends[v].isActive) {
+          ll.push(bd.Recommends[v]);
+        }
+      }
+      this.values = ll;
+    },
   },
 };
 </script>
+<style scoped>
+table{
+  background-image: url("../../assets/img/RecommendedArea/guznzhu_bg_01.png");
+  text-align: center;
+  font-size:12px;
+  width: 110px;
+  height: 110px;
+  background-size:110px;
+  margin-left: 10px;
+  margin-top: 10px;
+  padding-top: 10px;
+  background-repeat:no-repeat;
+}
+</style>
 

+ 10 - 10
src/components/area/gy-card.vue

@@ -1,8 +1,8 @@
 /* 自定义tabs */
 <template>
     <transition>
-        <div :class='areaClass' @mouseover="hover = true"
-             @mouseleave="hover = false" @contextmenu="rightClick">
+        <div :class='areaClass' @mouseover="hover = false"
+             @mouseleave="hover = false" @contextmenu="rightClick" onselectstart="return false">
             <div :class="headerClass" @dblclick="gyCardDbClick">
                 <div :class='circleClass'></div>
                 <span class="gy-card-title">{{ title }}</span>
@@ -96,7 +96,7 @@
                 if (big) {
                     this.big = false
                 } else {
-                    this.big = true
+                    this.big = false
                 }
             },
             rightClick() {
@@ -290,7 +290,7 @@
     .gy-card-header-hover {
         position: relative;
         height: 40px;
-        background-color: #606060;
+        background-color: #292929;
         color: white;
         box-sizing: border-box;
     }
@@ -298,7 +298,7 @@
     .gy-card-area-problem:hover {
         position: relative;
         height: 89vh;
-        background-color: #606060;
+        background-color: #292929;
         border-radius: 7px;
         margin: 0px;
         padding-top: 0;
@@ -312,7 +312,7 @@
         position: relative;
         height: 25vh;
         margin-top: 10px;
-        background-color: #606060;
+        background-color: #292929;
         border-radius: 7px;
         padding-left: 10px;
         padding-right: 10px;
@@ -323,7 +323,7 @@
     .gy-card-area-check:hover {
         position: relative;
         height: 44vh;
-        background-color: #606060;
+        background-color: #292929;
         border-radius: 7px;
         margin: 0px;
         padding-top: 0;
@@ -337,7 +337,7 @@
         position: relative;
         width: 100%;
         height: 44vh;
-        background-color: #606060;
+        background-color: #292929;
         border-radius: 7px;
         margin-top: 10px;
         padding-top: 0;
@@ -351,7 +351,7 @@
         position: relative;
         height: 25vh;
         margin-top: 10px;
-        background-color: #606060;
+        background-color: #292929;
         border-radius: 7px;
         padding-left: 10px;
         padding-right: 10px;
@@ -362,7 +362,7 @@
     .gy-card-area-recommended:hover {
         position: relative;
         height: 37vh;
-        background-color: #606060;
+        background-color: #292929;
         border-radius: 7px;
         padding-left: 10px;
         padding-right: 10px;

+ 2 - 18
src/components/area/mainwindow/TitleBarCard.vue

@@ -3,22 +3,6 @@
         <span class="title">{{title}}</span>
         <span class="value">{{value}}</span>
         <span class="title">{{unit}}</span>
-        <el-dialog
-            title="用户登录"
-            v-model="dialogVisible"
-            width="21%"
-            :before-close="handleClose"
-          >
-            
-            <template #footer>
-              <span class="dialog-footer">
-                <el-button @click="dialogVisible = false">取 消</el-button>
-                <el-button type="primary" @click="dialogVisible = false"
-                  >登 录</el-button
-                >
-              </span>
-            </template>
-          </el-dialog>
     </div>
 </template>
 
@@ -32,7 +16,7 @@ export default {
   },
   data() {
     return {
-      dialogVisible: false,      
+      
     };
   },
   methods: {
@@ -44,7 +28,7 @@ export default {
 <style scoped>
 
 span{
-  font-size: 8;
+  font-size: 15px;
   margin-left: 9px;
 }
 .title{

+ 5 - 0
src/components/area/windturbine/MatrixCard.vue

@@ -1,6 +1,11 @@
 <template>
+<<<<<<< HEAD
   <div class="main" v-if="values.length > 0">
     <div>{{ title }}</div>
+=======
+  <div class="main">
+    <div style="font-size:15px">{{ title }}</div>
+>>>>>>> 64c9264e6ca1fb3703e63df00bdc23c878c0dd89
     <div class="content">
       <WindturbineMinCard
         v-for="vs in values"

+ 20 - 0
src/components/area/windturbine/WindturbineDetailPages.vue

@@ -0,0 +1,20 @@
+<template>
+    <el-dialog
+  title="风机详情"
+  width="80%"
+  :before-close="handleClose">
+  <span>这是一段信息</span>
+</el-dialog>
+</template>
+
+<script>
+
+export default{
+    props:{
+        
+    },
+    methods:{
+
+    }
+}
+</script>

+ 22 - 11
src/components/area/windturbine/WindturbineMinCard.vue

@@ -22,10 +22,13 @@
                 </el-row>
             </div>
         </el-row>
+        
     </div>
 </template>
 
 <script>
+
+
     export default {
         name: "WindturbineMinCard",
         props: {
@@ -40,6 +43,9 @@
                 sigSelect: false
             }
         },
+        components: {
+            
+        },
         computed: {
             cardStyle: function () {
                 if (this.sigSelect) {
@@ -56,7 +62,11 @@
                 }
             },
             rightStyle: function () {
-                return "card-right-style card-right-style-" + this.status;
+                if (this.sigSelect) {
+                    return "card-right-style card-right-style-select-" + this.status;
+                } else {
+                    return "card-right-style card-right-style-" + this.status;
+                }
             },
             title1Style: function () {
                 return "card-title1-style card-title1-style-" + this.status;
@@ -95,11 +105,12 @@
         height: 50px;
         box-sizing: border-box;
         display: inline-block;
+        margin-top: 5px;
     }
+    /* 卡片整体样式 */
     .card-style-0 {
         border: 2px solid rgb(255, 255, 255);
         background-color: rgba(255, 255, 255, 0.15);
-        color: rgb(120, 120, 120);
     }
     .card-style-1 {
         border: 2px solid rgb(197, 48, 72);
@@ -129,11 +140,10 @@
         border: 2px solid rgb(96, 103, 105);
         background-color: rgba(96, 103, 105, 0.15);
     }
-
+    /* 卡片整体样式-选择 */
     .card-style-select-0 {
         border: 2px solid rgba(255, 255, 255, 0.5);
         background-color: rgba(255, 255, 255, 0.1);
-        color: rgba(120, 120, 120,0.5);
     }
     .card-style-select-1 {
         border: 2px solid rgba(197, 48, 72, 0.5);
@@ -171,9 +181,10 @@
         margin: 3px;
         display: inline-block;
     }
+    /* 卡片左边样式 */
     .card-left-style-0 {
         background-color: rgb(255, 255, 255);
-        color: rgb(120, 120, 120);
+        color: rgb(0, 0, 0);
     }
     .card-left-style-1 {
         background-color: rgb(121, 73, 81);
@@ -196,10 +207,10 @@
     .card-left-style-7 {
         background-color: rgb(159, 163, 165);
     }
-
+    /* 卡片左边样式-选择 */
     .card-left-style-select-0 {
         background-color: rgba(255, 255, 255,0.7);
-        color: rgba(120, 120, 120,0.7);
+        color: rgba(0, 0, 0,0.7);
     }
     .card-left-style-select-1 {
         background-color: rgba(121, 73, 81,0.7);
@@ -240,10 +251,10 @@
         position: absolute;
         right: 0px;
     }
-
+    /* 卡片虚线样式 */
     .card-right-style-0 {
         border-left: 2px dashed rgb(255, 255, 255);
-        color: rgb(120, 120, 120);
+        color: rgb(255, 255, 255);
     }
     .card-right-style-1 {
         border-left: 2px dashed rgb(121, 73, 81);
@@ -266,10 +277,10 @@
     .card-right-style-7 {
         border-left: 2px dashed rgb(159, 163, 165);
     }
-    
+    /* 卡片虚线样式-选择 */
     .card-right-style-select-0 {
         border-left: 2px dashed rgba(255, 255, 255,0.7);
-        color: rgba(120, 120, 120,0.7);
+        color: rgba(255, 255, 255,0.7);
     }
     .card-right-style-select-1 {
         border-left: 2px dashed rgba(121, 73, 81,0.7);

+ 5 - 0
src/config.js

@@ -0,0 +1,5 @@
+export const config = {
+    shardingUrl:"192.168.10.18:8075",// 报警地址
+    calcUrl:"192.168.10.18:8099",// 大后台地址
+    adapterUrl:"192.168.10.18:8011",// 数据适配器地址
+};

+ 5 - 0
vue.config.js

@@ -1,5 +1,10 @@
 module.exports = {
     configureWebpack: {
       devtool: 'source-map'
+    },
+    pluginOptions:{
+      electronBuilder:{
+        nodeIntegration:true
+      }
     }
   }