From 13b683d6719b14cb2a760031c82afa624364ca0a Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Tue, 4 Jun 2024 15:36:19 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E7=B3=BB=E7=BB=9F=E8=AE=BE=E7=BD=AE):?= =?UTF-8?q?=20=E4=BC=98=E5=8C=96=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/mapper/ExtApiReportMapper.xml | 15 ++-- .../api/mapper/ExtApiScenarioReportMapper.xml | 20 +++-- .../api/service/ApiTaskCenterService.java | 18 ++-- .../controller/TaskCenterController.java | 37 +++++++++ .../system/mapper/ExtRealMapper.java | 13 +++ .../system/mapper/ExtRealMapper.xml | 41 +++++++++ .../system/mapper/ExtScheduleMapper.java | 2 + .../system/mapper/ExtScheduleMapper.xml | 83 +++++++++++-------- .../system/service/TaskCenterService.java | 73 +++++++++++++--- .../TaskCenterScheduleControllerTests.java | 11 ++- .../modules/project-management/taskCenter.ts | 46 ++++++++++ .../requrls/project-management/taskCenter.ts | 8 ++ .../taskCenter/component/scheduledTask.vue | 17 ---- 13 files changed, 294 insertions(+), 90 deletions(-) create mode 100644 backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtRealMapper.java create mode 100644 backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtRealMapper.xml diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiReportMapper.xml b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiReportMapper.xml index 4b8c8d5321..16aa9b18bf 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiReportMapper.xml +++ b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiReportMapper.xml @@ -191,14 +191,15 @@ LEFT JOIN test_resource_pool t ON ar.pool_id = t.id left join project on ar.project_id = project.id where - ar.test_plan_id = 'NONE' - and ar.start_time BETWEEN #{startTime} AND #{endTime} + ar.start_time BETWEEN #{startTime} AND #{endTime} - and - ar.project_id IN - - #{projectId} - + + and + ar.project_id IN + + #{projectId} + + and ( if(ar.integrated, ar.id, c.num) like concat('%', #{request.keyword},'%') diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiScenarioReportMapper.xml b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiScenarioReportMapper.xml index c92d87cdae..aca12b5ff4 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiScenarioReportMapper.xml +++ b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiScenarioReportMapper.xml @@ -163,18 +163,20 @@ INNER JOIN api_scenario s on a.api_scenario_id = s.id left JOIN test_resource_pool t on asr.pool_id = t.id left join project on asr.project_id = project.id - where asr.test_plan_id = 'NONE' - and asr.start_time BETWEEN #{startTime} AND #{endTime} - and - asr.project_id IN - - #{projectId} - + where asr.start_time BETWEEN #{startTime} AND #{endTime} + + and + asr.project_id IN + + #{projectId} + + + and ( if(asr.integrated, asr.id, s.num) like concat('%', #{request.keyword},'%') - or if(asr.integrated, asr.name,s.name) like concat('%', #{request.keyword},'%') - ) + or if(asr.integrated, asr.name,s.name) like concat('%', #{request.keyword},'%') + ) diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/service/ApiTaskCenterService.java b/backend/services/api-test/src/main/java/io/metersphere/api/service/ApiTaskCenterService.java index 382476a4a2..b7414422b7 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/service/ApiTaskCenterService.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/service/ApiTaskCenterService.java @@ -99,7 +99,7 @@ public class ApiTaskCenterService { public Pager> getProjectPage(TaskCenterPageRequest request, String projectId) { checkProjectExist(projectId); List projectList = getProjectOption(projectId); - return createTaskCenterPager(request, projectList); + return createTaskCenterPager(request, projectList, false); } /** @@ -111,7 +111,7 @@ public class ApiTaskCenterService { public Pager> getOrganizationPage(TaskCenterPageRequest request, String organizationId) { checkOrganizationExist(organizationId); List projectList = getOrgProjectList(organizationId); - return createTaskCenterPager(request, projectList); + return createTaskCenterPager(request, projectList, false); } /** @@ -122,22 +122,22 @@ public class ApiTaskCenterService { */ public Pager> getSystemPage(TaskCenterPageRequest request) { List projectList = getSystemProjectList(); - return createTaskCenterPager(request, projectList); + return createTaskCenterPager(request, projectList, true); } - private Pager> createTaskCenterPager(TaskCenterPageRequest request, List projectList) { + private Pager> createTaskCenterPager(TaskCenterPageRequest request, List projectList, boolean isSystem) { Page page = PageMethod.startPage(request.getCurrent(), request.getPageSize(), StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : DEFAULT_SORT); - return PageUtils.setPageInfo(page, getPage(request, projectList)); + return PageUtils.setPageInfo(page, getPage(request, projectList, isSystem)); } - public List getPage(TaskCenterPageRequest request, List projectList) { + public List getPage(TaskCenterPageRequest request, List projectList, boolean isSystem) { List list = new ArrayList<>(); List projectIds = projectList.stream().map(OptionDTO::getId).toList(); if (request != null && !projectIds.isEmpty()) { Map historyDeletedMap = new HashMap<>(); if (request.getModuleType().equals(TaskCenterResourceType.API_CASE.toString())) { - list = extApiReportMapper.taskCenterlist(request, projectIds, DateUtils.getDailyStartTime(), DateUtils.getDailyEndTime()); + list = extApiReportMapper.taskCenterlist(request, isSystem ? new ArrayList<>() : projectIds, DateUtils.getDailyStartTime(), DateUtils.getDailyEndTime()); //执行历史列表 List reportIds = list.stream().map(TaskCenterDTO::getId).toList(); if (CollectionUtils.isNotEmpty(reportIds)) { @@ -145,7 +145,7 @@ public class ApiTaskCenterService { historyDeletedMap = historyDeletedList.stream().collect(Collectors.toMap(ExecuteReportDTO::getId, Function.identity())); } } else if (request.getModuleType().equals(TaskCenterResourceType.API_SCENARIO.toString())) { - list = extApiScenarioReportMapper.taskCenterlist(request, projectIds, DateUtils.getDailyStartTime(), DateUtils.getDailyEndTime()); + list = extApiScenarioReportMapper.taskCenterlist(request, isSystem ? new ArrayList<>() : projectIds, DateUtils.getDailyStartTime(), DateUtils.getDailyEndTime()); List reportIds = list.stream().map(TaskCenterDTO::getId).toList(); if (CollectionUtils.isNotEmpty(reportIds)) { List historyDeletedList = extApiScenarioReportMapper.getHistoryDeleted(reportIds); @@ -220,7 +220,7 @@ public class ApiTaskCenterService { } public void systemStop(TaskCenterBatchRequest request, String userId) { - stopApiTask(request, getSystemProjectList().stream().map(OptionDTO::getId).toList(), userId, SYSTEM_STOP, HttpMethodConstants.POST.name(), OperationLogModule.SETTING_SYSTEM_TASK_CENTER); + stopApiTask(request, new ArrayList<>(), userId, SYSTEM_STOP, HttpMethodConstants.POST.name(), OperationLogModule.SETTING_SYSTEM_TASK_CENTER); } private void stopApiTask(TaskCenterBatchRequest request, List projectIds, String userId, String path, String method, String module) { diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/controller/TaskCenterController.java b/backend/services/system-setting/src/main/java/io/metersphere/system/controller/TaskCenterController.java index a04f22aa63..b9604c01e5 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/controller/TaskCenterController.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/controller/TaskCenterController.java @@ -179,4 +179,41 @@ public class TaskCenterController { taskCenterService.batchEnableProject(request, SessionUtils.getUserId(), SessionUtils.getCurrentProjectId(), "/task/center/project/schedule/batch-disable", OperationLogModule.PROJECT_MANAGEMENT_TASK_CENTER, false); } + @GetMapping("/system/schedule/total") + @Operation(summary = "系统-任务中心-定时任务总数") + public int systemScheduleTotal() { + return taskCenterService.getSystemScheduleTotal(); + } + + @GetMapping("/org/schedule/total") + @Operation(summary = "组织-任务中心-定时任务总数") + public int orgScheduleTotal() { + return taskCenterService.getOrgScheduleTotal(SessionUtils.getCurrentOrganizationId()); + } + + @GetMapping("/project/schedule/total") + @Operation(summary = "项目-任务中心-定时任务总数") + public int projectScheduleTotal() { + return taskCenterService.getProjectScheduleTotal(SessionUtils.getCurrentProjectId()); + } + + @GetMapping("/system/real/total") + @Operation(summary = "系统-任务中心-实时任务总数") + public int systemRealTotal() { + return taskCenterService.getSystemRealTotal(); + } + + @GetMapping("/org/real/total") + @Operation(summary = "组织-任务中心-实时任务总数") + public int orgRealTotal() { + return taskCenterService.getOrgRealTotal(SessionUtils.getCurrentOrganizationId()); + } + + @GetMapping("/project/real/total") + @Operation(summary = "项目-任务中心-实时任务总数") + public int projectRealTotal() { + return taskCenterService.getProjectRealTotal(SessionUtils.getCurrentProjectId()); + } + + } diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtRealMapper.java b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtRealMapper.java new file mode 100644 index 0000000000..4c64b35808 --- /dev/null +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtRealMapper.java @@ -0,0 +1,13 @@ +package io.metersphere.system.mapper; + +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface ExtRealMapper { + int caseReportCountByProjectIds(@Param("ids") List ids, @Param("startTime") long startTime, @Param("endTime") long endTime); + + int scenarioReportCountByProjectIds(@Param("ids") List ids, @Param("startTime") long startTime, @Param("endTime") long endTime); + + int testPlanReportCountByProjectIds(@Param("ids") List ids, @Param("startTime") long startTime, @Param("endTime") long endTime); +} diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtRealMapper.xml b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtRealMapper.xml new file mode 100644 index 0000000000..752140036f --- /dev/null +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtRealMapper.xml @@ -0,0 +1,41 @@ + + + + + + + + \ No newline at end of file diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtScheduleMapper.java b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtScheduleMapper.java index 25d863800b..aaaaec7d61 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtScheduleMapper.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtScheduleMapper.java @@ -39,4 +39,6 @@ public interface ExtScheduleMapper { List getSchedule(@Param("request") TaskCenterScheduleBatchRequest request, @Param("projectIds") List projectIds); + + int countByProjectIds(@Param("ids") List ids); } diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtScheduleMapper.xml b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtScheduleMapper.xml index c618a65045..2a8f5a4aac 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtScheduleMapper.xml +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtScheduleMapper.xml @@ -2,26 +2,26 @@ + \ No newline at end of file diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/service/TaskCenterService.java b/backend/services/system-setting/src/main/java/io/metersphere/system/service/TaskCenterService.java index aa58d28174..61aa402a35 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/service/TaskCenterService.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/service/TaskCenterService.java @@ -8,6 +8,7 @@ import io.metersphere.sdk.constants.HttpMethodConstants; import io.metersphere.sdk.constants.PermissionConstants; import io.metersphere.sdk.constants.TaskCenterResourceType; import io.metersphere.sdk.exception.MSException; +import io.metersphere.sdk.util.DateUtils; import io.metersphere.sdk.util.SubListUtils; import io.metersphere.sdk.util.Translator; import io.metersphere.system.domain.Organization; @@ -93,6 +94,8 @@ public class TaskCenterService { ApiScheduleNoticeService apiScheduleNoticeService; @Resource UserMapper userMapper; + @Resource + ExtRealMapper extRealMapper; private static final String CREATE_TIME_SORT = "create_time desc"; @@ -101,33 +104,31 @@ public class TaskCenterService { public Pager> getProjectSchedulePage(TaskCenterSchedulePageRequest request, String projectId) { checkProjectExist(projectId); List projectList = getProjectOption(projectId); - return createTaskCenterSchedulePager(request, projectList); + return createTaskCenterSchedulePager(request, projectList, false); } public Pager> getOrgSchedulePage(TaskCenterSchedulePageRequest request, String organizationId) { checkOrganizationExist(organizationId); List projectList = getOrgProjectList(organizationId); - return createTaskCenterSchedulePager(request, projectList); + return createTaskCenterSchedulePager(request, projectList, false); } public Pager> getSystemSchedulePage(TaskCenterSchedulePageRequest request) { List projectList = getSystemProjectList(); - return createTaskCenterSchedulePager(request, projectList); + return createTaskCenterSchedulePager(request, projectList, true); } - private Pager> createTaskCenterSchedulePager(TaskCenterSchedulePageRequest request, List projectList) { + private Pager> createTaskCenterSchedulePager(TaskCenterSchedulePageRequest request, List projectList, boolean isSystem) { Page page = PageMethod.startPage(request.getCurrent(), request.getPageSize(), StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : CREATE_TIME_SORT); - return PageUtils.setPageInfo(page, getSchedulePage(request, projectList)); + return PageUtils.setPageInfo(page, getSchedulePage(request, projectList, isSystem)); } - public List getSchedulePage(TaskCenterSchedulePageRequest request, List projectList) { + public List getSchedulePage(TaskCenterSchedulePageRequest request, List projectList, boolean isSystem) { List list = new ArrayList<>(); - if (request != null && !projectList.isEmpty()) { - List projectIds = projectList.stream().map(OptionDTO::getId).toList(); - list = extScheduleMapper.taskCenterSchedulelist(request, projectIds); - processTaskCenterSchedule(list, projectList, projectIds); - } + List projectIds = projectList.stream().map(OptionDTO::getId).toList(); + list = extScheduleMapper.taskCenterSchedulelist(request, isSystem ? new ArrayList<>() : projectIds); + processTaskCenterSchedule(list, projectList, projectIds); return list; } @@ -272,8 +273,7 @@ public class TaskCenterService { } public void batchEnable(TaskCenterScheduleBatchRequest request, String userId, String path, String module, boolean enable, String projectId) { - List projectList = getSystemProjectList(); - batchOperation(request, userId, path, module, projectList, enable, projectId); + batchOperation(request, userId, path, module, new ArrayList<>(), enable, projectId); } public void batchEnableOrg(TaskCenterScheduleBatchRequest request, String userId, String orgId, String path, String module, boolean enable, String projectId) { @@ -353,4 +353,51 @@ public class TaskCenterService { throw new MSException(Translator.get("no_permission_to_resource")); } } + + public int getSystemScheduleTotal() { + List projectList = getSystemProjectList(); + List projectIds = projectList.stream().map(OptionDTO::getId).toList(); + return extScheduleMapper.countByProjectIds(projectIds); + } + + public int getOrgScheduleTotal(String currentOrganizationId) { + checkOrganizationExist(currentOrganizationId); + List projectList = getOrgProjectList(currentOrganizationId); + //获取项目id + List projectIds = projectList.stream().map(OptionDTO::getId).toList(); + return extScheduleMapper.countByProjectIds(projectIds); + } + + public int getProjectScheduleTotal(String currentProjectId) { + checkProjectExist(currentProjectId); + return extScheduleMapper.countByProjectIds(List.of(currentProjectId)); + } + + public int getSystemRealTotal() { + List projectList = getSystemProjectList(); + List projectIds = projectList.stream().map(OptionDTO::getId).toList(); + int apiTestCaseTotal = extRealMapper.caseReportCountByProjectIds(projectIds, DateUtils.getDailyStartTime(), DateUtils.getDailyEndTime()); + int apiScenarioTotal = extRealMapper.scenarioReportCountByProjectIds(projectIds, DateUtils.getDailyStartTime(), DateUtils.getDailyEndTime()); + int testPlanTotal = extRealMapper.testPlanReportCountByProjectIds(projectIds, DateUtils.getDailyStartTime(), DateUtils.getDailyEndTime()); + return apiTestCaseTotal + apiScenarioTotal + testPlanTotal; + } + + public int getOrgRealTotal(String currentOrganizationId) { + checkOrganizationExist(currentOrganizationId); + List projectList = getOrgProjectList(currentOrganizationId); + //获取项目id + List projectIds = projectList.stream().map(OptionDTO::getId).toList(); + int apiTestCaseTotal = extRealMapper.caseReportCountByProjectIds(projectIds, DateUtils.getDailyStartTime(), DateUtils.getDailyEndTime()); + int apiScenarioTotal = extRealMapper.scenarioReportCountByProjectIds(projectIds, DateUtils.getDailyStartTime(), DateUtils.getDailyEndTime()); + int testPlanTotal = extRealMapper.testPlanReportCountByProjectIds(projectIds, DateUtils.getDailyStartTime(), DateUtils.getDailyEndTime()); + return apiTestCaseTotal + apiScenarioTotal + testPlanTotal; + } + + public int getProjectRealTotal(String currentProjectId) { + checkProjectExist(currentProjectId); + int apiTestCaseTotal = extRealMapper.caseReportCountByProjectIds(List.of(currentProjectId), DateUtils.getDailyStartTime(), DateUtils.getDailyEndTime()); + int apiScenarioTotal = extRealMapper.scenarioReportCountByProjectIds(List.of(currentProjectId), DateUtils.getDailyStartTime(), DateUtils.getDailyEndTime()); + int testPlanTotal = extRealMapper.testPlanReportCountByProjectIds(List.of(currentProjectId), DateUtils.getDailyStartTime(), DateUtils.getDailyEndTime()); + return apiTestCaseTotal + apiScenarioTotal + testPlanTotal; + } } diff --git a/backend/services/system-setting/src/test/java/io/metersphere/system/controller/TaskCenterScheduleControllerTests.java b/backend/services/system-setting/src/test/java/io/metersphere/system/controller/TaskCenterScheduleControllerTests.java index 4e93b590e5..f9aeb0389e 100644 --- a/backend/services/system-setting/src/test/java/io/metersphere/system/controller/TaskCenterScheduleControllerTests.java +++ b/backend/services/system-setting/src/test/java/io/metersphere/system/controller/TaskCenterScheduleControllerTests.java @@ -78,6 +78,16 @@ class TaskCenterScheduleControllerTests extends BaseTest { doTaskCenterSchedulePage("FILTER", SCHEDULED_ORG_PAGE, ScheduleTagType.TEST_PLAN.toString()); doTaskCenterSchedulePage("KEYWORD", SCHEDULED_SYSTEM_PAGE, ScheduleTagType.TEST_PLAN.toString()); doTaskCenterSchedulePage("FILTER", SCHEDULED_SYSTEM_PAGE, ScheduleTagType.TEST_PLAN.toString()); + + + this.requestGet("/task/center/system/schedule/total"); + this.requestGet("/task/center/org/schedule/total"); + this.requestGet("/task/center/project/schedule/total"); + + this.requestGet("/task/center/system/real/total"); + this.requestGet("/task/center/org/real/total"); + this.requestGet("/task/center/project/real/total"); + } private void doTaskCenterSchedulePage(String search, String url, String scheduleTagType) throws Exception { @@ -163,7 +173,6 @@ class TaskCenterScheduleControllerTests extends BaseTest { void testDel() throws Exception { LogUtils.info("delete Schedule test"); String scheduleId = "1"; - Schedule oldSchedule = scheduleMapper.selectByPrimaryKey(scheduleId); // @@请求成功 this.requestGet("/task/center/system/schedule/delete/" + "API_IMPORT/" + scheduleId); Schedule schedule = scheduleMapper.selectByPrimaryKey(scheduleId); diff --git a/frontend/src/api/modules/project-management/taskCenter.ts b/frontend/src/api/modules/project-management/taskCenter.ts index b611efec60..e2241348a2 100644 --- a/frontend/src/api/modules/project-management/taskCenter.ts +++ b/frontend/src/api/modules/project-management/taskCenter.ts @@ -16,12 +16,18 @@ import { enableScheduleOrgTaskUrl, enableScheduleProTaskUrl, enableScheduleSysTaskUrl, + orgRealTotal, + orgScheduleTotal, + projectRealTotal, + projectScheduleTotal, scheduleOrgCenterListUrl, scheduleProCenterListUrl, scheduleSysCenterListUrl, stopRealOrdApiUrl, stopRealProjectApiUrl, stopRealSysApiUrl, + systemRealTotal, + systemScheduleTotal, taskOrgRealCenterListUrl, taskProRealCenterListUrl, taskSysRealCenterListUrl, @@ -62,9 +68,11 @@ export function batchStopRealProjectApi(data: TableQueryParams) { export function stopRealSysApi(moduleType: keyof typeof TaskCenterEnum, id: string) { return MSR.get({ url: `${stopRealSysApiUrl}/${moduleType}/${id}` }); } + export function stopRealOrdApi(moduleType: keyof typeof TaskCenterEnum, id: string) { return MSR.get({ url: `${stopRealOrdApiUrl}/${moduleType}/${id}` }); } + export function stopRealProjectApi(moduleType: keyof typeof TaskCenterEnum, id: string) { return MSR.get({ url: `${stopRealProjectApiUrl}/${moduleType}/${id}` }); } @@ -86,10 +94,12 @@ export function getScheduleProApiCaseList(data: TableQueryParams) { export function deleteScheduleSysTask(moduleType: keyof typeof TaskCenterEnum, id: string) { return MSR.get({ url: `${deleteScheduleSysTaskUrl}/${moduleType}/${id}` }); } + // 组织删除定时任务 export function deleteScheduleOrgTask(moduleType: keyof typeof TaskCenterEnum, id: string) { return MSR.get({ url: `${deleteScheduleOrgTaskUrl}/${moduleType}/${id}` }); } + // 项目删除定时任务 export function deleteScheduleProTask(moduleType: keyof typeof TaskCenterEnum, id: string) { return MSR.get({ url: `${deleteScheduleProTaskUrl}/${moduleType}/${id}` }); @@ -99,46 +109,57 @@ export function deleteScheduleProTask(moduleType: keyof typeof TaskCenterEnum, i export function enableScheduleSysTask(moduleType: keyof typeof TaskCenterEnum, id: string) { return MSR.get({ url: `${enableScheduleSysTaskUrl}/${moduleType}/${id}` }); } + // 组织启用定时任务 export function enableScheduleOrgTask(moduleType: keyof typeof TaskCenterEnum, id: string) { return MSR.get({ url: `${enableScheduleOrgTaskUrl}/${moduleType}/${id}` }); } + // 项目启用定时任务 export function enableScheduleProTask(moduleType: keyof typeof TaskCenterEnum, id: string) { return MSR.get({ url: `${enableScheduleProTaskUrl}/${moduleType}/${id}` }); } + // 系统更新定时任务规则 export function updateRunRules(moduleType: keyof typeof TaskCenterEnum, id: string, data: string) { return MSR.post({ url: `${updateScheduleSysTaskUrl}/${moduleType}/${id}`, data }); } + // 组织更新定时任务规则 export function updateRunRulesOrg(moduleType: keyof typeof TaskCenterEnum, id: string, data: string) { return MSR.post({ url: `${updateScheduleOrgTaskUrl}/${moduleType}/${id}`, data }); } + // 项目更新定时任务规则 export function updateRunRulesPro(moduleType: keyof typeof TaskCenterEnum, id: string, data: string) { return MSR.post({ url: `${updateScheduleProTaskUrl}/${moduleType}/${id}`, data }); } + // 系统批量开启定时任务 export function batchEnableScheduleSysTask(data: TableQueryParams) { return MSR.post({ url: `${batchEnableScheduleSysTaskUrl}`, data }); } + // 组织批量开启定时任务 export function batchEnableScheduleOrgTask(data: TableQueryParams) { return MSR.post({ url: `${batchEnableScheduleOrgTaskUrl}`, data }); } + // 项目批量开启定时任务 export function batchEnableScheduleProTask(data: TableQueryParams) { return MSR.post({ url: `${batchEnableScheduleProTaskUrl}`, data }); } + // 系统批量关闭定时任务 export function batchDisableScheduleSysTask(data: TableQueryParams) { return MSR.post({ url: `${batchDisableScheduleSysTaskUrl}`, data }); } + // 组织批量关闭定时任务 export function batchDisableScheduleOrgTask(data: TableQueryParams) { return MSR.post({ url: `${batchDisableScheduleOrgTaskUrl}`, data }); } + // 项目批量关闭定时任务 export function batchDisableScheduleProTask(data: TableQueryParams) { return MSR.post({ url: `${batchDisableScheduleProTaskUrl}`, data }); @@ -147,4 +168,29 @@ export function batchDisableScheduleProTask(data: TableQueryParams) { export function switchSchedule(id: string) { return MSR.get({ url: `${enableSchedule}/${id}` }); } + +export function getSystemScheduleTotal() { + return MSR.get({ url: `${systemScheduleTotal}` }); +} + +export function getOrgScheduleTotal() { + return MSR.get({ url: `${orgScheduleTotal}` }); +} + +export function getProjectScheduleTotal() { + return MSR.get({ url: `${projectScheduleTotal}` }); +} + +export function getSystemRealTotal() { + return MSR.get({ url: `${systemRealTotal}` }); +} + +export function getOrgRealTotal() { + return MSR.get({ url: `${orgRealTotal}` }); +} + +export function getProjectRealTotal() { + return MSR.get({ url: `${projectRealTotal}` }); +} + export default {}; diff --git a/frontend/src/api/requrls/project-management/taskCenter.ts b/frontend/src/api/requrls/project-management/taskCenter.ts index c2f4567738..9035be6f9f 100644 --- a/frontend/src/api/requrls/project-management/taskCenter.ts +++ b/frontend/src/api/requrls/project-management/taskCenter.ts @@ -68,3 +68,11 @@ export const batchDisableScheduleSysTaskUrl = '/task/center/system/schedule/batc export const batchDisableScheduleOrgTaskUrl = '/task/center/org/schedule/batch-disable'; // 项目定时任务 批量关闭 export const batchDisableScheduleProTaskUrl = '/task/center/project/schedule/batch-disable'; + +export const systemScheduleTotal = '/task/center/system/schedule/total'; +export const orgScheduleTotal = '/task/center/org/schedule/total'; +export const projectScheduleTotal = '/task/center/project/schedule/total'; + +export const systemRealTotal = '/task/center/system/real/total'; +export const orgRealTotal = '/task/center/org/real/total'; +export const projectRealTotal = '/task/center/project/real/total'; diff --git a/frontend/src/views/project-management/taskCenter/component/scheduledTask.vue b/frontend/src/views/project-management/taskCenter/component/scheduledTask.vue index a7ae9a3359..5cfa5b17cb 100644 --- a/frontend/src/views/project-management/taskCenter/component/scheduledTask.vue +++ b/frontend/src/views/project-management/taskCenter/component/scheduledTask.vue @@ -405,24 +405,7 @@ TEST_PLAN: [...resourceColumns, ...staticColumns], }, }; - const orgApiCaseFilter = ref([]); - const orgApiScenarioFilter = ref([]); - const orgTestPlanFilter = ref([]); - const orgFiltersMap = ref>({ - API_IMPORT: orgApiCaseFilter.value, - API_SCENARIO: orgApiScenarioFilter.value, - TEST_PLAN: orgTestPlanFilter.value, - }); - - const projectApiCaseFilter = ref([]); - const projectApiScenarioFilter = ref([]); - const projectTestPlanFilter = ref([]); - const projectFiltersMap = ref>({ - API_CASE: projectApiCaseFilter.value, - API_SCENARIO: projectApiScenarioFilter.value, - TEST_PLAN: projectTestPlanFilter.value, - }); const typeFilter = computed(() => { if (showType.value === 'All') { return [];