From f72b4b8d563acd6d2829018be0d079a835911f18 Mon Sep 17 00:00:00 2001 From: kils Date: Wed, 19 Jun 2024 16:51:51 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=89=B9=E9=87=8F=E5=AF=BC=E5=85=A5=E5=8A=9F=E8=83=BD=20(#23)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/system/type.ts | 9 + src/apis/system/user.ts | 17 +- src/views/system/user/UserImportModal.vue | 196 ++++++++++++++++++++++ src/views/system/user/index.vue | 33 +++- 4 files changed, 247 insertions(+), 8 deletions(-) create mode 100644 src/views/system/user/UserImportModal.vue diff --git a/src/apis/system/type.ts b/src/apis/system/type.ts index 63261b8..2de3400 100644 --- a/src/apis/system/type.ts +++ b/src/apis/system/type.ts @@ -25,6 +25,15 @@ export type UserDetailResp = UserResp & { pwdResetTime?: string } +export interface UserImportResp { + importKey: string + totalRows: number + validRows: number + duplicateUserRows: number + duplicateEmailRows: number + duplicatePhoneRows: number +} + export interface UserQuery { description?: string status?: number diff --git a/src/apis/system/user.ts b/src/apis/system/user.ts index 344946c..b7add2d 100644 --- a/src/apis/system/user.ts +++ b/src/apis/system/user.ts @@ -30,10 +30,25 @@ export function deleteUser(ids: string | Array) { /** @desc 导出用户 */ export function exportUser(query: System.UserQuery) { - return http.download(`${BASE_URL}/export`, query) + return http.download(`${BASE_URL}/export`, query) } /** @desc 重置密码 */ export function resetUserPwd(data: any, id: string) { return http.patch(`${BASE_URL}/${id}/password`, data) } + +/** @desc 下载用户导入模板 */ +export function downloadImportUserTemplate() { + return http.download(`${BASE_URL}/downloadImportUserTemplate`) +} + +/** @desc 解析用户导入数据 */ +export function parseImportUser(data: FormData) { + return http.post(`${BASE_URL}/parseImportUser`, data) +} + +/** @desc 导入用户 */ +export function importUser(data: any) { + return http.post(`${BASE_URL}/import`, data) +} diff --git a/src/views/system/user/UserImportModal.vue b/src/views/system/user/UserImportModal.vue new file mode 100644 index 0000000..b069501 --- /dev/null +++ b/src/views/system/user/UserImportModal.vue @@ -0,0 +1,196 @@ + + + + + diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue index 7cb7c66..0c12f9c 100644 --- a/src/views/system/user/index.vue +++ b/src/views/system/user/index.vue @@ -13,21 +13,31 @@ + :scroll="{ x: '100%', y: '100%', minWidth: 1500 }" :pagination="pagination" :disabled-tools="['size']" + :disabled-column-keys="['username']" @refresh="search">