feat(任务中心): 任务中心操作接口调试

This commit is contained in:
baiqi 2024-10-21 14:44:23 +08:00 committed by Craftsman
parent 474d7e2930
commit 196037b7d4
13 changed files with 643 additions and 332 deletions

View File

@ -1,153 +0,0 @@
import MSR from '@/api/http/index';
import {
organizationDeleteTaskUrl,
organizationExecuteTaskDetailListUrl,
organizationExecuteTaskListUrl,
organizationExecuteTaskStatisticsUrl,
organizationScheduleListUrl,
organizationStopTaskUrl,
organizationTaskCenterResourcePoolsUrl,
projectDeleteTaskUrl,
projectExecuteTaskDetailListUrl,
projectExecuteTaskListUrl,
projectExecuteTaskStatisticsUrl,
projectScheduleTaskListUrl,
projectStopTaskUrl,
projectTaskCenterResourcePoolsUrl,
scheduleProCenterListUrl,
systemDeleteTaskUrl,
systemExecuteTaskDetailListUrl,
systemExecuteTaskListUrl,
systemExecuteTaskStatisticsUrl,
systemResourcePoolStatusUrl,
systemScheduleListUrl,
systemStopTaskUrl,
systemTaskCenterResourcePoolsUrl,
} from '@/api/requrls/taskCenter';
import type { CommonList, TableQueryParams } from '@/models/common';
import type { TimingTaskCenterApiCaseItem } from '@/models/projectManagement/taskCenter';
import type {
TaskCenterResourcePoolItem,
TaskCenterResourcePoolStatus,
TaskCenterStatisticsItem,
TaskCenterSystemTaskItem,
TaskCenterTaskDetailItem,
TaskCenterTaskDetailParams,
TaskCenterTaskItem,
} from '@/models/taskCenter';
// 项目任务-系统后台任务列表
export function getProjectScheduleList(data: TableQueryParams) {
return MSR.post<CommonList<TaskCenterSystemTaskItem>>({ url: projectScheduleTaskListUrl, data });
}
// 项目任务-获取任务详情列表
export function getProjectExecuteTaskDetailList(data: TaskCenterTaskDetailParams) {
return MSR.post<CommonList<TaskCenterTaskDetailItem>>({ url: projectExecuteTaskDetailListUrl, data });
}
// 项目任务-获取任务列表
export function getProjectExecuteTaskList(data: TableQueryParams) {
return MSR.post<CommonList<TaskCenterTaskItem>>({ url: projectExecuteTaskListUrl, data });
}
// 项目任务-获取任务统计
export function getProjectExecuteTaskStatistics(data: string[]) {
return MSR.post<TaskCenterStatisticsItem[]>({ url: projectExecuteTaskStatisticsUrl, data });
}
// 项目任务-获取资源池列表
export function getProjectTaskCenterResourcePools() {
return MSR.get<TaskCenterResourcePoolItem[]>({ url: projectTaskCenterResourcePoolsUrl });
}
// 项目任务-停止任务
export function projectStopTask(id: string) {
return MSR.get({ url: `${projectStopTaskUrl}/${id}` });
}
// 项目任务-删除任务
export function projectDeleteTask(id: string) {
return MSR.get({ url: `${projectDeleteTaskUrl}/${id}` });
}
// 接口测试-定时任务列表
export function getScheduleProApiCaseList(data: TableQueryParams) {
return MSR.post<CommonList<TimingTaskCenterApiCaseItem>>({ url: scheduleProCenterListUrl, data });
}
// 系统任务-系统后台任务列表
export function getSystemScheduleList(data: TableQueryParams) {
return MSR.post<CommonList<TaskCenterSystemTaskItem>>({ url: systemScheduleListUrl, data });
}
// 系统任务-获取任务详情列表
export function getSystemExecuteTaskDetailList(data: TaskCenterTaskDetailParams) {
return MSR.post<CommonList<TaskCenterTaskDetailItem>>({ url: systemExecuteTaskDetailListUrl, data });
}
// 系统任务-获取任务列表
export function getSystemExecuteTaskList(data: TableQueryParams) {
return MSR.post<CommonList<TaskCenterTaskItem>>({ url: systemExecuteTaskListUrl, data });
}
// 系统任务-获取任务统计
export function getSystemExecuteTaskStatistics(data: string[]) {
return MSR.post<TaskCenterStatisticsItem[]>({ url: systemExecuteTaskStatisticsUrl, data });
}
// 系统任务-获取资源池列表
export function getSystemTaskCenterResourcePools() {
return MSR.get<TaskCenterResourcePoolItem[]>({ url: systemTaskCenterResourcePoolsUrl });
}
// 系统任务-停止任务
export function systemStopTask(id: string) {
return MSR.get({ url: `${systemStopTaskUrl}/${id}` });
}
// 系统任务-删除任务
export function systemDeleteTask(id: string) {
return MSR.get({ url: `${systemDeleteTaskUrl}/${id}` });
}
// 任务中心-资源池状态
export function getResourcePoolsStatus(data: string[]) {
return MSR.post<TaskCenterResourcePoolStatus[]>({ url: systemResourcePoolStatusUrl, data });
}
// 组织任务-系统后台任务列表
export function getOrganizationScheduleList(data: TableQueryParams) {
return MSR.post<CommonList<TaskCenterSystemTaskItem>>({ url: organizationScheduleListUrl, data });
}
// 组织任务-获取任务详情列表
export function getOrganizationExecuteTaskDetailList(data: TaskCenterTaskDetailParams) {
return MSR.post<CommonList<TaskCenterTaskDetailItem>>({ url: organizationExecuteTaskDetailListUrl, data });
}
// 组织任务-获取任务列表
export function getOrganizationExecuteTaskList(data: TableQueryParams) {
return MSR.post<CommonList<TaskCenterTaskItem>>({ url: organizationExecuteTaskListUrl, data });
}
// 组织任务-获取任务统计
export function getOrganizationExecuteTaskStatistics(data: string[]) {
return MSR.post<TaskCenterStatisticsItem[]>({ url: organizationExecuteTaskStatisticsUrl, data });
}
// 组织任务-获取资源池列表
export function getOrgTaskCenterResourcePools() {
return MSR.get<TaskCenterResourcePoolItem[]>({ url: organizationTaskCenterResourcePoolsUrl });
}
// 组织任务-停止任务
export function organizationStopTask(id: string) {
return MSR.get({ url: `${organizationStopTaskUrl}/${id}` });
}
// 组织任务-删除任务
export function organizationDeleteTask(id: string) {
return MSR.get({ url: `${organizationDeleteTaskUrl}/${id}` });
}

View File

