feat: 优化定时任务的列表宽度

This commit is contained in:
dhb52 2024-05-08 00:55:24 +08:00
parent a8834e8798
commit ce3e484795

View File

@ -21,7 +21,7 @@ const detailData = ref<Api.Job.Job | null>();
/** 详情页可见状态 */ /** 详情页可见状态 */
const { bool: detailVisible, setTrue: openDetail } = useBoolean(false); const { bool: detailVisible, setTrue: openDetail } = useBoolean(false);
const { columns, data, getData, loading, mobilePagination, searchParams, resetSearchParams } = useTable({ const { columnChecks, columns, data, getData, loading, mobilePagination, searchParams, resetSearchParams } = useTable({
apiFn: fetchGetJobPage, apiFn: fetchGetJobPage,
apiParams: { apiParams: {
page: 1, page: 1,
@ -35,13 +35,14 @@ const { columns, data, getData, loading, mobilePagination, searchParams, resetSe
key: 'index', key: 'index',
title: $t('common.index'), title: $t('common.index'),
align: 'center', align: 'center',
width: 64 width: 40
}, },
{ {
key: 'jobName', key: 'jobName',
title: $t('page.jobTask.jobName'), title: $t('page.jobTask.jobName'),
align: 'center', align: 'center',
minWidth: 120, width: 140,
fixed: 'left',
render: row => { render: row => {
async function showDetailDrawer() { async function showDetailDrawer() {
detailData.value = row; detailData.value = row;
@ -59,19 +60,19 @@ const { columns, data, getData, loading, mobilePagination, searchParams, resetSe
key: 'groupName', key: 'groupName',
title: $t('page.jobTask.groupName'), title: $t('page.jobTask.groupName'),
align: 'left', align: 'left',
minWidth: 120 width: 180
}, },
{ {
key: 'nextTriggerAt', key: 'nextTriggerAt',
title: $t('page.jobTask.nextTriggerAt'), title: $t('page.jobTask.nextTriggerAt'),
align: 'center', align: 'center',
minWidth: 120 width: 120
}, },
{ {
key: 'jobStatus', key: 'jobStatus',
title: $t('page.jobTask.jobStatus'), title: $t('page.jobTask.jobStatus'),
align: 'center', align: 'center',
minWidth: 120, width: 60,
render: row => { render: row => {
const fetchFn = async (jobStatus: Api.Common.EnableStatusNumber, callback: () => void) => { const fetchFn = async (jobStatus: Api.Common.EnableStatusNumber, callback: () => void) => {
const { error } = await fetchUpdateJobStatus({ id: row.id!, jobStatus }); const { error } = await fetchUpdateJobStatus({ id: row.id!, jobStatus });
@ -89,7 +90,7 @@ const { columns, data, getData, loading, mobilePagination, searchParams, resetSe
key: 'taskType', key: 'taskType',
title: $t('page.jobTask.taskType'), title: $t('page.jobTask.taskType'),
align: 'center', align: 'center',
minWidth: 120, width: 120,
render: row => { render: row => {
if (row.taskType === null) { if (row.taskType === null) {
return null; return null;
@ -108,7 +109,7 @@ const { columns, data, getData, loading, mobilePagination, searchParams, resetSe
key: 'triggerType', key: 'triggerType',
title: $t('page.jobTask.triggerType'), title: $t('page.jobTask.triggerType'),
align: 'center', align: 'center',
minWidth: 120, width: 120,
render: row => { render: row => {
if (row.triggerType === null) { if (row.triggerType === null) {
return null; return null;
@ -127,13 +128,13 @@ const { columns, data, getData, loading, mobilePagination, searchParams, resetSe
key: 'triggerInterval', key: 'triggerInterval',
title: $t('page.jobTask.triggerInterval'), title: $t('page.jobTask.triggerInterval'),
align: 'center', align: 'center',
minWidth: 120 width: 80
}, },
{ {
key: 'blockStrategy', key: 'blockStrategy',
title: $t('page.jobTask.blockStrategy'), title: $t('page.jobTask.blockStrategy'),
align: 'center', align: 'center',
minWidth: 120, width: 80,
render: row => { render: row => {
if (row.blockStrategy === null) { if (row.blockStrategy === null) {
return null; return null;
@ -152,19 +153,20 @@ const { columns, data, getData, loading, mobilePagination, searchParams, resetSe
key: 'executorTimeout', key: 'executorTimeout',
title: $t('page.jobTask.executorTimeout'), title: $t('page.jobTask.executorTimeout'),
align: 'center', align: 'center',
minWidth: 120 width: 80
}, },
{ {
key: 'updateDt', key: 'updateDt',
title: $t('page.jobTask.executorTimeout'), title: $t('page.jobTask.updateDt'),
align: 'center', align: 'center',
minWidth: 120 width: 120
}, },
{ {
key: 'operate', key: 'operate',
title: $t('common.operate'), title: $t('common.operate'),
align: 'center', align: 'center',
width: 260, width: 180,
fixed: 'right',
render: row => ( render: row => (
<div class="flex-center gap-8px"> <div class="flex-center gap-8px">
<NButton type="primary" ghost size="small" onClick={() => edit(row.id!)}> <NButton type="primary" ghost size="small" onClick={() => edit(row.id!)}>
@ -245,27 +247,33 @@ function goToBatch(jobId: string) {
header-class="view-card-header" header-class="view-card-header"
> >
<template #header-extra> <template #header-extra>
<TableHeaderOperation :loading="loading" :show-delete="false" @add="handleAdd" @refresh="getData" /> <TableHeaderOperation
v-model:columns="columnChecks"
:loading="loading"
:show-delete="false"
@add="handleAdd"
@refresh="getData"
/>
</template> </template>
<NDataTable <NDataTable
v-model:checked-row-keys="checkedRowKeys" v-model:checked-row-keys="checkedRowKeys"
:columns="columns" :columns="columns"
:data="data" :data="data"
:flex-height="!appStore.isMobile" :flex-height="!appStore.isMobile"
:scroll-x="962" :scroll-x="2000"
:loading="loading" :loading="loading"
remote remote
:row-key="row => row.id" :row-key="row => row.id"
:pagination="mobilePagination" :pagination="mobilePagination"
class="sm:h-full" class="sm:h-full"
/> />
</NCard>
<JobTaskOperateDrawer <JobTaskOperateDrawer
v-model:visible="drawerVisible" v-model:visible="drawerVisible"
:operate-type="operateType" :operate-type="operateType"
:row-data="editingData" :row-data="editingData"
@submitted="getData" @submitted="getData"
/> />
</NCard>
<JobTaskDetailDrawer v-model:visible="detailVisible" :row-data="detailData" /> <JobTaskDetailDrawer v-model:visible="detailVisible" :row-data="detailData" />
</div> </div>
</template> </template>