fix(接口定义): 修复重新上传csv报错的缺陷

--bug=1016598 --user=王孝刚 【接口测试】github#17676,2.1版本本地上传方式,重新上传csv报错
https://www.tapd.cn/55049933/s/1239618
This commit is contained in:
wxg0103 2022-09-06 17:43:13 +08:00 committed by jianxing
parent d776006d1f
commit 4b2a17eef8
2 changed files with 23 additions and 3 deletions

View File

@ -28,7 +28,9 @@
<span slot="file"/> <span slot="file"/>
</el-upload> </el-upload>
</div> </div>
<el-button type="text" @click="associationFile">{{ $t('permission.project_file.associated_files') }}</el-button> <el-button type="text" @click="associationFile">{{
$t('permission.project_file.associated_files')
}}</el-button>
<i class="el-icon-plus" slot="reference"/> <i class="el-icon-plus" slot="reference"/>
</el-popover> </el-popover>
</div> </div>
@ -103,7 +105,14 @@ export default {
if (this.file && this.file.file) { if (this.file && this.file.file) {
files.push(this.file.file); files.push(this.file.file);
} }
let request = {id: getUUID(), csv: true, resourceId: this.file.id, moduleId: moduleId, projectId: getCurrentProjectID(), fileName: this.file.name}; let request = {
id: getUUID(),
csv: true,
resourceId: this.file.id,
moduleId: moduleId,
projectId: getCurrentProjectID(),
fileName: this.file.name
};
this.$fileUpload("/file/metadata/dump/file", null, files, request, (response) => { this.$fileUpload("/file/metadata/dump/file", null, files, request, (response) => {
this.$success(this.$t("organization.integration.successful_operation")); this.$success(this.$t("organization.integration.successful_operation"));
}); });
@ -125,7 +134,14 @@ export default {
this.$warning(this.$t('variables.cvs_info')); this.$warning(this.$t('variables.cvs_info'));
return; return;
} }
let file = {name: item.name, id: getUUID(), fileId: item.id, storage: "FILE_REF", projectId: item.projectId, fileType: item.type}; let file = {
name: item.name,
id: getUUID(),
fileId: item.id,
storage: "FILE_REF",
projectId: item.projectId,
fileType: item.type
};
this.parameter.files.push(file); this.parameter.files.push(file);
}) })
}, },
@ -177,12 +193,14 @@ export default {
callback: (action) => { callback: (action) => {
if (action === 'confirm') { if (action === 'confirm') {
this.$refs.upload.handleRemove(file); this.$refs.upload.handleRemove(file);
this.$refs.uploadLocal.handleRemove(file);
for (let i = 0; i < this.parameter.files.length; i++) { for (let i = 0; i < this.parameter.files.length; i++) {
let paramFileName = this.parameter.files[i].name ? let paramFileName = this.parameter.files[i].name ?
this.parameter.files[i].name : this.parameter.files[i].file.name; this.parameter.files[i].name : this.parameter.files[i].file.name;
if (fileName === paramFileName) { if (fileName === paramFileName) {
this.parameter.files.splice(i, 1); this.parameter.files.splice(i, 1);
this.$refs.upload.handleRemove(file); this.$refs.upload.handleRemove(file);
this.$refs.uploadLocal.handleRemove(file);
break; break;
} }
} }

View File

@ -176,12 +176,14 @@ export default {
callback: (action) => { callback: (action) => {
if (action === 'confirm') { if (action === 'confirm') {
this.$refs.upload.handleRemove(file); this.$refs.upload.handleRemove(file);
this.$refs.uploadLocal.handleRemove(file);
for (let i = 0; i < this.parameter.files.length; i++) { for (let i = 0; i < this.parameter.files.length; i++) {
let paramFileName = this.parameter.files[i].name ? let paramFileName = this.parameter.files[i].name ?
this.parameter.files[i].name : this.parameter.files[i].file.name; this.parameter.files[i].name : this.parameter.files[i].file.name;
if (fileName === paramFileName) { if (fileName === paramFileName) {
this.parameter.files.splice(i, 1); this.parameter.files.splice(i, 1);
this.$refs.upload.handleRemove(file); this.$refs.upload.handleRemove(file);
this.$refs.uploadLocal.handleRemove(file);
break; break;
} }
} }