diff --git a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java index 2c3c25b5e6..5181517719 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java @@ -652,6 +652,9 @@ public class ApiAutomationService { } public void bathEdit(SaveApiScenarioRequest request) { + if (CollectionUtils.isEmpty(request.getScenarioIds())) { + return; + } if (request.isSelectAllDate()) { request.setScenarioIds(this.getAllScenarioIdsByFontedSelect( request.getModuleIds(), request.getName(), request.getProjectId(), request.getFilters(), request.getUnSelectIds())); diff --git a/frontend/src/business/components/api/automation/ApiAutomation.vue b/frontend/src/business/components/api/automation/ApiAutomation.vue index dcc3e5abf4..f4e322c62a 100644 --- a/frontend/src/business/components/api/automation/ApiAutomation.vue +++ b/frontend/src/business/components/api/automation/ApiAutomation.vue @@ -6,6 +6,7 @@ @refreshTable="refresh" @saveAsEdit="editScenario" @setModuleOptions="setModuleOptions" + @setNodeTree="setNodeTree" @enableTrash="enableTrash" :type="'edit'" ref="nodeTree"/> @@ -15,6 +16,8 @@ + + @@ -129,10 +131,12 @@ import BatchEdit from "../../../track/case/components/BatchEdit"; import {WORKSPACE_ID} from "../../../../../common/js/constants"; import EnvironmentSelect from "../../definition/components/environment/EnvironmentSelect"; + import BatchMove from "../../../track/case/components/BatchMove"; export default { name: "MsApiScenarioList", components: { + BatchMove, EnvironmentSelect, BatchEdit, PlanStatusTableItem, @@ -157,6 +161,18 @@ trashEnable: { type: Boolean, default: false, + }, + moduleTree: { + type: Array, + default() { + return [] + }, + }, + moduleOptions: { + type: Array, + default() { + return [] + }, } }, data() { @@ -188,16 +204,15 @@ { name: this.$t('api_test.automation.batch_add_plan'), handleClick: this.handleBatchAddCase }, + { + name: this.$t('api_test.automation.batch_execute'), handleClick: this.handleBatchExecute + }, { name: this.$t('test_track.case.batch_edit_case'), handleClick: this.handleBatchEdit }, { - name: this.$t('api_test.automation.batch_execute'), handleClick: this.handleBatchExecute - }, - - // { - // name: this.$t('test_track.case.batch_move_case'), handleClick: this.handleBatchMove - // } + name: this.$t('test_track.case.batch_move_case'), handleClick: this.handleBatchMove + } ], isSelectAllDate: false, unSelection: [], @@ -319,31 +334,22 @@ handleBatchAddCase() { this.planVisible = true; }, - handleDeleteBatch() { - this.$alert(this.$t('test_track.case.delete_confirm') + "?", '', { - confirmButtonText: this.$t('commons.confirm'), - callback: (action) => { - if (action === 'confirm') { - let ids = Array.from(this.selectRows).map(row => row.id); - this.$post('/test/case/batch/delete', {ids: ids}, () => { - this.selectRows.clear(); - this.$emit("refresh"); - this.$success(this.$t('commons.delete_success')); - // 发送广播,刷新 head 上的最新列表 - }); - } - } - }); - }, handleBatchEdit() { this.$refs.batchEdit.open(this.selectDataCounts); }, handleBatchMove() { - this.$emit("batchMove", Array.from(this.selectRows).map(row => row.id)); + this.$refs.testBatchMove.open(this.moduleTree, [], this.moduleOptions); + }, + moveSave(param) { + this.buildBatchParam(param); + param.apiScenarioModuleId = param.nodeId; + this.$post('/api/automation/batch/edit', param, () => { + this.$success(this.$t('commons.save_success')); + this.$refs.testBatchMove.close(); + this.search(); + }); }, batchEdit(form) { - let arr = this.selection; - let ids = this.selection; let param = {}; param[form.type] = form.value; this.buildBatchParam(param); diff --git a/frontend/src/business/components/api/automation/scenario/ApiScenarioModule.vue b/frontend/src/business/components/api/automation/scenario/ApiScenarioModule.vue index 855d04e0fa..0e1401ebc6 100644 --- a/frontend/src/business/components/api/automation/scenario/ApiScenarioModule.vue +++ b/frontend/src/business/components/api/automation/scenario/ApiScenarioModule.vue @@ -119,6 +119,7 @@ buildNodePath(node, {path: ''}, moduleOptions); }); this.$emit('setModuleOptions', moduleOptions); + this.$emit('setNodeTree', this.data); if (this.$refs.nodeTree) { this.$refs.nodeTree.filter(this.condition.filterText); } diff --git a/frontend/src/business/components/track/case/TestCase.vue b/frontend/src/business/components/track/case/TestCase.vue index 23020f1f9f..860164b0f9 100644 --- a/frontend/src/business/components/track/case/TestCase.vue +++ b/frontend/src/business/components/track/case/TestCase.vue @@ -35,7 +35,7 @@ - + @@ -54,6 +54,7 @@ import MsMainContainer from "../../common/components/MsMainContainer"; import {checkoutTestManagerOrTestUser, getCurrentProjectID, hasRoles} from "../../../../common/js/utils"; import BatchMove from "./components/BatchMove"; import TestCaseNodeTree from "../common/TestCaseNodeTree"; +import {TrackEvent,LIST_CHANGE} from "@/business/components/common/head/ListEvent"; export default { name: "TestCase", @@ -163,6 +164,15 @@ export default { }, setTreeNodes(data) { this.treeNodes = data; + }, + moveSave(param) { + this.result = this.$post('/test/case/batch/edit', param, () => { + this.$success(this.$t('commons.save_success')); + this.$refs.testBatchMove.close(); + // 发送广播,刷新 head 上的最新列表 + TrackEvent.$emit(LIST_CHANGE); + this.refresh(); + }); } } } diff --git a/frontend/src/business/components/track/case/components/BatchMove.vue b/frontend/src/business/components/track/case/components/BatchMove.vue index 7cb28efe52..deeb7ec81d 100644 --- a/frontend/src/business/components/track/case/components/BatchMove.vue +++ b/frontend/src/business/components/track/case/components/BatchMove.vue @@ -1,5 +1,5 @@