@ -0,0 +1,109 @@
import MSR from '@/api/http/index';
import {
organizationBatchCloseTaskUrl,
organizationBatchDeleteTaskUrl,
organizationBatchOpenTaskUrl,
organizationBatchStopTaskDetailUrl,
organizationBatchStopTaskUrl,
organizationDeleteScheduleUrl,
organizationDeleteTaskUrl,
organizationExecuteTaskDetailListUrl,
organizationExecuteTaskListUrl,
organizationExecuteTaskStatisticsUrl,
organizationScheduleListUrl,
organizationScheduleSwitchUrl,
organizationStopTaskDetailUrl,
organizationStopTaskUrl,
organizationTaskCenterResourcePoolsUrl,
organizationTaskOrderUrl,
} from '@/api/requrls/taskCenter';
import type { CommonList, TableQueryParams } from '@/models/common';
import type {
TaskCenterBatchParams,
TaskCenterResourcePoolItem,
TaskCenterStatisticsItem,
TaskCenterSystemTaskItem,
TaskCenterTaskDetailItem,
TaskCenterTaskItem,
} from '@/models/taskCenter';
// 组织任务-系统后台任务列表
export function getOrganizationScheduleList(data: TableQueryParams) {
return MSR.post<CommonList<TaskCenterSystemTaskItem>>({ url: organizationScheduleListUrl, data });
}
// 组织任务-获取任务详情列表
export function getOrganizationExecuteTaskDetailList(data: TaskCenterBatchParams) {
return MSR.post<CommonList<TaskCenterTaskDetailItem>>({ url: organizationExecuteTaskDetailListUrl, data });
}
// 组织任务-获取任务列表
export function getOrganizationExecuteTaskList(data: TableQueryParams) {
return MSR.post<CommonList<TaskCenterTaskItem>>({ url: organizationExecuteTaskListUrl, data });
}
// 组织任务-获取任务统计
export function getOrganizationExecuteTaskStatistics(data: string[]) {
return MSR.post<TaskCenterStatisticsItem[]>({ url: organizationExecuteTaskStatisticsUrl, data });
}
// 组织任务-获取资源池列表
export function getOrgTaskCenterResourcePools() {
return MSR.get<TaskCenterResourcePoolItem[]>({ url: organizationTaskCenterResourcePoolsUrl });
}
// 组织任务-停止任务
export function organizationStopTask(id: string) {
return MSR.get({ url: `${organizationStopTaskUrl}/${id}` });
}
// 组织任务-删除任务
export function organizationDeleteTask(id: string) {
return MSR.get({ url: `${organizationDeleteTaskUrl}/${id}` });
}
// 组织任务-开启/关闭任务
export function organizationScheduleSwitch(id: string) {
return MSR.get({ url: `${organizationScheduleSwitchUrl}/${id}` });
}
// 组织任务-任务排队信息
export function organizationTaskOrder(data: string[]) {
return MSR.post<Record<string, any>>({ url: organizationTaskOrderUrl, data });
}
// 组织任务-批量停止任务
export function organizationBatchStopTask(data: TaskCenterBatchParams) {
return MSR.get({ url: organizationBatchStopTaskUrl, data });
}
// 组织任务-用例任务详情-停止任务
export function organizationStopTaskDetail(id: string) {
return MSR.get({ url: `${organizationStopTaskDetailUrl}/${id}` });
}
// 组织任务-用例任务详情-批量停止任务
export function organizationBatchStopTaskDetail(data: TaskCenterBatchParams) {
return MSR.post({ url: organizationBatchStopTaskDetailUrl, data });
}
// 组织任务-批量删除任务
export function organizationBatchDeleteTask(data: TaskCenterBatchParams) {
return MSR.post({ url: organizationBatchDeleteTaskUrl, data });
}
// 组织任务-删除后台任务
export function organizationDeleteSchedule(id: string) {
return MSR.get({ url: `${organizationDeleteScheduleUrl}/${id}` });
}
// 组织任务-批量开启后台任务
export function organizationBatchOpenTask(data: TaskCenterBatchParams) {
return MSR.post({ url: organizationBatchOpenTaskUrl, data });
}
// 组织任务-批量关闭后台任务
export function organizationBatchCloseTask(data: TaskCenterBatchParams) {
return MSR.post({ url: organizationBatchCloseTaskUrl, data });
}

View File

@ -0,0 +1,116 @@
import MSR from '@/api/http/index';
import {
projectBatchCloseTaskUrl,
projectBatchDeleteTaskUrl,
projectBatchOpenTaskUrl,
projectBatchStopTaskDetailUrl,
projectBatchStopTaskUrl,
projectDeleteScheduleUrl,
projectDeleteTaskUrl,
projectExecuteTaskDetailListUrl,
projectExecuteTaskListUrl,
projectExecuteTaskStatisticsUrl,
projectScheduleSwitchUrl,
projectScheduleTaskListUrl,
projectStopTaskDetailUrl,
projectStopTaskUrl,
projectTaskCenterResourcePoolsUrl,
projectTaskOrderUrl,
scheduleProCenterListUrl,
} from '@/api/requrls/taskCenter';
import type { CommonList, TableQueryParams } from '@/models/common';
import type { TimingTaskCenterApiCaseItem } from '@/models/projectManagement/taskCenter';
import type {
TaskCenterBatchParams,
TaskCenterResourcePoolItem,
TaskCenterStatisticsItem,
TaskCenterSystemTaskItem,
TaskCenterTaskDetailItem,
TaskCenterTaskItem,
} from '@/models/taskCenter';
// 项目任务-系统后台任务列表
export function getProjectScheduleList(data: TableQueryParams) {
return MSR.post<CommonList<TaskCenterSystemTaskItem>>({ url: projectScheduleTaskListUrl, data });
}
// 项目任务-获取任务详情列表
export function getProjectExecuteTaskDetailList(data: TaskCenterBatchParams) {
return MSR.post<CommonList<TaskCenterTaskDetailItem>>({ url: projectExecuteTaskDetailListUrl, data });
}
// 项目任务-获取任务列表
export function getProjectExecuteTaskList(data: TableQueryParams) {
return MSR.post<CommonList<TaskCenterTaskItem>>({ url: projectExecuteTaskListUrl, data });
}
// 项目任务-获取任务统计
export function getProjectExecuteTaskStatistics(data: string[]) {
return MSR.post<TaskCenterStatisticsItem[]>({ url: projectExecuteTaskStatisticsUrl, data });
}
// 项目任务-获取资源池列表
export function getProjectTaskCenterResourcePools() {
return MSR.get<TaskCenterResourcePoolItem[]>({ url: projectTaskCenterResourcePoolsUrl });
}
// 项目任务-停止任务
export function projectStopTask(id: string) {
return MSR.get({ url: `${projectStopTaskUrl}/${id}` });
}
// 项目任务-删除任务
export function projectDeleteTask(id: string) {
return MSR.get({ url: `${projectDeleteTaskUrl}/${id}` });
}
// 接口测试-定时任务列表
export function getScheduleProApiCaseList(data: TableQueryParams) {
return MSR.post<CommonList<TimingTaskCenterApiCaseItem>>({ url: scheduleProCenterListUrl, data });
}
// 项目任务-开启/关闭任务
export function projectScheduleSwitch(id: string) {
return MSR.get({ url: `${projectScheduleSwitchUrl}/${id}` });
}
// 项目任务-任务排队信息
export function projectTaskOrder(data: string[]) {
return MSR.post<Record<string, any>>({ url: projectTaskOrderUrl, data });
}
// 项目任务-批量停止任务
export function projectBatchStopTask(data: TaskCenterBatchParams) {
return MSR.get({ url: projectBatchStopTaskUrl, data });
}
// 项目任务-用例任务详情-停止任务
export function projectStopTaskDetail(id: string) {
return MSR.get({ url: `${projectStopTaskDetailUrl}/${id}` });
}
// 项目任务-用例任务详情-批量停止任务
export function projectBatchStopTaskDetail(data: TaskCenterBatchParams) {
return MSR.post({ url: projectBatchStopTaskDetailUrl, data });
}
// 项目任务-批量删除任务
export function projectBatchDeleteTask(data: TaskCenterBatchParams) {
return MSR.post({ url: projectBatchDeleteTaskUrl, data });
}
// 项目任务-删除后台任务
export function projectDeleteSchedule(id: string) {
return MSR.get({ url: `${projectDeleteScheduleUrl}/${id}` });
}
// 项目任务-批量开启后台任务
export function projectBatchOpenTask(data: TaskCenterBatchParams) {
return MSR.post({ url: projectBatchOpenTaskUrl, data });
}
// 项目任务-批量关闭后台任务
export function projectBatchCloseTask(data: TaskCenterBatchParams) {
return MSR.post({ url: projectBatchCloseTaskUrl, data });
}

