style(sj_map_reduce): 优化任务批次操作按钮栏

This commit is contained in:
xlsea 2024-06-24 16:35:11 +08:00
parent 34826d7ea4
commit 629204f270

View File

@ -159,26 +159,36 @@ const { columnChecks, columns, data, getData, loading, mobilePagination, searchP
title: $t('common.operate'), title: $t('common.operate'),
align: 'center', align: 'center',
width: 130, width: 130,
render: row => ( render: row => {
<div class="flex-center gap-8px"> const stopBtn = () => {
<NButton type="primary" text ghost size="small" onClick={handleLog}> if (row.taskBatchStatus === 1 || row.taskBatchStatus === 2) {
{$t('common.log')} return (
</NButton> <>
{row.taskBatchStatus === 1 || row.taskBatchStatus === 2 ? ( <n-divider vertical />
<NPopconfirm onPositiveClick={() => handleStopJob(row.id!)}> <NPopconfirm onPositiveClick={() => handleStopJob(row.id!)}>
{{ {{
default: () => $t('common.confirmStop'), default: () => $t('common.confirmStop'),
trigger: () => ( trigger: () => (
<>
<n-divider vertical />
<NButton type="error" text ghost size="small"> <NButton type="error" text ghost size="small">
{$t('common.stop')} {$t('common.stop')}
</NButton> </NButton>
</>
) )
}} }}
</NPopconfirm> </NPopconfirm>
) : ( </>
'' );
)} }
{row.taskBatchStatus === 4 || row.taskBatchStatus === 5 || row.taskBatchStatus === 6 ? ( return null;
};
const retryBtn = () => {
if (row.taskBatchStatus === 4 || row.taskBatchStatus === 5 || row.taskBatchStatus === 6) {
return (
<>
<n-divider vertical />
<NPopconfirm onPositiveClick={() => handleRetryJob(row.id!)}> <NPopconfirm onPositiveClick={() => handleRetryJob(row.id!)}>
{{ {{
default: () => $t('common.confirmRetry'), default: () => $t('common.confirmRetry'),
@ -189,11 +199,21 @@ const { columnChecks, columns, data, getData, loading, mobilePagination, searchP
) )
}} }}
</NPopconfirm> </NPopconfirm>
) : ( </>
'' );
)} }
return null;
};
return (
<div class="flex-center gap-8px">
<NButton type="primary" text ghost size="small" onClick={handleLog}>
{$t('common.log')}
</NButton>
{stopBtn()}
{retryBtn()}
</div> </div>
) );
}
} }
] ]
}); });