From cedd2d1daf444c0f74ca2a7844e769d524877279 Mon Sep 17 00:00:00 2001 From: RuoYi <yzz_ivy@163.com> Date: 星期三, 17 十一月 2021 11:57:17 +0800 Subject: [PATCH] 优化导出数据操作 --- ruoyi-ui/src/views/system/user/index.vue | 22 +++++++--------------- 1 files changed, 7 insertions(+), 15 deletions(-) diff --git a/ruoyi-ui/src/views/system/user/index.vue b/ruoyi-ui/src/views/system/user/index.vue index 4f20b08..2b7283f 100644 --- a/ruoyi-ui/src/views/system/user/index.vue +++ b/ruoyi-ui/src/views/system/user/index.vue @@ -131,7 +131,6 @@ plain icon="el-icon-download" size="mini" - :loading="exportLoading" @click="handleExport" v-hasPermi="['system:user:export']" >瀵煎嚭</el-button> @@ -346,7 +345,7 @@ </template> <script> -import { listUser, getUser, delUser, addUser, updateUser, exportUser, resetUserPwd, changeUserStatus, importTemplate } from "@/api/system/user"; +import { listUser, getUser, delUser, addUser, updateUser, resetUserPwd, changeUserStatus } from "@/api/system/user"; import { getToken } from "@/utils/auth"; import { treeselect } from "@/api/system/dept"; import Treeselect from "@riophae/vue-treeselect"; @@ -360,8 +359,6 @@ return { // 閬僵灞� loading: true, - // 瀵煎嚭閬僵灞� - exportLoading: false, // 閫変腑鏁扮粍 ids: [], // 闈炲崟涓鐢� @@ -643,14 +640,9 @@ }, /** 瀵煎嚭鎸夐挳鎿嶄綔 */ handleExport() { - const queryParams = this.queryParams; - this.$modal.confirm('鏄惁纭瀵煎嚭鎵�鏈夌敤鎴锋暟鎹」锛�').then(() => { - this.exportLoading = true; - return exportUser(queryParams); - }).then(response => { - this.$download.name(response.msg); - this.exportLoading = false; - }).catch(() => {}); + this.download('system/user/export', { + ...this.queryParams + }, `user_${new Date().getTime()}.xlsx`) }, /** 瀵煎叆鎸夐挳鎿嶄綔 */ handleImport() { @@ -659,9 +651,9 @@ }, /** 涓嬭浇妯℃澘鎿嶄綔 */ importTemplate() { - importTemplate().then(response => { - this.$download.name(response.msg); - }); + this.download('system/user/importTemplate', { + ...this.queryParams + }, `user_template_${new Date().getTime()}.xlsx`) }, // 鏂囦欢涓婁紶涓鐞� handleFileUploadProgress(event, file, fileList) { -- Gitblit v1.9.3