View File

@ -0,0 +1,116 @@
import MSR from '@/api/http/index';
import {
systemBatchCloseTaskUrl,
systemBatchDeleteTaskUrl,
systemBatchOpenTaskUrl,
systemBatchStopTaskDetailUrl,
systemBatchStopTaskUrl,
systemDeleteScheduleUrl,
systemDeleteTaskUrl,
systemExecuteTaskDetailListUrl,
systemExecuteTaskListUrl,
systemExecuteTaskStatisticsUrl,
systemResourcePoolStatusUrl,
systemScheduleListUrl,
systemScheduleSwitchUrl,
systemStopTaskDetailUrl,
systemStopTaskUrl,
systemTaskCenterResourcePoolsUrl,
systemTaskOrderUrl,
} from '@/api/requrls/taskCenter';
import type { CommonList, TableQueryParams } from '@/models/common';
import type {
TaskCenterBatchParams,
TaskCenterResourcePoolItem,
TaskCenterResourcePoolStatus,
TaskCenterStatisticsItem,
TaskCenterSystemTaskItem,
TaskCenterTaskDetailItem,
TaskCenterTaskItem,
} from '@/models/taskCenter';
// 系统任务-系统后台任务列表
export function getSystemScheduleList(data: TableQueryParams) {
return MSR.post<CommonList<TaskCenterSystemTaskItem>>({ url: systemScheduleListUrl, data });
}
// 系统任务-开启/关闭任务
export function systemScheduleSwitch(id: string) {
return MSR.get({ url: `${systemScheduleSwitchUrl}/${id}` });
}
// 系统任务-获取任务详情列表
export function getSystemExecuteTaskDetailList(data: TaskCenterBatchParams) {
return MSR.post<CommonList<TaskCenterTaskDetailItem>>({ url: systemExecuteTaskDetailListUrl, data });
}
// 系统任务-获取任务列表
export function getSystemExecuteTaskList(data: TableQueryParams) {
return MSR.post<CommonList<TaskCenterTaskItem>>({ url: systemExecuteTaskListUrl, data });
}
// 系统任务-获取任务统计
export function getSystemExecuteTaskStatistics(data: string[]) {
return MSR.post<TaskCenterStatisticsItem[]>({ url: systemExecuteTaskStatisticsUrl, data });
}
// 系统任务-获取资源池列表
export function getSystemTaskCenterResourcePools() {
return MSR.get<TaskCenterResourcePoolItem[]>({ url: systemTaskCenterResourcePoolsUrl });
}
// 系统任务-任务排队信息
export function systemTaskOrder(data: string[]) {
return MSR.post<Record<string, any>>({ url: systemTaskOrderUrl, data });
}
// 系统任务-停止任务
export function systemStopTask(id: string) {
return MSR.get({ url: `${systemStopTaskUrl}/${id}` });
}
// 系统任务-批量停止任务
export function systemBatchStopTask(data: TaskCenterBatchParams) {
return MSR.get({ url: systemBatchStopTaskUrl, data });
}
// 系统任务-用例任务详情-停止任务
export function systemStopTaskDetail(id: string) {
return MSR.get({ url: `${systemStopTaskDetailUrl}/${id}` });
}
// 系统任务-用例任务详情-批量停止任务
export function systemBatchStopTaskDetail(data: TaskCenterBatchParams) {
return MSR.post({ url: systemBatchStopTaskDetailUrl, data });
}
// 系统任务-删除任务
export function systemDeleteTask(id: string) {
return MSR.get({ url: `${systemDeleteTaskUrl}/${id}` });
}
// 系统任务-批量删除任务
export function systemBatchDeleteTask(data: TaskCenterBatchParams) {
return MSR.post({ url: systemBatchDeleteTaskUrl, data });
}
// 系统任务-删除后台任务
export function systemDeleteSchedule(id: string) {
return MSR.get({ url: `${systemDeleteScheduleUrl}/${id}` });
}
// 任务中心-资源池状态
export function getResourcePoolsStatus(data: string[]) {
return MSR.post<TaskCenterResourcePoolStatus[]>({ url: systemResourcePoolStatusUrl, data });
}
// 系统任务-批量开启后台任务
export function systemBatchOpenTask(data: TaskCenterBatchParams) {
return MSR.post({ url: systemBatchOpenTaskUrl, data });
}
// 系统任务-批量关闭后台任务
export function systemBatchCloseTask(data: TaskCenterBatchParams) {
return MSR.post({ url: systemBatchCloseTaskUrl, data });
}

View File

