fix(任务中心): bugFix

This commit is contained in:
baiqi 2024-10-25 15:55:07 +08:00 committed by 刘瑞斌
parent b4a3d240b3
commit 7466d1b3ac
7 changed files with 73 additions and 38 deletions

View File

@ -42,11 +42,14 @@
import { switchDefinitionSchedule } from '@/api/modules/api-test/management'; import { switchDefinitionSchedule } from '@/api/modules/api-test/management';
import { getScheduleProApiCaseList, projectDeleteSchedule } from '@/api/modules/taskCenter/project'; import { getScheduleProApiCaseList, projectDeleteSchedule } from '@/api/modules/taskCenter/project';
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import useModal from '@/hooks/useModal';
import { characterLimit } from '@/utils';
import { TimingTaskCenterApiCaseItem } from '@/models/projectManagement/taskCenter'; import { TimingTaskCenterApiCaseItem } from '@/models/projectManagement/taskCenter';
import { TaskCenterEnum } from '@/enums/taskCenter'; import { TaskCenterEnum } from '@/enums/taskCenter';
const { t } = useI18n(); const { t } = useI18n();
const { openModal } = useModal();
const taskDrawerVisible = defineModel<boolean>('visible', { required: true }); const taskDrawerVisible = defineModel<boolean>('visible', { required: true });
const keyword = ref(''); const keyword = ref('');
@ -159,7 +162,18 @@
} }
} }
async function deleteTask(record: TimingTaskCenterApiCaseItem) { function deleteTask(record: TimingTaskCenterApiCaseItem) {
openModal({
type: 'error',
title: t('ms.taskCenter.deleteTaskTitle', { name: characterLimit(record?.taskName) }),
content: t('ms.taskCenter.deleteTimeTaskTip'),
okText: t('common.confirmDelete'),
cancelText: t('common.cancel'),
okButtonProps: {
status: 'danger',
},
maskClosable: false,
onBeforeOk: async () => {
try { try {
await projectDeleteSchedule(record.id); await projectDeleteSchedule(record.id);
Message.success(t('common.deleteSuccess')); Message.success(t('common.deleteSuccess'));
@ -168,6 +182,9 @@
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.log(error); console.log(error);
} }
},
hideCancel: false,
});
} }
</script> </script>

View File

