蒋珅 1 year atrás
parent
commit
32257aaaa1
4 changed files with 119 additions and 23 deletions
  1. 2 0
      .env.development
  2. 2 1
      package.json
  3. 9 1
      src/api/index.js
  4. 106 21
      src/components/temperatureMatrix.vue

+ 2 - 0
.env.development

@@ -3,3 +3,5 @@ VUE_APP_SHARDINGURL=http://192.168.10.18:8075
 VUE_APP_ADAPTERURL=http://192.168.10.18:8011
 VUE_APP_APIS=192.168.10.18:8099
 VUE_APP_ADAPTERURLS=192.168.10.18:8011
+VUE_APP_APT=http://192.168.137.1:8099
+

+ 2 - 1
package.json

@@ -27,7 +27,8 @@
     "vue-grid-layout": "^3.0.0-beta1",
     "vue-router": "^4.0.0-0",
     "vuex": "^4.0.0-0",
-    "xlsx": "^0.17.5"
+    "xlsx": "^0.17.5",
+    "xlsx-style": "^0.8.13"
   },
   "devDependencies": {
     "@vue/cli-plugin-babel": "~4.5.0",

+ 9 - 1
src/api/index.js

@@ -443,6 +443,13 @@ const getControlStatistics = (startTs, endTs,stationId) => {
         method: "get",
     });
 }
+const getnb = (data) => {
+    return request({
+        baseURL: process.env.VUE_APP_APT,
+        url: `/api/windturbine/temperature-export?windturbineIds=${data.windturbineIds}&startTs=${data.startTs}&endTs=${data.endTs}`,
+        method: "get",
+    });
+}
 export default {
     login,
     getStation,
@@ -499,5 +506,6 @@ export default {
     returnSetting,
     getAlarmSnap,
     getEvaluationData,
-    getControlStatistics
+    getControlStatistics,
+    getnb
 };

+ 106 - 21
src/components/temperatureMatrix.vue

@@ -39,6 +39,19 @@
             }}</el-checkbox>
           </el-checkbox-group>
           <div class="bpickers">
+             <!-- <div class="search"> -->
+          <div class="date">日期:</div>
+          <el-date-picker
+            class="pickers"
+            @change="changes"
+            v-model="timeValue"
+            type="datetimerange"
+            range-separator="至"
+            start-placeholder="开始日期"
+            end-placeholder="结束日期"
+          >
+          </el-date-picker>
+        <!-- </div> -->
             <div>
               <el-button type="info" size="small" @click="exportExcel()"
                 >导出</el-button
@@ -143,11 +156,13 @@
 import api from "api/index";
 import BackgroundData from "utils/BackgroundData";
 import XLSX from "xlsx";