@ -4,22 +4,49 @@ export const projectExecuteTaskListUrl = '/project/task-center/exec-task/page';
export const projectExecuteTaskDetailListUrl = '/project/task-center/exec-task/item/page'; // 项目任务-任务详情列表 export const projectExecuteTaskDetailListUrl = '/project/task-center/exec-task/item/page'; // 项目任务-任务详情列表
export const scheduleProCenterListUrl = '/task/center/project/schedule/page'; // 项目-任务中心-定时任务列表 export const scheduleProCenterListUrl = '/task/center/project/schedule/page'; // 项目-任务中心-定时任务列表
export const projectTaskCenterResourcePoolsUrl = '/project/task-center/resource-pool/options'; // 项目-任务中心-获取资源池列表 export const projectTaskCenterResourcePoolsUrl = '/project/task-center/resource-pool/options'; // 项目-任务中心-获取资源池列表
export const projectTaskOrderUrl = '/project/task-center/exec-task/item/order'; // 项目-任务中心-排队信息
export const projectStopTaskDetailUrl = '/project/task-center/exec-task/item/stop'; // 系统任务-用例任务详情-停止任务
export const projectBatchStopTaskDetailUrl = '/project/task-center/exec-task/item/batch-stop'; // 项目-任务中心-用例任务详情-批量停止任务
export const projectStopTaskUrl = '/project/task-center/exec-task/stop'; // 项目-任务中心-停止任务 export const projectStopTaskUrl = '/project/task-center/exec-task/stop'; // 项目-任务中心-停止任务
export const projectBatchStopTaskUrl = '/project/task-center/exec-task/batch-stop'; // 项目-任务中心-用例任务-批量停止任务
export const projectDeleteTaskUrl = '/project/task-center/exec-task/delete'; // 项目-任务中心-删除任务 export const projectDeleteTaskUrl = '/project/task-center/exec-task/delete'; // 项目-任务中心-删除任务
export const projectBatchDeleteTaskUrl = '/project/task-center/exec-task/batch-delete'; // 项目-任务中心-用例任务-批量删除任务
export const projectScheduleSwitchUrl = '/project/task-center/schedule/switch'; // 项目-任务中心-开启/关闭后台任务
export const projectDeleteScheduleUrl = '/project/task-center/schedule/delete'; // 项目-任务中心-删除后台任务
export const projectBatchOpenTaskUrl = '/project/task-center/schedule/batch-enable'; // 项目-任务中心-系统后台任务-批量开启任务
export const projectBatchCloseTaskUrl = '/project/task-center/schedule/batch-disable'; // 项目-任务中心-系统后台任务-批量关闭任务
export const systemScheduleListUrl = '/system/task-center/schedule/page'; // 系统任务-系统后台任务列表 export const systemScheduleListUrl = '/system/task-center/schedule/page'; // 系统任务-系统后台任务列表
export const systemExecuteTaskListUrl = '/system/task-center/exec-task/page'; // 系统任务-执行任务列表 export const systemExecuteTaskListUrl = '/system/task-center/exec-task/page'; // 系统任务-执行任务列表
export const systemExecuteTaskDetailListUrl = '/system/task-center/exec-task/item/page'; // 系统任务-执行任务详情列表 export const systemExecuteTaskDetailListUrl = '/system/task-center/exec-task/item/page'; // 系统任务-执行任务详情列表
export const systemExecuteTaskStatisticsUrl = '/system/task-center/exec-task/statistics'; // 系统任务-获取任务统计 export const systemExecuteTaskStatisticsUrl = '/system/task-center/exec-task/statistics'; // 系统任务-获取任务统计
export const systemTaskCenterResourcePoolsUrl = '/system/task-center/resource-pool/options'; // 系统任务-获取资源池列表 export const systemTaskCenterResourcePoolsUrl = '/system/task-center/resource-pool/options'; // 系统任务-获取资源池列表
export const systemStopTaskUrl = '/system/task-center/exec-task/stop'; // 系统任务-停止任务
export const systemDeleteTaskUrl = '/system/task-center/exec-task/delete'; // 系统任务-删除任务
export const systemResourcePoolStatusUrl = '/system/task-center/resource-pool/status'; // 系统任务-资源池状态 export const systemResourcePoolStatusUrl = '/system/task-center/resource-pool/status'; // 系统任务-资源池状态
export const systemTaskOrderUrl = '/system/task-center/exec-task/item/order'; // 系统任务-排队信息
export const systemStopTaskUrl = '/system/task-center/exec-task/stop'; // 系统任务-停止任务
export const systemStopTaskDetailUrl = '/system/task-center/exec-task/item/stop'; // 系统任务-用例任务详情-停止任务
export const systemBatchStopTaskDetailUrl = '/system/task-center/exec-task/item/batch-stop'; // 系统任务-用例任务详情-批量停止任务
export const systemBatchStopTaskUrl = '/system/task-center/exec-task/batch-stop'; // 系统任务-用例任务-批量停止任务
export const systemBatchDeleteTaskUrl = '/system/task-center/exec-task/batch-delete'; // 系统任务-用例任务-批量删除任务
export const systemDeleteTaskUrl = '/system/task-center/exec-task/delete'; // 系统任务-用例任务-删除任务
export const systemDeleteScheduleUrl = '/system/task-center/schedule/delete'; // 系统任务-删除后台任务
export const systemScheduleSwitchUrl = '/system/task-center/schedule/switch'; // 系统任务-开启/关闭后台任务
export const systemBatchOpenTaskUrl = '/system/task-center/schedule/batch-enable'; // 系统任务-系统后台任务-批量开启任务
export const systemBatchCloseTaskUrl = '/system/task-center/schedule/batch-disable'; // 系统任务-系统后台任务-批量关闭任务
export const organizationScheduleListUrl = '/organization/task-center/schedule/page'; // 组织任务-系统后台任务列表 export const organizationScheduleListUrl = '/organization/task-center/schedule/page'; // 组织任务-系统后台任务列表
export const organizationExecuteTaskListUrl = '/organization/task-center/exec-task/page'; // 组织任务-执行任务列表 export const organizationExecuteTaskListUrl = '/organization/task-center/exec-task/page'; // 组织任务-执行任务列表
export const organizationExecuteTaskDetailListUrl = '/organization/task-center/exec-task/item/page'; // 组织任务-执行任务详情列表 export const organizationExecuteTaskDetailListUrl = '/organization/task-center/exec-task/item/page'; // 组织任务-执行任务详情列表
export const organizationExecuteTaskStatisticsUrl = '/organization/task-center/exec-task/statistics'; // 组织任务-获取任务统计 export const organizationExecuteTaskStatisticsUrl = '/organization/task-center/exec-task/statistics'; // 组织任务-获取任务统计
export const organizationTaskCenterResourcePoolsUrl = '/organization/task-center/resource-pool/options'; // 组织任务-获取资源池列表 export const organizationTaskCenterResourcePoolsUrl = '/organization/task-center/resource-pool/options'; // 组织任务-获取资源池列表
export const organizationTaskOrderUrl = '/organization/task-center/exec-task/item/order'; // 组织任务-排队信息
export const organizationStopTaskUrl = '/organization/task-center/exec-task/stop'; // 组织任务-停止任务 export const organizationStopTaskUrl = '/organization/task-center/exec-task/stop'; // 组织任务-停止任务
export const organizationBatchStopTaskUrl = '/organization/task-center/exec-task/batch-stop'; // 组织任务-批量停止任务
export const organizationDeleteTaskUrl = '/organization/task-center/exec-task/delete'; // 组织任务-删除任务 export const organizationDeleteTaskUrl = '/organization/task-center/exec-task/delete'; // 组织任务-删除任务
export const organizationBatchDeleteTaskUrl = '/organization/task-center/exec-task/batch-delete'; // 组织任务-批量删除任务
export const organizationStopTaskDetailUrl = '/organization/task-center/exec-task/item/stop/{id}'; // 系统任务-用例任务详情-停止任务
export const organizationBatchStopTaskDetailUrl = '/organization/task-center/exec-task/item/batch-stop'; // 组织任务-用例任务详情-批量停止任务
export const organizationScheduleSwitchUrl = '/organization/task-center/schedule/switch'; // 组织任务-开启/关闭后台任务
export const organizationDeleteScheduleUrl = '/organization/task-center/schedule/delete'; // 组织任务-删除后台任务
export const organizationBatchOpenTaskUrl = '/organization/task-center/schedule/batch-enable'; // 组织任务-系统后台任务-批量开启任务
export const organizationBatchCloseTaskUrl = '/organization/task-center/schedule/batch-disable'; // 组织任务-系统后台任务-批量关闭任务

View File

