From 50c81a2b6fca9e6c8fd97cc5bf04b4ce430b0a4e Mon Sep 17 00:00:00 2001 From: dshclm <3321914460@qq.com> Date: Thu, 11 Jul 2024 10:43:58 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=95=E9=A2=98=E7=AE=A1=E7=90=86=E5=AF=BC?= =?UTF-8?q?=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/system/elExam/qu/toImport.html | 44 ++++++++++++++++--- 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/ruoyi-admin/src/main/resources/templates/system/elExam/qu/toImport.html b/ruoyi-admin/src/main/resources/templates/system/elExam/qu/toImport.html index 0b8a50b..31ff4ed 100644 --- a/ruoyi-admin/src/main/resources/templates/system/elExam/qu/toImport.html +++ b/ruoyi-admin/src/main/resources/templates/system/elExam/qu/toImport.html @@ -4,13 +4,30 @@ - +
- 上传导入 - 下载导入模板 + 导入文件 + 下载导入模板 + +
+ 请选择后缀为 “xls”或“xlsx”的文件。 +
+
+ +
+ + {{file.name}} + 删除 + +
+
+ + 确认上传 + 取消 +
@@ -24,7 +41,8 @@ var app = new Vue({ el: '#app', data: { - importVisible:false + importVisible:false, + fileList:[] }, mounted(){ @@ -81,10 +99,21 @@ importExcel(file) { return this.upload('system/qu/import', file) }, + deleteFile(index){ + this.fileList= [] + }, doImport(e) { - const file = e.target.files[0] + let file = e.target.files[0] + if (!file.name.match(/\.(xls|xlsx)$/i)) { + // Display error message if the file extension is not .xls or .xlsx + this.$message.error('请选择Excel文件 (.xls, .xlsx)'); + return; + } + this.fileList = e.target.files + }, + save(){ let that = this - this.importExcel(file).then((res)=>{ + this.importExcel(this.fileList[0]).then((res)=>{ console.log(res) if (res.data.code !== 0) { that.$alert(res.data.msg, '导入信息', { @@ -100,6 +129,9 @@ } }) }, + canle(){ + $.modal.close() + }, // 成功回调执行事件(父窗体静默更新) successCallback: function(result) { if (result.data.code == web_status.SUCCESS) {