refactor(测试跟踪): 附件上传删除关联操作日志优化
This commit is contained in:
parent
9e5641ddd3
commit
e2dae826ff
|
@ -525,7 +525,7 @@ export function getUrl(d, _this) {
|
|||
case "测试用例" :
|
||||
case "測試用例" :
|
||||
case "Test case":
|
||||
url += "/track/case/all?resourceId=" + resourceId;
|
||||
url += "/track/case/edit/" + resourceId;
|
||||
break;
|
||||
case "系统-用户":
|
||||
case "System user":
|
||||
|
|
|
@ -30,9 +30,15 @@ public class AttachmentController {
|
|||
@Resource
|
||||
private FileMetadataService fileMetadataService;
|
||||
|
||||
@MsAuditLog(module = OperLogModule.TRACK_TEST_CASE, type = OperLogConstants.UPDATE, title = "#request.belongType", content = "#msClass.getLogDetails(#request.belongId, #request.belongType, #file.getOriginalFilename(), false)", msClass = AttachmentService.class)
|
||||
@PostMapping(value = "/upload", consumes = {"multipart/form-data"})
|
||||
public void uploadAttachment(@RequestPart("request") AttachmentRequest request, @RequestPart(value = "file", required = false) MultipartFile file) {
|
||||
@MsAuditLog(module = OperLogModule.TRACK_BUG, type = OperLogConstants.UPDATE, content = "#msClass.getLogDetails(#request.belongId, #request.belongType, #file.getOriginalFilename(), false)", msClass = AttachmentService.class)
|
||||
@PostMapping(value = "/issue/upload", consumes = {"multipart/form-data"})
|
||||
public void uploadIssueAttachment(@RequestPart("request") AttachmentRequest request, @RequestPart(value = "file", required = false) MultipartFile file) {
|
||||
attachmentService.uploadAttachment(request, file);
|
||||
}
|
||||
|
||||
@MsAuditLog(module = OperLogModule.TRACK_TEST_CASE, type = OperLogConstants.UPDATE, content = "#msClass.getLogDetails(#request.belongId, #request.belongType, #file.getOriginalFilename(), false)", msClass = AttachmentService.class)
|
||||
@PostMapping(value = "/testcase/upload", consumes = {"multipart/form-data"})
|
||||
public void uploadTestCaseAttachment(@RequestPart("request") AttachmentRequest request, @RequestPart(value = "file", required = false) MultipartFile file) {
|
||||
attachmentService.uploadAttachment(request, file);
|
||||
}
|
||||
|
||||
|
@ -61,10 +67,16 @@ public class AttachmentController {
|
|||
}
|
||||
}
|
||||
|
||||
@MsAuditLog(module = OperLogModule.TRACK_TEST_CASE, type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#attachmentId, #attachmentType)", title = "#request.belongType", msClass = AttachmentService.class)
|
||||
@GetMapping("/delete/{attachmentType}/{attachmentId}")
|
||||
public void deleteAttachment(@PathVariable String attachmentId, @PathVariable String attachmentType) {
|
||||
attachmentService.deleteAttachment(attachmentId, attachmentType);
|
||||
@MsAuditLog(module = OperLogModule.TRACK_TEST_CASE, type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#attachmentId, 'testcase')", msClass = AttachmentService.class)
|
||||
@GetMapping("/delete/testcase/{attachmentId}")
|
||||
public void deleteTestCaseAttachment(@PathVariable String attachmentId) {
|
||||
attachmentService.deleteAttachment(attachmentId, "testcase");
|
||||
}
|
||||
|
||||
@MsAuditLog(module = OperLogModule.TRACK_BUG, type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#attachmentId, 'issue')", msClass = AttachmentService.class)
|
||||
@GetMapping("/delete/issue/{attachmentId}")
|
||||
public void deleteIssueAttachment(@PathVariable String attachmentId) {
|
||||
attachmentService.deleteAttachment(attachmentId, "issue");
|
||||
}
|
||||
|
||||
@PostMapping("/metadata/list")
|
||||
|
@ -72,15 +84,27 @@ public class AttachmentController {
|
|||
return attachmentService.listMetadata(request);
|
||||
}
|
||||
|
||||
@PostMapping("/metadata/relate")
|
||||
@MsAuditLog(module = OperLogModule.TRACK_TEST_CASE, type = OperLogConstants.UPDATE, title = "#request.belongType", content = "#msClass.getLogDetails(#request.belongId, #request.belongType, #request.metadataRefIds, true)", msClass = AttachmentService.class)
|
||||
public void relate(@RequestBody AttachmentRequest request) {
|
||||
@PostMapping("/testcase/metadata/relate")
|
||||
@MsAuditLog(module = OperLogModule.TRACK_TEST_CASE, type = OperLogConstants.UPDATE, content = "#msClass.getLogDetails(#request.belongId, #request.belongType, #request.metadataRefIds, true)", msClass = AttachmentService.class)
|
||||
public void caseRelate(@RequestBody AttachmentRequest request) {
|
||||
attachmentService.relate(request);
|
||||
}
|
||||
|
||||
@PostMapping("/metadata/unrelated")
|
||||
@MsAuditLog(module = OperLogModule.TRACK_TEST_CASE, type = OperLogConstants.UPDATE, title = "#request.belongType", beforeEvent = "#msClass.getLogDetails(#request.belongId, #request.belongType, #request.metadataRefIds)", msClass = AttachmentService.class)
|
||||
public void unrelated(@RequestBody AttachmentRequest request) {
|
||||
@PostMapping("/issue/metadata/relate")
|
||||
@MsAuditLog(module = OperLogModule.TRACK_BUG, type = OperLogConstants.UPDATE, content = "#msClass.getLogDetails(#request.belongId, #request.belongType, #request.metadataRefIds, true)", msClass = AttachmentService.class)
|
||||
public void issueRelate(@RequestBody AttachmentRequest request) {
|
||||
attachmentService.relate(request);
|
||||
}
|
||||
|
||||
@PostMapping("/testcase/metadata/unrelated")
|
||||
@MsAuditLog(module = OperLogModule.TRACK_TEST_CASE, type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#request.belongId, #request.belongType, #request.metadataRefIds)", msClass = AttachmentService.class)
|
||||
public void caseUnrelated(@RequestBody AttachmentRequest request) {
|
||||
attachmentService.unrelated(request);
|
||||
}
|
||||
|
||||
@PostMapping("/issue/metadata/unrelated")
|
||||
@MsAuditLog(module = OperLogModule.TRACK_BUG, type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#request.belongId, #request.belongType, #request.metadataRefIds)", msClass = AttachmentService.class)
|
||||
public void issueUnrelated(@RequestBody AttachmentRequest request) {
|
||||
attachmentService.unrelated(request);
|
||||
}
|
||||
|
||||
|
|
|
@ -163,7 +163,7 @@ public class AttachmentService {
|
|||
}
|
||||
|
||||
public void copyAttachment(AttachmentRequest request, List<String> filterIds) {
|
||||
List<AttachmentModuleRelation> needDealFiles = new ArrayList<>();
|
||||
List<AttachmentModuleRelation> needDealFiles;
|
||||
AttachmentModuleRelationExample example = new AttachmentModuleRelationExample();
|
||||
example.createCriteria().andRelationIdEqualTo(request.getCopyBelongId()).andRelationTypeEqualTo(request.getBelongType());
|
||||
List<AttachmentModuleRelation> attachmentModuleRelations = attachmentModuleRelationMapper.selectByExample(example);
|
||||
|
@ -178,7 +178,7 @@ public class AttachmentService {
|
|||
List<String> localAttachments = needDealFiles.stream()
|
||||
.filter(relation -> StringUtils.isEmpty(relation.getFileMetadataRefId()))
|
||||
.map(AttachmentModuleRelation::getAttachmentId)
|
||||
.filter(StringUtils::isNotEmpty).collect(Collectors.toList());
|
||||
.filter(StringUtils::isNotEmpty).toList();
|
||||
localAttachments.forEach(localAttachmentId -> {
|
||||
FileAttachmentMetadata fileAttachmentMetadata = copyAttachment(localAttachmentId, request.getBelongType(), request.getBelongId());
|
||||
AttachmentModuleRelation record = new AttachmentModuleRelation();
|
||||
|
@ -189,7 +189,7 @@ public class AttachmentService {
|
|||
});
|
||||
// 文件管理关联附件
|
||||
List<AttachmentModuleRelation> refAttachments = needDealFiles.stream()
|
||||
.filter(relation -> StringUtils.isNotEmpty(relation.getFileMetadataRefId())).collect(Collectors.toList());
|
||||
.filter(relation -> StringUtils.isNotEmpty(relation.getFileMetadataRefId())).toList();
|
||||
refAttachments.forEach(refAttachment -> {
|
||||
refAttachment.setRelationId(request.getBelongId());
|
||||
attachmentModuleRelationMapper.insert(refAttachment);
|
||||
|
@ -227,7 +227,7 @@ public class AttachmentService {
|
|||
}
|
||||
|
||||
public List<FileAttachmentMetadata> listMetadata(AttachmentRequest request) {
|
||||
List<FileAttachmentMetadata> attachments = new ArrayList<FileAttachmentMetadata>();
|
||||
List<FileAttachmentMetadata> attachments = new ArrayList<>();
|
||||
AttachmentModuleRelationExample example = new AttachmentModuleRelationExample();
|
||||
example.createCriteria().andRelationIdEqualTo(request.getBelongId()).andRelationTypeEqualTo(request.getBelongType());
|
||||
List<AttachmentModuleRelation> attachmentModuleRelations = attachmentModuleRelationMapper.selectByExample(example);
|
||||
|
@ -376,9 +376,7 @@ public class AttachmentService {
|
|||
AttachmentModuleRelationExample example = new AttachmentModuleRelationExample();
|
||||
example.createCriteria().andRelationIdEqualTo(request.getBelongId()).andRelationTypeEqualTo(request.getBelongType());
|
||||
List<AttachmentModuleRelation> attachmentModuleRelations = attachmentModuleRelationMapper.selectByExample(example);
|
||||
List<String> attachmentIds = attachmentModuleRelations.stream().map(AttachmentModuleRelation::getAttachmentId)
|
||||
.collect(Collectors.toList());
|
||||
return attachmentIds;
|
||||
return attachmentModuleRelations.stream().map(AttachmentModuleRelation::getAttachmentId).toList();
|
||||
}
|
||||
|
||||
public String getRefIdByAttachmentId(String attachmentId) {
|
||||
|
@ -546,21 +544,6 @@ public class AttachmentService {
|
|||
return fileAttachmentMetadataMapper.selectByExample(example);
|
||||
}
|
||||
|
||||
public List<FileAttachmentMetadata> getFileAttachmentMetadataByIssueId(String issueId) {
|
||||
IssueFileExample issueFileExample = new IssueFileExample();
|
||||
issueFileExample.createCriteria().andIssueIdEqualTo(issueId);
|
||||
final List<IssueFile> issueFiles = issueFileMapper.selectByExample(issueFileExample);
|
||||
|
||||
if (org.apache.commons.collections.CollectionUtils.isEmpty(issueFiles)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
List<String> fileIds = issueFiles.stream().map(IssueFile::getFileId).collect(Collectors.toList());
|
||||
FileAttachmentMetadataExample example = new FileAttachmentMetadataExample();
|
||||
example.createCriteria().andIdIn(fileIds);
|
||||
return fileAttachmentMetadataMapper.selectByExample(example);
|
||||
}
|
||||
|
||||
public FileAttachmentMetadata getFileAttachmentMetadataByFileId(String fileId) {
|
||||
return fileAttachmentMetadataMapper.selectByPrimaryKey(fileId);
|
||||
}
|
||||
|
@ -592,13 +575,14 @@ public class AttachmentService {
|
|||
/**
|
||||
* 上传文件的操作记录
|
||||
*
|
||||
* @param sourceId
|
||||
* @param type
|
||||
* @return
|
||||
* @param sourceId 所属操作对象ID
|
||||
* @param type 所属操作类型
|
||||
* @return 操作日志content
|
||||
*/
|
||||
public String getLogDetails(String sourceId, String type, String fileName, Boolean isDelete) {
|
||||
String projectId = null;
|
||||
String createUser = null;
|
||||
String title = null;
|
||||
if (StringUtils.isBlank(sourceId) || StringUtils.isBlank(type) || StringUtils.isBlank(fileName)) {
|
||||
return null;
|
||||
}
|
||||
|
@ -609,6 +593,7 @@ public class AttachmentService {
|
|||
}
|
||||
projectId = issues.getProjectId();
|
||||
createUser = issues.getCreator();
|
||||
title = issues.getTitle();
|
||||
} else if (AttachmentType.TEST_CASE.type().equals(type)) {
|
||||
TestCaseWithBLOBs testCase = testCaseMapper.selectByPrimaryKey(sourceId);
|
||||
if (testCase == null) {
|
||||
|
@ -616,6 +601,7 @@ public class AttachmentService {
|
|||
}
|
||||
projectId = testCase.getProjectId();
|
||||
createUser = testCase.getCreateUser();
|
||||
title = testCase.getName();
|
||||
}
|
||||
AttachmentRequest attachmentRequest = new AttachmentRequest();
|
||||
attachmentRequest.setBelongId(sourceId);
|
||||
|
@ -639,23 +625,23 @@ public class AttachmentService {
|
|||
}
|
||||
|
||||
List<DetailColumn> columns = new ArrayList<>();
|
||||
DetailColumn column;
|
||||
if (isDelete) {
|
||||
DetailColumn column = new DetailColumn("附件", "files", after, before);
|
||||
columns.add(column);
|
||||
column = new DetailColumn("附件", "files", after, before);
|
||||
} else {
|
||||
DetailColumn column = new DetailColumn("附件", "files", before, after);
|
||||
columns.add(column);
|
||||
column = new DetailColumn("附件", "files", before, after);
|
||||
}
|
||||
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(sourceId), projectId, createUser, columns);
|
||||
columns.add(column);
|
||||
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(sourceId), projectId, title, createUser, columns);
|
||||
return JSON.toJSONString(details);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除文件操作记录
|
||||
*
|
||||
* @param attachmentId
|
||||
* @param attachmentType
|
||||
* @return
|
||||
* @param attachmentId 所属对象ID
|
||||
* @param attachmentType 所属对象类型
|
||||
* @return 操作日志content
|
||||
*/
|
||||
public String getLogDetails(String attachmentId, String attachmentType) {
|
||||
FileAttachmentMetadata fileAttachmentMetadata = fileAttachmentMetadataMapper.selectByPrimaryKey(attachmentId);
|
||||
|
@ -676,14 +662,16 @@ public class AttachmentService {
|
|||
/**
|
||||
* 关联文件的操作记录
|
||||
*
|
||||
* @param sourceId
|
||||
* @param type
|
||||
* @param sourceId 附件所属对象ID
|
||||
* @param type 附件所属对象类型
|
||||
* @param refIds 关联或取消关联的文件ID
|
||||
* @return
|
||||
* @param isRelate 关联操作
|
||||
* @return 返回操作日志content
|
||||
*/
|
||||
public String getLogDetails(String sourceId, String type, List refIds, Boolean isRelate) {
|
||||
public String getLogDetails(String sourceId, String type, List<String> refIds, Boolean isRelate) {
|
||||
String projectId = null;
|
||||
String createUser = null;
|
||||
String title = null;
|
||||
if (StringUtils.isBlank(sourceId) || StringUtils.isBlank(type) || CollectionUtils.isEmpty(refIds)) {
|
||||
return null;
|
||||
}
|
||||
|
@ -694,6 +682,7 @@ public class AttachmentService {
|
|||
}
|
||||
projectId = issues.getProjectId();
|
||||
createUser = issues.getCreator();
|
||||
title = issues.getTitle();
|
||||
} else if (AttachmentType.TEST_CASE.type().equals(type)) {
|
||||
TestCaseWithBLOBs testCase = testCaseMapper.selectByPrimaryKey(sourceId);
|
||||
if (testCase == null) {
|
||||
|
@ -701,6 +690,7 @@ public class AttachmentService {
|
|||
}
|
||||
projectId = testCase.getProjectId();
|
||||
createUser = testCase.getCreateUser();
|
||||
title = testCase.getName();
|
||||
}
|
||||
AttachmentRequest attachmentRequest = new AttachmentRequest();
|
||||
attachmentRequest.setBelongId(sourceId);
|
||||
|
@ -716,7 +706,7 @@ public class AttachmentService {
|
|||
FileMetadataExample example = new FileMetadataExample();
|
||||
example.createCriteria().andIdIn(refIds);
|
||||
List<FileMetadata> fileMetadata = fileMetadataMapper.selectByExample(example);
|
||||
List<String> refNames = fileMetadata.stream().map(FileMetadata::getName).collect(Collectors.toList());
|
||||
List<String> refNames = fileMetadata.stream().map(FileMetadata::getName).toList();
|
||||
|
||||
after = String.join(",", fileNames);
|
||||
List<String> unRelateFiles = fileNames.stream().filter(filename -> !refNames.contains(filename)).collect(Collectors.toList());
|
||||
|
@ -725,21 +715,22 @@ public class AttachmentService {
|
|||
List<DetailColumn> columns = new ArrayList<>();
|
||||
DetailColumn column = new DetailColumn("附件", "files", before, after);
|
||||
columns.add(column);
|
||||
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(sourceId), projectId, createUser, columns);
|
||||
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(sourceId), projectId, title, createUser, columns);
|
||||
return JSON.toJSONString(details);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消关联文件的操作记录
|
||||
*
|
||||
* @param sourceId
|
||||
* @param type
|
||||
* @param sourceId 附件所属对象ID
|
||||
* @param type 附件所属对象类型
|
||||
* @param refIds 关联或取消关联的文件ID
|
||||
* @return
|
||||
* @return 返回操作日志content
|
||||
*/
|
||||
public String getLogDetails(String sourceId, String type, List refIds) {
|
||||
public String getLogDetails(String sourceId, String type, List<String> refIds) {
|
||||
String projectId = null;
|
||||
String createUser = null;
|
||||
String title = null;
|
||||
if (StringUtils.isBlank(sourceId) || StringUtils.isBlank(type) || CollectionUtils.isEmpty(refIds)) {
|
||||
return null;
|
||||
}
|
||||
|
@ -750,6 +741,7 @@ public class AttachmentService {
|
|||
}
|
||||
projectId = issues.getProjectId();
|
||||
createUser = issues.getCreator();
|
||||
title = issues.getTitle();
|
||||
} else if (AttachmentType.TEST_CASE.type().equals(type)) {
|
||||
TestCaseWithBLOBs testCase = testCaseMapper.selectByPrimaryKey(sourceId);
|
||||
if (testCase == null) {
|
||||
|
@ -757,6 +749,7 @@ public class AttachmentService {
|
|||
}
|
||||
projectId = testCase.getProjectId();
|
||||
createUser = testCase.getCreateUser();
|
||||
title = testCase.getName();
|
||||
}
|
||||
AttachmentRequest attachmentRequest = new AttachmentRequest();
|
||||
attachmentRequest.setBelongId(sourceId);
|
||||
|
@ -770,15 +763,14 @@ public class AttachmentService {
|
|||
String before;
|
||||
|
||||
before = String.join(",", fileNames);
|
||||
List<String> unRelateFiles = originFiles.stream().filter(originFile -> !StringUtils.equals(originFile.getId(), refIds.get(0).toString()))
|
||||
List<String> unRelateFiles = originFiles.stream().filter(originFile -> !StringUtils.equals(originFile.getId(), refIds.get(0)))
|
||||
.map(FileAttachmentMetadata::getName).collect(Collectors.toList());
|
||||
after = String.join(",", unRelateFiles);
|
||||
|
||||
List<DetailColumn> columns = new ArrayList<>();
|
||||
DetailColumn column = new DetailColumn("附件", "files", before, after);
|
||||
columns.add(column);
|
||||
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(sourceId), projectId, createUser, columns);
|
||||
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(sourceId), projectId, title, createUser, columns);
|
||||
return JSON.toJSONString(details);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,15 +14,27 @@ export function attachmentList(param) {
|
|||
}
|
||||
|
||||
export function uploadIssueAttachment(file, param, cancelToken, cancelTokens, progressCallback) {
|
||||
return fileUploadWithProcessAndCancel(BASE_URL + "upload", file, param, cancelToken, cancelTokens, progressCallback);
|
||||
return fileUploadWithProcessAndCancel(BASE_URL + "issue/upload", file, param, cancelToken, cancelTokens, progressCallback);
|
||||
}
|
||||
|
||||
export function unrelatedAttachment(param) {
|
||||
return post(BASE_URL + "metadata/unrelated", param)
|
||||
export function uploadTestCaseAttachment(file, param, cancelToken, cancelTokens, progressCallback) {
|
||||
return fileUploadWithProcessAndCancel(BASE_URL + "testcase/upload", file, param, cancelToken, cancelTokens, progressCallback);
|
||||
}
|
||||
|
||||
export function relatedAttachment(param) {
|
||||
return post(BASE_URL + "metadata/relate", param)
|
||||
export function unrelatedTestCaseAttachment(param) {
|
||||
return post(BASE_URL + "testcase/metadata/unrelated", param)
|
||||
}
|
||||
|
||||
export function unrelatedIssueAttachment(param) {
|
||||
return post(BASE_URL + "issue/metadata/unrelated", param)
|
||||
}
|
||||
|
||||
export function relatedTestCaseAttachment(param) {
|
||||
return post(BASE_URL + "testcase/metadata/relate", param)
|
||||
}
|
||||
|
||||
export function relatedIssueAttachment(param) {
|
||||
return post(BASE_URL + "issue/metadata/relate", param)
|
||||
}
|
||||
|
||||
export function dumpAttachment(param) {
|
||||
|
|
|
@ -155,9 +155,9 @@ import {testCaseCommentList} from "@/api/test-case-comment";
|
|||
import {
|
||||
attachmentList,
|
||||
deleteTestCaseAttachment, dumpAttachment,
|
||||
relatedAttachment,
|
||||
unrelatedAttachment,
|
||||
uploadIssueAttachment
|
||||
relatedTestCaseAttachment,
|
||||
unrelatedTestCaseAttachment,
|
||||
uploadTestCaseAttachment
|
||||
} from "@/api/attachment";
|
||||
import {getUUID} from "metersphere-frontend/src/utils"
|
||||
import {getCurrentProjectID} from "metersphere-frontend/src/utils/token"
|
||||
|
@ -326,11 +326,11 @@ export default {
|
|||
async uploadFile(param, progressCallback) {
|
||||
let progress = 0;
|
||||
let file = param.file;
|
||||
let data = {"belongId": this.caseId, "belongType": "testcase"};
|
||||
let data = {"belongId": this.caseId, "belongType": "testcase", "belongTitle": this.};
|
||||
let CancelToken = axios.CancelToken;
|
||||
let self = this;
|
||||
|
||||
uploadIssueAttachment(file, data, CancelToken, self.cancelFileToken, progressCallback)
|
||||
uploadTestCaseAttachment(file, data, CancelToken, self.cancelFileToken, progressCallback)
|
||||
.then(response => { // 成功回调
|
||||
progress = 100;
|
||||
param.onSuccess(response);
|
||||
|
@ -425,7 +425,7 @@ export default {
|
|||
// 已经关联的记录
|
||||
this.unRelateFiles.push(file.id);
|
||||
let data = {'belongType': 'testcase', 'belongId': this.caseId, 'metadataRefIds': this.unRelateFiles};
|
||||
unrelatedAttachment(data)
|
||||
unrelatedTestCaseAttachment(data)
|
||||
.then(() => {
|
||||
this.$success(this.$t('commons.unrelated_success'));
|
||||
this.result.loading = false;
|
||||
|
@ -516,7 +516,7 @@ export default {
|
|||
rows.forEach(row => metadataRefIds.push(row.id));
|
||||
let data = {'belongType': 'testcase', 'belongId': this.caseId, 'metadataRefIds': metadataRefIds};
|
||||
this.result.loading = true;
|
||||
relatedAttachment(data)
|
||||
relatedTestCaseAttachment(data)
|
||||
.then(() => {
|
||||
this.$success(this.$t('commons.relate_success'));
|
||||
this.result.loading = false;
|
||||
|
|
|
@ -125,9 +125,9 @@ import {
|
|||
attachmentList,
|
||||
deleteTestCaseAttachment,
|
||||
dumpAttachment,
|
||||
relatedAttachment,
|
||||
unrelatedAttachment,
|
||||
uploadIssueAttachment,
|
||||
relatedTestCaseAttachment,
|
||||
unrelatedTestCaseAttachment,
|
||||
uploadTestCaseAttachment,
|
||||
} from "@/api/attachment";
|
||||
import MsFileBatchMove from "metersphere-frontend/src/components/environment/commons/variable/FileBatchMove";
|
||||
|
||||
|
@ -244,7 +244,7 @@ export default {
|
|||
let CancelToken = axios.CancelToken;
|
||||
let self = this;
|
||||
|
||||
uploadIssueAttachment(
|
||||
uploadTestCaseAttachment(
|
||||
file,
|
||||
data,
|
||||
CancelToken,
|
||||
|
@ -381,7 +381,7 @@ export default {
|
|||
belongId: this.targetId,
|
||||
metadataRefIds: this.unRelateFiles,
|
||||
};
|
||||
unrelatedAttachment(data).then(() => {
|
||||
unrelatedTestCaseAttachment(data).then(() => {
|
||||
this.$success(this.$t("commons.unrelated_success"), false);
|
||||
this.result.loading = false;
|
||||
this.getFileMetaData(this.issueId);
|
||||
|
@ -480,7 +480,7 @@ export default {
|
|||
metadataRefIds: metadataRefIds,
|
||||
};
|
||||
this.result.loading = true;
|
||||
relatedAttachment(data).then(() => {
|
||||
relatedTestCaseAttachment(data).then(() => {
|
||||
this.$success(this.$t("commons.relate_success"), false);
|
||||
this.result.loading = false;
|
||||
this.getFileMetaData();
|
||||
|
|
|
@ -146,45 +146,31 @@ import CaseAttachmentComponent from "@/business/case/components/case/CaseAttachm
|
|||
import TemplateComponentEditHeader from "@/business/plan/view/comonents/report/TemplateComponentEditHeader";
|
||||
import MsFormDivider from "metersphere-frontend/src/components/MsFormDivider";
|
||||
import FormRichTextItem from "../richtext/FormRichTextItem";
|
||||
import {
|
||||
buildCustomFields,
|
||||
parseCustomField,
|
||||
} from "metersphere-frontend/src/utils/custom_field";
|
||||
import {buildCustomFields, parseCustomField,} from "metersphere-frontend/src/utils/custom_field";
|
||||
import CustomFiledComponent from "metersphere-frontend/src/components/template/CustomFiledComponent";
|
||||
import TestCaseIssueList from "@/business/issue/TestCaseIssueList";
|
||||
import IssueEditDetail from "@/business/issue/IssueEditDetail";
|
||||
import {
|
||||
getCurrentProjectID,
|
||||
getCurrentUser,
|
||||
getCurrentWorkspaceId,
|
||||
getCurrentUserId,
|
||||
getCurrentWorkspaceId,
|
||||
} from "metersphere-frontend/src/utils/token";
|
||||
import { hasLicense } from "metersphere-frontend/src/utils/permission";
|
||||
import {hasLicense} from "metersphere-frontend/src/utils/permission";
|
||||
import {
|
||||
enableThirdPartTemplate,
|
||||
getIssuePartTemplateWithProject,
|
||||
saveOrUpdateIssue,
|
||||
saveFollow,
|
||||
getFollow,
|
||||
getComments,
|
||||
getIssuePartTemplateWithProject,
|
||||
getPlatformFormOption,
|
||||
getPlatformTransitions,
|
||||
getTapdUser,
|
||||
getPlatformTransitions, getPlatformFormOption,
|
||||
saveOrUpdateIssue,
|
||||
} from "@/api/issue";
|
||||
import {
|
||||
uploadIssueAttachment,
|
||||
attachmentList,
|
||||
deleteIssueAttachment,
|
||||
unrelatedAttachment,
|
||||
relatedAttachment,
|
||||
dumpAttachment,
|
||||
} from "@/api/attachment";
|
||||
import CustomFiledFormItem from "../common/CaseCustomFiledFormItem";
|
||||
import MsMarkDownText from "metersphere-frontend/src/components/MsMarkDownText";
|
||||
import IssueComment from "@/business/issue/IssueComment";
|
||||
import ReviewCommentItem from "@/business/review/commom/ReviewCommentItem";
|
||||
import { TokenKey } from "metersphere-frontend/src/utils/constants";
|
||||
import TestCaseAttachment from "@/business/case/components/TestCaseAttachment";
|
||||
import axios from "axios";
|
||||
import MsFileMetadataList from "metersphere-frontend/src/components/environment/commons/variable/QuoteFileList";
|
||||
import MsFileBatchMove from "metersphere-frontend/src/components/environment/commons/variable/FileBatchMove";
|
||||
|
||||
|
|
|
@ -213,8 +213,8 @@ import {
|
|||
uploadIssueAttachment,
|
||||
attachmentList,
|
||||
deleteIssueAttachment,
|
||||
unrelatedAttachment,
|
||||
relatedAttachment, dumpAttachment
|
||||
unrelatedIssueAttachment,
|
||||
relatedIssueAttachment, dumpAttachment
|
||||
} from "@/api/attachment";
|
||||
import CustomFiledFormItem from "metersphere-frontend/src/components/form/CustomFiledFormItem";
|
||||
import MsMarkDownText from "metersphere-frontend/src/components/MsMarkDownText";
|
||||
|
@ -810,7 +810,7 @@ export default {
|
|||
this.unRelateFiles.push(file.id);
|
||||
let data = {'belongType': 'issue', 'belongId': this.issueId, 'metadataRefIds': this.unRelateFiles};
|
||||
this.result.loading = true;
|
||||
unrelatedAttachment(data)
|
||||
unrelatedIssueAttachment(data)
|
||||
.then(() => {
|
||||
this.$success(this.$t('commons.unrelated_success'));
|
||||
this.result.loading = false;
|
||||
|
@ -870,7 +870,7 @@ export default {
|
|||
rows.forEach(row => metadataRefIds.push(row.id));
|
||||
let data = {'belongType': 'issue', 'belongId': this.issueId, 'metadataRefIds': metadataRefIds};
|
||||
this.result.loading = true;
|
||||
relatedAttachment(data)
|
||||
relatedIssueAttachment(data)
|
||||
.then(() => {
|
||||
this.$success(this.$t('commons.relate_success'));
|
||||
this.result.loading = false;
|
||||
|
|
Loading…
Reference in New Issue