lining 3 years ago
parent
commit
6b2882abd6

+ 32 - 21
src/App.vue

@@ -1,7 +1,7 @@
 <template class="app">
   <TitleBar class="titleBar" />
   <div class="right">
-    <el-col >
+    <el-col>
       <el-row>
         <el-col>
           <ModeControl ref="modeControl" :current="current" @clicks="handleClick"></ModeControl>
@@ -27,8 +27,8 @@
   import StatusBar from 'views/StatusBar.vue'
   import MessageBridge from 'utils/MessageBridge'
   import ModeControl from "components/modeControl/modeControl.vue";
-	import FocusArea from "components/focus/focusArea.vue";
-	import WarningArea from "components/warning/warningArea.vue";
+  import FocusArea from "components/focus/focusArea.vue";
+  import WarningArea from "components/warning/warningArea.vue";
   export default {
     components: {
       TitleBar,
@@ -39,41 +39,51 @@
     },
     created: function () {
       this.initData()
+      this.ceshi()
     },
     methods: {
       initData: function () {
-        var mb = MessageBridge.getInstance();
-        var windturbine = [{ key: "/topic/windturbine", action: this.windturbineMessage }];
-        var popup = [{ key: "/topic/fault-popup", action: this.faultMessage }];
-        var suggestion = [{ key: "/topic/suggestion", action: this.suggestion }];
-        var title = [{ key: "/topic/title-info", action: this.titleInfos }];
+        let mb = MessageBridge.getInstance();
+        let windturbine = [{ key: "/topic/windturbine", action: this.windturbineMessage }];
+        let popup = [{ key: "/topic/fault-popup", action: this.faultMessage }];
+        let title = [{ key: "/topic/title-info", action: this.titleInfos }];
+        // var heartbeat = [{ key: "/topic/heartbeat-data", action: this.heartbeat }];
+        // mb.register(heartbeat);
         mb.register(title);
         mb.register(windturbine);
         mb.register(popup);
-        mb.register(suggestion);
       },
       windturbineMessage(msg) {
-        var json = JSON.parse(msg);
+        let json = JSON.parse(msg);
         this.$store.commit('windturbinelist', json)
       },
-      faultMessage(msg){
-        var json = JSON.parse(msg);
+      faultMessage(msg) {
+        let json = JSON.parse(msg);
         this.$store.commit('warning', json)
       },
-      suggestion(msg){
-        var json = JSON.parse(msg);
-        this.$store.commit('suggestion', json)
-      },
-      // titleInfos(msg){
-      //   var json = JSON.parse(msg);
-      //   this.$store.commit('titleInfo', json)
+      // heartbeat(msg){
+      //   console.log(msg);
       // },
+      ceshi() {
+        setTimeout(() => {
+          this.ceshi()
+        }, 6000);
+        if (!this.$store.state.observers) {
+          let mb = MessageBridge.getInstance();
+          let windturbine = [{ key: "/topic/windturbine", action: this.windturbineMessage }];
+          let popup = [{ key: "/topic/fault-popup", action: this.faultMessage }];
+          let title = [{ key: "/topic/title-info", action: this.titleInfos }];
+          mb.register(title);xz
+          mb.register(windturbine);
+          mb.register(popup);
+          this.$store.commit('observers', true)
+        }
+      }
     },
   }
 </script>
 <style>
   @import "../src/assets/styles/main.css";
-
   body {
     /* 设置内容不可选中 */
     -webkit-user-select: none;
@@ -85,12 +95,13 @@
   /* .app{
     background-color: #000000;
   } */
-  .right{
+  .right {
     width: 32%;
     position: absolute;
     right: 20px;
     z-index: 99;
   }
+
   .statusBar {
     width: 100%;
     position: absolute;

+ 26 - 7
src/api/index.js

@@ -1,11 +1,11 @@
 import request from "../utils/request";
 //登陆
-const login = (uname, psd, data) => {
+const login = (data) => {
     return request({
         baseURL:process.env.VUE_APP_API,
-        url: `/api/user/login?userName=${uname}&psd=${psd}`,
-        method: "get",
-        data,
+        url: `/user/login`,
+        method: "post",
+        data:data,
     });
 };
 //刷新报警信息
@@ -25,10 +25,19 @@ const refreshData = (keys) => {
     });
 };
 //风机控制
-const windturbControl = (isLockOrUnlock,pairs,test) => {
+const windturbControl = (pairs) => {
     return request({
         baseURL:process.env.VUE_APP_API,
-        url: `/api/control/send?isLockOrUnlock=${isLockOrUnlock}&test=${test}`,
+        url: `/api/control/`,
+        method: "post",
+        data:pairs
+    });
+};
+//风机控制
+const windturbControlLock = (pairs) => {
+    return request({
+        baseURL:process.env.VUE_APP_API,
+        url: `/api/control/lock`,
         method: "post",
         data:pairs
     });
@@ -98,11 +107,20 @@ const getWarning=(data,wtid,pt)=>{
         method:"get"
     })
 }
+const getCustomerLock=()=>{
+    return request({
+        baseURL: process.env.VUE_APP_API,
+        url:`/api/windturbine/customer-lock`,
+        method:"get"
+    })
+}
+
 export default {
     login,
     getSnap,
     refreshData,
     windturbControl,
+    windturbControlLock,
     nitWinturbineBaseData,
     getOverview,
     sendWarning,
@@ -111,5 +129,6 @@ export default {
     getWindWarning,
     getHealthDate,
     getDetial,
-    getWarning
+    getWarning,
+    getCustomerLock
 };

+ 165 - 206
src/components/BasicInformationDetail.vue

@@ -65,31 +65,31 @@
           </div>
         </div>
         <div class="showDate">
-          <div class="label">
+          <!-- <div class="label">
             <div class="title">标注信息:</div>
             <el-autocomplete @blur="labelChange(state1)" class="inputs" v-model="state1"
               :fetch-suggestions="querySearch" placeholder="请输入内容" @select="handleSelect" style="width: 174px">
             </el-autocomplete>
-          </div>
+          </div> -->
           <div class="label1">
             <div class="title">挂牌信息:</div>
             <!-- <div>挂牌原因</div> -->
-            <el-select @change="listedChange(value)" class="inputs" v-model="selectValue" placeholder="请选择">
+            <el-select filterable allow-create default-first-option @change="listedChange(value)" class="inputs"
+              v-model="selectValue" placeholder="请选择">
               <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
               </el-option>
             </el-select>
           </div>
         </div>
         <div class="label">
-          <div class="button" v-if="types === 2" @click="menuClicked({ type: 'send', controlType:'1' })">启动</div>
-          <div class="button" v-if="types === 4" @click="menuClicked({ type: 'send', controlType:'2' })">停机</div>
-          <div class="button" v-if="types === 0 ||types === 5 " @click="menuClicked({ type: 'send', controlType:'5' })">
+          <div class="button" v-if="types === 2" @click="sendCommand({controlType:'1' })">启动</div>
+          <div class="button" v-if="types === 4" @click="sendCommand({controlType:'2' })">停机</div>
+          <div class="button" v-if="types === 0 ||types === 5 " @click="sendCommand({controlType:'5' })">
             复位</div>
-          <div class="button" v-if="types === 2" @click="menuClicked({ type: 'send', controlType:'6' })">维护</div>
-          <div class="button" v-if="types === 6" @click="menuClicked({ type: 'send', controlType:'8' })">取消维护</div>
-          <div class="button" v-if="selectValue !==''" @click="menuClicked({ type: 'lock', value: 'UnLock' })">取消挂牌
+          <div class="button" v-if="types === 2" @click="sendCommand({controlType:'6' })">维护</div>
+          <div class="button" v-if="types === 6" @click="sendCommand({controlType:'8' })">取消维护</div>
+          <div class="button" v-if="selectValue !==''" @click="sendLock({value: 'UnLock' })">取消挂牌
           </div>
-          <!-- <div class="button" @click="menuClicked({ type: 'send' })">生成缺陷单</div> -->
         </div>
       </el-col>
     </el-row>
@@ -99,7 +99,7 @@
           <div class="dataTitle">
             <div style="margin-left: 24px;">部件主要参数</div>
           </div>
-          <div class="dataContent">
+          <div class="dataContent" @dblclick="dbClicks()">
             <div class="dataBlock" v-for="(item,index) in showData" :key="index">
               <div class="dataName">{{item.name}}</div>
               <div class="numerical">
@@ -134,12 +134,13 @@
         </div>
       </el-col>
     </el-row>
+    <BasicDataDetails @closed="closeds()" v-model="display"></BasicDataDetails>
   </div>
 </template>
 
 <script>
   import BackgroundData from 'utils/BackgroundData'
-  // import Worning from "./warning.vue"
+  import BasicDataDetails from "./basicDataDetails.vue";
   import StandAloneImg from "./StandAloneImg.vue";
   import dayjs from 'dayjs'
   import api from "api/index";
@@ -148,6 +149,7 @@
     components: {
       // Worning,
       StandAloneImg,
+      BasicDataDetails,
     },
     props: {
       types: {
@@ -157,56 +159,35 @@
       windturbine: Object,
     },
     mounted() {
-      this.getDetial()
+      this.getLocks()
       this.getHealthDate()
       this.getWarning()
+      this.getDetial()
     },
     beforeUpdate() {
-      this.getDetial()
+      this.getLocks()
       this.getHealthDate()
       this.getWarning()
+      this.getDetial()
     },
 
     data() {
       return {
         // warnList: [],
+        display: false,
         BasicInfo: {},
         temperatureInfo: new Array() /* 温度信息 */,
         pitchInfo: new Array() /* 变桨信息 */,
         generalInfo: new Array() /* 基本信息 */,
         powerGridInfo: new Array() /* 电网信息 */,
         restaurants: [],
+        lockValues: [],
         state1: "",
         showIndex: 1,
         starValue: 3,
         max: 4,
         current: null,
         disableds: true,
-        tableData: [{
-          date: '2016-05-02',
-          name: '王小虎',
-          address: '上海市普陀区金沙江路 1518 弄'
-        }, {
-          date: '2016-05-04',
-          name: '王小虎',
-          address: '上海市普陀区金沙江路 1517 弄'
-        }, {
-          date: '2016-05-01',
-          name: '王小虎',
-          address: '上海市普陀区金沙江路 1519 弄'
-        }, {
-          date: '2016-05-03',
-          name: '王小虎',
-          address: '上海市普陀区金沙江路 1516 弄'
-        }, {
-          date: '2016-05-08',
-          name: '王小虎',
-          address: '上海市普陀区金沙江路 1516 弄'
-        }, {
-          date: '2016-05-09',
-          name: '王小虎',
-          address: '上海市普陀区金沙江路 1516 弄'
-        }],
         options: [{
           value: '8',
           label: '检修'
@@ -251,29 +232,40 @@
     },
     methods: {
       getHealthDate() {
-          api.getHealthDate(this.windturbine.stationId,this.windturbine.windturbineId).then(msg => {
-            if (msg.data.code === 200) {
-              this.healthInfo = msg.data.data;
-            }
+        api.getHealthDate(this.windturbine.stationId, this.windturbine.windturbineId).then(msg => {
+          if (msg.data.code === 200) {
+            this.healthInfo = msg.data.data;
+          }
 
-          })
+        })
           .catch(err => {
             console.log(err);
           });
       },
       getDetial() {
         api.getDetial(this.windturbine.windturbineId).then(msg => {
-            let restaurants = []
+          let restaurants = []
+          if(msg.data.lockType === 9){
+            this.selectValue = this.lockValues?.filter(item => this.windturbine.windturbineId === item.windturbineID)[0]?.value;
+          }else{
             this.selectValue = (msg.data.lockType === 0 ? '' : String(msg.data.lockType))
-            this.state1 = msg.data.markValue
-            msg.data.markValues.forEach(item => {
-              let data = {}
-              data.value = item
-              restaurants.push(data)
-            })
-            this.restaurants = restaurants
+          }
+          this.state1 = msg.data.markValue
+          msg.data.markValues.forEach(item => {
+            let data = {}
+            data.value = item
+            restaurants.push(data)
           })
+          this.restaurants = restaurants
+        })
       },
+      getLocks(){
+                api.getCustomerLock().then(res =>{
+                    if(res){
+                        this.lockValues = res.data
+                    }
+                })
+            },
       getWarning() {
         let parts = ''
         switch (this.showIndex) {
@@ -293,15 +285,15 @@
             parts = 'yy'
             break;
         }
-        api.getWarning(this.windturbine.stationId,this.windturbine.windturbineId,parts).then(msg => {
-            if (msg.data.code === 200) {
-              msg.data.data && msg.data.data.forEach(item => {
-                item.time = dayjs(item.time).format('MM-DD HH:mm:ss')
-              })
-              this.warning = msg.data.data;
-            }
+        api.getWarning(this.windturbine.stationId, this.windturbine.windturbineId, parts).then(msg => {
+          if (msg.data.code === 200) {
+            msg.data.data && msg.data.data.forEach(item => {
+              item.time = dayjs(item.time).format('MM-DD HH:mm:ss')
+            })
+            this.warning = msg.data.data;
+          }
 
-          })
+        })
           .catch(err => {
             console.log(err);
           });
@@ -310,19 +302,19 @@
         this.showIndex = value
         switch (this.showIndex) {
           case 1:
-            this.showData = this.BasicInfo.BasicInfo.filter(item => item.index === "part6")[0] ? this.BasicInfo.BasicInfo.filter(item => item.index === "part6")[0].param : []
+            this.showData = this.BasicInfo.BasicInfo.filter(item => item.index === "part6")[0]?.param
             break;
           case 2:
-            this.showData = this.BasicInfo.BasicInfo.filter(item => item.index === "part8")[0] ? this.BasicInfo.BasicInfo.filter(item => item.index === "part8")[0].param : []
+            this.showData = this.BasicInfo.BasicInfo.filter(item => item.index === "part8")[0]?.param
             break;
           case 3:
-            this.showData = this.BasicInfo.BasicInfo.filter(item => item.index === "part7")[0] ? this.BasicInfo.BasicInfo.filter(item => item.index === "part7")[0].param : []
+            this.showData = this.BasicInfo.BasicInfo.filter(item => item.index === "part7")[0]?.param
             break;
           case 4:
-            this.showData = this.BasicInfo.BasicInfo.filter(item => item.index === "part10")[0] ? this.BasicInfo.BasicInfo.filter(item => item.index === "part10")[0].param : []
+            this.showData = this.BasicInfo.BasicInfo.filter(item => item.index === "part10")[0]?.param
             break;
           case 5:
-            this.showData = this.BasicInfo.BasicInfo.filter(item => item.index === "part9")[0] ? this.BasicInfo.BasicInfo.filter(item => item.index === "part9")[0].param : []
+            this.showData = this.BasicInfo.BasicInfo.filter(item => item.index === "part9")[0]?.param
             break;
         }
         this.getWarning()
@@ -330,121 +322,45 @@
       listedChange() {
         switch (this.selectValue) {
           case '8':
-            this.menuClicked({ type: "lock", value: "CheckLock" });
+            this.sendLock({ value: "CheckLock" });
             break;
           case '7':
-            this.menuClicked({ type: "lock", value: "FaultLock" });
+            this.sendLock({ value: "FaultLock" });
             break;
           case '2':
-            this.menuClicked({ type: "lock", value: "StationCheckLock" });
+            this.sendLock({ value: "StationCheckLock" });
             break;
           case '3':
-            this.menuClicked({ type: "lock", value: "StationFaulLock" });
+            this.sendLock({ value: "StationFaulLock" });
             break;
           case '4':
-            this.menuClicked({ type: "lock", value: "StationPowerLineLock" });
+            this.sendLock({ value: "StationPowerLineLock" });
             break;
           case '5':
-            this.menuClicked({ type: "lock", value: "StationWeatherLock" });
+            this.sendLock({ value: "StationWeatherLock" });
+            break;
+          default:
+            this.sendLock({ value: "CustomerLock", lockValue: this.selectValue});
             break;
         }
       },
-      labelChange() {
-        let values = BackgroundData.getInstance().Marks;
-        if (!values.filter(item => item.title = this.windturbine.windturbineId)[0]) {
-          this.menuClicked({ type: "marking" })
-        }
-        BackgroundData.getInstance().updateMarks(this.windturbine, this.state1);
-      },
-      show() {    
-        // axiios.get(`http://${config.calcUrl}/alarm/real-time-alarm?objectId=${this.windturbine.windturbineId}&pageIndex=1&pageSize=50`)
-        // .then(msg=>{
-        //   var vs = msg.data;
-        //   if(vs.length<=0)return;
-        //   this.alarmTime = BackgroundData.getInstance().formatDate(vs[0].lastUpdateTime);
-        //   this.alarmContent = vs[0].alertText;
-        //   this.alarms = msg.data;
-        //   console.log(this.alarms)
-        // })
-      },
+      // labelChange() {
+      //   let values = BackgroundData.getInstance().Marks;
+      //   if (!values.filter(item => item.title = this.windturbine.windturbineId)[0]) {
+      //     this.menuClicked({ type: "marking" })
+      //   }
+      //   BackgroundData.getInstance().updateMarks(this.windturbine, this.state1);
+      // },
+
       start(bi) {
         this.BasicInfo = bi;
         this.bindData();
-
         this.refreshData();
         this.refreshTimer = setInterval(this.refreshData, 3000);
       },
       end() {
         clearInterval(this.refreshTimer);
       },
-      // alarmd(bi) {
-      //   let dataList = []
-      //   let warnList = []
-      //   let date1 = {
-      //     type: 1,
-      //     alertText: []
-      //   }
-      //   let date2 = {
-      //     type: 2,
-      //     alertText: []
-      //   }
-      //   let date3 = {
-      //     type: 3,
-      //     alertText: []
-      //   }
-      //   let date4 = {
-      //     type: 4,
-      //     alertText: []
-      //   }
-      //   let date5 = {
-      //     type: 5,
-      //     alertText: []
-      //   }
-      //   bi.forEach(item => {
-      //     let data = {}
-      //     data.alertText = item.alertText
-      //     if (item.alertText.indexOf("变桨") >= 0) {
-      //       data.type = 1
-      //     } else if (item.alertText.indexOf("偏航") >= 0) {
-      //       data.type = 5
-      //     }
-      //     else if (item.alertText.indexOf("发电机") >= 0) {
-      //       data.type = 3
-      //     }
-      //     else if (item.alertText.indexOf("齿轮箱") >= 0) {
-      //       data.type = 2
-      //     }
-      //     else if (item.alertText.indexOf("液压") >= 0) {
-      //       data.type = 4
-      //     }
-      //     data.type ? warnList.push(data) : ''
-      //   })
-      //   warnList.forEach(item => {
-      //     switch (item.type) {
-      //       case 1:
-      //         date1.alertText.push(item.alertText)
-      //         break;
-      //       case 2:
-      //         date2.alertText.push(item.alertText)
-      //         break;
-      //       case 3:
-      //         date3.alertText.push(item.alertText)
-      //         break;
-      //       case 4:
-      //         date4.alertText.push(item.alertText)
-      //         break;
-      //       case 5:
-      //         date5.alertText.push(item.alertText)
-      //         break;
-      //     }
-      //   })
-      //   date1.alertText.length > 0 ? dataList.push(date1) : ''
-      //   date2.alertText.length > 0 ? dataList.push(date2) : ''
-      //   date3.alertText.length > 0 ? dataList.push(date3) : ''
-      //   date4.alertText.length > 0 ? dataList.push(date4) : ''
-      //   date5.alertText.length > 0 ? dataList.push(date5) : ''
-      //   this.warnList = dataList
-      // },
       /* 刷新数据 */
       refreshData() {
         var bg = BackgroundData.getInstance();
@@ -472,19 +388,19 @@
         console.log(this.BasicInfo.BasicInfo);
         switch (this.showIndex) {
           case 1:
-            this.showData = this.BasicInfo.BasicInfo.filter(item => item.index === "part6")[0] ? this.BasicInfo.BasicInfo.filter(item => item.index === "part6")[0].param : []
+            this.showData = this.BasicInfo.BasicInfo.filter(item => item.index === "part6")[0]?.param
             break;
           case 2:
-            this.showData = this.BasicInfo.BasicInfo.filter(item => item.index === "part8")[0] ? this.BasicInfo.BasicInfo.filter(item => item.index === "part8")[0].param : []
+            this.showData = this.BasicInfo.BasicInfo.filter(item => item.index === "part8")[0]?.param
             break;
           case 3:
-            this.showData = this.BasicInfo.BasicInfo.filter(item => item.index === "part7")[0] ? this.BasicInfo.BasicInfo.filter(item => item.index === "part7")[0].param : []
+            this.showData = this.BasicInfo.BasicInfo.filter(item => item.index === "part7")[0]?.param
             break;
           case 4:
-            this.showData = this.BasicInfo.BasicInfo.filter(item => item.index === "part10")[0] ? this.BasicInfo.BasicInfo.filter(item => item.index === "part10")[0].param : []
+            this.showData = this.BasicInfo.BasicInfo.filter(item => item.index === "part10")[0]?.param
             break;
           case 5:
-            this.showData = this.BasicInfo.BasicInfo.filter(item => item.index === "part9")[0] ? this.BasicInfo.BasicInfo.filter(item => item.index === "part9")[0].param : []
+            this.showData = this.BasicInfo.BasicInfo.filter(item => item.index === "part9")[0]?.param
             break;
         }
       },
@@ -523,29 +439,28 @@
       },
       selectSvg(index) {
         this.showIndex = index;
+        // this.showData = this.BasicInfo.BasicInfo.filter(item => item.index === `part${this.showIndex+5}`)[0]?.param
         switch (this.showIndex) {
           case 1:
-            this.showData = this.BasicInfo.BasicInfo.filter(item => item.index === "part6")[0] ? this.BasicInfo.BasicInfo.filter(item => item.index === "part6")[0].param : []
+            this.showData = this.BasicInfo.BasicInfo.filter(item => item.index === `part6`)[0]?.param
             break;
           case 2:
-            this.showData = this.BasicInfo.BasicInfo.filter(item => item.index === "part8")[0] ? this.BasicInfo.BasicInfo.filter(item => item.index === "part8")[0].param : []
+            this.showData = this.BasicInfo.BasicInfo.filter(item => item.index === "part8")[0]?.param
             break;
           case 3:
-            this.showData = this.BasicInfo.BasicInfo.filter(item => item.index === "part7")[0] ? this.BasicInfo.BasicInfo.filter(item => item.index === "part7")[0].param : []
+            this.showData = this.BasicInfo.BasicInfo.filter(item => item.index === "part7")[0]?.param
             break;
           case 4:
-            this.showData = this.BasicInfo.BasicInfo.filter(item => item.index === "part10")[0] ? this.BasicInfo.BasicInfo.filter(item => item.index === "part10")[0].param : []
+            this.showData = this.BasicInfo.BasicInfo.filter(item => item.index === "part10")[0]?.param
             break;
           case 5:
-            this.showData = this.BasicInfo.BasicInfo.filter(item => item.index === "part9")[0] ? this.BasicInfo.BasicInfo.filter(item => item.index === "part9")[0].param : []
+            this.showData = this.BasicInfo.BasicInfo.filter(item => item.index === "part9")[0]?.param
             break;
         }
         this.getWarning()
       },
-      menuClicked(msg, windturbine) {
-        let dataList = []
-        dataList[0] = windturbine ? windturbine : this.windturbine
-        var bd = BackgroundData.getInstance();
+      sendCommand(msg, windturbine) {
+        let bd = BackgroundData.getInstance();
         if (!bd.LoginUser) {
           this.$notify({
             title: "请登录",
@@ -555,40 +470,76 @@
             offset: 60,
             duration: 3000,
           });
-          this.selectValue = ''
           return;
         }
-        if (msg.type == "lock") {
-          // 挂牌
-          var los = dataList;
-          for (var id in los) {
-            los[id].lockType = msg.value;
-          }
-          bd.windturbineControl(
-            los,
-            true,
-            '',
-            '',
-            this.controlSuccess,
-            this.controlError
-          );
-        } else if (msg.type == "send") {
-
-          // 发送
-          dataList[0].controlType = Number(msg.controlType)
-          var vs = dataList;
-          bd.windturbineControl(
-            vs,
-            false,
-            '',
-            '',
-            this.controlSuccess,
-            this.controlError
-          );
-        } else if (msg.type == "marking") {
-          // 标注
-          var vvs = dataList;
-          bd.marking(vvs);
+        let sendList = []
+        this.windturbine.controlType = Number(msg.controlType)
+        sendList.push(this.windturbine)
+        if (sendList.length > 0) {
+          bd.checkout(sendList);
+          let pairs = {}
+          sendList.forEach(item => {
+            let ct = {
+              windturbineId: item.windturbineId,
+              stationId: item.stationId,
+              projectId: item.projectId,
+              modelId: item.modelId,
+              controlType: item.controlType,
+              lockType: item.lockType,
+              userName: `system_${bd.LoginUser.name}`,
+              userId: 0,
+            };
+            pairs[ct.windturbineId] = ct;
+          })
+          api.windturbControl(pairs).then(res => {
+            if (res) {
+              this.controlSuccess(res)
+            }
+          })
+        }
+      },
+
+      sendLock(msg) {
+        let bd = BackgroundData.getInstance();
+        if (!bd.LoginUser) {
+          this.$notify({
+            title: "请登录",
+            message: "控制风机需要先登录!",
+            type: "warning",
+            position: "bottom-right",
+            offset: 60,
+            duration: 3000,
+          });
+          return;
+        }
+        let sendList = []
+        this.windturbine.lockType = msg.value;
+        if(msg.lockValue){
+          this.windturbine.lockValue = msg.lockValue
+        }
+        sendList.push(this.windturbine)
+        if (sendList.length > 0) {
+          this.chooseList = []
+          let pairs = {}
+          sendList.forEach(item => {
+            let ct = {
+              windturbineId: item.windturbineId,
+              stationId: item.stationId,
+              projectId: item.projectId,
+              modelId: item.modelId,
+              controlType: item.controlType,
+              lockType: item.lockType,
+              lockValue: item.lockValue,
+              userName: `system_${bd.LoginUser.name}`,
+              userId: 0,
+            };
+            pairs[ct.windturbineId] = ct;
+          })
+          api.windturbControlLock(pairs).then(res => {
+            if (res) {
+              this.controlSuccess(res)
+            }
+          })
         }
       },
       /* 控制成功 */
@@ -630,6 +581,13 @@
           duration: 3000,
         });
       },
+
+      dbClicks() {
+        this.display = true;
+      },
+      closeds() {
+        this.display = false;
+      }
     },
   };
 </script>
@@ -972,7 +930,8 @@
     justify-content: space-between;
     align-items: center;
   }
+
   .el-table::before {
-		width: 0;
-	}
+    width: 0;
+  }
 </style>

+ 50 - 53
src/components/WindturbineDetailPages.vue

@@ -147,37 +147,37 @@
 				alarms: [],
 				count: false,
 				typeList: [{
-						type: 0,
-						name: '已经停机',
-					},
-					{
-						type: 1,
-						name: '上电',
-					},
-					{
-						type: 2,
-						name: '待机',
-					},
-					{
-						type: 3,
-						name: '启动',
-					},
-					{
-						type: 4,
-						name: '并网',
-					},
-					{
-						type: 5,
-						name: '故障',
-					},
-					{
-						type: 6,
-						name: '维护',
-					},
-					{
-						type: 7,
-						name: '离线',
-					},
+					type: 0,
+					name: '已经停机',
+				},
+				{
+					type: 1,
+					name: '上电',
+				},
+				{
+					type: 2,
+					name: '待机',
+				},
+				{
+					type: 3,
+					name: '启动',
+				},
+				{
+					type: 4,
+					name: '并网',
+				},
+				{
+					type: 5,
+					name: '故障',
+				},
+				{
+					type: 6,
+					name: '维护',
+				},
+				{
+					type: 7,
+					name: '离线',
+				},
 				],
 				baseDate: {
 					windSpeed: {
@@ -212,16 +212,14 @@
 				this.BasicInfo.windturbineId = this.windturbine.windturbineId;
 				// this.dateDeal(this.BasicInfo)
 				this.$refs.BasicInfo.start(this.BasicInfo);
-
 				this.initData();
-
 				this.refreshData();
 				this.refreshTimer = setInterval(this.refreshData, 100)
 				// clearInterval(this.refreshTimer);
 			},
 			closed() {
 				// todo 切换页面的时候应该让上一个页面停止刷新数据(调用end方法)
-				this.$refs.svgRef.closed();
+				// this.$refs.svgRef.closed();
 				this.$refs.BasicInfo.end();
 				// this.$refs.BasicInfo.labelChange();
 				this.$emit('close');
@@ -234,7 +232,7 @@
 				this.baseDate.power = showInf.param.filter(item => item.name === "有功功率")[0]
 				this.baseDate.generatorSpeed = showInf.param.filter(item => item.name === "发电机转速")[0]
 				this.baseDate.type = showInf.param.filter(item => item.name === "状态")[0].value ? this.typeList.filter(
-						status => status.type === Number(showInf.param.filter(item => item.name === "状态")[0].value))[0]
+					status => status.type === Number(showInf.param.filter(item => item.name === "状态")[0].value))[0]
 					.name : ''
 				console.log(this.baseDate.generatorSpeed.name);
 				this.types = Number(showInf.param.filter(item => item.name === "状态")[0].value)
@@ -246,33 +244,32 @@
 				this.dateDeal(this.BasicInfo)
 				clearInterval(this.refreshTimer);
 				this.refreshTimer = setInterval(this.refreshData, 5000)
-
 			},
 			initData() {
 				// axiios.get(`http://${config.calcUrl}/windturbine/line/${this.windturbine.windturbineId}`)
 				//   .then(msg => this.line = msg.data);
-				api.getWindWarning(this.windturbine.windturbineId,'1','50').then(msg => {
-						var vs = msg.data;
-						if (vs.length <= 0) return;
-						this.alarmTime = BackgroundData.getInstance().formatDate(vs[0].lastUpdateTime);
-						this.alarmContent = vs[0].alertText;
-						this.alarms = msg.data;
-						this.$refs.BasicInfo.alarmd(this.alarms);
-						console.log(this.alarms)
-					})
+				api.getWindWarning(this.windturbine.windturbineId, '1', '50').then(msg => {
+					var vs = msg.data;
+					if (vs.length <= 0) return;
+					this.alarmTime = BackgroundData.getInstance().formatDate(vs[0].lastUpdateTime);
+					this.alarmContent = vs[0].alertText;
+					this.alarms = msg.data;
+					this.$refs.BasicInfo.alarmd(this.alarms);
+					console.log(this.alarms)
+				})
 					.catch(err => {
 						console.log(err);
 					});
 			},
 		},
-		watch:{
+		watch: {
 			'windturbine': {
-                handler: function (json) {
-                    if (json) {
-                        this.initData()
-                    }
-                }
-            }
+				handler: function (json) {
+					if (json) {
+						this.initData()
+					}
+				}
+			}
 		}
 	};
 </script>
@@ -328,4 +325,4 @@
 	.svg {
 		height: 67vh;
 	}
-</style>
+</style>

File diff suppressed because it is too large
+ 138 - 0
src/components/basicDataDetails.vue


+ 137 - 125
src/components/control/areaCard.vue

@@ -68,8 +68,6 @@
         },
         data() {
             return {
-                testsIndex: 0,
-                testIndex: 0,
                 current: 1,
                 vss: {},
                 windturbinelist: {},
@@ -89,6 +87,7 @@
                 stationName: '',
                 // 定时器
                 timer: "",
+
                 controlErorCodes: [
                     "控制成功",
                     "控制命令发送失败",
@@ -107,6 +106,26 @@
                     "风机操作与风机状态不符",
                     "需要登录",
                 ],
+                windStation: {
+                    'NG01': {
+                        name: '牛首山'
+                    },
+                    'MG01': {
+                        name: '麻黄山'
+                    },
+                    'QG01': {
+                        name: '青山'
+                    },
+                    'NG01': {
+                        name: '牛首山'
+                    },
+                    'SG01': {
+                        name: '石板泉'
+                    },
+                    'XG01': {
+                        name: '香山'
+                    },
+                },
                 boosterStation: {
                     'MHS_SYZ': {
                         name: '麻黄山升压站'
@@ -155,11 +174,11 @@
         },
         methods: {
             control(current) {
-                this.current = current === 0?current:current === 1?current:1
+                this.current = current === 0 ? current : current === 1 ? current : 1
             },
             initData: function () {
                 var mb = MessageBridge.getInstance();
-                mb.unregister({ key: "/topic/suggestion"});
+                mb.unregister({ key: "/topic/suggestion" });
                 var vs = [{ key: "/topic/suggestion", action: this.suggestion }];
                 var vss = [{ key: "/topic/voice-control", action: this.windturbineMessage }];
                 this.vss = vss
@@ -167,6 +186,7 @@
                 mb.register(vss);
             },
             suggestion(msg, headers) {
+                msg ? this.$store.commit('suggestion', JSON.parse(msg)) : ''
                 let bd = BackgroundData.getInstance();
                 this.titleList = msg ? JSON.parse(msg) : this.$store.state.suggestion
                 if (msg && JSON.parse(msg).length > 0) {
@@ -179,6 +199,8 @@
                     let dateList = []
                     this.titleList.forEach(item => {
                         if (item.windturbineId.slice(0, 2) === 'NG') {
+                            let arr = Object.keys(this.windturbinelist).sort()
+                            this.windturbinelist = (arr.length !== 0 )?this.windturbinelist:this.$store.state.windturbinelist
                             switch (item.operateStyle) {
                                 case 'Start':
                                     this.windturbinelist[item.windturbineId].controlType = 1
@@ -252,37 +274,34 @@
                             }
                         })
                         mss.type = 'send'
-                        this.testIndex++
-                        this.sendCommand(mss, windControlList, 'automatic')
-                        // this.menuClicked(mss, windControlList, 'automatic')
+                        this.sendCommand(mss, windControlList)
                     } else if (arr[0] === 'CONTROL_LOCK_OVERHAUL' || arr[0] === 'CONTROL_LOCK_MAINTAIN' || arr[0] === 'CONTROL_LOCK_LNVOLVED_OVERHAUL' ||
                         arr[0] === 'CONTROL_LOCK_LNVOLVED_MAINTAIN' || arr[0] === 'CONTROL_LOCK_LNVOLVED_PG' || arr[0] === 'CONTROL_LOCK_LNVOLVED_WEATHER' || arr[0] === 'CONTROL_UNLOCK') {
                         let windturbine = this.windturbinelist[arr[1]]
-                        this.testIndex++
                         switch (arr[0]) {
                             case 'CONTROL_LOCK':
-                                this.menuClicked({ type: "lock", value: "Lock" }, windturbine);
+                                this.sendLock({value: "Lock" }, windturbine);
                                 break;
                             case 'CONTROL_LOCK_OVERHAUL':
-                                this.menuClicked({ type: "lock", value: "CheckLock" }, windturbine);
+                                this.sendLock({value: "CheckLock" }, windturbine);
                                 break;
                             case 'CONTROL_LOCK_MAINTAIN':
-                                this.menuClicked({ type: "lock", value: "FaultLock" }, windturbine);
+                                this.sendLock({value: "FaultLock" }, windturbine);
                                 break;
                             case 'CONTROL_LOCK_LNVOLVED_OVERHAUL':
-                                this.menuClicked({ type: "lock", value: "StationCheckLock" }, windturbine);
+                                this.sendLock({value: "StationCheckLock" }, windturbine);
                                 break;
                             case 'CONTROL_LOCK_LNVOLVED_MAINTAIN':
-                                this.menuClicked({ type: "lock", value: "StationFaulLock" }, windturbine);
+                                this.sendLock({value: "StationFaulLock" }, windturbine);
                                 break;
                             case 'CONTROL_LOCK_LNVOLVED_PG':
-                                this.menuClicked({ type: "lock", value: "StationPowerLineLock" }, windturbine);
+                                this.sendLock({value: "StationPowerLineLock" }, windturbine);
                                 break;
                             case 'CONTROL_LOCK_LNVOLVED_WEATHER':
-                                this.menuClicked({ type: "lock", value: "StationWeatherLock" }, windturbine);
+                                this.sendLock({value: "StationWeatherLock" }, windturbine);
                                 break;
                             case 'CONTROL_UNLOCK':
-                                this.menuClicked({ type: "lock", value: "UnLock" }, windturbine);
+                                this.sendLock({value: "UnLock" }, windturbine);
                                 break;
                         }
                     } else if (arr[0] === 'CONTROL_SART_RECOMMENDATION') {
@@ -291,14 +310,14 @@
                         this.startList.forEach(item => {
                             item.controlType = '1'
                         })
-                        this.menuClicked(mss, this.startList, 'automatic')
+                        this.sendCommand(mss, this.startList)
                     } else if (arr[0] === 'CONTROL_STOP_RECOMMENDATION') {
                         let mss = {}
                         mss.type = 'send'
                         this.stopList.forEach(item => {
                             item.controlType = '2'
                         })
-                        this.menuClicked(mss, this.stopList, 'automatic')
+                        this.sendCommand(mss, this.stopList)
                     } else if (arr[0] === 'CONTROL_RECOMMENDATION_ALL') {
                         let windControlList = []
                         let mss = {}
@@ -319,8 +338,7 @@
                             item.controlType = '8'
                             windControlList.push(item)
                         })
-                        console.log(windControlList);
-                        this.menuClicked(mss, windControlList, 'automatic')
+                        this.sendCommand(mss, windControlList)
                     }
                 }
 
@@ -352,7 +370,20 @@
             },
             handleSend() {
                 if (this.chooseList.length > 0) {
-                    this.menuClicked({ type: "send" });
+                    this.chooseList.forEach(item => {
+                        if (item.operateStyle === "Start") {
+                            item.controlType = 1
+                        } else if (item.operateStyle === "Stop") {
+                            item.controlType = 2
+                        } else if (item.operateStyle === "Maintain") {
+                            item.controlType = 6
+                        } else if (item.operateStyle === "UnMaintain") {
+                            item.controlType = 8
+                        }
+                    })
+                    let mss = {}
+                    mss.type = 'send'
+                    this.sendCommand(mss, this.chooseList)
                 }
             },
             /* 右键菜单 */
@@ -363,7 +394,7 @@
                     {
                         label: "发送",
                         click() {
-                            that.menuClicked({ type: "send" });
+                            that.handleSend();
                         },
                     },
                     {
@@ -372,57 +403,47 @@
                             {
                                 label: "检修",
                                 click() {
-                                    that.menuClicked({ type: "lock", value: "CheckLock" });
+                                    that.sendLock({value: "CheckLock" });
                                 },
                             },
                             {
                                 label: "故障维修",
                                 click() {
-                                    that.menuClicked({ type: "lock", value: "FaultLock" });
+                                    that.sendLock({value: "FaultLock" });
                                 },
                             },
                             {
                                 label: "场内受累检修",
                                 click() {
-                                    that.menuClicked({ type: "lock", value: "StationCheckLock" });
+                                    that.sendLock({value: "StationCheckLock" });
                                 },
                             },
                             {
                                 label: "场内受累故障",
                                 click() {
-                                    that.menuClicked({ type: "lock", value: "StationFaulLock" });
+                                    that.sendLock({value: "StationFaulLock" });
                                 },
                             },
                             {
                                 label: "场外受累电网",
                                 click() {
-                                    that.menuClicked({
-                                        type: "lock",
-                                        value: "StationPowerLineLock",
-                                    });
+                                    that.sendLock({value: "StationPowerLineLock" });
                                 },
                             },
                             {
                                 label: "场外受累天气",
                                 click() {
-                                    that.menuClicked({ type: "lock", value: "StationWeatherLock" });
+                                    that.sendLock({value: "StationWeatherLock" });
                                 },
                             },
                         ],
                     },
-                    // {
-                    //     label: "标注",
-                    //     click() {
-                    //         that.menuClicked({ type: "marking" });
-                    //     },
-                    // },
                 ];
                 const menu = remote.Menu.buildFromTemplate(menuTemplate);
 
                 menu.popup(remote.getCurrentWindow());
             },
