fix(测试跟踪): 修复功能用例点击切换版本控制台报错

This commit is contained in:
wxg0103 2022-01-21 09:43:46 +08:00 committed by zhangdahai112
parent dd612ba5a9
commit 720d24e657
6 changed files with 19 additions and 40 deletions

View File

@ -435,7 +435,7 @@
<if test="request.selectFields == null or request.selectFields.size() == 0"> <if test="request.selectFields == null or request.selectFields.size() == 0">
<include refid="io.metersphere.base.mapper.TestCaseMapper.Base_Column_List"/> <include refid="io.metersphere.base.mapper.TestCaseMapper.Base_Column_List"/>
</if> </if>
from test_case from test_case left join project on test_case.project_id = project.id
<include refid="queryWhereCondition"/> <include refid="queryWhereCondition"/>
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.orders"/> <include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.orders"/>
</select> </select>

View File

@ -108,12 +108,6 @@ public class TestCaseController {
return testCaseService.listTestCaseIds(request); return testCaseService.listTestCaseIds(request);
} }
@PostMapping("/list/ids/public")
public List<TestCaseDTO> getTestPlanCaseIdsPublic(@RequestBody QueryTestCaseRequest request) {
return testCaseService.publicListTestCase(request);
}
@GetMapping("/relationship/case/{id}/{relationshipType}") @GetMapping("/relationship/case/{id}/{relationshipType}")
public List<RelationshipEdgeDTO> getRelationshipCase(@PathVariable("id") String id, @PathVariable("relationshipType") String relationshipType) { public List<RelationshipEdgeDTO> getRelationshipCase(@PathVariable("id") String id, @PathVariable("relationshipType") String relationshipType) {
return testCaseService.getRelationshipCase(id, relationshipType); return testCaseService.getRelationshipCase(id, relationshipType);

View File

@ -1712,8 +1712,8 @@ public class TestCaseService {
public List<TestCaseDTO> listTestCaseIds(QueryTestCaseRequest request) { public List<TestCaseDTO> listTestCaseIds(QueryTestCaseRequest request) {
setDefaultOrder(request); setDefaultOrder(request);
List<String> selectFields = new ArrayList<>(); List<String> selectFields = new ArrayList<>();
selectFields.add("id"); selectFields.add("test_case.id");
selectFields.add("name"); selectFields.add("test_case.name");
request.setSelectFields(selectFields); request.setSelectFields(selectFields);
return extTestCaseMapper.listIds(request); return extTestCaseMapper.listIds(request);
} }

View File

@ -663,7 +663,6 @@ export default {
checkout(testCase, item) { checkout(testCase, item) {
Object.assign(item.testCaseInfo, testCase) Object.assign(item.testCaseInfo, testCase)
// copy // copy
this.$refs.testCaseEdit[0].changeType("copy");
this.$refs.testCaseEdit[0].initEdit(item.testCaseInfo, () => { this.$refs.testCaseEdit[0].initEdit(item.testCaseInfo, () => {
this.$nextTick(() => { this.$nextTick(() => {
let vh = this.$refs.testCaseEdit[0].$refs.versionHistory; let vh = this.$refs.testCaseEdit[0].$refs.versionHistory;
@ -676,7 +675,6 @@ export default {
checkoutPublic(testCase, item) { checkoutPublic(testCase, item) {
Object.assign(item.testCaseInfo, testCase) Object.assign(item.testCaseInfo, testCase)
// copy // copy
this.$refs.testCaseEditShow[0].changeType("copy");
this.$refs.testCaseEditShow[0].initEdit(item.testCaseInfo, () => { this.$refs.testCaseEditShow[0].initEdit(item.testCaseInfo, () => {
this.$nextTick(() => { this.$nextTick(() => {
let vh = this.$refs.testCaseEditShow[0].$refs.versionHistory; let vh = this.$refs.testCaseEditShow[0].$refs.versionHistory;

View File

@ -114,7 +114,8 @@
<ms-form-divider :title="$t('test_track.case.other_info')"/> <ms-form-divider :title="$t('test_track.case.other_info')"/>
<test-case-edit-other-info :read-only="readOnly" :project-id="projectIds" :form="form" <test-case-edit-other-info :read-only="readOnly" :project-id="projectIds" :form="form"
:label-width="formLabelWidth" :case-id="form.id" :version-enable="versionEnable" ref="otherInfo"/> :label-width="formLabelWidth" :case-id="form.id" :version-enable="versionEnable"
ref="otherInfo"/>
<el-row style="margin-top: 10px" v-if="type!=='add'"> <el-row style="margin-top: 10px" v-if="type!=='add'">
<el-col :span="20" :offset="1">{{ $t('test_track.review.comment') }}: <el-col :span="20" :offset="1">{{ $t('test_track.review.comment') }}:
@ -637,17 +638,11 @@ export default {
}, },
initTestCases(testCase) { initTestCases(testCase) {
if (this.publicEnable) { if (this.publicEnable) {
this.result = this.$post('/test/case/list/ids/public', this.selectCondition, response => { this.selectCondition.projectId = null;
this.testCases = response.data;
for (let i = 0; i < this.testCases.length; i++) {
if (this.testCases[i].id === testCase.id) {
this.index = i;
this.getTestCase(i);
}
}
});
} else { } else {
this.selectCondition.workspaceId = null; this.selectCondition.workspaceId = null;
}
this.selectCondition.versionId = testCase.versionId
this.result = this.$post('/test/case/list/ids', this.selectCondition, response => { this.result = this.$post('/test/case/list/ids', this.selectCondition, response => {
this.testCases = response.data; this.testCases = response.data;
for (let i = 0; i < this.testCases.length; i++) { for (let i = 0; i < this.testCases.length; i++) {
@ -657,7 +652,6 @@ export default {
} }
} }
}); });
}
}, },
getTestCase(index) { getTestCase(index) {
let id = ""; let id = "";

View File

@ -594,17 +594,11 @@ export default {
}, },
initTestCases(testCase) { initTestCases(testCase) {
if (this.publicEnable) { if (this.publicEnable) {
this.result = this.$post('/test/case/list/ids/public', this.selectCondition, response => { this.selectCondition.projectId = null;
this.testCases = response.data;
for (let i = 0; i < this.testCases.length; i++) {
if (this.testCases[i].id === testCase.id) {
this.index = i;
this.getTestCase(i);
}
}
});
} else { } else {
this.selectCondition.workspaceId = null; this.selectCondition.workspaceId = null;
}
this.selectCondition.versionId = testCase.versionId
this.result = this.$post('/test/case/list/ids', this.selectCondition, response => { this.result = this.$post('/test/case/list/ids', this.selectCondition, response => {
this.testCases = response.data; this.testCases = response.data;
for (let i = 0; i < this.testCases.length; i++) { for (let i = 0; i < this.testCases.length; i++) {
@ -614,7 +608,6 @@ export default {
} }
} }
}); });
}
}, },
getTestCase(index) { getTestCase(index) {
let id = ""; let id = "";