fix(性能设置): 加载关联JMX文件提示多次问题

--bug=1027555 --user=宋昌昌 【性能测试】github#25351,性能模块-场景配置,加载jmx文件后,修改jmx文件再次上传,提示文件已存在,删除资源文件下的jmx后也会提示已存在,只能在项目文件下删除jmx文件后才可以上传,建议在资源文件列表中删除jmx文件后即可重新上传文件。 https://www.tapd.cn/55049933/s/1396989
This commit is contained in:
song-cc-rock 2023-07-25 11:58:38 +08:00 committed by fit2-zhao
parent 7850d9034f
commit c3104c327c
2 changed files with 22 additions and 9 deletions

View File

@ -159,8 +159,12 @@ export default {
handleSelectAll(selection) { handleSelectAll(selection) {
if (selection.length > 0) { if (selection.length > 0) {
this.existFiles.forEach(item => { this.existFiles.forEach(item => {
this.selectIds.add(item.id); if (!this.selectIds.has(item.id)) {
this.selectFiles.push(item); this.selectIds.add(item.id);
}
if (this.selectFiles.filter(f => f.id === item.id).length === 0) {
this.selectFiles.push(item);
}
}); });
} else { } else {
this.existFiles.forEach(item => { this.existFiles.forEach(item => {
@ -184,8 +188,12 @@ export default {
} }
} }
} else { } else {
this.selectIds.add(row.id); if (!this.selectIds.has(row.id)) {
this.selectFiles.push(row); this.selectIds.add(row.id);
}
if (this.selectFiles.filter(f => f.id === row.id).length === 0) {
this.selectFiles.push(row);
}
} }
}, },
getProjectFiles() { getProjectFiles() {
@ -202,8 +210,12 @@ export default {
}, },
handleImport(file) { handleImport(file) {
if (file) { // if (file) { //
this.selectIds.add(file.id); if (!this.selectIds.has(file.id)) {
this.selectFiles.push(file) this.selectIds.add(file.id);
}
if (this.selectFiles.filter(f => f.id === file.id).length === 0) {
this.selectFiles.push(file)
}
this.getJmxContents(); this.getJmxContents();
return; return;
} }
@ -239,6 +251,7 @@ export default {
} }
this.getJmxContents(jmxIds); this.getJmxContents(jmxIds);
this.selectFiles = [];
}, },
getJmxContents(jmxIds) { getJmxContents(jmxIds) {
getJmxContents(jmxIds) getJmxContents(jmxIds)

View File

@ -465,7 +465,7 @@ public class AttachmentService {
fileAttachmentMetadata.setSize(file.getSize()); fileAttachmentMetadata.setSize(file.getSize());
fileAttachmentMetadata.setCreateTime(System.currentTimeMillis()); fileAttachmentMetadata.setCreateTime(System.currentTimeMillis());
fileAttachmentMetadata.setUpdateTime(System.currentTimeMillis()); fileAttachmentMetadata.setUpdateTime(System.currentTimeMillis());
fileAttachmentMetadata.setCreator(SessionUtils.getUser().getName()); fileAttachmentMetadata.setCreator(SessionUtils.getUser() == null ? "admin" : SessionUtils.getUser().getName());
fileAttachmentMetadata.setFilePath(uploadPath); fileAttachmentMetadata.setFilePath(uploadPath);
fileAttachmentMetadataMapper.insert(fileAttachmentMetadata); fileAttachmentMetadataMapper.insert(fileAttachmentMetadata);
return fileAttachmentMetadata; return fileAttachmentMetadata;
@ -494,7 +494,7 @@ public class AttachmentService {
fileAttachmentMetadata.setSize(Integer.valueOf(total).longValue()); fileAttachmentMetadata.setSize(Integer.valueOf(total).longValue());
fileAttachmentMetadata.setCreateTime(System.currentTimeMillis()); fileAttachmentMetadata.setCreateTime(System.currentTimeMillis());
fileAttachmentMetadata.setUpdateTime(System.currentTimeMillis()); fileAttachmentMetadata.setUpdateTime(System.currentTimeMillis());
fileAttachmentMetadata.setCreator(SessionUtils.getUser().getName()); fileAttachmentMetadata.setCreator(SessionUtils.getUser() == null ? "admin" : SessionUtils.getUser().getName());
fileAttachmentMetadata.setFilePath(uploadPath); fileAttachmentMetadata.setFilePath(uploadPath);
fileAttachmentMetadataMapper.insert(fileAttachmentMetadata); fileAttachmentMetadataMapper.insert(fileAttachmentMetadata);
return fileAttachmentMetadata; return fileAttachmentMetadata;
@ -527,7 +527,7 @@ public class AttachmentService {
fileAttachmentMetadata.setId(UUID.randomUUID().toString()); fileAttachmentMetadata.setId(UUID.randomUUID().toString());
fileAttachmentMetadata.setCreateTime(System.currentTimeMillis()); fileAttachmentMetadata.setCreateTime(System.currentTimeMillis());
fileAttachmentMetadata.setUpdateTime(System.currentTimeMillis()); fileAttachmentMetadata.setUpdateTime(System.currentTimeMillis());
fileAttachmentMetadata.setCreator(SessionUtils.getUser().getName()); fileAttachmentMetadata.setCreator(SessionUtils.getUser() == null ? "admin" : SessionUtils.getUser().getName());
fileAttachmentMetadata.setFilePath(copyPath); fileAttachmentMetadata.setFilePath(copyPath);
fileAttachmentMetadataMapper.insert(fileAttachmentMetadata); fileAttachmentMetadataMapper.insert(fileAttachmentMetadata);
} }