From a689af1348938afd3b4506aad9b6d5057193e25d Mon Sep 17 00:00:00 2001
From: ZZJ <10913410+zzj2100@user.noreply.gitee.com>
Date: 星期五, 27 五月 2022 09:59:00 +0800
Subject: [PATCH] bug修复

---
 src/views/equipmentManagement/equipmentList/components/FormList.vue |   81 ++++++++++++++++++++++++++++++++++++----
 1 files changed, 72 insertions(+), 9 deletions(-)

diff --git a/src/views/equipmentManagement/equipmentList/components/FormList.vue b/src/views/equipmentManagement/equipmentList/components/FormList.vue
index ce47fc3..dda4626 100644
--- a/src/views/equipmentManagement/equipmentList/components/FormList.vue
+++ b/src/views/equipmentManagement/equipmentList/components/FormList.vue
@@ -44,7 +44,7 @@
       <div class="button add" @click="isShowAdd = true">
         <span>+</span>娣诲姞璁惧
       </div>
-      <div class="button export">
+      <div class="button export" @click="exportFile">
         <span class="iconfont">&#xe614;</span>瀵煎嚭
       </div>
     </div>
@@ -101,7 +101,7 @@
         </el-table-column>
 
         <el-table-column label="鎵�灞為泦缇�" show-overflow-tooltip min-width="154">
-          <template> -- </template>
+          <template slot-scope="scope"> {{ scope.row.clusterName }} </template>
         </el-table-column>
 
         <el-table-column label="鐘舵��" min-width="70">
@@ -195,7 +195,11 @@
 </template>
 
 <script>
-import { findDevList, findClustersBySearch } from "@/api/device";
+import {
+  findDevList,
+  findClustersBySearch,
+  exportDevListExcel,
+} from "@/api/device";
 import AddBox from "@/views/equipmentManagement/equipmentList/components/AddBox";
 import UnbindBox from "@/views/equipmentManagement/equipmentDetail/components/UnbindBox";
 import QuitClusterBox from "@/views/equipmentManagement/equipmentList/components/QuitClusterBox";
@@ -379,6 +383,7 @@
     clearSearch() {
       this.searchTime = this.getDateInit();
       this.inputText = "";
+      this.cluster = "";
       this.searchingBtn();
     },
 
@@ -398,6 +403,54 @@
       }
       this.activeEquipment = equipment;
       this.showJoin = true;
+    },
+
+    //瀵煎嚭鍒楄〃鏂囦欢
+    async exportFile() {
+      let param = {};
+
+      if (!this.searchTime) {
+        param = {
+          page: this.page,
+          size: this.size,
+          startTime: "",
+          endTime: "",
+          clusterId: this.cluster,
+          inputText: this.inputText,
+        };
+      } else {
+        param = {
+          page: this.page,
+          size: this.size,
+          startTime: this.searchTime[0],
+          endTime: this.searchTime[1],
+          clusterId: this.cluster,
+          inputText: this.inputText,
+        };
+      }
+      const result = await exportDevListExcel(param);
+
+      var blob = new Blob([result.body.data], {
+          type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8",
+        }),
+        Temp = document.createElement("a");
+
+      Temp.href = window.URL.createObjectURL(blob);
+
+      console.log(result);
+      console.log(result.fileName);
+
+      Temp.download = window.decodeURI(result.fileName);
+
+      Temp.setAttribute("download", result.fileName);
+
+      document.body.appendChild(Temp);
+
+      Temp.click();
+
+      document.body.removeChild(Temp);
+
+      window.URL.revokeObjectURL(Temp);
     },
   },
   mounted() {
@@ -428,7 +481,7 @@
 
     .cluster {
       .el-select {
-        width: 200px;
+        width: 190px;
         height: 40px;
         line-height: 40px;
 
@@ -469,7 +522,7 @@
     }
 
     .el-input ::v-deep {
-      width: 280px;
+      width: 270px;
       height: 40px;
       margin-left: 10px;
       margin-right: 20px;
@@ -487,7 +540,7 @@
     }
 
     .el-date-editor {
-      width: 318px;
+      width: 340px;
       height: 40px;
       margin-left: 10px;
       margin-right: 20px;
@@ -503,7 +556,7 @@
     }
 
     .searchBtn {
-      width: 120px;
+      width: 110px;
       height: 40px;
       line-height: 40px;
       text-align: center;
@@ -513,7 +566,7 @@
     }
 
     .resetBtn {
-      width: 120px;
+      width: 110px;
       height: 40px;
       line-height: 40px;
       text-align: center;
@@ -616,7 +669,7 @@
 
   .el-pagination ::v-deep {
     margin-top: 30px;
-    text-align: center;
+    text-align: right;
     height: 24px;
     .el-pagination__sizes {
       margin-right: 0;
@@ -650,6 +703,16 @@
         border-color: #0065ff;
       }
     }
+
+    .el-pagination__jump {
+      margin-left: 12px;
+      .el-pagination__editor {
+        width: 37px;
+        input {
+          width: 32px;
+        }
+      }
+    }
   }
 }
 </style>

--
Gitblit v1.8.0