From 4444768153469a8eb86a4727da0043b6587415ec Mon Sep 17 00:00:00 2001
From: qb <1191961160@qq.com>
Date: Mon, 3 Mar 2025 16:37:01 +0800
Subject: [PATCH] =?UTF-8?q?=E4=B8=89=E6=96=B9=E7=89=A9=E6=96=99=E6=96=B0?=
 =?UTF-8?q?=E5=A2=9E=E5=AF=BC=E5=87=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/api/basicdata/TripartiteMaterial.js       | 12 +++++++++
 .../basicdata/TripartiteMaterial/list.vue     | 26 ++++++++++++++++++-
 2 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/src/api/basicdata/TripartiteMaterial.js b/src/api/basicdata/TripartiteMaterial.js
index 1613b33c..5c7a8eec 100644
--- a/src/api/basicdata/TripartiteMaterial.js
+++ b/src/api/basicdata/TripartiteMaterial.js
@@ -61,6 +61,18 @@ export const getDownTemplate = () => {
   });
 };
 
+/**
+ * 导出
+ */
+export const getExportList = data => {
+  return request({
+    url: '/api/logpm-basicdata/factoryCategory/exportList',
+    method: 'post',
+    data,
+    responseType: 'blob',
+  });
+};
+
 /**
  * 获取详情列表
  */
diff --git a/src/views/basicdata/TripartiteMaterial/list.vue b/src/views/basicdata/TripartiteMaterial/list.vue
index 26bd0e16..ee4a6db9 100644
--- a/src/views/basicdata/TripartiteMaterial/list.vue
+++ b/src/views/basicdata/TripartiteMaterial/list.vue
@@ -33,7 +33,7 @@
             "
             >导 入
           </el-button>
-          <!-- <el-button type="primary" icon="Edit" @click="handleEdit"> 编辑 </el-button> -->
+          <el-button type="primary" icon="Download" @click="handleExport"> 导出 </el-button>
         </div>
         <!-- 头部右侧按钮模块 -->
         <div class="avue-crud__right">
@@ -252,6 +252,7 @@ import {
   postLazyTree,
   postBrandLists,
   getDownTemplate,
+  getExportList,
 } from '@/api/basicdata/TripartiteMaterial';
 
 import { useStore } from 'vuex';
@@ -644,6 +645,29 @@ const handleDownloadTemplate = async () => {
   }
 };
 
+/** 导出 */
+const handleExport = async () => {
+  try {
+    details.loadingObj.pageLoading = true;
+
+    const submitData = { ...details.query };
+
+    const res = await getExportList(submitData);
+
+    const { status, data } = res;
+
+    if (status !== 200) return;
+
+    downloadXls(data, '三方物料 - ' + new Date().getTime() + '.xlsx');
+
+    console.log('res :>> ', res);
+  } catch (error) {
+    console.log('error :>> ', error);
+  } finally {
+    details.loadingObj.pageLoading = false;
+  }
+};
+
 /** 导出表格数据 */
 const handleExportData = () => {
   exportExcel(details.columnList, details.data, '三方物料 - ' + new Date().getTime());