feat(任务中心): 任务中心操作&交互MOCK
This commit is contained in:
parent
30c690bf46
commit
a404376e51
|
@ -41,10 +41,23 @@ export enum ExecuteTriggerMode {
|
|||
SCHEDULE = 'SCHEDULE',
|
||||
}
|
||||
|
||||
export enum ExecuteTaskType {
|
||||
export enum SystemTaskType {
|
||||
API_IMPORT = 'API_IMPORT',
|
||||
API_SCENARIO = 'API_SCENARIO',
|
||||
BUG_SYNC = 'BUG_SYNC',
|
||||
DEMAND_SYNC = 'DEMAND_SYNC',
|
||||
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';
|
||||
|
||||
|
@ -34,7 +34,7 @@ export interface TaskCenterTaskItem {
|
|||
status: string; // 执行状态
|
||||
caseCount: number;
|
||||
result: string; // 执行结果
|
||||
taskType: string; // 任务类型
|
||||
taskType: ExecuteTaskType; // 任务类型
|
||||
resourceId: string;
|
||||
triggerMode: ExecuteTriggerMode; // 执行方式
|
||||
projectId: string;
|
||||
|
|
|
@ -12,18 +12,18 @@
|
|||
/>
|
||||
</div>
|
||||
<ms-base-table v-bind="propsRes" no-disable v-on="propsEvent">
|
||||
<template #status="{ record }">
|
||||
<a-switch
|
||||
v-model:modelValue="record.enable"
|
||||
type="line"
|
||||
size="small"
|
||||
:before-change="() => handleBeforeEnableChange(record)"
|
||||
></a-switch>
|
||||
</template>
|
||||
<template #action="{ record }">
|
||||
<div class="flex items-center gap-[12px]">
|
||||
<a-switch
|
||||
v-model:modelValue="record.enable"
|
||||
type="line"
|
||||
size="small"
|
||||
:before-change="() => handleBeforeEnableChange(record)"
|
||||
></a-switch>
|
||||
<MsButton @click="deleteTask(record)">
|
||||
{{ t('common.delete') }}
|
||||
</MsButton>
|
||||
</div>
|
||||
<MsButton @click="deleteTask(record)">
|
||||
{{ t('common.delete') }}
|
||||
</MsButton>
|
||||
</template>
|
||||
</ms-base-table>
|
||||
</MsDrawer>
|
||||
|
@ -55,7 +55,7 @@
|
|||
title: 'apiTestManagement.resourceID',
|
||||
dataIndex: 'resourceNum',
|
||||
slotName: 'resourceNum',
|
||||
width: 140,
|
||||
width: 90,
|
||||
showInTable: true,
|
||||
showTooltip: true,
|
||||
},
|
||||
|
@ -82,6 +82,12 @@
|
|||
dataIndex: 'value',
|
||||
width: 140,
|
||||
},
|
||||
{
|
||||
title: 'common.status',
|
||||
dataIndex: 'status',
|
||||
slotName: 'status',
|
||||
width: 80,
|
||||
},
|
||||
{
|
||||
title: 'apiTestManagement.taskNextRunTime',
|
||||
dataIndex: 'nextTime',
|
||||
|
@ -104,7 +110,7 @@
|
|||
slotName: 'action',
|
||||
dataIndex: 'operation',
|
||||
fixed: 'right',
|
||||
width: 110,
|
||||
width: 60,
|
||||
},
|
||||
];
|
||||
const { propsRes, propsEvent, loadList, setLoadListParams } = useTable(
|
||||
|
|
|
@ -405,7 +405,7 @@
|
|||
/**
|
||||
* @description 项目管理-项目与权限-菜单管理
|
||||
*/
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { Message, TableData } from '@arco-design/web-vue';
|
||||
import { cloneDeep } from 'lodash-es';
|
||||
|
||||
|
@ -433,6 +433,7 @@
|
|||
import { ProjectManagementRouteEnum } from '@/enums/routeEnum';
|
||||
|
||||
const appStore = useAppStore();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const currentProjectId = computed(() => appStore.currentProjectId);
|
||||
const { t } = useI18n();
|
||||
|
@ -873,7 +874,19 @@
|
|||
};
|
||||
|
||||
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 });
|
||||
} else {
|
||||
|
|
|
@ -423,10 +423,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
function rerunTask(record: TaskCenterTaskDetailItem) {
|
||||
console.log('rerunTask', record);
|
||||
}
|
||||
|
||||
const executeResultId = ref('');
|
||||
const caseExecuteResultDrawerVisible = 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 () => {
|
||||
if (props.id) {
|
||||
keyword.value = props.id;
|
||||
|
|
|
@ -202,7 +202,7 @@
|
|||
import { TestPlanRouteEnum } from '@/enums/routeEnum';
|
||||
import { TableKeyEnum } from '@/enums/tableEnum';
|
||||
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';
|
||||
|
||||
|
@ -580,8 +580,22 @@
|
|||
}
|
||||
}
|
||||
|
||||
function rerunTask(record: TaskCenterTaskItem) {
|
||||
console.log('rerunTask', record);
|
||||
async function rerunTask(record: TaskCenterTaskItem) {
|
||||
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) {
|
||||
activeDetailId.value = record.id;
|
||||
if (record.taskType === 'API_SCENARIO') {
|
||||
if ([ExecuteTaskType.API_SCENARIO, ExecuteTaskType.TEST_PLAN_API_SCENARIO].includes(record.taskType)) {
|
||||
showDetailDrawer.value = true;
|
||||
} else {
|
||||
showCaseDetailDrawer.value = true;
|
||||
|
@ -631,10 +645,19 @@
|
|||
? ReportEnum.API_REPORT
|
||||
: ReportEnum.API_SCENARIO_REPORT;
|
||||
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);
|
||||
} else if (record.taskType === ExecuteTaskType.TEST_PLAN) {
|
||||
openNewPage(TestPlanRouteEnum.TEST_PLAN_REPORT);
|
||||
} else if ([ExecuteTaskType.TEST_PLAN_GROUP, ExecuteTaskType.TEST_PLAN].includes(record.taskType)) {
|
||||
openNewPage(TestPlanRouteEnum.TEST_PLAN_REPORT, {
|
||||
id: record.reportId,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -82,8 +82,10 @@
|
|||
import { characterLimit } from '@/utils';
|
||||
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 { SystemTaskType } from '@/enums/taskCenter';
|
||||
|
||||
import { scheduleTaskTypeMap } from './config';
|
||||
|
||||
|
@ -288,35 +290,68 @@
|
|||
});
|
||||
}
|
||||
|
||||
function openTask(record?: any, isBatch?: boolean, params?: BatchActionQueryParams) {
|
||||
console.log(record);
|
||||
function openTask(params?: BatchActionQueryParams) {
|
||||
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) {
|
||||
console.log(record);
|
||||
function closeTask(params?: BatchActionQueryParams) {
|
||||
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) {
|
||||
switch (record.resourceType) {
|
||||
case 'API_IMPORT':
|
||||
case SystemTaskType.API_IMPORT:
|
||||
openNewPage(ApiTestRouteEnum.API_TEST_MANAGEMENT, {
|
||||
taskDrawer: true,
|
||||
});
|
||||
break;
|
||||
case 'TEST_PLAN':
|
||||
openNewPage(TestPlanRouteEnum.TEST_PLAN_REPORT_DETAIL, {
|
||||
reportId: record.reportId,
|
||||
case SystemTaskType.TEST_PLAN:
|
||||
openNewPage(TestPlanRouteEnum.TEST_PLAN_INDEX_DETAIL, {
|
||||
id: record.resourceId,
|
||||
});
|
||||
break;
|
||||
case 'API_SCENARIO':
|
||||
openNewPage(ApiTestRouteEnum.API_TEST_REPORT, {
|
||||
reportId: record.reportId,
|
||||
case SystemTaskType.API_SCENARIO:
|
||||
openNewPage(ApiTestRouteEnum.API_TEST_SCENARIO, {
|
||||
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;
|
||||
default:
|
||||
openNewPage(ApiTestRouteEnum.API_TEST_MANAGEMENT, {
|
||||
taskDrawer: true,
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -340,10 +375,10 @@
|
|||
batchModalParams.value = params;
|
||||
switch (event.eventTag) {
|
||||
case 'open':
|
||||
openTask(undefined, true, params);
|
||||
openTask(params);
|
||||
break;
|
||||
case 'close':
|
||||
closeTask(undefined, true, params);
|
||||
closeTask(params);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue