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 { getScheduleProApiCaseList, projectDeleteSchedule } from '@/api/modules/taskCenter/project';
import { useI18n } from '@/hooks/useI18n';
import useModal from '@/hooks/useModal';
import { characterLimit } from '@/utils';
import { TimingTaskCenterApiCaseItem } from '@/models/projectManagement/taskCenter';
import { TaskCenterEnum } from '@/enums/taskCenter';
const { t } = useI18n();
const { openModal } = useModal();
const taskDrawerVisible = defineModel<boolean>('visible', { required: true });
const keyword = ref('');
@ -159,15 +162,29 @@
}
}
async function deleteTask(record: TimingTaskCenterApiCaseItem) {
try {
await projectDeleteSchedule(record.id);
Message.success(t('common.deleteSuccess'));
loadTaskList();
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
}
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 {
await projectDeleteSchedule(record.id);
Message.success(t('common.deleteSuccess'));
loadTaskList();
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
}
},
hideCancel: false,
});
}
</script>

View File

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

View File

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

View File

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

View File

@ -141,6 +141,15 @@
const appStore = useAppStore();
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 = [
{
title: 'ms.taskCenter.taskID',
@ -187,10 +196,7 @@
sorter: true,
},
filterConfig: {
options: Object.keys(scheduleTaskTypeMap).map((key) => ({
label: t(scheduleTaskTypeMap[key]),
value: key,
})),
options: thirdPartyTypeOptions,
filterSlotName: FilterSlotNameEnum.GLOBAL_TASK_CENTER_SYSTEM_TASK_TYPE,
},
width: 120,

View File

@ -19,7 +19,7 @@ export default {
'ms.taskCenter.taskCreateTime': 'Task Initiation Time',
'ms.taskCenter.taskStartTime': 'Task Start 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.passThreshold': 'Pass Threshold',
'ms.taskCenter.executeProgress': 'Execution Progress',

View File

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