+// import XLSXStyle from 'xlsx-style';
 import { saveAs } from 'file-saver'
 const cityOptions = ["越限", "超限", "坏点"];
 export default {
   data() {
     return {
+       timeValue: [],
       windturbineStatus: [
         {
           type: 0,
@@ -183,9 +198,9 @@ export default {
         },
       ],
       contentList: [],
-      resultArray: [],
       hanb:"",
       tableData: [],
+      tablejs:[],
       stationList: [],
       current: "",
       intervals: null,
@@ -264,6 +279,11 @@ export default {
       this.getData();
     },
     opened() {
+       let date = new Date();
+      this.timeValue[0] = new Date(new Date().toLocaleDateString()).getTime() - 86400000;
+      this.timeValue[1] = new Date(new Date().toLocaleDateString()).getTime();
+
+
       this.$nextTick(() => {
         let tableDom = this.$refs.multipleTable?.$refs?.bodyWrapper;
         let time = null;
@@ -375,8 +395,7 @@ export default {
                 }
               });
               tableDatas.push(tableData);
-              // console.log('ha',tableDatas);
-              this.resultArray = tableDatas;
+              // console.log('ha',tableData);
             });
             this.contentList = contentList;
             let arr = [];
@@ -408,7 +427,70 @@ export default {
     },
 
     exportExcel() {
-      const headers = [
+      let fjcode=[]
+      // console.log('sb',this.tableData);
+      this.tableData.forEach((ele)=>{
+          fjcode.push(ele.code)
+         
+      })
+      let str = fjcode.join(',');
+      console.log('nb',str);
+      console.log('nb',this.timeValue[0]);
+      console.log('nb',this.timeValue[1]);
+      const stTs = this.timeValue[0];
+      const endTs = this.timeValue[1];
+     api.getnb({
+          windturbineIds:str,
+          startTs: this.timeValue[0],
+          endTs: this.timeValue[1],
+          // interval: 200,
+        }) .then((res) => {
+ if (res.data.length) {
+            let contentList = [];
+            let tableDatas = [];
+            res.data.forEach((item, index) => {
+              let tablejs = {};
+              tablejs.code = item.code;
+              tablejs.windturbineId = item.windturbineId;
+              tablejs.windSpeed = item.windSpeed.toFixed(1);
+              tablejs.status = Number(item.status);
+              tablejs.stationId = item.stationId;
+              tablejs.rollSpeed = item.rollSpeed.toFixed(1);
+              tablejs.power = item.power.toFixed(1);
+              item.temperatureComponentInfos.forEach((val) => {
+                if (index === 0) {
+                  let obj = {
+                    children: [],
+                  };
+                  obj.name = val.name;
+                  val.temperatureItemInfos.forEach((temp) => {
+                    if (index === 0) {
+                      let str = {};
+                      str.name = temp.name;
+                      str.keyname = `${val.name}${temp.name}`;
+                      obj.children.push(str);
+                    }
+                    tablejs[`${val.name}${temp.name}`] =
+                      temp.value.toFixed(1);
+                    tablejs[`${val.name}${temp.name}Status`] = temp.status;
+                  });
+                  contentList.push(obj);
+                } else {
+                  val.temperatureItemInfos.forEach((temp) => {
+                    tablejs[`${val.name}${temp.name}`] =
+                      temp.value.toFixed(1);
+                    tablejs[`${val.name}${temp.name}Status`] = temp.status;
+                  });
+                }
+              });
+              tableDatas.push(tablejs);
+            });
+            
+        }
+        })
+
+      const headers   = [   
+        "时间",
         "机组编号",
         "状态",
         "风速",
@@ -439,8 +521,10 @@ export default {
         "齿轮箱轴1温度",
         "齿轮箱轴2温度",
       ];
-      let data = this.resultArray.map((item) => [
+      // console.log(this.tableData);
+      let data = this.tablejs.map((item) => [
         item.code,
+        item.windturbineId,
         item.status,
         item.windSpeed,
         item.power,
@@ -473,22 +557,22 @@ export default {
       ]);
 
       data.forEach((ele) => {
-        if (ele[1] == 0) {
-          ele[1] = '停机';
-        } else if (ele[1] == 1) {
-          ele[1] = '上电';
-        } else if (ele[1] == 2) {
-          ele[1] = '待机';
-        } else if (ele[1] == 3) {
-          ele[1] = '启动';
-        } else if (ele[1] == 4) {
-          ele[1] = '并网';
-        } else if (ele[1] == 5) {
-          ele[1] = '故障';
-        } else if (ele[1] == 6) {
-          ele[1]= '维护';
-        } else if (ele[1] == 7) {
-          ele[1] = '离线';
+        if (ele[2] == 0) {
+          ele[2] = '停机';
+        } else if (ele[2] == 1) {
+          ele[2] = '上电';
+        } else if (ele[2] == 2) {
+          ele[2] = '待机';
+        } else if (ele[2] == 3) {
+          ele[2] = '启动';
+        } else if (ele[2] == 4) {
+          ele[2] = '并网';
+        } else if (ele[2] == 5) {
+          ele[2] = '故障';
+        } else if (ele[2] == 6) {
+          ele[2]= '维护';
+        } else if (ele[2] == 7) {
+          ele[2] = '离线';
         }
       });
       console.log("66 ", data);
@@ -517,6 +601,7 @@ export default {
     link.click()
     document.body.removeChild(link)
   }
+  
 },
     /* 右键菜单 */
     contextmenu() {