fix(测试跟踪):导入缺陷文件内容错误后,修改原始文件并保存,报network_error

--bug=1026473 --user=王旭 【测试跟踪】缺陷管理,导入缺陷文件内容错误后,修改一下原始文件再保存,报network error https://www.tapd.cn/55049933/s/1379517
This commit is contained in:
WangXu10 2023-06-09 14:16:30 +08:00 committed by fit2-zhao
parent 0152880a5e
commit 1045257972
4 changed files with 39 additions and 28 deletions

View File

@ -197,6 +197,7 @@ export default {
upload_limit_count: "Only one file can be uploaded at a time",
upload_limit_format: "Upload files can only be XLS, XLSX format!",
upload_limit_size: "Upload file size cannot exceed 100MB!",
upload_refresh_tips: "Content has been updated, please upload the file again!",
upload_limit_other_size: "Upload file size cannot exceed",
success: "Import success",
error: "Import error",

View File

@ -174,6 +174,7 @@ export default {
upload_limit_count: "一次只能上传一个文件",
upload_limit_format: "只支持 xls/xlsx格式文件",
upload_limit_size: "上传文件大小不能超过 100MB!",
upload_refresh_tips: "内容已更新,请重新上传文件!",
success: "导入成功",
error: "导入失败",
importing: "导入中...",

View File

@ -174,6 +174,7 @@ export default {
upload_limit_count: "一次只能上傳一個文件",
upload_limit_format: "只支持 xls/xlsx格式文件",
upload_limit_size: "上傳文件大小不能超過 100MB!",
upload_refresh_tips: "内容已更新,請重新上傳文件!",
success: "導入成功!",
importing: "導入中...",
excel_title: "錶格文件",

View File

@ -123,35 +123,43 @@ export default {
return;
}
let uploadFile = this.uploadFiles[0]
let suffix = uploadFile.name.substring(uploadFile.name.lastIndexOf('.') + 1);
if (suffix !== 'xls' && suffix !== 'xlsx') {
this.$warning(this.$t('test_track.case.import.upload_limit_format'));
return;
}
if (uploadFile.size / 1024 / 1024 > 100) {
this.$warning(this.$t('test_track.case.import.upload_limit_size'));
return;
}
let param = {
workspaceId: getCurrentWorkspaceId(),
projectId: getCurrentProjectID(),
userId: getCurrentUserId(),
importType: this.importType
};
this.loading = true;
this.$fileUpload('/issues/import', uploadFile, param)
.then(response => {
this.loading = false;
let res = response.data;
if (res.success) {
this.$success(this.$t('test_track.case.import.success'));
this.cancel();
this.$emit("refresh");
} else {
this.errList = res.errList;
this.uploadFiles[0].slice(0, 1).arrayBuffer()
.then(() => {
let suffix = uploadFile.name.substring(uploadFile.name.lastIndexOf('.') + 1);
if (suffix !== 'xls' && suffix !== 'xlsx') {
this.$warning(this.$t('test_track.case.import.upload_limit_format'));
return;
}
}).catch((err) => {
this.loading = false;
if (uploadFile.size / 1024 / 1024 > 100) {
this.$warning(this.$t('test_track.case.import.upload_limit_size'));
return;
}
let param = {
workspaceId: getCurrentWorkspaceId(),
projectId: getCurrentProjectID(),
userId: getCurrentUserId(),
importType: this.importType
};
this.loading = true;
this.$fileUpload('/issues/import', uploadFile, param)
.then(response => {
this.loading = false;
let res = response.data;
if (res.success) {
this.$success(this.$t('test_track.case.import.success'));
this.cancel();
this.$emit("refresh");
} else {
this.errList = res.errList;
}
}).catch((err) => {
this.loading = false;
});
})
.catch((err) => {
this.$warning(this.$t('test_track.case.import.upload_refresh_tips'));
return;
});
}
}