-
-            menuClicked(msg, windturbine, automatic) {
+            sendCommand(msg, windturbine) {
                 let bd = BackgroundData.getInstance();
                 if (!bd.LoginUser) {
                     this.$notify({
@@ -435,89 +456,32 @@
                     });
                     return;
                 }
-
-                if (msg.type == "lock") {
-                    let sendList = []
-                    // 挂牌
-                    if (windturbine) {
-                        windturbine.lockType = msg.value;
-                        sendList.push(windturbine)
-                    } else {
-                        this.chooseList.forEach(item => {
-                            item.lockType = msg.value;
-                        })
-                        sendList = this.chooseList
-                    }
-                    if (sendList.length > 0) {
-                        let showss = ''
-                        this.testsIndex++
-                        showss = String(this.testsIndex) + String(this.testIndex)
-                        bd.windturbineControl(
-                            sendList,
-                            true,
-                            '',
-                            showss,
-                            this.controlSuccess,
-                            this.controlError
-                        );
-                    }
-                } else if (msg.type == "send") {
-                    // 发送
-                    let sendList = []
-                    if (automatic) {
-                        sendList = windturbine
-                    }
-                    else if (windturbine) {
-                        //windturbine.controlType = msg.controlType
-                        sendList.push(windturbine)
-                    } else {
-                        this.chooseList.forEach(item => {
-                            if (item.operateStyle === "Start") {
-                                item.controlType = 1
-                            } else if (item.operateStyle === "Stop") {
-                                item.controlType = 2
-                            } else if (item.operateStyle === "Maintain") {
-                                item.controlType = 6
-                            } else if (item.operateStyle === "UnMaintain") {
-                                item.controlType = 8
-                            }
-                        })
-                        sendList = this.chooseList
-                    }
-                    this.showFlag = true
-                    this.testsIndex++
-                    let showss = ''
-                    showss = String(this.testsIndex) + String(this.testIndex)
-                    if (sendList.length > 0) {
-                        bd.checkout(sendList);
-                        if (automatic) {
-                            bd.windturbineControl(
-                                sendList,
-                                false,
-                                'automatic',
-                                showss,
-                                this.controlSuccess,
-                                this.controlError
-                            );
-                        } else {
-                            bd.windturbineControl(
-                                sendList,
-                                false,
-                                '',
-                                '',
-                                this.controlSuccess,
-                                this.controlError
-                            );
+                let sendList = windturbine
+                if (sendList.length > 0) {
+                    bd.checkout(sendList);
+                    this.chooseList = []
+                    let pairs = {}
+                    sendList.forEach(item => {
+                        let ct = {
+                            windturbineId: item.windturbineId,
+                            stationId: item.stationId,
+                            projectId: item.projectId,
+                            modelId: item.modelId,
+                            controlType: item.controlType,
+                            lockType: item.lockType,
+                            userName: `system_${bd.LoginUser.name}`,
+                            userId: 0,
+                        };
+                        pairs[ct.windturbineId] = ct;
+                    })
+                    api.windturbControl(pairs).then(res => {
+                        if (res) {
+                            this.controlSuccess(res)
                         }
-                    }
-                } else if (msg.type == "marking") {
-                    // 标注
-                    let vvs = this.getSelectedItems();
-                    bd.marking(vvs);
+                    })
                 }
-                this.clearSelected();
             },
-            sendCommand(msg, windturbine, automatic) {
+            sendLock(msg, windturbine) {
                 let bd = BackgroundData.getInstance();
                 if (!bd.LoginUser) {
                     this.$notify({
@@ -530,9 +494,18 @@
                     });
                     return;
                 }
-                let sendList = windturbine
+                let sendList = []
+                if (windturbine) {
+                    windturbine.lockType = msg.value;
+                    sendList.push(windturbine)
+                } else {
+                    this.chooseList.forEach(item => {
+                        item.lockType = msg.value;
+                    })
+                    sendList = this.chooseList
+                }
                 if (sendList.length > 0) {
-                    bd.checkout(sendList);
+                    this.chooseList = []
                     let pairs = {}
                     sendList.forEach(item => {
                         let ct = {
@@ -547,7 +520,7 @@
                         };
                         pairs[ct.windturbineId] = ct;
                     })
-                    api.windturbControl(false, pairs, '1').then(res => {
+                    api.windturbControlLock(pairs).then(res => {
                         if (res) {
                             this.controlSuccess(res)
                         }
@@ -568,6 +541,39 @@
                 let bd = BackgroundData.getInstance();
                 console.log(msg);
                 if (msg.data || msg.data !== {}) {
+                    // if (this.current !== 0) {
+                    //     let successReport = ''
+                    //     let failureReport = ''
+                    //     let successList = []
+                    //     let failureList = []
+                    //     for (let item in msg.data) {
+                    //         if (msg.data[item].errorCode === '0') {
+                    //             successList.push(msg.data[item])
+                    //         } else {
+                    //             failureList.push(msg.data[item])
+                    //         }
+                    //     }
+                    //     successList.forEach((item, index) => {
+                    //         if (index < 3) {
+                    //             let wind = item.windturbineId.split('_')
+                    //             successReport = successReport + this.windStation[wind[0]].name + wind[1] + '风机,'
+                    //         }
+                    //     })
+                    //     failureList.forEach((item, index) => {
+                    //         if (index < 3) {
+                    //             let wind = item.windturbineId.split('_')
+                    //             failureReport = failureReport + this.windStation[wind[0]].name + wind[1] + '风机,'
+                    //         }
+                    //     })
+                    //     if (successReport !== '') {
+                    //         let url1 = process.env.VUE_APP_API + '/api/voice-control/send-topic/TTS:' + successReport + (successList.length > 3 ? '等风机操作成功' : '操作成功')
+                    //         this.sendMessage(url1)
+                    //     }
+                    //     if (failureReport !== '') {
+                    //         let url1 = process.env.VUE_APP_API + '/api/voice-control/send-topic/TTS:' + failureReport + (failureList.length > 3 ? '等风机操作失败' : '操作失败')
+                    //         this.sendMessage(url1)
+                    //     }
+                    // }
                     let mss = '';     // 信息
                     let iserror = false;// 是否有控制错误的风机
                     for (let v in msg.data) {
@@ -578,7 +584,6 @@
                         }
                     }
                     let tp = iserror ? "warning" : "success";
-                    let dt = iserror ? 0 : 4500;
                     if (!iserror) {
                         mss = "控制成功";
                     }
@@ -600,7 +605,6 @@
                         duration: 3000,
                     });
                 }
-
             },
 
             /* 控制失败 */
@@ -614,6 +618,12 @@
                     duration: 3000,
                 });
             },
+            sendMessage(url1) {
+                this.messageUrl = url1
+                // let link = document.createElement('a')
+                // link.href = url1
+                // link.click()
+            }
         },
         watch: {
             "$store.getters.windturbinelist": {
@@ -706,6 +716,8 @@
                         let dateList = []
                         this.titleList.forEach(item => {
                             if (item.windturbineId.slice(0, 2) === 'NG') {
+                                let arr = Object.keys(this.windturbinelist).sort()
+                                this.windturbinelist = (arr.length !== 0 )?this.windturbinelist:this.$store.state.windturbinelist
                                 switch (item.operateStyle) {
                                     case 'Start':
                                         this.windturbinelist[item.windturbineId].controlType = 1
@@ -726,7 +738,7 @@
                         let mss = {}
                         mss.type = 'send'
                         this.timer = setTimeout(() => {
-                            this.sendCommand(mss, dateList, 'automatic')
+                            this.sendCommand(mss, dateList)
                             this.showFlag = false
                             clearInterval(this.timer);
                         }, 3000);

+ 123 - 111
src/components/control/controlAllArea.vue

@@ -31,6 +31,7 @@
     import MatrixBlock from "../matrixBlock.vue";
     import BackgroundData from 'utils/BackgroundData'
     import MessageBridge from 'utils/MessageBridge'
+    import api from "api/index";
     export default {
         name: "ProblemArea",
         components: {
@@ -50,7 +51,7 @@
                 dataList: [],
                 showList: [],
                 chooseList: [],
-                totleList: [],
+                lockValues: [],
                 currentWindturbine: {},
                 dialogVisible: false,
                 showSvg: false,
@@ -123,8 +124,7 @@
         created: function () {
             this.initData();
             this.controls()
-            console.log(this.datas);
-
+            this.getLocks()
         },
         methods: {
             controls() {
@@ -132,8 +132,8 @@
                 this.dataList = []
                 this.showList = []
                 let arr = Object.keys(json).sort()
-                for (var id of arr) {
-                    var val = json[id];
+                for (let id of arr) {
+                    let val = json[id];
                     this.chooseList.forEach(item => {
                         if (item.windturbineId === val.windturbineId) {
                             val.active = true
@@ -175,9 +175,6 @@
                             break;
 
                     }
-                    // if (val.lockValue > 0) {
-                    //     this.listedList.push(val)
-                    // }
                 }
                 console.log(this.showList);
                 let checkoutList = BackgroundData.getInstance().checkouts;
@@ -192,7 +189,13 @@
                 })
                 console.log(this.showList);
             },
-
+            getLocks() {
+                api.getCustomerLock().then(res => {
+                    if (res) {
+                        this.lockValues = res.data
+                    }
+                })
+            },
             initData: function () {
                 var mb = MessageBridge.getInstance();
                 var vss = [{ key: "/topic/voice-control", action: this.windturbineMessage }];
@@ -242,32 +245,32 @@
                             }
                         })
                         mss.type = 'send'
-                        this.menuClicked(mss, windControlList, 'automatic')
+                        this.sendCommand(mss, windControlList)
                     }
                     else if (arr[0] === 'CONTROL_LOCK_OVERHAUL' || arr[0] === 'CONTROL_LOCK_MAINTAIN' || arr[0] === 'CONTROL_LOCK_LNVOLVED_OVERHAUL' ||
                         arr[0] === 'CONTROL_LOCK_LNVOLVED_MAINTAIN' || arr[0] === 'CONTROL_LOCK_LNVOLVED_PG' || arr[0] === 'CONTROL_LOCK_LNVOLVED_WEATHER' || arr[0] === 'CONTROL_UNLOCK') {
                         let windturbine = this.windturbinelist[arr[1]]
                         switch (arr[0]) {
                             case 'CONTROL_LOCK_OVERHAUL':
-                                this.menuClicked({ type: "lock", value: "CheckLock" }, windturbine);
+                                this.sendLock({ value: "CheckLock" }, windturbine);
                                 break;
                             case 'CONTROL_LOCK_MAINTAIN':
-                                this.menuClicked({ type: "lock", value: "FaultLock" }, windturbine);
+                                this.sendLock({ value: "FaultLock" }, windturbine);
                                 break;
                             case 'CONTROL_LOCK_LNVOLVED_OVERHAUL':
-                                this.menuClicked({ type: "lock", value: "StationCheckLock" }, windturbine);
+                                this.sendLock({ value: "StationCheckLock" }, windturbine);
                                 break;
                             case 'CONTROL_LOCK_LNVOLVED_MAINTAIN':
-                                this.menuClicked({ type: "lock", value: "StationFaulLock" }, windturbine);
+                                this.sendLock({ value: "StationFaulLock" }, windturbine);
                                 break;
                             case 'CONTROL_LOCK_LNVOLVED_PG':
-                                this.menuClicked({ type: "lock", value: "StationPowerLineLock" }, windturbine);
+                                this.sendLock({ value: "StationPowerLineLock" }, windturbine);
                                 break;
                             case 'CONTROL_LOCK_LNVOLVED_WEATHER':
-                                this.menuClicked({ type: "lock", value: "StationWeatherLock" }, windturbine);
+                                this.sendLock({ value: "StationWeatherLock" }, windturbine);
                                 break;
                             case 'CONTROL_UNLOCK':
-                                this.menuClicked({ type: "lock", value: "UnLock" }, windturbine);
+                                this.sendLock({ value: "UnLock" }, windturbine);
                                 break;
                         }
                     }
@@ -284,7 +287,7 @@
                         // {
                         //     label: "标注",
                         //     click() {
-                        //         that.menuClicked({ type: "marking" });
+                        //         that.sendLock({ type: "marking" });
                         //     },
                         // },
                         {
@@ -293,37 +296,37 @@
                                 {
                                     label: "检修",
                                     click() {
-                                        that.menuClicked({ type: "lock", value: "CheckLock" });
+                                        that.sendLock({ value: "CheckLock" });
                                     },
                                 },
                                 {
                                     label: "故障维修",
                                     click() {
-                                        that.menuClicked({ type: "lock", value: "FaultLock" });
+                                        that.sendLock({ value: "FaultLock" });
                                     },
                                 },
                                 {
                                     label: "场内受累检修",
                                     click() {
-                                        that.menuClicked({ type: "lock", value: "StationCheckLock" });
+                                        that.sendLock({ value: "StationCheckLock" });
                                     },
                                 },
                                 {
                                     label: "场内受累故障",
                                     click() {
-                                        that.menuClicked({ type: "lock", value: "StationFaulLock" });
+                                        that.sendLock({ value: "StationFaulLock" });
                                     },
                                 },
                                 {
                                     label: "场外受累电网",
                                     click() {
-                                        that.menuClicked({ type: "lock", value: "StationPowerLineLock" });
+                                        that.sendLock({ value: "StationPowerLineLock" });
                                     },
                                 },
                                 {
                                     label: "场外受累天气",
                                     click() {
-                                        that.menuClicked({ type: "lock", value: "StationWeatherLock" });
+                                        that.sendLock({ value: "StationWeatherLock" });
                                     },
                                 },
                             ],
@@ -331,7 +334,7 @@
                         {
                             label: "取消挂牌",
                             click() {
-                                that.menuClicked({ type: "lock", value: "UnLock" });
+                                that.sendLock({ value: "UnLock" });
                             },
                         },
                     ];
@@ -340,31 +343,31 @@
                         {
                             label: "启动",
                             click() {
-                                that.menuClicked({ type: "send", controlType: '1' });
+                                that.sendCommand({ controlType: '1' });
                             },
                         },
                         {
                             label: "停机",
                             click() {
-                                that.menuClicked({ type: "send", controlType: '2' });
+                                that.sendCommand({ controlType: '2' });
                             },
                         },
                         {
                             label: "复位",
                             click() {
-                                that.menuClicked({ type: "send", controlType: '5' });
+                                that.sendCommand({ controlType: '5' });
                             },
                         },
                         {
                             label: "维护",
                             click() {
-                                that.menuClicked({ type: "send", controlType: '6' });
+                                that.sendCommand({ controlType: '6' });
                             },
                         },
                         {
                             label: "取消维护",
                             click() {
-                                that.menuClicked({ type: "send", controlType: '8' });
+                                that.sendCommand({ controlType: '8' });
                             },
                         },
                         {
@@ -373,40 +376,37 @@
                                 {
                                     label: "检修",
                                     click() {
-                                        that.menuClicked({ type: "lock", value: "CheckLock" });
+                                        that.sendLock({ value: "CheckLock" });
                                     },
                                 },
                                 {
                                     label: "故障维修",
                                     click() {
-                                        that.menuClicked({ type: "lock", value: "FaultLock" });
+                                        that.sendLock({ value: "FaultLock" });
                                     },
                                 },
                                 {
                                     label: "场内受累检修",
                                     click() {
-                                        that.menuClicked({ type: "lock", value: "StationCheckLock" });
+                                        that.sendLock({ value: "StationCheckLock" });
                                     },
                                 },
                                 {
                                     label: "场内受累故障",
                                     click() {
-                                        that.menuClicked({ type: "lock", value: "StationFaulLock" });
+                                        that.sendLock({ value: "StationFaulLock" });
                                     },
                                 },
                                 {
                                     label: "场外受累电网",
                                     click() {
-                                        that.menuClicked({
-                                            type: "lock",
-                                            value: "StationPowerLineLock",
-                                        });
+                                        that.sendLock({ value: "StationPowerLineLock", });
                                     },
                                 },
                                 {
                                     label: "场外受累天气",
                                     click() {
-                                        that.menuClicked({ type: "lock", value: "StationWeatherLock" });
+                                        that.sendLock({ value: "StationWeatherLock" });
                                     },
                                 },
                             ],
@@ -414,13 +414,13 @@
                         {
                             label: "取消挂牌",
                             click() {
-                                that.menuClicked({ type: 'lock', value: 'UnLock' });
+                                that.sendLock({ value: 'UnLock' });
                             },
                         },
                         // {
                         //     label: "标注",
                         //     click() {
-                        //         that.menuClicked({ type: "marking" });
+                        //         that.sendLock({ type: "marking" });
                         //     },
                         // },
                     ];
@@ -431,8 +431,8 @@
                 menu.popup(remote.getCurrentWindow());
             },
 
-            menuClicked(msg, windturbine, automatic) {
-                var bd = BackgroundData.getInstance();
+            sendCommand(msg, windturbine) {
+                let bd = BackgroundData.getInstance();
                 if (!bd.LoginUser) {
                     this.$notify({
                         title: "请登录",
@@ -444,72 +444,85 @@
                     });
                     return;
                 }
-                if (msg.type == "lock") {
-                    // 挂牌
-                    let sendList = []
-                    // 挂牌
-                    if (windturbine) {
-                        windturbine.lockType = msg.value;
-                        sendList.push(windturbine)
-                    } else {
-                        this.chooseList.forEach(item => {
-                            item.lockType = msg.value;
-                        })
-                        sendList = this.chooseList
-                    }
+                let sendList = []
+                if (windturbine) {
+                    sendList = windturbine
+                } else {
+                    this.chooseList.forEach(item => {
+                        item.controlType = Number(msg.controlType)
+                    })
+                    sendList = this.chooseList
+                }
 
-                    if (sendList.length > 0) {
-                        bd.windturbineControl(
-                            sendList,
-                            true,
-                            '',
-                            '',
-                            this.controlSuccess,
-                            this.controlError
-                        );
-                    }
-                } else if (msg.type == "send") {
-                    // 发送
-                    let sendList = []
-                    if (automatic) {
-                        sendList = windturbine
-                    }
-                    else if (windturbine) {
-                        windturbine.controlType = msg.controlType
-                        sendList.push(windturbine)
-                    } else {
-                        this.chooseList.forEach(item => {
-                            item.controlType = Number(msg.controlType)
-                        })
-                        sendList = this.chooseList
-                    }
-                    if (sendList.length > 0) {
-                        bd.checkout(sendList);
-                        if (automatic) {
-                            bd.windturbineControl(
-                                sendList,
-                                false,
-                                'automatic',
-                                '',
-                                this.controlSuccess,
-                                this.controlError
-                            );
-                        } else {
-                            bd.windturbineControl(
-                                sendList,
-                                false,
-                                '',
-                                '',
-                                this.controlSuccess,
-                                this.controlError
-                            );
+                if (sendList.length > 0) {
+                    bd.checkout(sendList);
+                    this.chooseList = []
+                    let pairs = {}
+                    sendList.forEach(item => {
+                        let ct = {
+                            windturbineId: item.windturbineId,
+                            stationId: item.stationId,
+                            projectId: item.projectId,
+                            modelId: item.modelId,
+                            controlType: item.controlType,
+                            lockType: item.lockType,
+                            userName: `system_${bd.LoginUser.name}`,
+                            userId: 0,
+                        };
+                        pairs[ct.windturbineId] = ct;
+                    })
+                    api.windturbControl(pairs).then(res => {
+                        if (res) {
+                            this.controlSuccess(res)
                         }
-                    }
-                } else if (msg.type == "marking") {
-                    // 标注
-                    bd.marking(this.chooseList);
+                    })
+                }
+            },
+            sendLock(msg, windturbine) {
+                let bd = BackgroundData.getInstance();
+                if (!bd.LoginUser) {
+                    this.$notify({
+                        title: "请登录",
+                        message: "控制风机需要先登录!",
+                        type: "warning",
+                        position: "bottom-right",
+                        offset: 60,
+                        duration: 3000,
+                    });
+                    return;
+                }
+                let sendList = []
+                if (windturbine) {
+                    windturbine.lockType = msg.value;
+                    sendList.push(windturbine)
+                } else {
+                    this.chooseList.forEach(item => {
+                        item.lockType = msg.value;
+                    })
+                    sendList = this.chooseList
+                }
+                if (sendList.length > 0) {
+                    this.chooseList = []
+                    let pairs = {}
+                    sendList.forEach(item => {
+                        let ct = {
+                            windturbineId: item.windturbineId,
+                            stationId: item.stationId,
+                            projectId: item.projectId,
+                            modelId: item.modelId,
+                            controlType: item.controlType,
+                            lockType: item.lockType,
+                            userName: `system_${bd.LoginUser.name}`,
+                            userId: 0,
+                        };
+                        pairs[ct.windturbineId] = ct;
+                    })
+                    api.windturbControlLock(pairs).then(res => {
+                        if (res) {
+                            this.controlSuccess(res)
+                        }
+                    })
                 }
-                this.clearSelected();
             },
 
             /* 清除所有选择 */
@@ -618,6 +631,7 @@
             handleClose() {
                 this.dialogVisible = false
                 this.showSvg = false
+                this.getLocks()
             },
         },
         watch: {
@@ -635,6 +649,9 @@
                                 val.active = true
                             }
                         })
+                        if (val.lockValue === 9) {
+                            val.lockValues = this.lockValues.filter(item => val.windturbineId === item.windturbineID)[0]?.value;
+                        }
                         this.dataList.push(val)
                         switch (Number(this.selectValue)) {
                             case 0:
@@ -669,13 +686,8 @@
                             case 9:
                                 val.windturbineId.substring(0, 2) === 'XG' ? this.showList.push(val) : ''
                                 break;
-
                         }
-                        // if (val.lockValue > 0) {
-                        //     this.listedList.push(val)
-                        // }
                     }
-                    console.log(this.showList);
                     let checkoutList = BackgroundData.getInstance().checkouts;
                     checkoutList.forEach(item => {
                         let showIndex = null

File diff suppressed because it is too large
+ 145 - 0
src/components/dataDetails.vue


+ 28 - 9
src/components/matrixBlock.vue

@@ -12,10 +12,15 @@
                 <div class="rightrow">{{ (item.modelId.indexOf("105") >= 0)?(item.rollSpeed *
                     9.55).toFixed(2):item.rollSpeed.toFixed(2) }} rpm</div>
             </div>
-            <!-- <div class="locks" v-if="item.lockValue > 0">
-                <img class="lock" src="../assets/img/type/lock.png" alt="">
-                <div class="lock-on">aaaa</div>
-            </div> -->
+            <div class="locks" v-if="item.lockValue > 0">
+                <el-popover placement="bottom-start" :width="150" trigger="hover" class="popoverBack"
+                    :show-arrow="false">
+                    <template #reference>
+                        <img class="lock" src="../assets/img/type/lock.png" alt="">
+                    </template>
+                    <input class="lock_input" type="text" placeholder="" :value="item.lockValue ===9 ? item.lockValues:options[item.lockValue]" disabled>
+                </el-popover>
+            </div>
         </div>
     </div>
     <WindturbineDetailPages v-model="dialogVisible" :showSvg="showSvg" @close="handleClose"
@@ -37,11 +42,10 @@
             area: String,
         },
         mounted() {
-            this.dataList.forEach(item => {
-                if (item.modelId.indexOf("105") >= 0) {
-                    item.rollSpeed *= 9.55;
-                }
-            })
+
+        },
+        updated() {
+            
         },
         methods: {
             onSelectHandler(values) {
@@ -67,6 +71,14 @@
                 dialogVisible: false,
                 showSvg: false,
                 currentWindturbine: {},
+                options: {
+                    8: '检修',
+                    7: '故障维修',
+                    2: '场内受累检修',
+                    3: '场内受累故障',
+                    4: '场外受累电网',
+                    5: '场外受累天气',
+                },
             };
         },
     }
@@ -99,6 +111,13 @@
         z-index: 999;
     }
 
+    .lock_input {
+        width: 140px;
+        background-color: #292929;
+        height: 40px;
+        color: #ffffff;
+    }
+
     .box-0 {
         width: 135px;
         height: 50px;

File diff suppressed because it is too large
+ 145 - 0
src/components/modeControl/dataDetails.vue


+ 110 - 9
src/components/modeControl/detailPages.vue

@@ -40,8 +40,9 @@
 					<div class="unit" @click='ChangeColors()'>MW</div>
 				</div>
 			</div>
-			<MultipleLineChart height="400px" :units="powerLineChartData.units" :list="powerLineChartData.value" :colors="colors"
-				:showLegend="true" />
+			<div id="totleEcharts" class="echarts"></div>
+			<!-- <MultipleLineChart height="400px" :units="powerLineChartData.units" :list="powerLineChartData.value" :colors="colors"
+				:showLegend="true" /> -->
 		</div>
 	</el-dialog>
 </template>
@@ -51,6 +52,7 @@
 	import MessageBridge from 'utils/MessageBridge'
 	import dayjs from 'dayjs'
 	import api from "api/index";
+	import * as echarts from "echarts";
 	export default {
 		components: {
 			MultipleLineChart
@@ -115,19 +117,18 @@
 				data.curveFollowingRate = data.curveFollowingRate.toFixed(2)
 				this.showDate = data
 			},
-			getDate() {
-				this.getPower({
+			async getDate() {
+				await this.getPower({
 					PowerSet: 'JSFW.NX_GD_FDC_XX_XX_XXX_XXX_CI0135',
 					name: 'PowerSet',
 				})
-				this.getPower({
+				await this.getPower({
 					ActualPower: 'JSFW.NX_GD_FDC_XX_XX_XXX_XXX_CI0192',
 					name: 'ActualPower',
 				})
 				this.timer = setTimeout(() => {
 					this.getDate()
-
-				}, 10000);
+				}, 60000);
 			},
 			getPower(values) {
 				let date = new Date()
@@ -155,15 +156,109 @@
 							res.data.forEach(item => {
 								list.push({
 									text: dayjs(item.ts).format('hh:mm'),
-									value: (parseFloat((item.doubleValue).toFixed(2))/1000)
+									value: (parseFloat((item.doubleValue).toFixed(2)) / 1000)
 								})
 								this.chartData.value[1].value = list
 							})
 						}
-						this.powerLineChartData = this.chartData;
+						// this.powerLineChartData = this.chartData;
+						this.totleErtcher(this.chartData)
 					}
 				})
 			},
+			totleErtcher(chartData) {
+				console.log(document.getElementById('totleEcharts'));
+				var chartDom = document.getElementById('totleEcharts');
+				var myChart = echarts.init(chartDom, '#ffffff');
+				var option;
+				option = {
+					legend: {
+						show: true,
+						data: chartData.value.map((t) => {
+							return t.title;
+						}),
+						right: 56,
+						icon: "circle",
+						itemWidth: 6,
+						inactiveColor: '#606769',
+						textStyle: {
+							color: '#B3BDC0',
+							fontSize: 12,
+						},
+					},
+					xAxis: [
+						{
+							type: "category",
+							boundaryGap: false,
+							axisLabel: {
+								interval: 60,
+								showMinLabel: true,
+								showMaxLabel: true,
+								formatter: "{value}",
+								fontSize: 14,
+								textStyle: {
+									color: '#606769',
+								},
+							},
+							axisLine: {
+								show: false,
+							},
+							data: chartData.value[0].value.map(item => {
+								return item.text;
+							}),
+						},
+					],
+					yAxis: {
+						type: "value",
+						axisLabel: {
+							formatter: "{value}",
+							fontSize: 14,
+						},
+						axisLine: {
+							show: false,
+						},
+						splitLine: {
+							show: true,
+							lineStyle: {
+								color: '#606769',
+								type: "dashed",
+							},
+						},
+					},
+					series: [{
+						name: chartData.value[0].title,
+						smooth: true,
+						showSymbol: false,
+						data: chartData.value[0].value.map(item => {
+							return item.value;
+						}),
+						type: 'line',
+						lineStyle: {
+							normal: {
+								color: 'rgba(75, 85, 174, 1)',
+								width: 1,
+							},
+						},
+					},
+					{
+						name: chartData.value[1].title,
+						smooth: true,
+						showSymbol: false,
+						data: chartData.value[1].value.map(item => {
+							return item.value;
+						}),
+						type: 'line',
+						lineStyle: {
+							normal: {
+								color: 'rgba(05, 187, 76, 1)',
+								width: 1,
+							},
+						},
+					}]
+				};
+
+				option && myChart.setOption(option);
+			},
 			ChangeColors() {
 				this.colors = ["#aa2116", "#fcaf17"]
 			},
@@ -303,4 +398,10 @@
 		height: 14px;
 		margin-left: 8px;
 	}
+
+	.echarts {
+		width: 100%;
+		height: 400px;
+		display: inline-block;
+	}
 </style>

+ 16 - 4
src/components/modeControl/modeControl.vue

@@ -5,9 +5,9 @@
             <div :class="current===1?'recommend_on':'recommend'" @click="ChangeBar(1)">推荐</div>
             <div :class="current===2?'manual_on':'manual'" @click="ChangeBar(2)">手动</div>
         </div>
-        <div style="display: flex;flex-direction: row;z-index: 2;" @dblclick="dbClick()">
+        <div style="display: flex;flex-direction: row;z-index: 2;">
             <div class="showData">
-                <div class="dataBox">
+                <div class="dataBox" @dblclick="dbClicks()">
                     <div class="dataTitle">健康指数</div>
                     <div class="datas">{{showDate.healthIndex}}</div>
                 </div>
@@ -16,7 +16,7 @@
                     <div class="datas">{{showDate.resourceIndex}}</div>
                 </div>
             </div>
-            <div id="mainEcharts" class="echarts"></div>
+            <div id="mainEcharts" @dblclick="dbClick()" class="echarts"></div>
             <div class="showData">
                 <div class="dataBox-right">
                     <div class="dataTitle">风能利用率</div>
@@ -31,6 +31,7 @@
     </div>
     <DetailPages ref="detials" @closed="closed()" v-model="dialogVisible">
 	</DetailPages>
+    <Details title='健康指数' @closed="closeds()" v-model="display"></Details>
 </template>
 <script>
     import BackgroundData from 'utils/BackgroundData'
@@ -38,6 +39,7 @@
     import MessageBridge from 'utils/MessageBridge'
     import * as echarts from "echarts";
     import DetailPages from "./detailPages.vue";
+    import Details from "./dataDetails.vue";
     export default {
         props: {
             // current: {
@@ -45,7 +47,8 @@
             // },
         },
         components: {
-			DetailPages
+			DetailPages,
+            Details
 		},
         data() {
             return {
@@ -57,6 +60,7 @@
                 curveFlag: 0,
                 fieldFlag: 0,
                 dialogVisible: false,
+                display: false,
             };
         },
         created() {
@@ -252,6 +256,8 @@
                 var bd = BackgroundData.getInstance();
                 var mb = MessageBridge.getInstance();
                 var vss = { key: "/topic/voice-control"};
+                var popup = { key: "/topic/fault-popup"};
+                mb.unregister(popup);
                 mb.unregister(vss);
                 if (!bd.LoginUser) {
                     this.$notify({
@@ -292,9 +298,15 @@
                 this.dialogVisible = true;
                 this.$refs.detials.getDate()
             },
+            dbClicks(){
+                this.display = true;
+            },
             closed(){
                 this.dialogVisible = false;
             },
+            closeds(){
+                this.display = false;
+            }
         },
     }
 </script>

+ 47 - 107
src/components/problem/areaCard.vue

@@ -1,20 +1,5 @@
 /* 自定义tabs */
 <template>
-    <!-- <transition>
-        <div :class='areaClass' @mouseover="hover = false" @mouseleave="hover = false" onselectstart="return false">
-            <div :class="headerClass">
-                <div :class='circleClass'></div>
-                <span class="gy-card-title">{{ title }}</span>
-                <img class="gy-card-decoration01" src="../../assets/img/controlcenter/decoration01.png">
-                <img class="gy-card-decoration02" src="../../assets/img/controlcenter/decoration02.png">
-            </div>
-            <div :class='contentClass'>
-                <el-scrollbar style="height: 100%">
-                    <slot></slot>
-                </el-scrollbar>
-            </div>
-        </div>
-    </transition> -->
     <div class="body" :style="style">
         <img class="logo" src="../../assets/img/logo.png" alt="">
         <div class="title">{{ title }}</div>
@@ -53,7 +38,7 @@
     import BackgroundData from 'utils/BackgroundData'
     import WindturbineDetailPages from "../WindturbineDetailPages.vue";
     import MatrixBlock from "../matrixBlock.vue";
-
+    import api from "api/index";
     export default {
         name: 'gy-card',
         components: {
@@ -64,39 +49,20 @@
         props: {
             title: {
                 type: String,
-                default: '校验区',
+                default: '',
                 required: true
             },
             height: {
                 type: Number,
                 default: 200,
             },
-            areaStyle: {
-                type: String,
-                default: 'check',
-                required: true
-            },
-            circleStyle: {
-                type: String,
-                default: 'green',
-                required: true
-            },
-            contentStyle: {
-                type: String,
-                default: '44',
-                required: true
-            },
-            showFlag: {
-                type: Boolean,
-                default: false,
-            }
         },
         data() {
             return {
-                aaa: '3',
                 dialogVisible: false,
                 currentWindturbine: {},
                 values: [],
+                lockValues: [],
                 hover: false,
                 big: false,
                 current: 0,
@@ -152,33 +118,10 @@
             style() {
                 return `width: 100%; height: ${this.height}vh;`
             },
-            areaClass() {
-                if (this.big) {
-                    return `gy-card-area-big`;
-                } else {
-                    return `gy-card-area-${this.areaStyle}`;
-                }
-            },
-            circleClass() {
-                return `gy-card-circle gy-card-circle-${this.circleStyle}`;
-            },
-            contentClass() {
-                if (this.big) {
-                    return `gy-card-content-big`;
-                } else {
-                    return `gy-card-content-${this.contentStyle}`;
-                }
-            },
-            headerClass() {
-                if (this.hover) {
-                    return `gy-card-header-hover`;
-                } else {
-                    return `gy-card-header`;
-                }
-            }
         },
         created() {
             this.deal()
+            this.getLocks()
         },
         methods: {
             deal() {
@@ -211,6 +154,13 @@
                     }
                 }
             },
+            getLocks() {
+                api.getCustomerLock().then(res => {
+                    if (res) {
+                        this.lockValues = res.data
+                    }
+                })
+            },
             handleClick(values) {
                 if (values.active) {
                     let showIndex = null
@@ -234,49 +184,43 @@
                 const { remote } = require("electron");
                 var that = this;
                 const menuTemplate = [
-                    // {
-                    //     label: "标注",
-                    //     click() {
-                    //         that.menuClicked({ type: "marking" });
-                    //     },
-                    // },
                     {
                         label: "挂牌",
                         submenu: [
                             {
                                 label: "检修",
                                 click() {
-                                    that.menuClicked({ type: "lock", value: "CheckLock" });
+                                    that.menuClicked({ value: "CheckLock" });
                                 },
                             },
                             {
                                 label: "故障维修",
                                 click() {
-                                    that.menuClicked({ type: "lock", value: "FaultLock" });
+                                    that.menuClicked({ value: "FaultLock" });
                                 },
                             },
                             {
                                 label: "场内受累检修",
                                 click() {
-                                    that.menuClicked({ type: "lock", value: "StationCheckLock" });
+                                    that.menuClicked({ value: "StationCheckLock" });
                                 },
                             },
                             {
                                 label: "场内受累故障",
                                 click() {
-                                    that.menuClicked({ type: "lock", value: "StationFaulLock" });
+                                    that.menuClicked({ value: "StationFaulLock" });
                                 },
                             },
                             {
                                 label: "场外受累电网",
                                 click() {
-                                    that.menuClicked({ type: "lock", value: "StationPowerLineLock" });
+                                    that.menuClicked({ value: "StationPowerLineLock" });
                                 },
                             },
                             {
                                 label: "场外受累天气",
                                 click() {
-                                    that.menuClicked({ type: "lock", value: "StationWeatherLock" });
+                                    that.menuClicked({ value: "StationWeatherLock" });
                                 },
                             },
                         ],
@@ -284,7 +228,7 @@
                     {
                         label: "取消挂牌",
                         click() {
-                            that.menuClicked({ type: "lock", value: "UnLock" });
+                            that.menuClicked({ value: "UnLock" });
                         },
                     },
                 ];
@@ -305,39 +249,33 @@
                     });
                     return;
                 }
-                if (msg.type == "lock") {
-                    // 挂牌
-                    this.chooseList.forEach(item => {
-                        item.lockType = msg.value;
+                let sendList = []
+                this.chooseList.forEach(item => {
+                    item.lockType = msg.value;
+                })
+                sendList = this.chooseList
+                if (sendList.length > 0) {
+                    this.chooseList = []
+                    let pairs = {}
+                    sendList.forEach(item => {
+                        let ct = {
+                            windturbineId: item.windturbineId,
+                            stationId: item.stationId,
+                            projectId: item.projectId,
+                            modelId: item.modelId,
+                            controlType: item.controlType,
+                            lockType: item.lockType,
+                            userName: `system_${bd.LoginUser.name}`,
+                            userId: 0,
+                        };
+                        pairs[ct.windturbineId] = ct;
+                    })
+                    api.windturbControlLock(pairs).then(res => {
+                        if (res) {
+                            this.controlSuccess(res)
+                        }
                     })
-                    bd.windturbineControl(
-                        this.chooseList,
-                        true,
-                        '',
-                        '',
-                        this.controlSuccess,
-                        this.controlError
-                    );
-                } else if (msg.type == "send") {
-                    // 发送
-                    bd.checkout(this.chooseList);
-                    bd.windturbineControl(
-                        this.chooseList,
-                        false,
-                        '',
-                        '',
-                        this.controlSuccess,
-                        this.controlError
-                    );
-                } else if (msg.type == "marking") {
-                    // 标注
-                    bd.marking(this.chooseList);
                 }
-                this.clearSelected();
-            },
-            /* 清除所有选择 */
-            clearSelected() {
-                this.chooseList = [];
             },
             /* 控制成功 */
             controlSuccess(msg) {
@@ -419,6 +357,7 @@
             handleClose() {
                 this.dialogVisible = false
                 this.showSvg = false
+                this.getLocks()
             },
         },
         watch: {
@@ -437,6 +376,9 @@
                                 val.active = true
                             }
                         })
+                        if (val.lockValue === 9) {
+                            val.lockValues = this.lockValues.filter(item => val.windturbineId === item.windturbineID)[0]?.value;
+                        }
                         switch (val.status) {
                             case 5:
                                 this.faultList.push(val)
@@ -518,6 +460,4 @@
         margin-bottom: 20px;
         margin-left: 12px;
     }
-
-    
 </style>

+ 11 - 0
src/store/index.js

@@ -8,7 +8,9 @@ const store = createStore({
                windturbinelist: Object,  // 服务器推送的风机详细信息
                warning: Object,
                suggestion: [],
+               observers: true,
                titleInfo: Object,
+               token: "",
                current: 1,
           }
      },
@@ -21,6 +23,9 @@ const store = createStore({
           current(state) {
                return state.current;
           },
+          token(state) {
+               return state.token;
+          },
      },
 
      // 数据更新 使用: this.$store.commit('函数名','val')
@@ -34,12 +39,18 @@ const store = createStore({
           suggestion(state, data) {
                state.suggestion = data;
           },
+          observers(state, data) {
+               state.observers = data;
+          },
           titleInfo(state, data) {
                state.titleInfo = data;
           },
           current(state, data) {
                state.current = data;
           },
+          token(state, data) {
+               state.token = data;
+          },
      }
 })
 

+ 28 - 30
src/utils/BackgroundData.js

@@ -140,7 +140,7 @@ export default class BackgroundData {
         for (var v in this.TopPoint) {
             val += this.TopPoint[v].pointTag + ',';
         }
-        api.refreshData(val).then(this.onTPMessage)
+        // api.refreshData(val).then(this.onTPMessage)
         // axios.get(process.env.VUE_APP_ADAPTERURL+`/ts/latest?keys=${val}`)
         //     .then(this.onTPMessage)
         //     .catch(err =>
@@ -154,7 +154,7 @@ export default class BackgroundData {
         for (var v in this.Recommends) {
             val += v + ',';
         }
-        api.refreshData(val).then(this.onRDMessage)
+        // api.refreshData(val).then(this.onRDMessage)
         // axios.get(process.env.VUE_APP_ADAPTERURL+`/ts/latest?keys=${val}`)
         //     .then(this.onRDMessage)
         //     .catch(err =>
@@ -170,30 +170,30 @@ export default class BackgroundData {
         var tm = enddt.getTime();
         enddt = new Date(tm + 900000);
         var startdt = new Date(tm - 86400000);
-        api.getSnap({
-            pagenum:'1',
-            pagesize:'500',
-            category1:'custom',
-            isopened:'1',
-            starttime:this.formatDate(startdt),
-            endtime:this.formatDate(enddt),
-        }).then(this.onHiddenProblemsMessage)
-        api.getSnap({
-            pagenum:'1',
-            pagesize:'500',
-            category1:'windturbine',
-            isopened:'1',
-            starttime:this.formatDate(startdt),
-            endtime:this.formatDate(enddt),
-        }).then(this.onHiddenProblemsMessage)
-        api.getSnap({
-            pagenum:'1',
-            pagesize:'500',
-            category1:'SYZ',
-            isopened:'1',
-            starttime:this.formatDate(startdt),
-            endtime:this.formatDate(enddt),
-        }).then(this.onHiddenProblemsMessage)
+        // api.getSnap({
+        //     pagenum:'1',
+        //     pagesize:'500',
+        //     category1:'custom',
+        //     isopened:'1',
+        //     starttime:this.formatDate(startdt),
+        //     endtime:this.formatDate(enddt),
+        // }).then(this.onHiddenProblemsMessage)
+        // api.getSnap({
+        //     pagenum:'1',
+        //     pagesize:'500',
+        //     category1:'windturbine',
+        //     isopened:'1',
+        //     starttime:this.formatDate(startdt),
+        //     endtime:this.formatDate(enddt),
+        // }).then(this.onHiddenProblemsMessage)
+        // api.getSnap({
+        //     pagenum:'1',
+        //     pagesize:'500',
+        //     category1:'SYZ',
+        //     isopened:'1',
+        //     starttime:this.formatDate(startdt),
+        //     endtime:this.formatDate(enddt),
+        // }).then(this.onHiddenProblemsMessage)
     }
 
     /* 获得故障数据 */
@@ -319,7 +319,7 @@ export default class BackgroundData {
             };
             pairs[ct.windturbineId] = ct;
         }
-        api.windturbControl(isLockOrUnlock,pairs,test).then(res =>{
+        api.windturbControl(pairs).then(res =>{
             success(res);
         })
         // axios.post(process.env.VUE_APP_API+`/api/control/send?isLockOrUnlock=${isLockOrUnlock}`, pairs)
@@ -350,9 +350,7 @@ export default class BackgroundData {
             pairs[ct.windturbineId] = ct;
         }
         let isLockOrUnlock = false
-        api.windturbControl(isLockOrUnlock,{
-            pairs: pairs
-        }).then(res =>{
+        api.windturbControl(pairs).then(res =>{
             success(res);
         })
         // axios.post(process.env.VUE_APP_API+`/api/control/send?isLockOrUnlock=false`, pairs)

+ 57 - 18
src/utils/MessageBridge.js

@@ -1,18 +1,25 @@
+import { setTimeout } from 'core-js';
 import Stomp from 'stompjs'
+import store from '../store/index'
 // import {config} from '../../config';
 
 export default class MessageBridge {
   observers;// 观察者
-
   calcSocket;// 后台websocket
   adapterSocket;// 适配器websocket
-
+  flag;
+  windFlag;
+  flagArr;
   constructor() {
     this.register = this.register.bind(this);
     this.unregister = this.unregister.bind(this);
     this.onmessage = this.onmessage.bind(this);
     this.getActions = this.getActions.bind(this);
     this.observers = new Array();
+    this.flagArr = new Array();
+    this.flag = (new Date()).getTime();
+    this.windFlag = (new Date()).getTime();
+    this.reconnect()
     this.calcSocket = new WebSocket(`ws://${process.env.VUE_APP_APIS}/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", "/topic/voice-control", "/topic/title-info"]);
     this.adapterSocket = new WebSocket(`ws://${process.env.VUE_APP_ADAPTERURLS}/wisdom`, this.onmessage, ["/topic/windturbine", "/topic/pv"]);
@@ -28,23 +35,31 @@ export default class MessageBridge {
 
   /* 获得消息 */
   onmessage(msg) {
-    if(msg.headers["data-type"] && msg.headers["data-type"]=="heartbeat"){
-      // console.log("获得心跳包!");
-      return;
+    if (msg.headers.destination === "/topic/heartbeat-data") {
+      this.flag = (new Date()).getTime()
+    }
+    if (msg.headers.destination === "/topic/windturbine") {
+      this.windFlag = (new Date()).getTime()
     }
     if (msg.command != "MESSAGE" || !msg.headers.destination) return;
     var os = this.getActions(msg.headers.destination);
     for (var id in os) {
-      try{
-        os[id].action(msg.body,msg.headers);
-      }catch(e){}
+      try {
+        os[id].action(msg.body, msg.headers);
+      } catch (e) { }
     }
   }
 
-  getActions(destination){
+  getActions(destination) {
     var list = new Array();
-    for(var i in this.observers){
-      if(this.observers[i].key==destination){
+    console.log(store.state.observers);
+    if (this.observers.filter(item => item.key === "/topic/windturbine").length === 0) {
+      store.commit('observers', false)
+      console.log(store.state.observers);
+    }
+
+    for (var i in this.observers) {
+      if (this.observers[i].key == destination) {
         list.push(this.observers[i]);
       }
     }
@@ -53,20 +68,38 @@ export default class MessageBridge {
 
   /* 注册消息 */
   register(msgs) {
-    for(var i in msgs){
+    for (var i in msgs) {
       this.observers.push(msgs[i]);
     }
   }
 
   /* 取消注册消息 */
   unregister(msgs) {
+    console.log('------------------', this.observers);
     let showIndex = null
-    this.observers.forEach((item,index) =>{
-      if(item.key === msgs.key){
+    this.observers.forEach((item, index) => {
+      if (item.key === msgs.key) {
         showIndex = index
       }
     })
-    this.observers.splice(showIndex,1);
+    this.observers.splice(showIndex, 1);
+  }
+
+  reconnect() {
+    setTimeout(() => {
+      this.reconnect()
+    }, 60000);
+    if (((new Date()).getTime() - this.windFlag) > 60000) {
+      console.log('心跳检测失败1,尝试重新连接');
+      this.adapterSocket.disconnect()
+      this.adapterSocket.connect()
+    }
+    if (((new Date()).getTime() - this.flag) > 60000) {
+      console.log('心跳检测失败,尝试重新连接');
+      this.calcSocket.disconnect()
+      this.calcSocket.connect()
+    }
+
   }
 }
 
@@ -75,15 +108,17 @@ class WebSocket {
   url;
   settings;
   client;
+
   constructor(url, onmessage, settings) {
     this.onerror = this.onerror.bind(this);
     this.connectCallBackSubscribe = this.connectCallBackSubscribe.bind(this);
     this.send = this.send.bind(this);
-    this.connect=this.connect.bind(this);
-
+    this.connect = this.connect.bind(this);
+    this.disconnect = this.disconnect.bind(this);
     this.onmessage = onmessage;
     this.url = url;
     this.settings = settings;
+    // this.MessageBridge = new MessageBridge()
     try {
       this.connect();
     } catch (e) {
@@ -99,6 +134,10 @@ class WebSocket {
     this.client.debug = null;
   }
 
+  disconnect() {
+    this.client.disconnect()
+  }
+
   /* 检测连接是否正常 */
   protector() {
 
@@ -116,7 +155,6 @@ class WebSocket {
   send(destination, headers, body) {
     if (this.client.connected) {
       this.client.send(destination, headers, body);
-     
     }
   }
 
@@ -126,4 +164,5 @@ class WebSocket {
     // TODO 断线重连还有问题
     setTimeout(this.connect(), 5000);
   }
+
 }

+ 5 - 3
src/utils/request.js

@@ -1,4 +1,5 @@
 import axios from "axios";
+import store from '../store/index'
 // import { getToken } from "@/utils/storage";
 const service = axios.create();
 // import { Loading } from 'element-ui';
@@ -6,7 +7,6 @@ const service = axios.create();
 service.defaults.timeout = 50000;
 // service.defaults.baseURL = `${process.env.VUE_APP_API}`
 service.interceptors.request.use(
-	
 	config => {
 		// 加载开始
 		// this.$loading({
@@ -17,8 +17,9 @@ service.interceptors.request.use(
 		// });
 		// Loading.start(),
 		config.headers = {
-			// Authorization: `Bearer ${getToken() ? getToken() : ""}`
-		}
+            // 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
+            Authorization: store.state.token,
+        }
 		return config;
 	},
 	error => {
@@ -51,6 +52,7 @@ service.interceptors.response.use(
 		if (error.response) {
 			// const { status } = error.response;
 			// tips[status](error);
+			return error.response.data
 		}else{
 			return false;
 		}

+ 1 - 1
src/views/ManualPage.vue

@@ -64,7 +64,7 @@
             };
         },
         mounted() {
-            const { current,datas } = this.$route.query
+            const { current } = this.$route.query
             this.current = Number(current) 
         },
         methods: {

+ 0 - 2
src/views/StatusBar.vue

@@ -165,7 +165,6 @@
         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;
@@ -174,7 +173,6 @@
           clearInterval(this.timer);
           this.refreshData()
         }, 5000);
-
       },
     },
   };

+ 48 - 83
src/views/TitleBar.vue

@@ -38,7 +38,7 @@
       </el-col>
       <el-col :span="19" style="margin-left: 60px;">
         <div class="titleinfoall">
-          <div class="titleinfo">
+          <div class="titleinfo" @dblclick="dbClicks()">
             <ul>
               <li>
                 <!-- <TitleBarCard title="装机容量" unit="MW" :value="installedCapacity"></TitleBarCard> -->
@@ -48,54 +48,59 @@
               </li>
             </ul>
           </div>
-          <div class="titleinfo">
+          <div class="titleinfo"  @dblclick="dbClicks()">
             <ul>
               <li>
                 <!-- <TitleBarCard title="实时功率" unit="MW" :value="totalPower"></TitleBarCard> -->
                 <span class="showTitle">故障损失</span>
-                <span :class="titleInfo.powerLossFault?(titleInfo.powerLossFault.trend === 'Counterpoise'?'showvalue':titleInfo.powerLossFault.trend === 'Rise'?'showvalue-up':'showvalue-down'):''">{{titleInfo.powerLossFault?titleInfo.powerLossFault.value:''}}</span>
+                <span
+                  :class="titleInfo.powerLossFault?(titleInfo.powerLossFault.trend === 'Counterpoise'?'showvalue':titleInfo.powerLossFault.trend === 'Rise'?'showvalue-up':'showvalue-down'):''">{{titleInfo.powerLossFault?titleInfo.powerLossFault.value:''}}</span>
                 <span class="showTitle">万kW/h</span>
               </li>
             </ul>
           </div>
-          <div class="titleinfo">
+          <div class="titleinfo"  @dblclick="dbClicks()">
             <ul>
               <li>
                 <!-- <TitleBarCard title="日发电量" unit="kWh" :value="dailyPowerGeneration"></TitleBarCard> -->
                 <span class="showTitle">限电损失</span>
-                <span :class="titleInfo.powerLossRestrictions?(titleInfo.powerLossRestrictions.trend === 'Counterpoise'?'showvalue':titleInfo.powerLossRestrictions.trend === 'Rise'?'showvalue-up':'showvalue-down'):''">{{titleInfo.powerLossRestrictions?titleInfo.powerLossRestrictions.value:''}}</span>
+                <span
+                  :class="titleInfo.powerLossRestrictions?(titleInfo.powerLossRestrictions.trend === 'Counterpoise'?'showvalue':titleInfo.powerLossRestrictions.trend === 'Rise'?'showvalue-up':'showvalue-down'):''">{{titleInfo.powerLossRestrictions?titleInfo.powerLossRestrictions.value:''}}</span>
                 <span class="showTitle">万kW/h</span>
               </li>
             </ul>
           </div>
-          <div class="titleinfo">
+          <div class="titleinfo"  @dblclick="dbClicks()">
             <ul>
               <li>
                 <span class="showTitle">检修损失</span>
-                <span :class="titleInfo.powerLossInspection?(titleInfo.powerLossInspection.trend === 'Counterpoise'?'showvalue':titleInfo.powerLossInspection.trend === 'Rise'?'showvalue-up':'showvalue-down'):''">{{titleInfo.powerLossInspection?titleInfo.powerLossInspection.value:''}}</span>
+                <span
+                  :class="titleInfo.powerLossInspection?(titleInfo.powerLossInspection.trend === 'Counterpoise'?'showvalue':titleInfo.powerLossInspection.trend === 'Rise'?'showvalue-up':'showvalue-down'):''">{{titleInfo.powerLossInspection?titleInfo.powerLossInspection.value:''}}</span>
                 <span class="showTitle">万kW/h</span>
               </li>
             </ul>
           </div>
-          <div class="titleinfo">
+          <div class="titleinfo"  @dblclick="dbClicks()">
             <ul>
               <li>
                 <span class="showTitle">受累损失</span>
-                <span :class="titleInfo.powerLossBurden?(titleInfo.powerLossBurden.trend === 'Counterpoise'?'showvalue':titleInfo.powerLossBurden.trend === 'Rise'?'showvalue-up':'showvalue-down'):''">{{titleInfo.powerLossBurden?titleInfo.powerLossBurden.value:''}}</span>
+                <span
+                  :class="titleInfo.powerLossBurden?(titleInfo.powerLossBurden.trend === 'Counterpoise'?'showvalue':titleInfo.powerLossBurden.trend === 'Rise'?'showvalue-up':'showvalue-down'):''">{{titleInfo.powerLossBurden?titleInfo.powerLossBurden.value:''}}</span>
                 <span class="showTitle">万kW/h</span>
               </li>
             </ul>
           </div>
-          <div class="titleinfo">
+          <div class="titleinfo"  @dblclick="dbClicks()">
             <ul>
               <li>
                 <span class="showTitle">性能损失</span>
-                <span :class="titleInfo.powerLossPerformance?(titleInfo.powerLossPerformance.trend === 'Counterpoise'?'showvalue':titleInfo.powerLossPerformance.trend === 'Rise'?'showvalue-up':'showvalue-down'):''">{{titleInfo.powerLossPerformance?titleInfo.powerLossPerformance.value:''}}</span>
+                <span
+                  :class="titleInfo.powerLossPerformance?(titleInfo.powerLossPerformance.trend === 'Counterpoise'?'showvalue':titleInfo.powerLossPerformance.trend === 'Rise'?'showvalue-up':'showvalue-down'):''">{{titleInfo.powerLossPerformance?titleInfo.powerLossPerformance.value:''}}</span>
                 <span class="showTitle">万kW/h</span>
               </li>
             </ul>
           </div>
-          <div class="titleinfo">
+          <div class="titleinfo"  @dblclick="dbClicks()">
             <ul>
               <li>
                 <span class="showTitle">场用电量</span>
@@ -104,31 +109,6 @@
               </li>
             </ul>
           </div>
-          <!-- <div class="titleinfo">
-            <ul>
-              <li>
-                <TitleBarCard title="年发电量" unit="kWh" :value="annualPowerGeneration"></TitleBarCard>
-              </li>
-            </ul>
-          </div>
-          <div class="titleinfo">
-            <ul>
-              <li>
-                <TitleBarCard title="月利用小时" unit="小时" :value="monthlyUtilizationHours"></TitleBarCard>
-              </li>
-            </ul>
-          </div> -->
-          <!-- <div class="titleinfo">
-            <ul>
-              <li>
-                <TitleBarCard
-                  title="年利用小时"
-                  unit="小时"
-                  :value="annualUtilizationHours"
-                ></TitleBarCard>
-              </li>
-            </ul>
-          </div> -->
         </div>
       </el-col>
       <el-col :span="1">
@@ -139,8 +119,7 @@
               {{usreName}}</el-button>
           </template>
           <div style="background-color: #363636;">
-            <!-- <el-button class="loginoption">编&emsp;辑</el-button>
-        <br> -->
+            <!-- <el-button class="loginoption">编&emsp;辑</el-button> -->
             <el-button v-if="!isLogin" class="loginoption" @click="userClick">登&emsp;录</el-button>
             <br v-if="!isLogin">
             <el-button v-if="isLogin" class="loginoption" @click="logout">注&emsp;销</el-button>
@@ -150,13 +129,8 @@
           <button class="closeButton" v-on:click="mainClose">×</button>
         </div>
       </el-col>
-
-      <!-- <el-col :span="1">
-        <div style="margin-top: 7px; position: absolute; right: 10px">
-          <button class="closeButton" v-on:click="mainClose">×</button>
-        </div>
-      </el-col> -->
     </el-row>
+    <DataDetails @closed="closeds()" v-model="display"></DataDetails>
   </div>
 </template>
 
@@ -164,11 +138,13 @@
   import TitleBarCard from "components/TitleBarCard.vue";
   import BackgroundData from "utils/BackgroundData";
   import MessageBridge from 'utils/MessageBridge'
+  import DataDetails from "components/dataDetails.vue";
   import api from "api/index";
   export default {
     name: "TitleBar",
     components: {
-      TitleBarCard
+      TitleBarCard,
+      DataDetails
     },
     data() {
       return {
@@ -189,32 +165,7 @@
         monthlyPowerGeneration: 0, // 月发电量
         annualPowerGeneration: 0, // 年发电量
         installedCapacity: 734, // 装机容量
-        tableData: [{
-          station: '麻黄山',
-        }, {
-          station: '牛首山',
-        }, {
-          station: '青山',
-        }, {
-          station: '石板泉',
-        }, {
-          station: '香山',
-        }, {
-          station: '风场汇总',
-        }, {
-          station: '大武口',
-        }, {
-          station: '平罗',
-        }, {
-          station: '宣和',
-        }, {
-          station: '马场湖',
-        }, {
-          station: '海子井',
-        }, {
-          station: '光伏汇总',
-        }
-        ]
+        display: false
       };
     },
     computed: {
@@ -244,8 +195,8 @@
         mb.register(vs);
       },
       titleInfos(msg) {
-        let data = msg?JSON.parse(msg):this.$store.state.titleInfo
-        if(Object.keys(data).length>0){
+        let data = JSON.parse(msg)
+        if (Object.keys(data)?.length > 0) {
           data.dailyPowerGeneration = data.dailyPowerGeneration.toFixed(2)
           data.powerLossFault.value = data.powerLossFault.value.toFixed(2)
           data.powerLossRestrictions.value = data.powerLossRestrictions.value.toFixed(2)
@@ -288,29 +239,34 @@
         // var bd = BackgroundData.getInstance();
         //   this.loginMessage='正在登录...';
         // bd.login(this.form.name,this.form.psd,this.onLoged);
-        api.login(this.form.name, this.form.psd, 11).then(res => {
+        api.login({
+          username:this.form.name,
+          password:  this.form.psd,
+        }).then(res => {
           if (res) {
+
             this.onLoged(res)
           }
         })
+        // api.login(this.form.name,this.form.psd,'11').then(res => {
+        //   if (res) {
+        //     this.onLoged(res)
+        //   }
+        // })
       },
 
       onLoged(msg) {
-        if (!msg.data) {
-          this.loginMessage = msg;
+        if (msg.status === 401) {
+          this.loginMessage = msg.message;
           return;
         }
         var user = msg.data;
-        if (!user.isValid) {
-          this.loginMessage = user.message;
-          return;
-        }
+        this.$store.commit('token', user.token)
         BackgroundData.getInstance().LoginUser = user;
         this.usreName = user.name;
         this.dialogVisible = false;
         this.loginMessage = "";
         this.form.name = this.form.psd = "";
-
         this.isLogin = true;
       },
 
@@ -324,6 +280,12 @@
         BackgroundData.getInstance().LoginUser = null;
         this.usreName = '未登录...';
         this.isLogin = false;
+      },
+      dbClicks() {
+        this.display = true;
+      },
+      closeds() {
+        this.display = false;
       }
     },
   };
@@ -382,15 +344,18 @@
     color: #FFFFFF;
     margin-right: 10px;
   }
+
   .showvalue {
     color: #ffffff;
     margin-right: 10px;
   }
+
   .showvalue-down {
     color: #50AE56;
     margin-right: 10px;
   }
-  .showvalue-up{
+
+  .showvalue-up {
     color: red;
     margin-right: 10px;
   }