@ -1,9 +1,9 @@
<template> <template>
<MsDrawer v-model:visible="visible" :width="800" :footer="false"> <MsDrawer v-model:visible="visible" :width="1200" :footer="false">
<template #title> <template #title>
<div class="flex items-center gap-[8px]"> <div class="flex items-center gap-[8px]">
<a-tag :color="executeResultMap[props.record.result]?.color"> <a-tag :color="executeResultMap[props.record.result]?.color">
{{ t(executeResultMap[props.record.result]?.label) }} {{ t(executeResultMap[props.record.result]?.label || 'common.unExecute') }}
</a-tag> </a-tag>
<div>{{ detail.name }}</div> <div>{{ detail.name }}</div>
</div> </div>
@ -96,8 +96,10 @@
value: res.createTime ? dayjs(res.createTime).format('YYYY-MM-DD HH:mm:ss') : '-', value: res.createTime ? dayjs(res.createTime).format('YYYY-MM-DD HH:mm:ss') : '-',
}, },
{ {
label: t('ms.taskCenter.taskResource'), label: t('ms.taskCenter.executeEnvInfo'),
value: res.taskOriginName || caseDetail.requestName, value: `${res.environmentName || t('ms.taskCenter.defaultResourcePool')} ${res.resourcePoolName} ${
res.resourcePoolNode
}`,
}, },
{ {
label: t('ms.taskCenter.threadID'), label: t('ms.taskCenter.threadID'),
@ -107,11 +109,15 @@
label: t('ms.taskCenter.taskStartTime'), label: t('ms.taskCenter.taskStartTime'),
value: res.startTime ? dayjs(res.startTime).format('YYYY-MM-DD HH:mm:ss') : '-', value: res.startTime ? dayjs(res.startTime).format('YYYY-MM-DD HH:mm:ss') : '-',
}, },
{ res.taskOriginName
label: t('ms.taskCenter.executeEnvInfo'), ? {
value: `${res.environmentName || t('ms.taskCenter.defaultResourcePool')} ${res.resourcePoolName} ${ label: t('ms.taskCenter.taskBelongTestPlan'),
res.resourcePoolNode value: res.taskOriginName,
}`, class: '!w-[calc(100%/3*2)]',
}
: {
label: '',
value: ' ',
class: '!w-[calc(100%/3*2)]', class: '!w-[calc(100%/3*2)]',
}, },
{ {

View File

@ -77,7 +77,7 @@
> >
{{ t('ms.taskCenter.rerun') }} {{ t('ms.taskCenter.rerun') }}
</MsButton> --> </MsButton> -->
<MsButton v-if="record.status !== ExecuteStatusEnum.PENDING" @click="checkExecuteResult(record)"> <MsButton @click="checkExecuteResult(record)">
{{ t('ms.taskCenter.executeResult') }} {{ t('ms.taskCenter.executeResult') }}
</MsButton> </MsButton>
</template> </template>

View File

@ -1,9 +1,9 @@
<template> <template>
<MsDrawer v-model:visible="visible" :width="960" :footer="false"> <MsDrawer v-model:visible="visible" :width="1200" :footer="false">
<template #title> <template #title>
<div class="flex items-center gap-[8px]"> <div class="flex items-center gap-[8px]">
<a-tag :color="executeResultMap[props.record.result]?.color"> <a-tag :color="executeResultMap[props.record.result]?.color">
{{ t(executeResultMap[props.record.result]?.label) }} {{ t(executeResultMap[props.record.result]?.label || 'common.unExecute') }}
</a-tag> </a-tag>
<div>{{ detail.name }}</div> <div>{{ detail.name }}</div>
</div> </div>
@ -102,8 +102,10 @@
value: res.createTime ? dayjs(res.createTime).format('YYYY-MM-DD HH:mm:ss') : '-', value: res.createTime ? dayjs(res.createTime).format('YYYY-MM-DD HH:mm:ss') : '-',
}, },
{ {
label: t('ms.taskCenter.taskResource'), label: t('ms.taskCenter.executeEnvInfo'),
value: res.taskOriginName || res.requestName, value: `${res.environmentName || t('ms.taskCenter.defaultResourcePool')} ${res.poolName} ${
res.resourcePoolNode
}`,
}, },
{ {
label: t('ms.taskCenter.threadID'), label: t('ms.taskCenter.threadID'),
@ -113,11 +115,15 @@
label: t('ms.taskCenter.taskStartTime'), label: t('ms.taskCenter.taskStartTime'),
value: res.startTime ? dayjs(res.startTime).format('YYYY-MM-DD HH:mm:ss') : '-', value: res.startTime ? dayjs(res.startTime).format('YYYY-MM-DD HH:mm:ss') : '-',
}, },
{ res.taskOriginName
label: t('ms.taskCenter.executeEnvInfo'), ? {
value: `${res.environmentName || t('ms.taskCenter.defaultResourcePool')} ${res.poolName} ${ label: t('ms.taskCenter.taskBelongTestPlan'),
res.resourcePoolNode value: res.taskOriginName,
}`, class: '!w-[calc(100%/3*2)]',
}
: {
label: '',
value: ' ',
class: '!w-[calc(100%/3*2)]', class: '!w-[calc(100%/3*2)]',
}, },
{ {

View File

@ -141,6 +141,15 @@
const appStore = useAppStore(); const appStore = useAppStore();
const keyword = ref(''); const keyword = ref('');
const thirdPartyTypeOptions: Record<string, any>[] = [];
Object.keys(scheduleTaskTypeMap).forEach((key) => {
if (!thirdPartyTypeOptions.some((item) => item.label === t(scheduleTaskTypeMap[key]))) {
thirdPartyTypeOptions.push({
label: t(scheduleTaskTypeMap[key]),
value: key,
});
}
});
const columns: MsTableColumn = [ const columns: MsTableColumn = [
{ {
title: 'ms.taskCenter.taskID', title: 'ms.taskCenter.taskID',
@ -187,10 +196,7 @@
sorter: true, sorter: true,
}, },
filterConfig: { filterConfig: {
options: Object.keys(scheduleTaskTypeMap).map((key) => ({ options: thirdPartyTypeOptions,
label: t(scheduleTaskTypeMap[key]),
value: key,
})),
filterSlotName: FilterSlotNameEnum.GLOBAL_TASK_CENTER_SYSTEM_TASK_TYPE, filterSlotName: FilterSlotNameEnum.GLOBAL_TASK_CENTER_SYSTEM_TASK_TYPE,
}, },
width: 120, width: 120,

View File

@ -19,7 +19,7 @@ export default {
'ms.taskCenter.taskCreateTime': 'Task Initiation Time', 'ms.taskCenter.taskCreateTime': 'Task Initiation Time',
'ms.taskCenter.taskStartTime': 'Task Start Time', 'ms.taskCenter.taskStartTime': 'Task Start Time',
'ms.taskCenter.taskEndTime': 'Task End Time', 'ms.taskCenter.taskEndTime': 'Task End Time',
'ms.taskCenter.taskResource': 'Task Source', 'ms.taskCenter.taskBelongTestPlan': 'Belonging test plan',
'ms.taskCenter.executeEnvInfo': 'Execution Environment Information', 'ms.taskCenter.executeEnvInfo': 'Execution Environment Information',
'ms.taskCenter.passThreshold': 'Pass Threshold', 'ms.taskCenter.passThreshold': 'Pass Threshold',
'ms.taskCenter.executeProgress': 'Execution Progress', 'ms.taskCenter.executeProgress': 'Execution Progress',

View File

@ -19,7 +19,7 @@ export default {
'ms.taskCenter.taskCreateTime': '任务发起时间', 'ms.taskCenter.taskCreateTime': '任务发起时间',
'ms.taskCenter.taskStartTime': '任务开始时间', 'ms.taskCenter.taskStartTime': '任务开始时间',
'ms.taskCenter.taskEndTime': '任务结束时间', 'ms.taskCenter.taskEndTime': '任务结束时间',
'ms.taskCenter.taskResource': '任务来源', 'ms.taskCenter.taskBelongTestPlan': '所属测试计划',
'ms.taskCenter.executeEnvInfo': '执行环境信息', 'ms.taskCenter.executeEnvInfo': '执行环境信息',
'ms.taskCenter.passThreshold': '通过阈值', 'ms.taskCenter.passThreshold': '通过阈值',
'ms.taskCenter.executeProgress': '执行进度', 'ms.taskCenter.executeProgress': '执行进度',