fix(任务中心): bugFix
This commit is contained in:
parent
1ee17c14bf
commit
53982f7bee
|
@ -184,9 +184,9 @@ export interface SetPaginationPrams {
|
|||
export interface BatchActionQueryParams {
|
||||
excludeIds?: string[]; // 排除的id
|
||||
selectedIds?: string[];
|
||||
selectIds?: string[]; // 选中的id
|
||||
selectAll: boolean; // 是否跨页全选
|
||||
params?: TableQueryParams; // 查询参数
|
||||
currentSelectCount?: number; // 当前选中的数量
|
||||
condition?: any; // 查询条件
|
||||
[key: string]: any;
|
||||
}
|
||||
|
|
|
@ -23,6 +23,8 @@ export enum FilterSlotNameEnum {
|
|||
GLOBAL_TASK_CENTER_EXEC_RESULT = 'GLOBAL_TASK_CENTER_EXEC_RESULT', // 任务中心-执行结果
|
||||
GLOBAL_TASK_CENTER_EXEC_METHOD = 'GLOBAL_TASK_CENTER_EXEC_METHOD', // 任务中心-执行方式
|
||||
GLOBAL_TASK_CENTER_SYSTEM_TASK_TYPE = 'GLOBAL_TASK_CENTER_SYSTEM_TASK_TYPE', // 任务中心-后台任务类型
|
||||
GLOBAL_TASK_CENTER_SYSTEM_TASK_STATUS = 'GLOBAL_TASK_CENTER_SYSTEM_TASK_STATUS', // 任务中心-后台任务状态
|
||||
GLOBAL_TASK_CENTER_BELONG_PROJECT = 'GLOBAL_TASK_CENTER_BELONG_PROJECT', // 任务中心-所属项目
|
||||
}
|
||||
|
||||
export enum FilterRemoteMethodsEnum {
|
||||
|
|
|
@ -68,7 +68,7 @@ const useAppStore = defineStore('app', {
|
|||
},
|
||||
packageType: '',
|
||||
projectList: [] as ProjectListItem[],
|
||||
ordList: [],
|
||||
orgList: [],
|
||||
envList: [],
|
||||
currentEnvConfig: undefined,
|
||||
fileMaxSize: 50,
|
||||
|
@ -231,8 +231,8 @@ const useAppStore = defineStore('app', {
|
|||
/**
|
||||
* 设置当前组织列表
|
||||
*/
|
||||
setOrdList(ordList: { id: string; name: string }[]) {
|
||||
this.ordList = ordList;
|
||||
setOrdList(orgList: { id: string; name: string }[]) {
|
||||
this.orgList = orgList;
|
||||
},
|
||||
/**
|
||||
* 设置当前系统包类型
|
||||
|
|
|
@ -42,7 +42,7 @@ export interface AppState {
|
|||
currentMenuConfig: string[];
|
||||
packageType: string;
|
||||
projectList: ProjectListItem[];
|
||||
ordList: { id: string; name: string }[];
|
||||
orgList: { id: string; name: string }[];
|
||||
envList: EnvironmentItem[];
|
||||
currentEnvConfig?: EnvConfig; // 当前环境配置信息
|
||||
fileMaxSize: number; // 文件上传最大限制
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
@drag-change="changeHandler"
|
||||
>
|
||||
<template #num="{ record }">
|
||||
<div>
|
||||
<div class="flex items-center">
|
||||
<MsButton type="text" class="float-left" style="margin-right: 4px" @click="openScenarioTab(record)">
|
||||
{{ record.num }}
|
||||
</MsButton>
|
||||
|
|
|
@ -136,7 +136,7 @@
|
|||
import executeButton from '@/views/api-test/components/executeButton.vue';
|
||||
import ScenarioTable from '@/views/api-test/scenario/components/scenarioTable.vue';
|
||||
|
||||
import { localExecuteApiDebug, stopExecute, stopLocalExecute } from '@/api/modules/api-test/common';
|
||||
import { localExecuteApiDebug, stopLocalExecute } from '@/api/modules/api-test/common';
|
||||
import {
|
||||
addScenario,
|
||||
debugScenario,
|
||||
|
@ -146,6 +146,7 @@
|
|||
updateScenario,
|
||||
} from '@/api/modules/api-test/scenario';
|
||||
import { getSocket } from '@/api/modules/project-management/commonScript';
|
||||
import { projectStopTask } from '@/api/modules/taskCenter/project';
|
||||
import { useI18n } from '@/hooks/useI18n';
|
||||
import useLeaveTabUnSaveCheck from '@/hooks/useLeaveTabUnSaveCheck';
|
||||
import useShortcutSave from '@/hooks/useShortcutSave';
|
||||
|
@ -258,6 +259,7 @@
|
|||
});
|
||||
}
|
||||
|
||||
const executeTaskId = ref('');
|
||||
/**
|
||||
* 实际执行函数
|
||||
* @param executeParams 执行参数
|
||||
|
@ -326,6 +328,7 @@
|
|||
}),
|
||||
});
|
||||
}
|
||||
executeTaskId.value = res.taskInfo?.taskId;
|
||||
if (executeType === 'localExec' && localExecuteUrl.value) {
|
||||
// 本地执行需要调 debug 接口获取响应结果,然后再调本地执行接口
|
||||
await localExecuteApiDebug(localExecuteUrl.value, res);
|
||||
|
@ -385,7 +388,7 @@
|
|||
ScenarioStepType.API_SCENARIO
|
||||
);
|
||||
} else {
|
||||
await stopExecute(activeScenarioTab.value.reportId, ScenarioStepType.API_SCENARIO);
|
||||
await projectStopTask(executeTaskId.value);
|
||||
}
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
|
|
|
@ -148,7 +148,7 @@
|
|||
|
||||
const orgName = computed(() => {
|
||||
if (licenseStore.hasLicense()) {
|
||||
return appStore.ordList.find((item: any) => item.id === appStore.currentOrgId)?.name;
|
||||
return appStore.orgList.find((item: any) => item.id === appStore.currentOrgId)?.name;
|
||||
}
|
||||
return '默认组织';
|
||||
});
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
:virtual-list-props="{ height: 200 }"
|
||||
strictly
|
||||
label-path-mode
|
||||
@clear="searchTask"
|
||||
@clear="clearResourcePools"
|
||||
@popup-visible-change="handleResourcePoolVisibleChange"
|
||||
@change="handleResourcePoolChange"
|
||||
>
|
||||
|
@ -317,6 +317,13 @@
|
|||
showTooltip: true,
|
||||
width: 200,
|
||||
showDrag: true,
|
||||
filterConfig: {
|
||||
options: appStore.projectList.map((item) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
})),
|
||||
filterSlotName: FilterSlotNameEnum.GLOBAL_TASK_CENTER_BELONG_PROJECT,
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'common.belongOrg',
|
||||
|
@ -324,6 +331,13 @@
|
|||
showTooltip: true,
|
||||
width: 200,
|
||||
showDrag: true,
|
||||
filterConfig: {
|
||||
options: appStore.orgList.map((item) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
})),
|
||||
filterSlotName: FilterSlotNameEnum.GLOBAL_TASK_CENTER_BELONG_PROJECT,
|
||||
},
|
||||
}
|
||||
);
|
||||
} else if (props.type === 'org') {
|
||||
|
@ -333,6 +347,13 @@
|
|||
showTooltip: true,
|
||||
width: 200,
|
||||
showDrag: true,
|
||||
filterConfig: {
|
||||
options: appStore.projectList.map((item) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
})),
|
||||
filterSlotName: FilterSlotNameEnum.GLOBAL_TASK_CENTER_BELONG_PROJECT,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -407,6 +428,12 @@
|
|||
}
|
||||
}
|
||||
|
||||
function clearResourcePools() {
|
||||
resourcePoolIds.value = new Set([]);
|
||||
resourcePoolNodes.value = new Set([]);
|
||||
searchTask();
|
||||
}
|
||||
|
||||
function handleResourcePoolChange(value: string[]) {
|
||||
if (resourcePool.value.length < value.length) {
|
||||
// 添加选中节点
|
||||
|
@ -455,12 +482,10 @@
|
|||
|
||||
function stopTask(record?: TaskCenterTaskDetailItem, isBatch?: boolean, params?: BatchActionQueryParams) {
|
||||
let title = t('ms.taskCenter.stopTaskTitle', { name: characterLimit(record?.taskName) });
|
||||
let selectIds = [record?.id || ''];
|
||||
if (isBatch) {
|
||||
title = t('ms.taskCenter.batchStopTaskTitle', {
|
||||
count: params?.currentSelectCount || tableSelected.value.length,
|
||||
});
|
||||
selectIds = tableSelected.value as string[];
|
||||
}
|
||||
openModal({
|
||||
type: 'warning',
|
||||
|
@ -476,7 +501,7 @@
|
|||
try {
|
||||
if (isBatch) {
|
||||
await currentBatchStopTask({
|
||||
selectIds,
|
||||
selectIds: params?.selectedIds || [],
|
||||
selectAll: !!params?.selectAll,
|
||||
excludeIds: params?.excludeIds || [],
|
||||
...getTableQueryParams(),
|
||||
|
@ -586,7 +611,7 @@
|
|||
if (queue) {
|
||||
item.lineNum = queue;
|
||||
} else if (
|
||||
[ExecuteStatusEnum.COMPLETED, ExecuteStatusEnum.STOPPED].includes(item.status) ||
|
||||
[ExecuteStatusEnum.COMPLETED, ExecuteStatusEnum.STOPPED, ExecuteStatusEnum.RUNNING].includes(item.status) ||
|
||||
!item.resourcePoolNode
|
||||
) {
|
||||
item.lineNum = '-';
|
||||
|
|
|
@ -238,8 +238,6 @@
|
|||
const appStore = useAppStore();
|
||||
|
||||
const keyword = ref('');
|
||||
const tableSelected = ref<string[]>([]);
|
||||
const batchModalParams = ref();
|
||||
const columns: MsTableColumn = [
|
||||
{
|
||||
title: 'ms.taskCenter.taskID',
|
||||
|
@ -381,6 +379,13 @@
|
|||
showTooltip: true,
|
||||
showDrag: true,
|
||||
width: 200,
|
||||
filterConfig: {
|
||||
options: appStore.projectList.map((item) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
})),
|
||||
filterSlotName: FilterSlotNameEnum.GLOBAL_TASK_CENTER_BELONG_PROJECT,
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'common.belongOrg',
|
||||
|
@ -388,6 +393,13 @@
|
|||
showTooltip: true,
|
||||
showDrag: true,
|
||||
width: 200,
|
||||
filterConfig: {
|
||||
options: appStore.orgList.map((item) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
})),
|
||||
filterSlotName: FilterSlotNameEnum.GLOBAL_TASK_CENTER_BELONG_PROJECT,
|
||||
},
|
||||
}
|
||||
);
|
||||
} else if (props.type === 'org') {
|
||||
|
@ -397,6 +409,13 @@
|
|||
showTooltip: true,
|
||||
showDrag: true,
|
||||
width: 200,
|
||||
filterConfig: {
|
||||
options: appStore.projectList.map((item) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
})),
|
||||
filterSlotName: FilterSlotNameEnum.GLOBAL_TASK_CENTER_BELONG_PROJECT,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -542,12 +561,10 @@
|
|||
*/
|
||||
function deleteTask(record?: TaskCenterTaskItem, isBatch?: boolean, params?: BatchActionQueryParams) {
|
||||
let title = t('ms.taskCenter.deleteTaskTitle', { name: characterLimit(record?.taskName) });
|
||||
let selectIds = [record?.id || ''];
|
||||
if (isBatch) {
|
||||
title = t('ms.taskCenter.deleteCaseTaskTitle', {
|
||||
count: params?.currentSelectCount || tableSelected.value.length,
|
||||
count: params?.currentSelectCount || (params?.selectedIds || []).length,
|
||||
});
|
||||
selectIds = tableSelected.value as string[];
|
||||
}
|
||||
openModal({
|
||||
type: 'error',
|
||||
|
@ -563,7 +580,7 @@
|
|||
try {
|
||||
if (isBatch) {
|
||||
await currentBatchDeleteTask({
|
||||
selectIds,
|
||||
selectIds: params?.selectedIds || [],
|
||||
selectAll: !!params?.selectAll,
|
||||
excludeIds: params?.excludeIds || [],
|
||||
...getTableQueryParams(),
|
||||
|
@ -600,12 +617,10 @@
|
|||
*/
|
||||
function stopTask(record?: TaskCenterTaskItem, isBatch?: boolean, params?: BatchActionQueryParams) {
|
||||
let title = t('ms.taskCenter.stopTaskTitle', { name: characterLimit(record?.taskName) });
|
||||
let selectIds = [record?.id || ''];
|
||||
if (isBatch) {
|
||||
title = t('ms.taskCenter.batchStopTaskTitle', {
|
||||
count: params?.currentSelectCount || tableSelected.value.length,
|
||||
count: params?.currentSelectCount || (params?.selectedIds || []).length,
|
||||
});
|
||||
selectIds = tableSelected.value as string[];
|
||||
}
|
||||
openModal({
|
||||
type: 'warning',
|
||||
|
@ -618,7 +633,7 @@
|
|||
try {
|
||||
if (isBatch) {
|
||||
await currentBatchStopTask({
|
||||
selectIds,
|
||||
selectIds: params?.selectedIds || [],
|
||||
selectAll: !!params?.selectAll,
|
||||
excludeIds: params?.excludeIds || [],
|
||||
...getTableQueryParams(),
|
||||
|
@ -643,8 +658,6 @@
|
|||
* @param event 批量操作事件对象
|
||||
*/
|
||||
function handleTableBatch(event: BatchActionParams, params: BatchActionQueryParams) {
|
||||
tableSelected.value = params.selectedIds || [];
|
||||
batchModalParams.value = params;
|
||||
switch (event.eventTag) {
|
||||
case 'delete':
|
||||
deleteTask(undefined, true, params);
|
||||
|
@ -745,6 +758,7 @@
|
|||
} else if ([ExecuteTaskType.TEST_PLAN_GROUP, ExecuteTaskType.TEST_PLAN].includes(record.taskType)) {
|
||||
openNewPage(TestPlanRouteEnum.TEST_PLAN_REPORT, {
|
||||
id: record.reportId,
|
||||
type: record.taskType === ExecuteTaskType.TEST_PLAN_GROUP ? 'GROUP' : '',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -164,6 +164,19 @@
|
|||
slotName: 'status',
|
||||
width: 50,
|
||||
showDrag: true,
|
||||
filterConfig: {
|
||||
options: [
|
||||
{
|
||||
label: t('common.open'),
|
||||
value: 'enable',
|
||||
},
|
||||
{
|
||||
label: t('common.close'),
|
||||
value: 'disable',
|
||||
},
|
||||
],
|
||||
filterSlotName: FilterSlotNameEnum.GLOBAL_TASK_CENTER_SYSTEM_TASK_STATUS,
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'ms.taskCenter.type',
|
||||
|
@ -246,6 +259,13 @@
|
|||
showTooltip: true,
|
||||
width: 200,
|
||||
showDrag: true,
|
||||
filterConfig: {
|
||||
options: appStore.projectList.map((item) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
})),
|
||||
filterSlotName: FilterSlotNameEnum.GLOBAL_TASK_CENTER_BELONG_PROJECT,
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'common.belongOrg',
|
||||
|
@ -253,6 +273,13 @@
|
|||
showTooltip: true,
|
||||
width: 200,
|
||||
showDrag: true,
|
||||
filterConfig: {
|
||||
options: appStore.orgList.map((item) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
})),
|
||||
filterSlotName: FilterSlotNameEnum.GLOBAL_TASK_CENTER_BELONG_PROJECT,
|
||||
},
|
||||
}
|
||||
);
|
||||
} else if (props.type === 'org') {
|
||||
|
@ -262,6 +289,13 @@
|
|||
showTooltip: true,
|
||||
width: 200,
|
||||
showDrag: true,
|
||||
filterConfig: {
|
||||
options: appStore.projectList.map((item) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
})),
|
||||
filterSlotName: FilterSlotNameEnum.GLOBAL_TASK_CENTER_BELONG_PROJECT,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue