From 3aedad63dd01f1fc5154cb520af32edab967d6e0 Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周一, 12 5月 2025 09:15:26 +0800
Subject: [PATCH] Merge branch 'master' of http://222.71.245.114:9086/r/HIA24016N_PipeLineDemo

---
 PipeLineLems/pipelinelems_web/src/widgets/WorkPlan/Controllers/File.ts |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/PipeLineLems/pipelinelems_web/src/widgets/WorkPlan/Controllers/File.ts b/PipeLineLems/pipelinelems_web/src/widgets/WorkPlan/Controllers/File.ts
new file mode 100644
index 0000000..9162fef
--- /dev/null
+++ b/PipeLineLems/pipelinelems_web/src/widgets/WorkPlan/Controllers/File.ts
@@ -0,0 +1,31 @@
+import { importFileToService, exportFileToClient } from '@/api/file' 
+import { ElMessage } from 'element-plus' 
+import { downloadFile } from '@/utils' 
+import dayjs from 'dayjs' 
+ 
+export const useFile = () => { 
+  /** 
+   * 瀵煎叆鏂囦欢 
+   * @param url 
+   */ 
+  const importFile = async (url: string, file: File) => { 
+    const formData = new FormData() 
+    formData.append('file', file) 
+    await importFileToService(url, formData) 
+    ElMessage('瀵煎叆鎴愬姛') 
+  } 
+  /** 
+   * 瀵煎嚭鏂囦欢 
+   * @param url 
+   */ 
+  const exportFile = async (url: string, params: any, name: string) => { 
+    const res = await exportFileToClient(url, params) 
+    downloadFile(res, `${name}_${dayjs().format('YYYYMMDDHHMMss')}.xlsx`) 
+    ElMessage.success('瀵煎嚭鎴愬姛') 
+  } 
+ 
+  return { 
+    importFile, 
+    exportFile, 
+  } 
+} 

--
Gitblit v1.9.3