feat(任务中心): 任务中心操作&交互MOCK
This commit is contained in:
parent
30c690bf46
commit
a404376e51
|
@ -41,10 +41,23 @@ export enum ExecuteTriggerMode {
|
||||||
SCHEDULE = 'SCHEDULE',
|
SCHEDULE = 'SCHEDULE',
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum ExecuteTaskType {
|
export enum SystemTaskType {
|
||||||
API_IMPORT = 'API_IMPORT',
|
API_IMPORT = 'API_IMPORT',
|
||||||
API_SCENARIO = 'API_SCENARIO',
|
API_SCENARIO = 'API_SCENARIO',
|
||||||
BUG_SYNC = 'BUG_SYNC',
|
BUG_SYNC = 'BUG_SYNC',
|
||||||
DEMAND_SYNC = 'DEMAND_SYNC',
|
DEMAND_SYNC = 'DEMAND_SYNC',
|
||||||
TEST_PLAN = 'TEST_PLAN',
|
TEST_PLAN = 'TEST_PLAN',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum ExecuteTaskType {
|
||||||
|
API_CASE = 'API_CASE', // 接口用例执行
|
||||||
|
API_CASE_BATCH = 'API_CASE_BATCH', // 接口用例批量执行
|
||||||
|
API_SCENARIO = 'API_SCENARIO', // 场景执行
|
||||||
|
API_SCENARIO_BATCH = 'API_SCENARIO_BATCH', // 场景批量执行
|
||||||
|
TEST_PLAN_API_CASE = 'TEST_PLAN_API_CASE', // 测试计划接口用例执行
|
||||||
|
TEST_PLAN_API_CASE_BATCH = 'TEST_PLAN_API_CASE_BATCH', // 测试计划接口用例批量执行
|
||||||
|
TEST_PLAN_API_SCENARIO = 'TEST_PLAN_API_SCENARIO', // 测试计划场景用例执行
|
||||||
|
TEST_PLAN_API_SCENARIO_BATCH = 'TEST_PLAN_API_SCENARIO_BATCH', // 测试计划场景用例批量执行
|
||||||
|
TEST_PLAN = 'TEST_PLAN', // 测试计划整体执行
|
||||||
|
TEST_PLAN_GROUP = 'TEST_PLAN_GROUP', // 测试计划组整体执行
|
||||||
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { ExecuteTriggerMode } from '@/enums/taskCenter';
|
import type { ExecuteTaskType, ExecuteTriggerMode } from '@/enums/taskCenter';
|
||||||
|
|
||||||
import type { TableQueryParams } from './common';
|
import type { TableQueryParams } from './common';
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ export interface TaskCenterTaskItem {
|
||||||
status: string; // 执行状态
|
status: string; // 执行状态
|
||||||
caseCount: number;
|
caseCount: number;
|
||||||
result: string; // 执行结果
|
result: string; // 执行结果
|
||||||
taskType: string; // 任务类型
|
taskType: ExecuteTaskType; // 任务类型
|
||||||
resourceId: string;
|
resourceId: string;
|
||||||
triggerMode: ExecuteTriggerMode; // 执行方式
|
triggerMode: ExecuteTriggerMode; // 执行方式
|
||||||
projectId: string;
|
projectId: string;
|
||||||
|
|
|
@ -12,18 +12,18 @@
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<ms-base-table v-bind="propsRes" no-disable v-on="propsEvent">
|
<ms-base-table v-bind="propsRes" no-disable v-on="propsEvent">
|
||||||
<template #action="{ record }">
|
<template #status="{ record }">
|
||||||
<div class="flex items-center gap-[12px]">
|
|
||||||
<a-switch
|
<a-switch
|
||||||
v-model:modelValue="record.enable"
|
v-model:modelValue="record.enable"
|
||||||
type="line"
|
type="line"
|
||||||
size="small"
|
size="small"
|
||||||
:before-change="() => handleBeforeEnableChange(record)"
|
:before-change="() => handleBeforeEnableChange(record)"
|
||||||
></a-switch>
|
></a-switch>
|
||||||
|
</template>
|
||||||
|
<template #action="{ record }">
|
||||||
<MsButton @click="deleteTask(record)">
|
<MsButton @click="deleteTask(record)">
|
||||||
{{ t('common.delete') }}
|
{{ t('common.delete') }}
|
||||||
</MsButton>
|
</MsButton>
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
</ms-base-table>
|
</ms-base-table>
|
||||||
</MsDrawer>
|
</MsDrawer>
|
||||||
|
@ -55,7 +55,7 @@
|
||||||
title: 'apiTestManagement.resourceID',
|
title: 'apiTestManagement.resourceID',
|
||||||
dataIndex: 'resourceNum',
|
dataIndex: 'resourceNum',
|
||||||
slotName: 'resourceNum',
|
slotName: 'resourceNum',
|
||||||
width: 140,
|
width: 90,
|
||||||
showInTable: true,
|
showInTable: true,
|
||||||
showTooltip: true,
|
showTooltip: true,
|
||||||
},
|
},
|
||||||
|
@ -82,6 +82,12 @@
|
||||||
dataIndex: 'value',
|
dataIndex: 'value',
|
||||||
width: 140,
|
width: 140,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: 'common.status',
|
||||||
|
dataIndex: 'status',
|
||||||
|
slotName: 'status',
|
||||||
|
width: 80,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: 'apiTestManagement.taskNextRunTime',
|
title: 'apiTestManagement.taskNextRunTime',
|
||||||
dataIndex: 'nextTime',
|
dataIndex: 'nextTime',
|
||||||
|
@ -104,7 +110,7 @@
|
||||||
slotName: 'action',
|
slotName: 'action',
|
||||||
dataIndex: 'operation',
|
dataIndex: 'operation',
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
width: 110,
|
width: 60,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
const { propsRes, propsEvent, loadList, setLoadListParams } = useTable(
|
const { propsRes, propsEvent, loadList, setLoadListParams } = useTable(
|
||||||
|
|
|
@ -405,7 +405,7 @@
|
||||||
/**
|
/**
|
||||||
* @description 项目管理-项目与权限-菜单管理
|
* @description 项目管理-项目与权限-菜单管理
|
||||||
*/
|
*/
|
||||||
import { useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
import { Message, TableData } from '@arco-design/web-vue';
|
import { Message, TableData } from '@arco-design/web-vue';
|
||||||
import { cloneDeep } from 'lodash-es';
|
import { cloneDeep } from 'lodash-es';
|
||||||
|
|
||||||
|
@ -433,6 +433,7 @@
|
||||||
import { ProjectManagementRouteEnum } from '@/enums/routeEnum';
|
import { ProjectManagementRouteEnum } from '@/enums/routeEnum';
|
||||||
|
|
||||||
const appStore = useAppStore();
|
const appStore = useAppStore();
|
||||||
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const currentProjectId = computed(() => appStore.currentProjectId);
|
const currentProjectId = computed(() => appStore.currentProjectId);
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
@ -873,7 +874,19 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
const initExpendKeys = async () => {
|
const initExpendKeys = async () => {
|
||||||
if (router.currentRoute.value.redirectedFrom) {
|
if (route.query.module) {
|
||||||
|
await expandChange({ module: route.query.module as MenuEnum });
|
||||||
|
switch (route.query.module as MenuEnum) {
|
||||||
|
case MenuEnum.bugManagement:
|
||||||
|
showDefectDrawer();
|
||||||
|
break;
|
||||||
|
case MenuEnum.caseManagement:
|
||||||
|
showRelatedCaseDrawer();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else if (router.currentRoute.value.redirectedFrom) {
|
||||||
// 从误报规则跳转回来的
|
// 从误报规则跳转回来的
|
||||||
await expandChange({ module: MenuEnum.apiTest });
|
await expandChange({ module: MenuEnum.apiTest });
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -423,10 +423,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function rerunTask(record: TaskCenterTaskDetailItem) {
|
|
||||||
console.log('rerunTask', record);
|
|
||||||
}
|
|
||||||
|
|
||||||
const executeResultId = ref('');
|
const executeResultId = ref('');
|
||||||
const caseExecuteResultDrawerVisible = ref(false);
|
const caseExecuteResultDrawerVisible = ref(false);
|
||||||
const scenarioExecuteResultDrawerVisible = ref(false);
|
const scenarioExecuteResultDrawerVisible = ref(false);
|
||||||
|
@ -474,6 +470,24 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
if (props.id) {
|
if (props.id) {
|
||||||
keyword.value = props.id;
|
keyword.value = props.id;
|
||||||
|
|
|
@ -202,7 +202,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 } from '@/enums/taskCenter';
|
import { ExecuteResultEnum, ExecuteStatusEnum, ExecuteTaskType, SystemTaskType } from '@/enums/taskCenter';
|
||||||
|
|
||||||
import { executeFinishedRateMap, executeMethodMap, executeResultMap, executeStatusMap } from './config';
|
import { executeFinishedRateMap, executeMethodMap, executeResultMap, executeStatusMap } from './config';
|
||||||
|
|
||||||
|
@ -580,8 +580,22 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function rerunTask(record: TaskCenterTaskItem) {
|
async function rerunTask(record: TaskCenterTaskItem) {
|
||||||
console.log('rerunTask', record);
|
try {
|
||||||
|
// await deleteUserInfo({
|
||||||
|
// selectIds,
|
||||||
|
// selectAll: !!params?.selectAll,
|
||||||
|
// excludeIds: params?.excludeIds || [],
|
||||||
|
// condition: { keyword: keyword.value },
|
||||||
|
// });
|
||||||
|
Message.success(t('common.executionSuccess'));
|
||||||
|
resetSelector();
|
||||||
|
await loadList();
|
||||||
|
initTaskStatistics();
|
||||||
|
} catch (error) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -594,7 +608,7 @@
|
||||||
|
|
||||||
function showReportDetail(record: TaskCenterTaskItem) {
|
function showReportDetail(record: TaskCenterTaskItem) {
|
||||||
activeDetailId.value = record.id;
|
activeDetailId.value = record.id;
|
||||||
if (record.taskType === 'API_SCENARIO') {
|
if ([ExecuteTaskType.API_SCENARIO, ExecuteTaskType.TEST_PLAN_API_SCENARIO].includes(record.taskType)) {
|
||||||
showDetailDrawer.value = true;
|
showDetailDrawer.value = true;
|
||||||
} else {
|
} else {
|
||||||
showCaseDetailDrawer.value = true;
|
showCaseDetailDrawer.value = true;
|
||||||
|
@ -631,10 +645,19 @@
|
||||||
? ReportEnum.API_REPORT
|
? ReportEnum.API_REPORT
|
||||||
: ReportEnum.API_SCENARIO_REPORT;
|
: ReportEnum.API_SCENARIO_REPORT;
|
||||||
taskReportDrawerVisible.value = true;
|
taskReportDrawerVisible.value = true;
|
||||||
} else if (['API_CASE', 'API_SCENARIO'].includes(record.taskType)) {
|
} else if (
|
||||||
|
[
|
||||||
|
ExecuteTaskType.API_CASE,
|
||||||
|
ExecuteTaskType.API_SCENARIO,
|
||||||
|
ExecuteTaskType.TEST_PLAN_API_CASE,
|
||||||
|
ExecuteTaskType.TEST_PLAN_API_SCENARIO,
|
||||||
|
].includes(record.taskType)
|
||||||
|
) {
|
||||||
showReportDetail(record);
|
showReportDetail(record);
|
||||||
} else if (record.taskType === ExecuteTaskType.TEST_PLAN) {
|
} else if ([ExecuteTaskType.TEST_PLAN_GROUP, ExecuteTaskType.TEST_PLAN].includes(record.taskType)) {
|
||||||
openNewPage(TestPlanRouteEnum.TEST_PLAN_REPORT);
|
openNewPage(TestPlanRouteEnum.TEST_PLAN_REPORT, {
|
||||||
|
id: record.reportId,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,8 +82,10 @@
|
||||||
import { characterLimit } from '@/utils';
|
import { characterLimit } from '@/utils';
|
||||||
import { hasAnyPermission } from '@/utils/permission';
|
import { hasAnyPermission } from '@/utils/permission';
|
||||||
|
|
||||||
import { ApiTestRouteEnum, TestPlanRouteEnum } from '@/enums/routeEnum';
|
import { MenuEnum } from '@/enums/commonEnum';
|
||||||
|
import { ApiTestRouteEnum, ProjectManagementRouteEnum, TestPlanRouteEnum } from '@/enums/routeEnum';
|
||||||
import { TableKeyEnum } from '@/enums/tableEnum';
|
import { TableKeyEnum } from '@/enums/tableEnum';
|
||||||
|
import { SystemTaskType } from '@/enums/taskCenter';
|
||||||
|
|
||||||
import { scheduleTaskTypeMap } from './config';
|
import { scheduleTaskTypeMap } from './config';
|
||||||
|
|
||||||
|
@ -288,35 +290,68 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function openTask(record?: any, isBatch?: boolean, params?: BatchActionQueryParams) {
|
function openTask(params?: BatchActionQueryParams) {
|
||||||
console.log(record);
|
try {
|
||||||
|
// await deleteUserInfo({
|
||||||
|
// selectIds,
|
||||||
|
// selectAll: !!params?.selectAll,
|
||||||
|
// excludeIds: params?.excludeIds || [],
|
||||||
|
// condition: { keyword: keyword.value },
|
||||||
|
// });
|
||||||
|
Message.success(t('ms.taskCenter.openTaskSuccess'));
|
||||||
|
resetSelector();
|
||||||
|
loadList();
|
||||||
|
} catch (error) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function closeTask(record?: any, isBatch?: boolean, params?: BatchActionQueryParams) {
|
function closeTask(params?: BatchActionQueryParams) {
|
||||||
console.log(record);
|
try {
|
||||||
|
// await deleteUserInfo({
|
||||||
|
// selectIds,
|
||||||
|
// selectAll: !!params?.selectAll,
|
||||||
|
// excludeIds: params?.excludeIds || [],
|
||||||
|
// condition: { keyword: keyword.value },
|
||||||
|
// });
|
||||||
|
Message.success(t('ms.taskCenter.closeTaskSuccess'));
|
||||||
|
resetSelector();
|
||||||
|
loadList();
|
||||||
|
} catch (error) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkDetail(record: any) {
|
function checkDetail(record: any) {
|
||||||
switch (record.resourceType) {
|
switch (record.resourceType) {
|
||||||
case 'API_IMPORT':
|
case SystemTaskType.API_IMPORT:
|
||||||
openNewPage(ApiTestRouteEnum.API_TEST_MANAGEMENT, {
|
openNewPage(ApiTestRouteEnum.API_TEST_MANAGEMENT, {
|
||||||
taskDrawer: true,
|
taskDrawer: true,
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 'TEST_PLAN':
|
case SystemTaskType.TEST_PLAN:
|
||||||
openNewPage(TestPlanRouteEnum.TEST_PLAN_REPORT_DETAIL, {
|
openNewPage(TestPlanRouteEnum.TEST_PLAN_INDEX_DETAIL, {
|
||||||
reportId: record.reportId,
|
id: record.resourceId,
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 'API_SCENARIO':
|
case SystemTaskType.API_SCENARIO:
|
||||||
openNewPage(ApiTestRouteEnum.API_TEST_REPORT, {
|
openNewPage(ApiTestRouteEnum.API_TEST_SCENARIO, {
|
||||||
reportId: record.reportId,
|
id: record.resourceId,
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case SystemTaskType.BUG_SYNC:
|
||||||
|
openNewPage(ProjectManagementRouteEnum.PROJECT_MANAGEMENT_PERMISSION_MENU_MANAGEMENT, {
|
||||||
|
module: MenuEnum.bugManagement,
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case SystemTaskType.DEMAND_SYNC:
|
||||||
|
openNewPage(ProjectManagementRouteEnum.PROJECT_MANAGEMENT_PERMISSION_MENU_MANAGEMENT, {
|
||||||
|
module: MenuEnum.caseManagement,
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
openNewPage(ApiTestRouteEnum.API_TEST_MANAGEMENT, {
|
|
||||||
taskDrawer: true,
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -340,10 +375,10 @@
|
||||||
batchModalParams.value = params;
|
batchModalParams.value = params;
|
||||||
switch (event.eventTag) {
|
switch (event.eventTag) {
|
||||||
case 'open':
|
case 'open':
|
||||||
openTask(undefined, true, params);
|
openTask(params);
|
||||||
break;
|
break;
|
||||||
case 'close':
|
case 'close':
|
||||||
closeTask(undefined, true, params);
|
closeTask(params);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue