feat(任务中心): 任务中心接口联调
This commit is contained in:
parent
6315e15e90
commit
b6f58a89dd
|
@ -5,8 +5,10 @@ import {
|
|||
organizationBatchOpenTaskUrl,
|
||||
organizationBatchStopTaskDetailUrl,
|
||||
organizationBatchStopTaskUrl,
|
||||
organizationBatchTaskReportUrl,
|
||||
organizationDeleteScheduleUrl,
|
||||
organizationDeleteTaskUrl,
|
||||
organizationEditCronUrl,
|
||||
organizationExecuteTaskDetailListUrl,
|
||||
organizationExecuteTaskListUrl,
|
||||
organizationExecuteTaskStatisticsUrl,
|
||||
|
@ -21,6 +23,7 @@ import {
|
|||
import type { CommonList, TableQueryParams } from '@/models/common';
|
||||
import type {
|
||||
TaskCenterBatchParams,
|
||||
TaskCenterBatchTaskReportItem,
|
||||
TaskCenterResourcePoolItem,
|
||||
TaskCenterStatisticsItem,
|
||||
TaskCenterSystemTaskItem,
|
||||
|
@ -107,3 +110,13 @@ export function organizationBatchOpenTask(data: TaskCenterBatchParams) {
|
|||
export function organizationBatchCloseTask(data: TaskCenterBatchParams) {
|
||||
return MSR.post({ url: organizationBatchCloseTaskUrl, data });
|
||||
}
|
||||
|
||||
// 组织任务-编辑 cron 表达式
|
||||
export function organizationEditCron(cron: string, id: string) {
|
||||
return MSR.post({ url: organizationEditCronUrl, data: { cron, id } });
|
||||
}
|
||||
|
||||
// 组织任务-批量任务报告列表
|
||||
export function organizationBatchTaskReportList(data: TaskCenterBatchParams) {
|
||||
return MSR.post<CommonList<TaskCenterBatchTaskReportItem>>({ url: organizationBatchTaskReportUrl, data });
|
||||
}
|
||||
|
|
|
@ -5,8 +5,10 @@ import {
|
|||
projectBatchOpenTaskUrl,
|
||||
projectBatchStopTaskDetailUrl,
|
||||
projectBatchStopTaskUrl,
|
||||
projectBatchTaskReportUrl,
|
||||
projectDeleteScheduleUrl,
|
||||
projectDeleteTaskUrl,
|
||||
projectEditCronUrl,
|
||||
projectExecuteTaskDetailListUrl,
|
||||
projectExecuteTaskListUrl,
|
||||
projectExecuteTaskStatisticsUrl,
|
||||
|
@ -23,6 +25,7 @@ import type { CommonList, TableQueryParams } from '@/models/common';
|
|||
import type { TimingTaskCenterApiCaseItem } from '@/models/projectManagement/taskCenter';
|
||||
import type {
|
||||
TaskCenterBatchParams,
|
||||
TaskCenterBatchTaskReportItem,
|
||||
TaskCenterResourcePoolItem,
|
||||
TaskCenterStatisticsItem,
|
||||
TaskCenterSystemTaskItem,
|
||||
|
@ -114,3 +117,13 @@ export function projectBatchOpenTask(data: TaskCenterBatchParams) {
|
|||
export function projectBatchCloseTask(data: TaskCenterBatchParams) {
|
||||
return MSR.post({ url: projectBatchCloseTaskUrl, data });
|
||||
}
|
||||
|
||||
// 项目任务-编辑 cron 表达式
|
||||
export function projectEditCron(cron: string, id: string) {
|
||||
return MSR.post({ url: projectEditCronUrl, data: { cron, id } });
|
||||
}
|
||||
|
||||
// 项目任务-批量任务报告列表
|
||||
export function projectBatchTaskReportList(data: TaskCenterBatchParams) {
|
||||
return MSR.post<CommonList<TaskCenterBatchTaskReportItem>>({ url: projectBatchTaskReportUrl, data });
|
||||
}
|
||||
|
|
|
@ -5,8 +5,10 @@ import {
|
|||
systemBatchOpenTaskUrl,
|
||||
systemBatchStopTaskDetailUrl,
|
||||
systemBatchStopTaskUrl,
|
||||
systemBatchTaskReportUrl,
|
||||
systemDeleteScheduleUrl,
|
||||
systemDeleteTaskUrl,
|
||||
systemEditCronUrl,
|
||||
systemExecuteTaskDetailListUrl,
|
||||
systemExecuteTaskListUrl,
|
||||
systemExecuteTaskStatisticsUrl,
|
||||
|
@ -22,6 +24,7 @@ import {
|
|||
import type { CommonList, TableQueryParams } from '@/models/common';
|
||||
import type {
|
||||
TaskCenterBatchParams,
|
||||
TaskCenterBatchTaskReportItem,
|
||||
TaskCenterResourcePoolItem,
|
||||
TaskCenterResourcePoolStatus,
|
||||
TaskCenterStatisticsItem,
|
||||
|
@ -114,3 +117,13 @@ export function systemBatchOpenTask(data: TaskCenterBatchParams) {
|
|||
export function systemBatchCloseTask(data: TaskCenterBatchParams) {
|
||||
return MSR.post({ url: systemBatchCloseTaskUrl, data });
|
||||
}
|
||||
|
||||
// 系统任务-编辑 cron 表达式
|
||||
export function systemEditCron(cron: string, id: string) {
|
||||
return MSR.post({ url: systemEditCronUrl, data: { cron, id } });
|
||||
}
|
||||
|
||||
// 系统任务-批量任务报告列表
|
||||
export function systemBatchTaskReportList(data: TaskCenterBatchParams) {
|
||||
return MSR.post<CommonList<TaskCenterBatchTaskReportItem>>({ url: systemBatchTaskReportUrl, data });
|
||||
}
|
||||
|
|
|
@ -15,6 +15,8 @@ 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 projectEditCronUrl = '/project/task-center/schedule/update-cron'; // 项目-任务中心-系统后台任务-编辑 cron 表达式
|
||||
export const projectBatchTaskReportUrl = '/project/task-center/exec-task/batch/page'; // 项目-任务中心-批量任务报告列表
|
||||
|
||||
export const systemScheduleListUrl = '/system/task-center/schedule/page'; // 系统任务-系统后台任务列表
|
||||
export const systemExecuteTaskListUrl = '/system/task-center/exec-task/page'; // 系统任务-执行任务列表
|
||||
|
@ -33,6 +35,8 @@ 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 systemEditCronUrl = '/system/task-center/schedule/update-cron'; // 系统任务-系统后台任务-编辑 cron 表达式
|
||||
export const systemBatchTaskReportUrl = '/system/task-center/exec-task/batch/page'; // 系统任务-批量任务报告列表
|
||||
|
||||
export const organizationScheduleListUrl = '/organization/task-center/schedule/page'; // 组织任务-系统后台任务列表
|
||||
export const organizationExecuteTaskListUrl = '/organization/task-center/exec-task/page'; // 组织任务-执行任务列表
|
||||
|
@ -50,3 +54,5 @@ export const organizationScheduleSwitchUrl = '/organization/task-center/schedule
|
|||
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'; // 组织任务-系统后台任务-批量关闭任务
|
||||
export const organizationEditCronUrl = '/organization/task-center/schedule/update-cron'; // 组织任务-系统后台任务-编辑 cron 表达式
|
||||
export const organizationBatchTaskReportUrl = '/organization/task-center/exec-task/batch/page'; // 组织任务-批量任务报告列表
|
||||
|
|
|
@ -24,6 +24,7 @@ export interface TaskCenterSystemTaskItem {
|
|||
|
||||
export interface TaskCenterBatchParams extends TableQueryParams {
|
||||
taskId?: string;
|
||||
batchType?: string;
|
||||
resourcePoolIds?: string[];
|
||||
resourcePoolNodes?: string[];
|
||||
}
|
||||
|
@ -96,3 +97,15 @@ export interface TaskCenterResourcePoolItem {
|
|||
name: string;
|
||||
children: TaskCenterResourcePoolItem[];
|
||||
}
|
||||
|
||||
export interface TaskCenterBatchTaskReportItem {
|
||||
id: string;
|
||||
source: string;
|
||||
integrated: boolean; // 是否集合报告
|
||||
name: string;
|
||||
status: string;
|
||||
execResult: string;
|
||||
triggerMode: ExecuteTriggerMode;
|
||||
createUser: string;
|
||||
createTime: number;
|
||||
}
|
||||
|
|
|
@ -58,17 +58,22 @@
|
|||
import ExecStatus from '@/views/test-plan/report/component/execStatus.vue';
|
||||
import ReportDrawer from '@/views/test-plan/testPlan/detail/reportDrawer.vue';
|
||||
|
||||
import { organizationBatchTaskReportList } from '@/api/modules/taskCenter/organization';
|
||||
import { projectBatchTaskReportList } from '@/api/modules/taskCenter/project';
|
||||
import { systemBatchTaskReportList } from '@/api/modules/taskCenter/system';
|
||||
import { useI18n } from '@/hooks/useI18n';
|
||||
import useTableStore from '@/hooks/useTableStore';
|
||||
import useAppStore from '@/store/modules/app';
|
||||
|
||||
import { TaskCenterBatchTaskReportItem } from '@/models/taskCenter';
|
||||
import { ReportExecStatus } from '@/enums/apiEnum';
|
||||
import { ReportEnum, ReportStatus, TriggerModeLabel } from '@/enums/reportEnum';
|
||||
import { TableKeyEnum } from '@/enums/tableEnum';
|
||||
import { FilterSlotNameEnum } from '@/enums/tableFilterEnum';
|
||||
|
||||
const props = defineProps<{
|
||||
type: 'case' | 'scenario';
|
||||
range: 'system' | 'project' | 'org';
|
||||
type: 'CASE' | 'SCENARIO';
|
||||
moduleType: keyof typeof ReportEnum;
|
||||
}>();
|
||||
|
||||
|
@ -78,7 +83,7 @@
|
|||
|
||||
const visible = defineModel<boolean>('visible', { required: true });
|
||||
const title = computed(() =>
|
||||
props.type === 'case' ? t('ms.taskCenter.batchCaseTask') : t('ms.taskCenter.batchScenarioTask')
|
||||
props.type === 'CASE' ? t('ms.taskCenter.batchCaseTask') : t('ms.taskCenter.batchScenarioTask')
|
||||
);
|
||||
const keyword = ref<string>('');
|
||||
|
||||
|
@ -187,8 +192,13 @@
|
|||
|
||||
await tableStore.initColumn(TableKeyEnum.API_TEST_REPORT, columns, 'drawer');
|
||||
|
||||
const currentList = {
|
||||
system: systemBatchTaskReportList,
|
||||
org: organizationBatchTaskReportList,
|
||||
project: projectBatchTaskReportList,
|
||||
}[props.range];
|
||||
const { propsRes, propsEvent, loadList, setLoadListParams } = useTable(
|
||||
() => Promise.resolve({ list: [], total: 0 }),
|
||||
currentList,
|
||||
{
|
||||
tableKey: TableKeyEnum.API_TEST_REPORT,
|
||||
scroll: {
|
||||
|
@ -229,7 +239,7 @@
|
|||
const reportVisible = ref(false);
|
||||
const independentReportId = ref<string>('');
|
||||
|
||||
function showReportDetail(record: any) {
|
||||
function showReportDetail(record: TaskCenterBatchTaskReportItem) {
|
||||
independentReportId.value = record.id;
|
||||
reportVisible.value = true;
|
||||
}
|
||||
|
|
|
@ -129,7 +129,12 @@
|
|||
</MsButton>
|
||||
</template>
|
||||
</ms-base-table>
|
||||
<batchTaskReportDrawer v-model:visible="taskReportDrawerVisible" type="case" :module-type="reportModuleType" />
|
||||
<batchTaskReportDrawer
|
||||
v-model:visible="taskReportDrawerVisible"
|
||||
:range="reportModuleType"
|
||||
:type="reportModuleType"
|
||||
:module-type="reportModuleType"
|
||||
/>
|
||||
<CaseReportDrawer
|
||||
v-model:visible="showCaseDetailDrawer"
|
||||
:report-id="activeDetailId"
|
||||
|
@ -649,7 +654,7 @@
|
|||
const showCaseDetailDrawer = ref<boolean>(false);
|
||||
|
||||
function showReportDetail(record: TaskCenterTaskItem) {
|
||||
activeDetailId.value = record.id;
|
||||
activeDetailId.value = record.reportId;
|
||||
if ([ExecuteTaskType.API_SCENARIO, ExecuteTaskType.TEST_PLAN_API_SCENARIO].includes(record.taskType)) {
|
||||
showDetailDrawer.value = true;
|
||||
} else {
|
||||
|
@ -681,11 +686,13 @@
|
|||
|
||||
const taskReportDrawerVisible = ref(false);
|
||||
const reportModuleType = ref();
|
||||
const reportBatchType = ref();
|
||||
function checkReport(record: TaskCenterTaskItem) {
|
||||
if (record.taskType.includes('BATCH')) {
|
||||
reportModuleType.value = record.taskType.includes('CASE')
|
||||
? ReportEnum.API_REPORT
|
||||
: ReportEnum.API_SCENARIO_REPORT;
|
||||
reportBatchType.value = record.taskType.includes('CASE') ? 'CASE' : 'SCENARIO';
|
||||
taskReportDrawerVisible.value = true;
|
||||
} else if (
|
||||
[
|
||||
|
|
|
@ -81,6 +81,7 @@
|
|||
organizationBatchCloseTask,
|
||||
organizationBatchOpenTask,
|
||||
organizationDeleteSchedule,
|
||||
organizationEditCron,
|
||||
organizationScheduleSwitch,
|
||||
} from '@/api/modules/taskCenter/organization';
|
||||
import {
|
||||
|
@ -88,6 +89,7 @@
|
|||
projectBatchCloseTask,
|
||||
projectBatchOpenTask,
|
||||
projectDeleteSchedule,
|
||||
projectEditCron,
|
||||
projectScheduleSwitch,
|
||||
} from '@/api/modules/taskCenter/project';
|
||||
import {
|
||||
|
@ -95,6 +97,7 @@
|
|||
systemBatchCloseTask,
|
||||
systemBatchOpenTask,
|
||||
systemDeleteSchedule,
|
||||
systemEditCron,
|
||||
systemScheduleSwitch,
|
||||
} from '@/api/modules/taskCenter/system';
|
||||
import { useI18n } from '@/hooks/useI18n';
|
||||
|
@ -437,13 +440,18 @@
|
|||
}
|
||||
}
|
||||
|
||||
const currentEditCron = {
|
||||
system: systemEditCron,
|
||||
org: organizationEditCron,
|
||||
project: projectEditCron,
|
||||
}[props.type];
|
||||
async function handleRunRuleChange(
|
||||
val: string | number | boolean | Record<string, any> | (string | number | boolean | Record<string, any>)[],
|
||||
record: TaskCenterSystemTaskItem
|
||||
) {
|
||||
try {
|
||||
record.runRuleLoading = true;
|
||||
// await runRuleChange();
|
||||
await currentEditCron(val as string, record.id);
|
||||
Message.success(t('common.updateSuccess'));
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
|
|
Loading…
Reference in New Issue