From 3149fa88a253076a741f422455f5aab374e63819 Mon Sep 17 00:00:00 2001 From: smallchill Date: Mon, 6 Apr 2020 21:18:45 +0800 Subject: [PATCH] =?UTF-8?q?:tada:=20=E5=A2=9E=E5=8A=A0=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E5=AF=BC=E5=87=BA=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/system/user.vue | 114 +++++++++++++++++++++++++++++++++----- 1 file changed, 100 insertions(+), 14 deletions(-) diff --git a/src/views/system/user.vue b/src/views/system/user.vue index ffd3476..ec9319d 100644 --- a/src/views/system/user.vue +++ b/src/views/system/user.vue @@ -76,7 +76,7 @@ - - 取 消 - 确 定 - + + 取 消 + 确 定 + + + + + + @@ -114,6 +125,7 @@ import {getPostList} from "@/api/system/post"; import {mapGetters} from "vuex"; import website from '@/config/website'; + import {getToken} from '@/util/auth'; export default { data() { @@ -135,7 +147,8 @@ }; return { form: {}, - box: false, + roleBox: false, + excelBox: false, selectionList: [], query: {}, loading: true, @@ -418,7 +431,59 @@ }, ] }, - data: [] + data: [], + excelForm: {}, + excelOption: { + submitBtn: false, + emptyBtn: false, + column: [ + { + label: '模板上传', + prop: 'excelFile', + type: 'upload', + drag: true, + loadText: '模板上传中,请稍等', + span: 24, + propsHttp: { + res: 'data' + }, + tip: '请上传 .xls,.xlsx 标准格式文件', + action: "/api/blade-user/import-user" + }, + { + label: "数据覆盖", + prop: "isCovered", + type: "switch", + align: "center", + width: 80, + dicData: [ + { + label: "否", + value: 0 + }, + { + label: "是", + value: 1 + } + ], + value: 0, + slot: true, + rules: [ + { + required: true, + message: "请选择是否覆盖", + trigger: "blur" + } + ] + }, + { + label: '模板下载', + prop: 'excelTemplate', + formslot: true, + span: 24, + } + ] + } }; }, watch: { @@ -426,6 +491,11 @@ if (this.form.tenantId !== '') { this.initData(this.form.tenantId); } + }, + 'excelForm.isCovered'() { + if (this.excelForm.isCovered !== '') { + this.excelOption.column[0].action = `/api/blade-user/import-user?isCovered=${this.excelForm.isCovered}`; + } } }, computed: { @@ -463,10 +533,10 @@ this.option.group[2].column[3].dicData = res.data.data; }); }, - submit() { + submitRole() { const roleList = this.$refs.treeRole.getCheckedKeys().join(","); grant(this.ids, roleList).then(() => { - this.box = false; + this.roleBox = false; this.$message({ type: "success", message: "操作成功!" @@ -595,14 +665,30 @@ } getRoleTree().then(res => { this.roleGrantList = res.data.data; - this.box = true; + this.roleBox = true; }); }, handleImport() { - + this.excelBox = true; + }, + uploadAfter(res, done, loading, column) { + window.console.log(column); + done(); + this.excelBox = false; + this.refreshChange(); }, handleExport() { - + this.$confirm("是否导出用户数据?", "提示", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning" + }).then(() => { + const searchForm = this.$refs.crud.searchForm; + window.open(`/api/blade-user/export-user?Blade-Auth=${getToken()}&account=${searchForm.account}&realName=${searchForm.realName}`); + }); + }, + handleTemplate() { + window.open(`/api/blade-user/export-template?Blade-Auth=${getToken()}`); }, beforeOpen(done, type) { if (["edit", "view"].includes(type)) {