From 0228043184a6f46917cbd3b52ae98c8cb6e25721 Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Thu, 9 Jul 2020 14:17:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92=E5=85=B3?= =?UTF-8?q?=E8=81=94=E7=94=A8=E4=BE=8B=E5=A2=9E=E5=8A=A0=E4=BC=98=E5=85=88?= =?UTF-8?q?=E7=BA=A7=E5=92=8C=E7=B1=BB=E5=9E=8B=E5=B9=B6=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base/mapper/ext/ExtTestCaseMapper.xml | 12 +- .../plan/view/comonents/TestCaseRelevance.vue | 272 ++++++++++-------- 2 files changed, 170 insertions(+), 114 deletions(-) diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml index 647d67665..863966c10 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml @@ -3,7 +3,7 @@ diff --git a/frontend/src/business/components/track/plan/view/comonents/TestCaseRelevance.vue b/frontend/src/business/components/track/plan/view/comonents/TestCaseRelevance.vue index 09a11d897..0697dc3b2 100644 --- a/frontend/src/business/components/track/plan/view/comonents/TestCaseRelevance.vue +++ b/frontend/src/business/components/track/plan/view/comonents/TestCaseRelevance.vue @@ -19,26 +19,47 @@ - - - - - - - - + + + + + + + + + + + + + + @@ -56,107 +77,128 @@ import NodeTree from '../../../common/NodeTree'; import MsDialogFooter from '../../../../common/components/MsDialogFooter' + import PriorityTableItem from "../../../common/tableItems/planview/PriorityTableItem"; + import TypeTableItem from "../../../common/tableItems/planview/TypeTableItem"; + import {_filter} from "../../../../../../common/js/utils"; export default { - name: "TestCaseRelevance", - components: {NodeTree, MsDialogFooter}, - data() { - return { - result: {}, - dialogFormVisible: false, - isCheckAll: false, - testCases: [], - selectIds: new Set(), - treeNodes: [], - selectNodeIds: [], - selectNodeNames: [] - }; + name: "TestCaseRelevance", + components: {NodeTree, MsDialogFooter, PriorityTableItem, TypeTableItem}, + data() { + return { + result: {}, + dialogFormVisible: false, + isCheckAll: false, + testCases: [], + selectIds: new Set(), + treeNodes: [], + selectNodeIds: [], + selectNodeNames: [], + condition: {}, + priorityFilters: [ + {text: 'P0', value: 'P0'}, + {text: 'P1', value: 'P1'}, + {text: 'P2', value: 'P2'}, + {text: 'P3', value: 'P3'} + ], + typeFilters: [ + {text: this.$t('commons.functional'), value: 'functional'}, + {text: this.$t('commons.performance'), value: 'performance'}, + {text: this.$t('commons.api'), value: 'api'} + ] + }; + }, + props: { + planId: { + type: String + } + }, + watch: { + planId() { + this.initData(); }, - props: { - planId: { - type: String - } + selectNodeIds() { + this.getCaseNames(); + } + }, + methods: { + openTestCaseRelevanceDialog() { + this.initData(); + this.dialogFormVisible = true; }, - watch: { - planId() { - this.initData(); - }, - selectNodeIds() { - this.getCaseNames(); - } + saveCaseRelevance() { + let param = {}; + param.planId = this.planId; + param.testCaseIds = [...this.selectIds]; + this.$post('/test/plan/relevance', param, () => { + this.selectIds.clear(); + this.$success(this.$t('commons.save_success')); + this.dialogFormVisible = false; + this.$emit('refresh'); + }); }, - methods: { - openTestCaseRelevanceDialog() { - this.initData(); - this.dialogFormVisible = true; - }, - saveCaseRelevance(){ - let param = {}; - param.planId = this.planId; - param.testCaseIds = [...this.selectIds]; - this.$post('/test/plan/relevance' , param, () => { - this.selectIds.clear(); - this.$success(this.$t('commons.save_success')); - this.dialogFormVisible = false; - this.$emit('refresh'); + getCaseNames() { + let param = {}; + if (this.planId) { + // param.planId = this.planId; + this.condition.planId = this.planId; + } + if (this.selectNodeIds && this.selectNodeIds.length > 0) { + // param.nodeIds = this.selectNodeIds; + this.condition.nodeIds = this.selectNodeIds; + } + this.result = this.$post('/test/case/name', this.condition, response => { + this.testCases = response.data; + this.testCases.forEach(item => { + item.checked = false; }); - }, - getCaseNames() { - let param = {}; - if (this.planId) { - param.planId = this.planId; - } - if (this.selectNodeIds && this.selectNodeIds.length > 0){ - param.nodeIds = this.selectNodeIds; - } - this.result = this.$post('/test/case/name', param, response => { - this.testCases = response.data; - this.testCases.forEach(item => { - item.checked = false; - }); + }); + }, + handleSelectAll(selection) { + if (selection.length > 0) { + this.testCases.forEach(item => { + this.selectIds.add(item.id); }); - }, - handleSelectAll(selection) { - if(selection.length > 0){ - this.testCases.forEach(item => { - this.selectIds.add(item.id); - }); - } else { - this.selectIds.clear(); - } - }, - handleSelectionChange(selection, row) { - if(this.selectIds.has(row.id)){ - this.selectIds.delete(row.id); - } else { - this.selectIds.add(row.id); - } - }, - nodeChange(nodeIds, nodeNames) { - this.selectNodeIds = nodeIds; - this.selectNodeNames = nodeNames; - }, - initData() { - this.getCaseNames(); - this.getAllNodeTreeByPlanId(); - }, - refresh() { - this.close(); - }, - getAllNodeTreeByPlanId() { - if (this.planId) { - this.result = this.$get("/case/node/list/all/plan/" + this.planId, response => { - this.treeNodes = response.data; - }); - } - }, - close() { + } else { this.selectIds.clear(); - this.selectNodeIds = []; - this.selectNodeNames = []; } - } + }, + handleSelectionChange(selection, row) { + if (this.selectIds.has(row.id)) { + this.selectIds.delete(row.id); + } else { + this.selectIds.add(row.id); + } + }, + nodeChange(nodeIds, nodeNames) { + this.selectNodeIds = nodeIds; + this.selectNodeNames = nodeNames; + }, + initData() { + this.getCaseNames(); + this.getAllNodeTreeByPlanId(); + }, + refresh() { + this.close(); + }, + getAllNodeTreeByPlanId() { + if (this.planId) { + this.result = this.$get("/case/node/list/all/plan/" + this.planId, response => { + this.treeNodes = response.data; + }); + } + }, + close() { + this.selectIds.clear(); + this.selectNodeIds = []; + this.selectNodeNames = []; + }, + filter(filters) { + _filter(filters, this.condition); + this.initData(); + }, } + }