fix: 导入用例文件上传提示

This commit is contained in:
chenjianxing 2020-07-21 01:30:42 +08:00
parent c41a29e863
commit 466ce4e790
1 changed files with 9 additions and 2 deletions

View File

@ -54,7 +54,9 @@
:http-request="upload" :http-request="upload"
:limit="1" :limit="1"
:beforeUpload="uploadValidate" :beforeUpload="uploadValidate"
:on-remove="handleRemove"
:file-list="fileList" :file-list="fileList"
:on-exceed="handleExceed"
multiple> multiple>
<i class="el-icon-upload"></i> <i class="el-icon-upload"></i>
<div class="el-upload__text" v-html="$t('load_test.upload_tips')"></div> <div class="el-upload__text" v-html="$t('load_test.upload_tips')"></div>
@ -160,7 +162,12 @@
}, },
upload(file) { upload(file) {
this.formData.file = file.file; this.formData.file = file.file;
this.fileList.push(file.file); },
handleExceed(files, fileList) {
this.$warning(this.$t('test_track.case.import.upload_limit_count'));
},
handleRemove(file, fileList) {
this.formData.file = undefined;
}, },
uploadValidate(file, fileList) { uploadValidate(file, fileList) {
let suffix = file.name.substring(file.name.lastIndexOf('.') + 1); let suffix = file.name.substring(file.name.lastIndexOf('.') + 1);
@ -204,7 +211,7 @@
Object.assign(param, this.formData); Object.assign(param, this.formData);
param.platform = this.selectedPlatformValue; param.platform = this.selectedPlatformValue;
param.useEnvironment = this.useEnvironment; param.useEnvironment = this.useEnvironment;
if (!param.file) { if (!this.formData.file) {
this.$warning(this.$t('commons.please_upload')); this.$warning(this.$t('commons.please_upload'));
return ; return ;
} }