From 055e5f9b0dd28544003826d31a16464c9c677c77 Mon Sep 17 00:00:00 2001 From: xiongchengqiang Date: Thu, 21 May 2020 16:46:18 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=AE=8C=E6=88=90=E5=91=98=E5=B7=A5?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E7=9A=84=E5=AF=BC=E5=85=A5=E6=A1=A3=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/modules/staff/manage/index.vue | 37 ++++++++++++++++++++---- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/src/views/modules/staff/manage/index.vue b/src/views/modules/staff/manage/index.vue index 949cf90..2a2f84f 100644 --- a/src/views/modules/staff/manage/index.vue +++ b/src/views/modules/staff/manage/index.vue @@ -186,20 +186,47 @@ export default { }, methods: { // 上传文件 - async handleChange (file) { - console.log('file: ', file) + async handleUpLoad (file) { let data = new FormData() - data.append('filename', file.raw) + data.append('file', file.raw) this.isUploading = true - // return let result = await apiUploadFile(data) this.isUploading = false if (result.code === 0) { - + this.$message.success('上传成功!') } else { this.$message.error(result.msg) } }, + // 确认上传 + async handleChange (file) { + const h = this.$createElement + const _this = this + this.$msgbox({ + title: '提示', + message: h('p', null, [ + h('div', { style: 'color: #a96161' }, '文件名:' + file.name), + h('span', null, '此操作不可逆,是否上传') + ]), + showCancelButton: true, + confirmButtonText: '确定', + cancelButtonText: '取消', + beforeClose: async (action, instance, done) => { + if (action === 'confirm') { + instance.confirmButtonLoading = true + instance.confirmButtonText = '上传中...' + await _this.handleUpLoad(file) + instance.confirmButtonLoading = false + } else { + _this.$message({ + type: 'info', + message: '已取消上传' + }) + } + done() + } + }) + }, async getEmployeesInfo (data) { this.dialogVisible = true