fix(UI 自动化): 测试计划ui关联用例模块数量统计错误

--bug=1015020 --user=张大海 【测试跟踪】测试计划中关联UI测试用例后左侧模块数量统计错误 https://www.tapd.cn/55049933/s/1213090

--bug=1015042 --user=张大海 【测试跟踪】测试计划详情-UI测试用例列表,左侧的模块树统计不对 https://www.tapd.cn/55049933/s/1213091
This commit is contained in:
zhangdahai112 2022-07-27 10:40:52 +08:00 committed by f2c-ci-robot[bot]
parent 1b76b933db
commit 313ed13ef2
2 changed files with 113 additions and 108 deletions

View File

@ -13,6 +13,7 @@
@setModuleOptions="setModuleOptions" @setModuleOptions="setModuleOptions"
:relevance-project-id="projectId" :relevance-project-id="projectId"
:is-read-only="true" :is-read-only="true"
:show-case-num="false"
ref="nodeTree"/> ref="nodeTree"/>
</template> </template>
@ -35,9 +36,10 @@ import TestCaseRelevanceBase from "../base/TestCaseRelevanceBase";
import {strMapToObj} from "../../../../../../../common/js/utils"; import {strMapToObj} from "../../../../../../../common/js/utils";
import ApiCaseSimpleList from "../../../../../api/definition/components/list/ApiCaseSimpleList"; import ApiCaseSimpleList from "../../../../../api/definition/components/list/ApiCaseSimpleList";
import MsApiScenarioList from "../../../../../api/automation/scenario/ApiScenarioList"; import MsApiScenarioList from "../../../../../api/automation/scenario/ApiScenarioList";
import UiScenarioModule from "@/business/components/xpack/ui/automation/scenario/UiScenarioModule";
import RelevanceUiScenarioList from "@/business/components/track/plan/view/comonents/api/RelevanceUiScenarioList"; import RelevanceUiScenarioList from "@/business/components/track/plan/view/comonents/api/RelevanceUiScenarioList";
import {ENV_TYPE} from "@/common/js/constants"; import {ENV_TYPE} from "@/common/js/constants";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const UiScenarioModule = requireComponent.keys().length > 0 ? requireComponent("./ui/automation/scenario/UiScenarioModule.vue") : {};
export default { export default {
name: "TestCaseUiScenarioRelevance", name: "TestCaseUiScenarioRelevance",
@ -45,7 +47,7 @@ export default {
RelevanceUiScenarioList, RelevanceUiScenarioList,
MsApiScenarioList, MsApiScenarioList,
ApiCaseSimpleList, ApiCaseSimpleList,
UiScenarioModule, "UiScenarioModule" : UiScenarioModule.default,
TestCaseRelevanceBase, TestCaseRelevanceBase,
}, },
data() { data() {

View File

@ -10,6 +10,7 @@
:is-read-only="true" :is-read-only="true"
:plan-id="planId" :plan-id="planId"
:plan-status="planStatus" :plan-status="planStatus"
:show-case-num="false"
ref="scenarioNodeTree"> ref="scenarioNodeTree">
</ui-scenario-module> </ui-scenario-module>
</template> </template>
@ -41,120 +42,122 @@
</template> </template>
<script> <script>
import NodeTree from "../../../../common/NodeTree"; import NodeTree from "../../../../common/NodeTree";
import MsTestPlanCommonComponent from "../base/TestPlanCommonComponent"; import MsTestPlanCommonComponent from "../base/TestPlanCommonComponent";
import TestPlanApiCaseList from "./TestPlanApiCaseList"; import TestPlanApiCaseList from "./TestPlanApiCaseList";
import TestCaseApiRelevance from "./TestCaseApiRelevance"; import TestCaseApiRelevance from "./TestCaseApiRelevance";
import ApiCaseSimpleList from "../../../../../api/definition/components/list/ApiCaseSimpleList"; import ApiCaseSimpleList from "../../../../../api/definition/components/list/ApiCaseSimpleList";
import MsApiModule from "../../../../../api/definition/components/module/ApiModule"; import MsApiModule from "../../../../../api/definition/components/module/ApiModule";
import MsTestPlanUiScenarioList from "./TestPlanUiScenarioList"; import MsTestPlanUiScenarioList from "./TestPlanUiScenarioList";
import UiScenarioModule from "@/business/components/xpack/ui/automation/scenario/UiScenarioModule"; import TestCaseUiScenarioRelevance
import TestCaseUiScenarioRelevance from "@/business/components/track/plan/view/comonents/api/TestCaseUiScenarioRelevance";
from "@/business/components/track/plan/view/comonents/api/TestCaseUiScenarioRelevance";
export default { const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
name: "TestPlanUi", const UiScenarioModule = requireComponent.keys().length > 0 ? requireComponent("./ui/automation/scenario/UiScenarioModule.vue") : {};
components: {
TestCaseUiScenarioRelevance,
MsTestPlanUiScenarioList,
UiScenarioModule,
MsApiModule,
ApiCaseSimpleList,
TestCaseApiRelevance,
TestPlanApiCaseList,
MsTestPlanCommonComponent,
NodeTree,
},
data() {
return {
result: {},
treeNodes: [],
currentRow: "",
trashEnable: false,
currentProtocol: null,
currentModule: null,
selectNodeIds: [],
moduleOptions: {},
model: 'scenario'
}
},
props: [
'planId',
'redirectCharType',
'clickType',
'versionEnable',
'planStatus'
],
mounted() {
this.checkRedirectCharType();
},
watch: {
model() {
this.selectNodeIds = [];
this.moduleOptions = {};
},
redirectCharType(){
if(this.redirectCharType=='scenario'){
this.model = 'scenario';
}else{
this.model = 'api';
}
}
},
methods: {
checkRedirectCharType(){
if(this.redirectCharType=='scenario'){
this.model = 'scenario';
}else{
this.model = 'api';
}
},
refresh() {
this.refreshTree();
this.refreshTable();
},
refreshTable() {
if (this.$refs.apiCaseList) {
this.$refs.apiCaseList.initTable();
}
if (this.$refs.apiScenarioList) {
this.$refs.apiScenarioList.search();
}
},
refreshTree() {
if (this.$refs.scenarioNodeTree) {
this.$refs.scenarioNodeTree.list();
}
},
nodeChange(node, nodeIds, pNodes) { export default {
this.selectNodeIds = nodeIds; name: "TestPlanUi",
}, components: {
handleProtocolChange(protocol) { TestCaseUiScenarioRelevance,
this.currentProtocol = protocol; MsTestPlanUiScenarioList,
}, "UiScenarioModule": UiScenarioModule.default,
setModuleOptions(data) { MsApiModule,
this.moduleOptions = data; ApiCaseSimpleList,
}, TestCaseApiRelevance,
TestPlanApiCaseList,
openTestCaseRelevanceDialog(model) { MsTestPlanCommonComponent,
if (model === 'scenario') { NodeTree,
this.$refs.scenarioCaseRelevance.open(); },
} else { data() {
this.$refs.apiCaseRelevance.open(); return {
} result: {},
}, treeNodes: [],
currentRow: "",
trashEnable: false,
currentProtocol: null,
currentModule: null,
selectNodeIds: [],
moduleOptions: {},
model: 'scenario'
}
},
props: [
'planId',
'redirectCharType',
'clickType',
'versionEnable',
'planStatus'
],
mounted() {
this.checkRedirectCharType();
},
watch: {
model() {
this.selectNodeIds = [];
this.moduleOptions = {};
},
redirectCharType() {
if (this.redirectCharType == 'scenario') {
this.model = 'scenario';
} else {
this.model = 'api';
} }
} }
},
methods: {
checkRedirectCharType() {
if (this.redirectCharType == 'scenario') {
this.model = 'scenario';
} else {
this.model = 'api';
}
},
refresh() {
this.refreshTree();
this.refreshTable();
},
refreshTable() {
if (this.$refs.apiCaseList) {
this.$refs.apiCaseList.initTable();
}
if (this.$refs.apiScenarioList) {
this.$refs.apiScenarioList.search();
}
},
refreshTree() {
if (this.$refs.scenarioNodeTree) {
this.$refs.scenarioNodeTree.list();
}
},
nodeChange(node, nodeIds, pNodes) {
this.selectNodeIds = nodeIds;
},
handleProtocolChange(protocol) {
this.currentProtocol = protocol;
},
setModuleOptions(data) {
this.moduleOptions = data;
},
openTestCaseRelevanceDialog(model) {
if (model === 'scenario') {
this.$refs.scenarioCaseRelevance.open();
} else {
this.$refs.apiCaseRelevance.open();
}
},
}
}
</script> </script>
<style scoped> <style scoped>
.model-change-radio { .model-change-radio {
height: 25px; height: 25px;
line-height: 25px; line-height: 25px;
margin: 5px 10px; margin: 5px 10px;
} }
</style> </style>