From 5fbe8f88f7986375c4bee8971281bf2a3ab92c33 Mon Sep 17 00:00:00 2001 From: "382696293@qq.com" <382696293@qq.com> Date: Tue, 27 Feb 2024 17:15:01 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90ID1000395=E3=80=91=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E3=80=81=E5=BA=8F=E5=88=97=E5=8F=B7=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E5=AF=BC=E5=85=A5pdf=E6=96=87=E4=BB=B6=EF=BC=8C?= =?UTF-8?q?=E6=9C=89=E4=B8=A4=E7=A7=8D=E9=94=99=E8=AF=AF=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=EF=BC=8C=E6=96=87=E4=BB=B6=E5=B7=B2=E4=B8=8A=E4=BC=A0=EF=BC=8C?= =?UTF-8?q?=E5=8F=AF=E5=A4=8D=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/system/instrumentSerial/index.vue | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/flossom-ui/src/views/system/instrumentSerial/index.vue b/flossom-ui/src/views/system/instrumentSerial/index.vue index a1082cb..8496785 100644 --- a/flossom-ui/src/views/system/instrumentSerial/index.vue +++ b/flossom-ui/src/views/system/instrumentSerial/index.vue @@ -245,6 +245,7 @@ :on-success="handleFileSuccess" :auto-upload="false" drag + :before-upload="handleBeforeUpload" >
将文件拖到此处,或点击上传
@@ -758,7 +759,18 @@ export default { // 提交上传文件 submitFileForm() { this.$refs.upload.submit(); - } + }, + handleBeforeUpload(file) { + let fileType = ["xls", "xlsx"] + const fileName = file.name.split('.'); + const fileExt = fileName[fileName.length - 1]; + const isTypeOk = fileType.indexOf(fileExt) >= 0; + if (!isTypeOk) { + this.$modal.msgError(`文件类型只能为xls格式/.xlsx格式`); + return false; + } + return true; + }, } };