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;
+ },
}
};