From 87e2e63e00be96ff5a1fbd83230120bff0657ae2 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期二, 10 十二月 2024 09:34:54 +0800
Subject: [PATCH] 项目名称修改

---
 src/views/projectEngineering/projectLibrary/component/FileDialog.vue |   58 +++++++++++++++++++++++++++++++---------------------------
 1 files changed, 31 insertions(+), 27 deletions(-)

diff --git a/src/views/projectEngineering/projectLibrary/component/FileDialog.vue b/src/views/projectEngineering/projectLibrary/component/FileDialog.vue
index 15b09ec..2e16b22 100644
--- a/src/views/projectEngineering/projectLibrary/component/FileDialog.vue
+++ b/src/views/projectEngineering/projectLibrary/component/FileDialog.vue
@@ -37,9 +37,9 @@
         </div>
         <div v-else-if="isImportOrExport" class="dialog-content">
           <el-button class="export-button" @click="handleDownloadTargetList">瀵煎嚭鐩爣鍒楄〃鍐呭</el-button>
-          <el-button class="export-button">瀵煎嚭鎵�鏈夊垪琛ㄥ唴瀹�</el-button>
-          <el-button class="export-button">瀵煎嚭鐩爣椤圭洰璇︽儏</el-button>
-          <el-button class="export-button">瀵煎嚭鎵�鏈夐」鐩鎯�</el-button>
+          <el-button class="export-button" @click="handleDownloadAllList">瀵煎嚭鎵�鏈夊垪琛ㄥ唴瀹�</el-button>
+          <el-button class="export-button" @click="handleDownloadDetailList">瀵煎嚭鐩爣椤圭洰璇︽儏</el-button>
+          <el-button class="export-button" @click="handleDownloadAllList">瀵煎嚭鎵�鏈夐」鐩鎯�</el-button>
         </div>
       </template>
       <template slot="footer">
@@ -54,7 +54,6 @@
 </template>
 
 <script>
-import { globalHeaders } from '@/utils/request';
 
 export default {
   name: 'FileDialog',
@@ -72,10 +71,17 @@
       default: function () {
         return [];
       }
-    }
+    },
+    dataIdList: {
+      type: Array,
+      default: function () {
+        return [];
+      }
+    },
   },
   data() {
     return {
+      queryParams: {},
       uploadRef: null,
       targetColumn: [],
       accept: `.zip`,
@@ -107,25 +113,7 @@
       }
     },
     handleDownloadFile() {
-      const self = this;
-      // fetch(`${process.env.VITE_APP_BASE_API}/project/export/template`, {
-      //   method: 'GET',
-      //   headers: self.upload.headers
-      // })
-      //   .then(response => response.blob())
-      //   .then(blob => {
-      //     const url = window.URL.createObjectURL(blob);
-      //     const a = document.createElement('a');
-      //     a.style.display = 'none';
-      //     a.href = url;
-      //     a.download = `椤圭洰鏂囦欢妯℃澘_${new Date().getTime()}.zip`;
-      //     document.body.appendChild(a);
-      //     a.click();
-      //     window.URL.revokeObjectURL(url);
-      //   })
-      //   .catch(error => {
-      //     console.error('鏂囦欢涓嬭浇澶辫触:', error);
-      //   });
+      this.download('/project/info/export/template', {}, `椤圭洰鏂囦欢妯℃澘_${new Date().getTime()}.zip`)
     },
     submitFileForm() {
       if (this.uploadRef) {
@@ -136,15 +124,31 @@
       this.$emit('fileDialogCancel');
     },
     handleDownloadTargetList() {
-      console.log('瀵煎嚭鐩爣鍒楄〃鍐呭', this.currentColumns);
-      this.targetColumn = this.currentColumns.filter(item => item.visible);
+      this.queryParams.fieldList = this.currentColumns.filter(item => item.visible).map(item =>item.id);
+      this.queryParams.requireFile = false;
+      this.download('project/info/export', {
+          ...this.queryParams
+        }, `椤圭洰搴�${new Date().getTime()}.xlsx`)
+    },
+    handleDownloadAllList() {
+      this.queryParams.fieldList = this.currentColumns;
+      this.queryParams.requireFile = false;
+      this.download('project/info/export', {
+        ...this.queryParams
+      }, `椤圭洰搴�${new Date().getTime()}.xlsx`)
+    },
+    handleDownloadDetailList() {
+      this.queryParams.dataIdList = this.dataIdList
+      this.queryParams.requireFile = true;
+      this.download('project/info/export', {
+        ...this.queryParams
+      }, `椤圭洰搴�${new Date().getTime()}.zip`)
     }
   },
   mounted() {
     this.uploadRef = this.$refs.uploadRef;
   },
   created() {
-
     this.isFileDialogVisible = this.fileDialogVisible;
   }
 };

--
Gitblit v1.8.0