@ -19,11 +19,13 @@ export interface TaskCenterSystemTaskItem {
createUserId: string; createUserId: string;
createUserName: string; createUserName: string;
createTime: number; createTime: number;
[key: string]: any;
} }
export interface TaskCenterTaskDetailParams extends TableQueryParams { export interface TaskCenterBatchParams extends TableQueryParams {
taskId: string; taskId?: string;
resourcePoolId: string; resourcePoolIds?: string[];
resourcePoolNodes?: string[];
} }
export interface TaskCenterTaskItem { export interface TaskCenterTaskItem {
@ -71,7 +73,7 @@ export interface TaskCenterTaskDetailItem {
userName: string; userName: string;
resourcePoolName: string; resourcePoolName: string;
triggerMode: string; // 触发方式 triggerMode: string; // 触发方式
lineNum: number; lineNum: number | string;
} }
export interface TaskCenterStatisticsItem { export interface TaskCenterStatisticsItem {

View File

@ -40,7 +40,7 @@
import useTable from '@/components/pure/ms-table/useTable'; import useTable from '@/components/pure/ms-table/useTable';
import { switchDefinitionSchedule } from '@/api/modules/api-test/management'; import { switchDefinitionSchedule } from '@/api/modules/api-test/management';
import { getScheduleProApiCaseList } from '@/api/modules/taskCenter'; import { getScheduleProApiCaseList, projectDeleteSchedule } from '@/api/modules/taskCenter/project';
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import { TimingTaskCenterApiCaseItem } from '@/models/projectManagement/taskCenter'; import { TimingTaskCenterApiCaseItem } from '@/models/projectManagement/taskCenter';
@ -139,6 +139,9 @@
if (value) { if (value) {
loadTaskList(); loadTaskList();
} }
},
{
immediate: true,
} }
); );
@ -158,7 +161,7 @@
async function deleteTask(record: TimingTaskCenterApiCaseItem) { async function deleteTask(record: TimingTaskCenterApiCaseItem) {
try { try {
// await switchDefinitionSchedule(record.id); await projectDeleteSchedule(record.id);
Message.success(t('common.deleteSuccess')); Message.success(t('common.deleteSuccess'));
loadTaskList(); loadTaskList();
} catch (error) { } catch (error) {

View File

@ -62,16 +62,13 @@
> >
{{ t('common.stop') }} {{ t('common.stop') }}
</MsButton> </MsButton>
<MsButton v-else v-permission="['SYSTEM_USER:READ+DELETE']" @click="deleteTask(record)"> <!-- <MsButton
{{ t('common.delete') }}
</MsButton>
<MsButton
v-if="record.status === ExecuteStatusEnum.COMPLETED && record.result === ExecuteResultEnum.ERROR" v-if="record.status === ExecuteStatusEnum.COMPLETED && record.result === ExecuteResultEnum.ERROR"
v-permission="['SYSTEM_USER:READ+DELETE']" v-permission="['SYSTEM_USER:READ+DELETE']"
@click="rerunTask(record)" @click="rerunTask(record)"
> >
{{ t('ms.taskCenter.rerun') }} {{ t('ms.taskCenter.rerun') }}
</MsButton> </MsButton> -->
<MsButton <MsButton
v-if="record.status === ExecuteStatusEnum.COMPLETED" v-if="record.status === ExecuteStatusEnum.COMPLETED"
v-permission="['SYSTEM_USER:READ+DELETE']" v-permission="['SYSTEM_USER:READ+DELETE']"
@ -104,12 +101,25 @@
import { import {
getOrganizationExecuteTaskDetailList, getOrganizationExecuteTaskDetailList,
getOrgTaskCenterResourcePools, getOrgTaskCenterResourcePools,
organizationBatchStopTaskDetail,
organizationStopTaskDetail,
organizationTaskOrder,
} from '@/api/modules/taskCenter/organization';
import {
getProjectExecuteTaskDetailList, getProjectExecuteTaskDetailList,
getProjectTaskCenterResourcePools, getProjectTaskCenterResourcePools,
projectBatchStopTaskDetail,
projectStopTaskDetail,
projectTaskOrder,
} from '@/api/modules/taskCenter/project';
import {
getResourcePoolsStatus, getResourcePoolsStatus,
getSystemExecuteTaskDetailList, getSystemExecuteTaskDetailList,
getSystemTaskCenterResourcePools, getSystemTaskCenterResourcePools,
} from '@/api/modules/taskCenter'; systemBatchStopTaskDetail,
systemStopTaskDetail,
systemTaskOrder,
} from '@/api/modules/taskCenter/system';
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import useModal from '@/hooks/useModal'; import useModal from '@/hooks/useModal';
import useTableStore from '@/hooks/useTableStore'; import useTableStore from '@/hooks/useTableStore';
@ -219,7 +229,7 @@
}, },
{ {
title: 'ms.taskCenter.startExecuteTime', title: 'ms.taskCenter.startExecuteTime',
dataIndex: 'startExecuteTime', dataIndex: 'startTime',
width: 170, width: 170,
sortable: { sortable: {
sortDirections: ['ascend', 'descend'], sortDirections: ['ascend', 'descend'],
@ -228,7 +238,7 @@
}, },
{ {
title: 'ms.taskCenter.endExecuteTime', title: 'ms.taskCenter.endExecuteTime',
dataIndex: 'endExecuteTime', dataIndex: 'endTime',
width: 170, width: 170,
sortable: { sortable: {
sortDirections: ['ascend', 'descend'], sortDirections: ['ascend', 'descend'],
@ -246,7 +256,7 @@
slotName: 'action', slotName: 'action',
dataIndex: 'operation', dataIndex: 'operation',
fixed: 'right', fixed: 'right',
width: 180, width: 150,
}, },
]; ];
@ -282,14 +292,10 @@
label: 'common.stop', label: 'common.stop',
eventTag: 'stop', eventTag: 'stop',
}, },
{ // {
label: 'ms.taskCenter.rerun', // label: 'ms.taskCenter.rerun',
eventTag: 'rerun', // eventTag: 'rerun',
}, // },
{
label: 'common.delete',
eventTag: 'delete',
},
], ],
}; };
@ -299,7 +305,7 @@
org: getOrganizationExecuteTaskDetailList, org: getOrganizationExecuteTaskDetailList,
}[props.type]; }[props.type];
const { propsRes, propsEvent, loadList, setLoadListParams, resetSelector } = useTable( const { propsRes, propsEvent, loadList, setLoadListParams, getTableQueryParams, resetSelector } = useTable(
currentExecuteTaskDetailList, currentExecuteTaskDetailList,
{ {
tableKey: TableKeyEnum.TASK_CENTER_CASE_TASK_DETAIL, tableKey: TableKeyEnum.TASK_CENTER_CASE_TASK_DETAIL,
@ -313,8 +319,8 @@
return { return {
...item, ...item,
resourcePoolName: [item.resourcePoolName], resourcePoolName: [item.resourcePoolName],
startExecuteTime: item.startExecuteTime ? dayjs(item.startExecuteTime).format('YYYY-MM-DD HH:mm:ss') : '-', startTime: item.startTime ? dayjs(item.startTime).format('YYYY-MM-DD HH:mm:ss') : '-',
endExecuteTime: item.endExecuteTime ? dayjs(item.endExecuteTime).format('YYYY-MM-DD HH:mm:ss') : '-', endTime: item.endTime ? dayjs(item.endTime).format('YYYY-MM-DD HH:mm:ss') : '-',
}; };
} }
); );
@ -324,47 +330,17 @@
loadList(); loadList();
} }
/** const currentStopTask = {
* 删除任务 system: systemStopTaskDetail,
*/ project: projectStopTaskDetail,
function deleteTask(record?: TaskCenterTaskDetailItem, isBatch?: boolean, params?: BatchActionQueryParams) { org: organizationStopTaskDetail,
let title = t('ms.taskCenter.deleteTaskTitle', { name: characterLimit(record?.taskName) }); }[props.type];
let selectIds = [record?.id || ''];
if (isBatch) { const currentBatchStopTask = {
title = t('ms.taskCenter.deleteCaseTaskTitle', { system: systemBatchStopTaskDetail,
count: params?.currentSelectCount || tableSelected.value.length, project: projectBatchStopTaskDetail,
}); org: organizationBatchStopTaskDetail,
selectIds = tableSelected.value as string[]; }[props.type];
}
openModal({
type: 'error',
title,
content: t('ms.taskCenter.deleteCaseTaskTip'),
okText: t('common.confirmDelete'),
cancelText: t('common.cancel'),
okButtonProps: {
status: 'danger',
},
maskClosable: false,
onBeforeOk: async () => {
try {
// await deleteUserInfo({
// selectIds,
// selectAll: !!params?.selectAll,
// excludeIds: params?.excludeIds || [],
// condition: { keyword: keyword.value },
// });
Message.success(t('common.deleteSuccess'));
resetSelector();
loadList();
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
}
},
hideCancel: false,
});
}
function stopTask(record?: TaskCenterTaskDetailItem, isBatch?: boolean, params?: BatchActionQueryParams) { function stopTask(record?: TaskCenterTaskDetailItem, isBatch?: boolean, params?: BatchActionQueryParams) {
let title = t('ms.taskCenter.stopTaskTitle', { name: characterLimit(record?.taskName) }); let title = t('ms.taskCenter.stopTaskTitle', { name: characterLimit(record?.taskName) });
@ -387,12 +363,16 @@
maskClosable: false, maskClosable: false,
onBeforeOk: async () => { onBeforeOk: async () => {
try { try {
// await deleteUserInfo({ if (isBatch) {
// selectIds, await currentBatchStopTask({
// selectAll: !!params?.selectAll, selectIds,
// excludeIds: params?.excludeIds || [], selectAll: !!params?.selectAll,
// condition: { keyword: keyword.value }, excludeIds: params?.excludeIds || [],
// }); ...getTableQueryParams(),
});
} else {
await currentStopTask(record?.id || '');
}
Message.success(t('common.stopped')); Message.success(t('common.stopped'));
resetSelector(); resetSelector();
loadList(); loadList();
@ -412,9 +392,6 @@
function handleTableBatch(event: BatchActionParams, params: BatchActionQueryParams) { function handleTableBatch(event: BatchActionParams, params: BatchActionQueryParams) {
batchModalParams.value = params; batchModalParams.value = params;
switch (event.eventTag) { switch (event.eventTag) {
case 'delete':
deleteTask(undefined, true, params);
break;
case 'stop': case 'stop':
stopTask(undefined, true, params); stopTask(undefined, true, params);
break; break;
@ -451,6 +428,9 @@
} }
} }
/**
* 初始化当前页所有任务的资源池状态
*/
async function initCurrentPageResourcePoolsStatus() { async function initCurrentPageResourcePoolsStatus() {
const ids = propsRes.value.data.map((item) => item.id); const ids = propsRes.value.data.map((item) => item.id);
if (ids.length === 0) { if (ids.length === 0) {
@ -470,31 +450,74 @@
} }
} }
async function rerunTask(record: TaskCenterTaskDetailItem) { const currentQueueRequest = {
system: systemTaskOrder,
project: projectTaskOrder,
org: organizationTaskOrder,
}[props.type];
/**
* 初始化当前页所有任务的排队状态
*/
async function initCurrentPageQueue() {
const ids = propsRes.value.data.map((item) => item.id);
if (ids.length === 0) {
return;
}
try { try {
// await deleteUserInfo({ const res = await currentQueueRequest(ids);
// selectIds, propsRes.value.data.forEach((item) => {
// selectAll: !!params?.selectAll, const queue = res[item.id];
// excludeIds: params?.excludeIds || [], if (queue) {
// condition: { keyword: keyword.value }, item.lineNum = queue;
// }); } else {
Message.success(t('common.executionSuccess')); item.lineNum = t('ms.taskCenter.waitQueue');
resetSelector(); }
await loadList(); });
initCurrentPageResourcePoolsStatus();
} catch (error) { } catch (error) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.log(error); console.log(error);
} }
} }
// async function rerunTask(record: TaskCenterTaskDetailItem) {
// try {
// // await deleteUserInfo({
// // selectIds,
// // selectAll: !!params?.selectAll,
// // excludeIds: params?.excludeIds || [],
// // condition: { keyword: keyword.value },
// // });
// Message.success(t('common.executionSuccess'));
// resetSelector();
// await loadList();
// initCurrentPageResourcePoolsStatus();
// } catch (error) {
// // eslint-disable-next-line no-console
// console.log(error);
// }
// }
watch(
() => propsRes.value.data,
() => {
initCurrentPageResourcePoolsStatus();
initCurrentPageQueue();
},
{
immediate: true,
}
);
onMounted(async () => { onMounted(async () => {
if (props.id) { if (props.id) {
keyword.value = props.id; keyword.value = props.id;
setLoadListParams({ keyword: props.id });
} }
initResourcePools(); initResourcePools();
await loadList(); await loadList();
initCurrentPageResourcePoolsStatus(); initCurrentPageResourcePoolsStatus();
initCurrentPageQueue();
}); });
await tableStore.initColumn(TableKeyEnum.TASK_CENTER_CASE_TASK_DETAIL, columns, 'drawer'); await tableStore.initColumn(TableKeyEnum.TASK_CENTER_CASE_TASK_DETAIL, columns, 'drawer');

