From 9cc9187d1d56332ab06620ae5bce8a9d0d2045bd Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周四, 08 5月 2025 09:32:41 +0800
Subject: [PATCH] 增加 公共工具api
---
Weben_CMS专用代码生成器/Weben_CMS_TemplateDemo/web/src/widgets/HIAWms/Controllers/File.ts | 62 +++++++++++++++---------------
1 files changed, 31 insertions(+), 31 deletions(-)
diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/web/src/widgets/HIAWms/Controllers/File.ts" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/web/src/widgets/HIAWms/Controllers/File.ts"
index 75397ed..9162fef 100644
--- "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/web/src/widgets/HIAWms/Controllers/File.ts"
+++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/web/src/widgets/HIAWms/Controllers/File.ts"
@@ -1,31 +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,
- }
-}
+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