fix(测试跟踪): 创建缺陷页面关联用例列表显示异常

--bug=1028840 --user=白奇 【测试跟踪】github#26207,创建缺陷页面关联用例列表显示异常 https://www.tapd.cn/55049933/s/1408439
This commit is contained in:
baiqi 2023-08-25 16:03:40 +08:00 committed by fit2-zhao
parent 496d0f81f5
commit 907d2e0a35
2 changed files with 569 additions and 327 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,8 @@
<template> <template>
<div> <div>
<el-button type="primary" @click="relateTestCase">{{$t('test_track.review_view.relevance_case')}}</el-button> <el-button type="primary" @click="relateTestCase">{{
$t("test_track.review_view.relevance_case")
}}</el-button>
<ms-table <ms-table
v-loading="result.loading" v-loading="result.loading"
@ -9,53 +11,42 @@
:data="tableData" :data="tableData"
:screen-height="null" :screen-height="null"
@refresh="initTableData" @refresh="initTableData"
ref="table"> ref="table"
>
<ms-table-column :label="$t('commons.id')" prop="num"> </ms-table-column>
<ms-table-column <ms-table-column :label="$t('commons.name')" prop="name">
:label="$t('commons.id')"
prop="num">
</ms-table-column> </ms-table-column>
<ms-table-column <ms-table-column :label="$t('test_track.case.priority')" prop="name">
:label="$t('commons.name')"
prop="name">
</ms-table-column>
<ms-table-column
:label="$t('test_track.case.priority')"
prop="name">
<template v-slot:default="scope"> <template v-slot:default="scope">
<priority-table-item :value="scope.row.priority" ref="priority"/> <priority-table-item :value="scope.row.priority" ref="priority" />
</template> </template>
</ms-table-column> </ms-table-column>
<ms-table-column <ms-table-column :label="$t('test_track.case.type')" prop="type">
:label="$t('test_track.case.type')"
prop="type">
<template v-slot:default="scope"> <template v-slot:default="scope">
<type-table-item :value="scope.row.type"/> <type-table-item :value="scope.row.type" />
</template> </template>
</ms-table-column> </ms-table-column>
<ms-table-column <ms-table-column :label="$t('test_track.case.module')" prop="nodePath">
:label="$t('test_track.case.module')"
prop="nodePath">
</ms-table-column> </ms-table-column>
<ms-table-column <ms-table-column
:label="$t('test_track.plan.plan_project')" :label="$t('test_track.plan.plan_project')"
prop="projectName"> prop="projectName"
>
</ms-table-column> </ms-table-column>
</ms-table> </ms-table>
<test-case-relate-list <test-case-relate-list
:test-case-contain-ids="testCaseContainIds" :test-case-contain-ids="testCaseContainIds"
@refresh="initTableData" @refresh="initTableData"
@save="handleRelate" @save="handleRelate"
ref="testCaseRelevance"/> ref="testCaseRelevance"
/>
</div> </div>
</template> </template>
<script> <script>
@ -64,28 +55,48 @@ import MsTableColumn from "metersphere-frontend/src/components/table/MsTableColu
import PriorityTableItem from "@/business/common/tableItems/planview/PriorityTableItem"; import PriorityTableItem from "@/business/common/tableItems/planview/PriorityTableItem";
import TypeTableItem from "@/business/common/tableItems/planview/TypeTableItem"; import TypeTableItem from "@/business/common/tableItems/planview/TypeTableItem";
import TestCaseRelateList from "@/business/issue/TestCaseRelateList"; import TestCaseRelateList from "@/business/issue/TestCaseRelateList";
import {getTestCaseIssueList} from "@/api/testCase"; import { getTestCaseIssueList } from "@/api/testCase";
export default { export default {
name: "TestCaseIssueList", name: "TestCaseIssueList",
components: {TestCaseRelateList, TypeTableItem, PriorityTableItem, MsTableColumn, MsTable}, components: {
TestCaseRelateList,
TypeTableItem,
PriorityTableItem,
MsTableColumn,
MsTable,
},
data() { data() {
return { return {
result: {}, result: {
loading: false,
},
tableData: [], tableData: [],
deleteIds: new Set(), deleteIds: new Set(),
addIds: new Set(), addIds: new Set(),
testCaseContainIds: new Set(), testCaseContainIds: new Set(),
operators: [ operators: [
{ {
tip: this.$t('commons.delete'), icon: "el-icon-delete", type: "danger", tip: this.$t("commons.delete"),
exec: this.handleDelete icon: "el-icon-delete",
} type: "danger",
exec: this.handleDelete,
},
], ],
}; };
}, },
props: { props: {
issuesId: String, issuesId: String,
}, },
watch: {
issuesId: {
handler(val) {
if (val) {
this.initTableData();
}
},
immediate: true,
},
},
methods: { methods: {
handleDelete(item, index) { handleDelete(item, index) {
this.testCaseContainIds.delete(item.id); this.testCaseContainIds.delete(item.id);
@ -99,17 +110,18 @@ export default {
initTableData() { initTableData() {
this.tableData = []; this.tableData = [];
let condition = { let condition = {
issuesId: this.issuesId issuesId: this.issuesId,
}; };
if (this.issuesId) { if (this.issuesId) {
getTestCaseIssueList(condition) this.result.loading = true;
.then((response) => { getTestCaseIssueList(condition).then((response) => {
this.tableData = response.data; this.tableData = response.data;
this.tableData.forEach(item => { this.tableData.forEach((item) => {
this.testCaseContainIds.add(item.id); this.testCaseContainIds.add(item.id);
}); });
this.$refs.table.reloadTable(); this.$refs.table.reloadTable();
}) this.result.loading = false;
});
} }
}, },
relateTestCase() { relateTestCase() {
@ -117,7 +129,7 @@ export default {
}, },
handleRelate(selectRows) { handleRelate(selectRows) {
let selectData = Array.from(selectRows); let selectData = Array.from(selectRows);
selectRows.forEach(i => { selectRows.forEach((i) => {
if (i.id) { if (i.id) {
this.testCaseContainIds.add(i.id); this.testCaseContainIds.add(i.id);
} }
@ -127,10 +139,8 @@ export default {
this.tableData.push(...selectData); this.tableData.push(...selectData);
this.testCaseContainIds = new Set(); this.testCaseContainIds = new Set();
}, },
} },
} };
</script> </script>
<style scoped> <style scoped></style>
</style>