View File

@ -113,19 +113,19 @@
<MsButton v-else v-permission="['SYSTEM_USER:READ+DELETE']" @click="deleteTask(record)"> <MsButton v-else v-permission="['SYSTEM_USER:READ+DELETE']" @click="deleteTask(record)">
{{ t('common.delete') }} {{ t('common.delete') }}
</MsButton> </MsButton>
<MsButton <!-- <MsButton
v-if="record.status === ExecuteStatusEnum.COMPLETED && record.result === ExecuteResultEnum.ERROR" v-if="record.status === ExecuteStatusEnum.COMPLETED && record.result === ExecuteResultEnum.ERROR"
v-permission="['SYSTEM_USER:READ+DELETE']" v-permission="['SYSTEM_USER:READ+DELETE']"
@click="rerunTask(record)" @click="rerunTask(record)"
> >
{{ t('ms.taskCenter.rerun') }} {{ t('ms.taskCenter.rerun') }}
</MsButton> </MsButton> -->
<MsButton <MsButton
v-if="record.status === ExecuteStatusEnum.COMPLETED" v-if="record.status === ExecuteStatusEnum.COMPLETED"
v-permission="['SYSTEM_USER:READ+DELETE']" v-permission="['SYSTEM_USER:READ+DELETE']"
@click="checkReport(record)" @click="checkReport(record)"
> >
{{ t('ms.taskCenter.executeResult') }} {{ t('ms.taskCenter.checkReport') }}
</MsButton> </MsButton>
</template> </template>
</ms-base-table> </ms-base-table>
@ -178,17 +178,27 @@
import { import {
getOrganizationExecuteTaskList, getOrganizationExecuteTaskList,
getOrganizationExecuteTaskStatistics, getOrganizationExecuteTaskStatistics,
getProjectExecuteTaskList, organizationBatchDeleteTask,
getProjectExecuteTaskStatistics, organizationBatchStopTask,
getSystemExecuteTaskList,
getSystemExecuteTaskStatistics,
organizationDeleteTask, organizationDeleteTask,
organizationStopTask, organizationStopTask,
} from '@/api/modules/taskCenter/organization';
import {
getProjectExecuteTaskList,
getProjectExecuteTaskStatistics,
projectBatchDeleteTask,
projectBatchStopTask,
projectDeleteTask, projectDeleteTask,
projectStopTask, projectStopTask,
} from '@/api/modules/taskCenter/project';
import {
getSystemExecuteTaskList,
getSystemExecuteTaskStatistics,
systemBatchDeleteTask,
systemBatchStopTask,
systemDeleteTask, systemDeleteTask,
systemStopTask, systemStopTask,
} from '@/api/modules/taskCenter'; } from '@/api/modules/taskCenter/system';
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import useModal from '@/hooks/useModal'; import useModal from '@/hooks/useModal';
import useOpenNewPage from '@/hooks/useOpenNewPage'; import useOpenNewPage from '@/hooks/useOpenNewPage';
@ -202,7 +212,7 @@
import { TestPlanRouteEnum } from '@/enums/routeEnum'; import { TestPlanRouteEnum } from '@/enums/routeEnum';
import { TableKeyEnum } from '@/enums/tableEnum'; import { TableKeyEnum } from '@/enums/tableEnum';
import { FilterSlotNameEnum } from '@/enums/tableFilterEnum'; import { FilterSlotNameEnum } from '@/enums/tableFilterEnum';
import { ExecuteResultEnum, ExecuteStatusEnum, ExecuteTaskType, SystemTaskType } from '@/enums/taskCenter'; import { ExecuteStatusEnum, ExecuteTaskType } from '@/enums/taskCenter';
import { executeFinishedRateMap, executeMethodMap, executeResultMap, executeStatusMap } from './config'; import { executeFinishedRateMap, executeMethodMap, executeResultMap, executeStatusMap } from './config';
@ -211,6 +221,7 @@
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'goDetail', id: string): void; (e: 'goDetail', id: string): void;
(e: 'init'): void;
}>(); }>();
const { t } = useI18n(); const { t } = useI18n();
@ -369,35 +380,23 @@
org: getOrganizationExecuteTaskStatistics, org: getOrganizationExecuteTaskStatistics,
}[props.type]; }[props.type];
const currentStopTask = {
system: projectStopTask,
project: organizationStopTask,
org: systemStopTask,
}[props.type];
const currentDeleteTask = {
system: projectDeleteTask,
project: organizationDeleteTask,
org: systemDeleteTask,
}[props.type];
const tableBatchActions = { const tableBatchActions = {
baseAction: [ baseAction: [
{ {
label: 'common.stop', label: 'common.stop',
eventTag: 'stop', eventTag: 'stop',
}, },
{ // {
label: 'ms.taskCenter.rerun', // label: 'ms.taskCenter.rerun',
eventTag: 'rerun', // eventTag: 'rerun',
}, // },
{ {
label: 'common.delete', label: 'common.delete',
eventTag: 'delete', eventTag: 'delete',
}, },
], ],
}; };
const { propsRes, propsEvent, loadList, setLoadListParams, resetSelector } = useTable( const { propsRes, propsEvent, loadList, setLoadListParams, getTableQueryParams, resetSelector } = useTable(
currentExecuteTaskList, currentExecuteTaskList,
{ {
tableKey: TableKeyEnum.TASK_CENTER_CASE_TASK, tableKey: TableKeyEnum.TASK_CENTER_CASE_TASK,
@ -475,6 +474,18 @@
emit('goDetail', id); emit('goDetail', id);
} }
const currentDeleteTask = {
system: systemDeleteTask,
project: projectDeleteTask,
org: organizationDeleteTask,
}[props.type];
const currentBatchDeleteTask = {
system: systemBatchDeleteTask,
project: projectBatchDeleteTask,
org: organizationBatchDeleteTask,
}[props.type];
/** /**
* 删除任务 * 删除任务
*/ */
@ -500,12 +511,12 @@
onBeforeOk: async () => { onBeforeOk: async () => {
try { try {
if (isBatch) { if (isBatch) {
// await deleteUserInfo({ await currentBatchDeleteTask({
// selectIds, selectIds,
// selectAll: !!params?.selectAll, selectAll: !!params?.selectAll,
// excludeIds: params?.excludeIds || [], excludeIds: params?.excludeIds || [],
// condition: { keyword: keyword.value }, ...getTableQueryParams(),
// }); });
} else { } else {
await currentDeleteTask(record?.id || ''); await currentDeleteTask(record?.id || '');
} }
@ -521,6 +532,21 @@
}); });
} }
const currentStopTask = {
system: projectStopTask,
project: organizationStopTask,
org: systemStopTask,
}[props.type];
const currentBatchStopTask = {
system: projectBatchStopTask,
project: organizationBatchStopTask,
org: systemBatchStopTask,
}[props.type];
/**
* 停止任务
*/
function stopTask(record?: TaskCenterTaskItem, isBatch?: boolean, params?: BatchActionQueryParams) { function stopTask(record?: TaskCenterTaskItem, isBatch?: boolean, params?: BatchActionQueryParams) {
let title = t('ms.taskCenter.stopTaskTitle', { name: characterLimit(record?.taskName) }); let title = t('ms.taskCenter.stopTaskTitle', { name: characterLimit(record?.taskName) });
let selectIds = [record?.id || '']; let selectIds = [record?.id || ''];
@ -540,12 +566,12 @@
onBeforeOk: async () => { onBeforeOk: async () => {
try { try {
if (isBatch) { if (isBatch) {
// await deleteUserInfo({ await currentBatchStopTask({
// selectIds, selectIds,
// selectAll: !!params?.selectAll, selectAll: !!params?.selectAll,
// excludeIds: params?.excludeIds || [], excludeIds: params?.excludeIds || [],
// condition: { keyword: keyword.value }, ...getTableQueryParams(),
// }); });
} else { } else {
await currentStopTask(record?.id || ''); await currentStopTask(record?.id || '');
} }
@ -580,23 +606,23 @@
} }
} }
async function rerunTask(record: TaskCenterTaskItem) { // async function rerunTask(record: TaskCenterTaskItem) {
try { // try {
// await deleteUserInfo({ // // await deleteUserInfo({
// selectIds, // // selectIds,
// selectAll: !!params?.selectAll, // // selectAll: !!params?.selectAll,
// excludeIds: params?.excludeIds || [], // // excludeIds: params?.excludeIds || [],
// condition: { keyword: keyword.value }, // // condition: { keyword: keyword.value },
// }); // // });
Message.success(t('common.executionSuccess')); // Message.success(t('common.executionSuccess'));
resetSelector(); // resetSelector();
await loadList(); // await loadList();
initTaskStatistics(); // initTaskStatistics();
} catch (error) { // } catch (error) {
// eslint-disable-next-line no-console // // eslint-disable-next-line no-console
console.log(error); // console.log(error);
} // }
} // }
/** /**
* 报告详情 showReportDetail * 报告详情 showReportDetail
@ -664,6 +690,7 @@
onMounted(async () => { onMounted(async () => {
searchTask(); searchTask();
getTime(); getTime();
emit('init');
}); });
watch( watch(

View File

@ -74,7 +74,27 @@
import useTable from '@/components/pure/ms-table/useTable'; import useTable from '@/components/pure/ms-table/useTable';
import MsTag from '@/components/pure/ms-tag/ms-tag.vue'; import MsTag from '@/components/pure/ms-tag/ms-tag.vue';
import { getOrganizationScheduleList, getProjectScheduleList, getSystemScheduleList } from '@/api/modules/taskCenter'; import {
getOrganizationScheduleList,
organizationBatchCloseTask,
organizationBatchOpenTask,
organizationDeleteSchedule,
organizationScheduleSwitch,
} from '@/api/modules/taskCenter/organization';
import {
getProjectScheduleList,
projectBatchCloseTask,
projectBatchOpenTask,
projectDeleteSchedule,
projectScheduleSwitch,
} from '@/api/modules/taskCenter/project';
import {
getSystemScheduleList,
systemBatchCloseTask,
systemBatchOpenTask,
systemDeleteSchedule,
systemScheduleSwitch,
} from '@/api/modules/taskCenter/system';
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import useModal from '@/hooks/useModal'; import useModal from '@/hooks/useModal';
import useOpenNewPage from '@/hooks/useOpenNewPage'; import useOpenNewPage from '@/hooks/useOpenNewPage';
@ -82,6 +102,7 @@
import { characterLimit } from '@/utils'; import { characterLimit } from '@/utils';
import { hasAnyPermission } from '@/utils/permission'; import { hasAnyPermission } from '@/utils/permission';
import { TaskCenterSystemTaskItem } from '@/models/taskCenter';
import { MenuEnum } from '@/enums/commonEnum'; import { MenuEnum } from '@/enums/commonEnum';
import { ApiTestRouteEnum, ProjectManagementRouteEnum, TestPlanRouteEnum } from '@/enums/routeEnum'; import { ApiTestRouteEnum, ProjectManagementRouteEnum, TestPlanRouteEnum } from '@/enums/routeEnum';
import { TableKeyEnum } from '@/enums/tableEnum'; import { TableKeyEnum } from '@/enums/tableEnum';
@ -222,7 +243,7 @@
project: getProjectScheduleList, project: getProjectScheduleList,
}[props.type]; }[props.type];
const { propsRes, propsEvent, loadList, setLoadListParams, resetSelector } = useTable( const { propsRes, propsEvent, loadList, setLoadListParams, getTableQueryParams, resetSelector } = useTable(
currentScheduleList, currentScheduleList,
{ {
tableKey: TableKeyEnum.TASK_CENTER_SYSTEM_TASK, tableKey: TableKeyEnum.TASK_CENTER_SYSTEM_TASK,
@ -248,18 +269,17 @@
loadList(); loadList();
} }
const currentDeleteSchedule = {
system: systemDeleteSchedule,
org: organizationDeleteSchedule,
project: projectDeleteSchedule,
}[props.type];
/** /**
* 删除任务 * 删除任务
*/ */
function deleteTask(record?: any, isBatch?: boolean, params?: BatchActionQueryParams) { function deleteTask(record: TaskCenterSystemTaskItem) {
let title = t('ms.taskCenter.deleteTaskTitle', { name: characterLimit(record?.taskName) }); const title = t('ms.taskCenter.deleteTaskTitle', { name: characterLimit(record?.taskName) });
let selectIds = [record?.id || ''];
if (isBatch) {
title = t('ms.taskCenter.deleteTimeTaskTitle', {
count: params?.currentSelectCount || tableSelected.value.length,
});
selectIds = tableSelected.value as string[];
}
openModal({ openModal({
type: 'error', type: 'error',
title, title,
@ -272,12 +292,7 @@
maskClosable: false, maskClosable: false,
onBeforeOk: async () => { onBeforeOk: async () => {
try { try {
// await deleteUserInfo({ await currentDeleteSchedule(record?.id || '');
// selectIds,
// selectAll: !!params?.selectAll,
// excludeIds: params?.excludeIds || [],
// condition: { keyword: keyword.value },
// });
Message.success(t('common.deleteSuccess')); Message.success(t('common.deleteSuccess'));
resetSelector(); resetSelector();
loadList(); loadList();
@ -290,14 +305,19 @@
}); });
} }
function openTask(params?: BatchActionQueryParams) { const currentBatchOpenSchedule = {
system: systemBatchOpenTask,
org: organizationBatchOpenTask,
project: projectBatchOpenTask,
}[props.type];
async function openTask(params?: BatchActionQueryParams) {
try { try {
// await deleteUserInfo({ await currentBatchOpenSchedule({
// selectIds, selectIds: params?.selectIds || [],
// selectAll: !!params?.selectAll, selectAll: !!params?.selectAll,
// excludeIds: params?.excludeIds || [], excludeIds: params?.excludeIds || [],
// condition: { keyword: keyword.value }, ...getTableQueryParams(),
// }); });
Message.success(t('ms.taskCenter.openTaskSuccess')); Message.success(t('ms.taskCenter.openTaskSuccess'));
resetSelector(); resetSelector();
loadList(); loadList();
@ -307,14 +327,19 @@
} }
} }
function closeTask(params?: BatchActionQueryParams) { const currentBatchCloseSchedule = {
system: systemBatchCloseTask,
org: organizationBatchCloseTask,
project: projectBatchCloseTask,
}[props.type];
async function closeTask(params?: BatchActionQueryParams) {
try { try {
// await deleteUserInfo({ await currentBatchCloseSchedule({
// selectIds, selectIds: params?.selectIds || [],
// selectAll: !!params?.selectAll, selectAll: !!params?.selectAll,
// excludeIds: params?.excludeIds || [], excludeIds: params?.excludeIds || [],
// condition: { keyword: keyword.value }, ...getTableQueryParams(),
// }); });
Message.success(t('ms.taskCenter.closeTaskSuccess')); Message.success(t('ms.taskCenter.closeTaskSuccess'));
resetSelector(); resetSelector();
loadList(); loadList();
@ -324,7 +349,7 @@
} }
} }
function checkDetail(record: any) { function checkDetail(record: TaskCenterSystemTaskItem) {
switch (record.resourceType) { switch (record.resourceType) {
case SystemTaskType.API_IMPORT: case SystemTaskType.API_IMPORT:
openNewPage(ApiTestRouteEnum.API_TEST_MANAGEMENT, { openNewPage(ApiTestRouteEnum.API_TEST_MANAGEMENT, {
@ -356,8 +381,17 @@
} }
} }
async function handleBeforeEnableChange(record: any) { const currentSwitchSchedule = {
system: systemScheduleSwitch,
org: organizationScheduleSwitch,
project: projectScheduleSwitch,
}[props.type];
/**
* 启用/关闭任务
*/
async function handleBeforeEnableChange(record: TaskCenterSystemTaskItem) {
try { try {
await currentSwitchSchedule(record.id);
Message.success(t(record.enable ? 'ms.taskCenter.closeTaskSuccess' : 'ms.taskCenter.openTaskSuccess')); Message.success(t(record.enable ? 'ms.taskCenter.closeTaskSuccess' : 'ms.taskCenter.openTaskSuccess'));
return true; return true;
} catch (error) { } catch (error) {
@ -387,7 +421,7 @@
async function handleRunRuleChange( async function handleRunRuleChange(
val: string | number | boolean | Record<string, any> | (string | number | boolean | Record<string, any>)[], val: string | number | boolean | Record<string, any> | (string | number | boolean | Record<string, any>)[],
record: any record: TaskCenterSystemTaskItem
) { ) {
try { try {
record.runRuleLoading = true; record.runRuleLoading = true;

View File

@ -6,7 +6,12 @@
<a-divider margin="0"></a-divider> <a-divider margin="0"></a-divider>
<div class="ms-taskCenter-content"> <div class="ms-taskCenter-content">
<Suspense> <Suspense>
<caseTaskTable v-if="activeTab === TaskCenterEnum.CASE" :type="props.type" @go-detail="goTaskDetail" /> <caseTaskTable
v-if="activeTab === TaskCenterEnum.CASE"
:type="props.type"
@go-detail="goTaskDetail"
@init="activeTaskId = ''"
/>
<caseTaskDetailTable v-else-if="activeTab === TaskCenterEnum.DETAIL" :id="activeTaskId" :type="props.type" /> <caseTaskDetailTable v-else-if="activeTab === TaskCenterEnum.DETAIL" :id="activeTaskId" :type="props.type" />
<systemTaskTable v-else-if="activeTab === TaskCenterEnum.BACKEND" :type="props.type" /> <systemTaskTable v-else-if="activeTab === TaskCenterEnum.BACKEND" :type="props.type" />
</Suspense> </Suspense>

View File

@ -55,4 +55,5 @@ export default {
'ms.taskCenter.thirdPartSync': 'Third-party sync', 'ms.taskCenter.thirdPartSync': 'Third-party sync',
'ms.taskCenter.openTaskSuccess': 'Task started successfully', 'ms.taskCenter.openTaskSuccess': 'Task started successfully',
'ms.taskCenter.closeTaskSuccess': 'Task closed successfully', 'ms.taskCenter.closeTaskSuccess': 'Task closed successfully',
'ms.taskCenter.waitQueue': 'Waiting in line',
}; };

View File

@ -55,4 +55,5 @@ export default {
'ms.taskCenter.thirdPartSync': '第三方同步', 'ms.taskCenter.thirdPartSync': '第三方同步',
'ms.taskCenter.openTaskSuccess': '任务开启成功', 'ms.taskCenter.openTaskSuccess': '任务开启成功',
'ms.taskCenter.closeTaskSuccess': '任务关闭成功', 'ms.taskCenter.closeTaskSuccess': '任务关闭成功',
'ms.taskCenter.waitQueue': '等待排队',
}; };