From e9df57709a425f913ac1dd6488cf8f12e7c6bf92 Mon Sep 17 00:00:00 2001 From: song-tianyang Date: Sat, 17 Jul 2021 14:35:58 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E3=80=81=E6=8E=A5=E5=8F=A3=E5=9C=BA=E6=99=AF=E3=80=81=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E6=A1=88=E4=BE=8B):=20=E6=9B=B4=E6=94=B9=E5=9B=9E?= =?UTF-8?q?=E6=94=B6=E7=AB=99=E4=BA=A4=E4=BA=92=EF=BC=9A=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E5=9B=9E=E6=94=B6=E7=AB=99=E8=8A=82=E7=82=B9=E6=97=B6=E5=9C=A8?= =?UTF-8?q?=E8=A1=A8=E6=A0=BC=E5=A4=84=E5=8D=95=E5=BC=80=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E5=9B=9E=E6=94=B6=E7=AB=99=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 更改回收站交互:点击回收站节点时在表格处单开一个回收站弹窗 --- .../base/mapper/ext/ExtApiScenarioMapper.xml | 4 +- .../base/mapper/ext/ExtTestCaseMapper.java | 2 + .../base/mapper/ext/ExtTestCaseMapper.xml | 10 +++ .../track/service/TestCaseService.java | 1 + .../api/automation/ApiAutomation.vue | 43 ++++++++- .../automation/scenario/ApiScenarioList.vue | 25 ++++-- .../api/definition/ApiDefinition.vue | 89 +++++++++++++++++-- .../components/list/ApiCaseSimpleList.vue | 18 ++-- .../definition/components/list/ApiList.vue | 18 ++-- .../components/track/case/TestCase.vue | 27 +++++- .../track/case/components/TestCaseList.vue | 7 +- frontend/src/i18n/en-US.js | 1 + frontend/src/i18n/zh-CN.js | 1 + frontend/src/i18n/zh-TW.js | 1 + 14 files changed, 219 insertions(+), 28 deletions(-) diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml index c228ad1f0a..febe1c7a47 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml @@ -325,7 +325,7 @@ update api_scenario set original_state=status, - status = 'Trash', module_path = null, api_scenario_module_id = null + status = 'Trash', module_path = null, api_scenario_module_id = null, delete_user_id = #{operator},delete_time = #{operationTime} @@ -334,7 +334,7 @@ update api_scenario set - status = original_state + status = original_state, delete_user_id = null,delete_time = null where id in #{v} diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.java index b3f6be50de..5e3a9d488c 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.java +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.java @@ -104,4 +104,6 @@ public interface ExtTestCaseMapper { int deleteToGc(@Param("request") TestCase testCase); int reduction(@Param("ids") List ids); + + void refreshOriginalStatusByIds(@Param("ids") List ids); } 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 04830ebada..490601ee23 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 @@ -529,4 +529,14 @@ #{v} + + update test_case + set + original_status = 'Underway' + where (original_status IS NULL OR original_status = 'Trash') AND id in + + #{v} + + + diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java index 8633ad75f1..e515b89644 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java @@ -1512,6 +1512,7 @@ public class TestCaseService { public void reduction(TestCaseBatchRequest request) { TestCaseExample example = this.getBatchExample(request); if(CollectionUtils.isNotEmpty(request.getIds())){ + extTestCaseMapper.refreshOriginalStatusByIds(request.getIds()); extTestCaseMapper.reduction(request.getIds()); } } diff --git a/frontend/src/business/components/api/automation/ApiAutomation.vue b/frontend/src/business/components/api/automation/ApiAutomation.vue index 7fe91c3a8e..618482edb1 100644 --- a/frontend/src/business/components/api/automation/ApiAutomation.vue +++ b/frontend/src/business/components/api/automation/ApiAutomation.vue @@ -20,6 +20,27 @@ + + + + - + { + this.$refs.scenarioTable.doLayout(); + }); } this.$emit('getTrashCase'); }); diff --git a/frontend/src/business/components/api/definition/ApiDefinition.vue b/frontend/src/business/components/api/definition/ApiDefinition.vue index 7da05e59f1..be143c0b19 100644 --- a/frontend/src/business/components/api/definition/ApiDefinition.vue +++ b/frontend/src/business/components/api/definition/ApiDefinition.vue @@ -22,6 +22,58 @@ + + + + + + + + + + ref="apiDefList"/> + ref="caseList"/> 0) { this.activeDom = 'middle'; + this.trashActiveDom = 'left'; } }, watch: { @@ -456,13 +516,25 @@ export default { this.$warning('用例列表暂不支持导出,请切换成接口列表'); return; } - this.$refs.apiList[0].exportApi(type); + this.$refs.apiDefList[0].exportApi(type); }, refreshModule() { this.$refs.nodeTree.list(); }, refresh(data) { - this.$refs.apiList[0].initTable(data); + if(this.$refs.caseList){ + this.$refs.caseList[0].initTable(); + } + if(this.$refs.trashApiList){ + this.$refs.trashApiList.initTable(); + } + if(this.$refs.trashCaseList){ + this.$refs.trashCaseList.initTable(); + } + if(this.$refs.apiDefList){ + this.$refs.apiDefList[0].initTable(); + } + //this.$refs.nodeTree.list(); }, refreshTree() { @@ -513,6 +585,11 @@ export default { enableTrash(data) { this.initApiTableOpretion = "trashEnable"; this.trashEnable = data; + if(data){ + this.apiDefaultTab = "trash"; + }else { + this.apiDefaultTab = "default" + } }, updateInitApiTableOpretion(param){ this.initApiTableOpretion = param; diff --git a/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue b/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue index ac52a51e93..abfd5e2730 100644 --- a/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue +++ b/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue @@ -540,7 +540,8 @@ export default { obj = Object.assign(obj, this.condition); this.$post('/api/testcase/deleteBatchByParam/', obj, () => { this.$refs.caseTable.clearSelectRows(); - this.initTable(); + // this.initTable(); + this.$emit('refreshTable'); this.$success(this.$t('commons.delete_success')); }); } @@ -560,7 +561,8 @@ export default { obj = Object.assign(obj, this.condition); this.$post('/api/testcase/deleteToGcByParam/', obj, () => { this.$refs.caseTable.clearSelectRows(); - this.initTable(); + // this.initTable(); + this.$emit('refreshTable'); this.$success(this.$t('commons.delete_success')); }); } @@ -601,7 +603,8 @@ export default { if (action === 'confirm') { this.$get('/api/testcase/delete/' + apiCase.id, () => { this.$success(this.$t('commons.delete_success')); - this.initTable(); + // this.initTable(); + this.$emit('refreshTable'); }); } } @@ -615,7 +618,8 @@ export default { if (action === 'confirm') { this.$get('/api/testcase/deleteToGc/' + apiCase.id, () => { this.$success(this.$t('commons.delete_success')); - this.initTable(); + // this.initTable(); + this.$emit('refreshTable'); }); } } @@ -640,7 +644,8 @@ export default { }else{ this.$success(this.$t('commons.save_success')); } - this.search(); + // this.search(); + this.$emit('refreshTable'); }); }, handleBatchRestore() { @@ -665,7 +670,8 @@ export default { }else{ this.$success(this.$t('commons.save_success')); } - this.search(); + // this.search(); + this.$emit('refreshTable'); }); }, setEnvironment(data) { diff --git a/frontend/src/business/components/api/definition/components/list/ApiList.vue b/frontend/src/business/components/api/definition/components/list/ApiList.vue index de40c04f57..8dc75b752a 100644 --- a/frontend/src/business/components/api/definition/components/list/ApiList.vue +++ b/frontend/src/business/components/api/definition/components/list/ApiList.vue @@ -644,13 +644,15 @@ export default { let rows = {ids: [tmp.id]}; this.$post('/api/definition/reduction/', rows, () => { this.$success(this.$t('commons.save_success')); - this.search(); + // this.search(); + this.$emit('refreshTable'); }); }, handleBatchRestore() { this.$post('/api/definition/reduction/', buildBatchParam(this, this.$refs.table.selectIds), () => { this.$success(this.$t('commons.save_success')); - this.search(); + // this.search(); + this.$emit('refreshTable'); }); }, handleDeleteBatch() { @@ -661,7 +663,8 @@ export default { if (action === 'confirm') { this.$post('/api/definition/deleteBatchByParams/', buildBatchParam(this, this.$refs.table.selectIds), () => { this.$refs.table.clear(); - this.initTable(); + // this.initTable(); + this.$emit("refreshTable"); this.$success(this.$t('commons.delete_success')); }); } @@ -674,7 +677,8 @@ export default { if (action === 'confirm') { this.$post('/api/definition/removeToGcByParams/', buildBatchParam(this, this.$refs.table.selectIds), () => { this.$refs.table.clear(); - this.initTable(); + // this.initTable(); + this.$emit("refreshTable"); this.$success(this.$t('commons.delete_success')); this.$refs.caseList.apiCaseClose(); }); @@ -733,7 +737,8 @@ export default { if (this.trashEnable) { this.$get('/api/definition/delete/' + api.id, () => { this.$success(this.$t('commons.delete_success')); - this.initTable(); + // this.initTable(); + this.$emit("refreshTable"); }); return; } @@ -744,7 +749,8 @@ export default { let ids = [api.id]; this.$post('/api/definition/removeToGc/', ids, () => { this.$success(this.$t('commons.delete_success')); - this.initTable(); + // this.initTable(); + this.$emit("refreshTable"); this.$refs.caseList.apiCaseClose(); }); } diff --git a/frontend/src/business/components/track/case/TestCase.vue b/frontend/src/business/components/track/case/TestCase.vue index 7c7bb673a2..f0287467df 100644 --- a/frontend/src/business/components/track/case/TestCase.vue +++ b/frontend/src/business/components/track/case/TestCase.vue @@ -19,6 +19,24 @@ + + + +