From 3413d3fcbe4d2b80685a0ec62a460b7cdb40b0ff Mon Sep 17 00:00:00 2001 From: Theo <971366405@qq.com> Date: Tue, 14 Jan 2025 11:03:22 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20:recycle:=20=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=94=99=E8=AF=AF=E6=8F=90=E7=A4=BA=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 导入增加错误提示信息 --- src/api/system/user.ts | 2 +- src/types/global.d.ts | 13 ++ .../system/user/components/UserImport.vue | 187 ++++++++++++------ 3 files changed, 137 insertions(+), 65 deletions(-) diff --git a/src/api/system/user.ts b/src/api/system/user.ts index 7045f6c3..b58e6f50 100644 --- a/src/api/system/user.ts +++ b/src/api/system/user.ts @@ -126,7 +126,7 @@ const UserAPI = { import(deptId: number, file: File) { const formData = new FormData(); formData.append("file", file); - return request({ + return request({ url: `${USER_BASE_URL}/import`, method: "post", params: { deptId: deptId }, diff --git a/src/types/global.d.ts b/src/types/global.d.ts index dfb3f337..efc4ba45 100644 --- a/src/types/global.d.ts +++ b/src/types/global.d.ts @@ -89,5 +89,18 @@ declare global { /** 子列表 */ children?: OptionType[]; } + /** + * 导入结果 + */ + interface ExcelResult { + /** 状态码 */ + code: string; + /** 无效数据条数 */ + invalidCount: number; + /** 有效数据条数 */ + validCount: number; + /** 错误信息 */ + messageList: Array; + } } export {}; diff --git a/src/views/system/user/components/UserImport.vue b/src/views/system/user/components/UserImport.vue index bfe37fd7..573bdca6 100644 --- a/src/views/system/user/components/UserImport.vue +++ b/src/views/system/user/components/UserImport.vue @@ -1,70 +1,97 @@