refactor(测试跟踪): 功能用例批量编辑刷新后保留之前选择的模块

--bug=1014311 --user=陈建星 【测试跟踪】测试计划功能用例选中某一模块,批量更改用例属性后,未选中该模块 https://www.tapd.cn/55049933/s/1189515
This commit is contained in:
chenjianxing 2022-06-23 17:20:51 +08:00 committed by jianxing
parent 876716c35f
commit 2e4f6561b5
3 changed files with 19 additions and 14 deletions

View File

@ -990,8 +990,7 @@ export default {
}, },
refresh() { refresh() {
this.$refs.table.clear(); this.$refs.table.clear();
this.condition.selectAll = false; this.$emit('refreshAll');
this.$emit('refresh');
}, },
refreshAll() { refreshAll() {
this.$refs.table.clear(); this.$refs.table.clear();

View File

@ -631,13 +631,9 @@ export default {
this.$refs.testPlanTestCaseEdit.openTestCaseEdit(row, this.tableData); this.$refs.testPlanTestCaseEdit.openTestCaseEdit(row, this.tableData);
}, },
refresh() { refresh() {
this.condition = {components: TEST_PLAN_TEST_CASE_CONFIGS};
this.$refs.table.clear(); this.$refs.table.clear();
this.$emit('refresh'); this.search();
}, this.$emit('refreshTree');
breadcrumbRefresh() {
this.showMyTestCase = false;
this.refresh();
}, },
refreshTableAndPlan() { refreshTableAndPlan() {
if (this.$refs.tableHeader) { if (this.$refs.tableHeader) {
@ -683,8 +679,7 @@ export default {
if (action === 'confirm') { if (action === 'confirm') {
let param = buildBatchParam(this, this.$refs.table.selectIds); let param = buildBatchParam(this, this.$refs.table.selectIds);
this.$post('/test/plan/case/batch/delete', param, () => { this.$post('/test/plan/case/batch/delete', param, () => {
this.$refs.table.clear(); this.refresh();
this.$emit("refresh");
this.$success(this.$t('test_track.cancel_relevance_success')); this.$success(this.$t('test_track.cancel_relevance_success'));
}); });
} }
@ -694,7 +689,7 @@ export default {
_handleDelete(testCase) { _handleDelete(testCase) {
let testCaseId = testCase.id; let testCaseId = testCase.id;
this.result = this.$post('/test/plan/case/delete/' + testCaseId, {}, () => { this.result = this.$post('/test/plan/case/delete/' + testCaseId, {}, () => {
this.$emit("refresh"); this.refresh();
this.$success(this.$t('test_track.cancel_relevance_success')); this.$success(this.$t('test_track.cancel_relevance_success'));
}); });
}, },
@ -738,11 +733,10 @@ export default {
} }
param.ids = this.$refs.table.selectIds; param.ids = this.$refs.table.selectIds;
this.$post('/test/plan/case/batch/edit', param, () => { this.$post('/test/plan/case/batch/edit', param, () => {
this.$refs.table.clear();
this.status = ''; this.status = '';
this.$post('/test/plan/edit/status/' + this.planId); this.$post('/test/plan/edit/status/' + this.planId);
this.$success(this.$t('commons.save_success')); this.$success(this.$t('commons.save_success'));
this.$emit('refresh'); this.refresh();
}); });
}, },
handleBatchEdit() { handleBatchEdit() {

View File

@ -25,6 +25,7 @@
v-if="activeDom === 'left'" v-if="activeDom === 'left'"
@openTestCaseRelevanceDialog="openTestCaseRelevanceDialog" @openTestCaseRelevanceDialog="openTestCaseRelevanceDialog"
@refresh="refresh" @refresh="refresh"
@refreshTree="refreshTree"
@setCondition="setCondition" @setCondition="setCondition"
:plan-id="planId" :plan-id="planId"
:plan-status="planStatus " :plan-status="planStatus "
@ -90,7 +91,8 @@ export default {
selectNode: {}, selectNode: {},
condition: {}, condition: {},
tmpActiveDom: null, tmpActiveDom: null,
tmpPath: null tmpPath: null,
currentNode: null
}; };
}, },
props: [ props: [
@ -128,6 +130,9 @@ export default {
this.$refs.testCaseRelevance.search(); this.$refs.testCaseRelevance.search();
this.getNodeTreeByPlanId(); this.getNodeTreeByPlanId();
}, },
refreshTree() {
this.getNodeTreeByPlanId();
},
clearSelectNode() { clearSelectNode() {
this.selectNodeIds = []; this.selectNodeIds = [];
this.$store.commit('setTestPlanViewSelectNode', {}); this.$store.commit('setTestPlanViewSelectNode', {});
@ -141,6 +146,7 @@ export default {
nodeChange(node, nodeIds, pNodes) { nodeChange(node, nodeIds, pNodes) {
this.selectNodeIds = nodeIds; this.selectNodeIds = nodeIds;
this.$store.commit('setTestPlanViewSelectNode', node); this.$store.commit('setTestPlanViewSelectNode', node);
this.currentNode = node;
// node // node
if (this.$refs.testPlanTestCaseList) { if (this.$refs.testPlanTestCaseList) {
this.$refs.testPlanTestCaseList.currentPage = 1; this.$refs.testPlanTestCaseList.currentPage = 1;
@ -155,9 +161,15 @@ export default {
} }
this.result = this.$get(url, response => { this.result = this.$get(url, response => {
this.treeNodes = response.data; this.treeNodes = response.data;
this.setCurrentKey();
}); });
} }
}, },
setCurrentKey() {
if (this.$refs.nodeTree) {
this.$refs.nodeTree.setCurrentKey(this.currentNode);
}
},
setCondition(data) { setCondition(data) {
this.condition = data; this.condition = data;
}, },