fix(sj_map_reduce): 修复自动刷新频率组件样式

This commit is contained in:
xlsea 2024-07-03 17:58:37 +08:00
parent 910530dd03
commit 0bb49996bc
2 changed files with 15 additions and 8 deletions

View File

@ -86,14 +86,14 @@ async function getLogList() {
} }
if (!logError && logData) { if (!logError && logData) {
finished.value = logData.finished; finished.value = logData.finished || syncTime.value === 0;
startId = logData.nextStartId; startId = logData.nextStartId;
fromIndex = logData.fromIndex; fromIndex = logData.fromIndex;
if (logData.message) { if (logData.message) {
logList.value.push(...logData.message); logList.value.push(...logData.message);
logList.value.sort((a, b) => Number.parseInt(a.time_stamp, 10) - Number.parseInt(b.time_stamp, 10)); logList.value.sort((a, b) => Number.parseInt(a.time_stamp, 10) - Number.parseInt(b.time_stamp, 10));
} }
if (!finished.value) { if (!finished.value && syncTime.value !== 0) {
clearTimeout(interval.value); clearTimeout(interval.value);
interval.value = setTimeout(getLogList, syncTime.value * 1000); interval.value = setTimeout(getLogList, syncTime.value * 1000);
} }
@ -165,6 +165,8 @@ function openNewTab() {
} }
const handleSyncSelect = async (time: number) => { const handleSyncSelect = async (time: number) => {
syncTime.value = time;
if (time === -1) { if (time === -1) {
if (finished.value) { if (finished.value) {
finished.value = false; finished.value = false;
@ -178,7 +180,6 @@ const handleSyncSelect = async (time: number) => {
return; return;
} }
syncTime.value = time;
finished.value = false; finished.value = false;
await getLogList(); await getLogList();
}; };

View File

@ -35,7 +35,7 @@ const getBatchDetail = async () => {
const { data, error } = await fetchWorkflowBatchInfo(id); const { data, error } = await fetchWorkflowBatchInfo(id);
if (!error) { if (!error) {
node.value = data; node.value = data;
finished.value = !(data.workflowBatchStatus && [1, 2].includes(data.workflowBatchStatus)); finished.value = !(data.workflowBatchStatus && [1, 2].includes(data.workflowBatchStatus)) || syncTime.value === 0;
if (!finished.value && syncTime.value !== 0) { if (!finished.value && syncTime.value !== 0) {
clearTimeout(interval.value); clearTimeout(interval.value);
interval.value = setTimeout(getBatchDetail, syncTime.value * 1000); interval.value = setTimeout(getBatchDetail, syncTime.value * 1000);
@ -47,6 +47,8 @@ const getBatchDetail = async () => {
}; };
const handleSyncSelect = async (time: number) => { const handleSyncSelect = async (time: number) => {
syncTime.value = time;
if (time === -1) { if (time === -1) {
if (finished.value) { if (finished.value) {
finished.value = false; finished.value = false;
@ -60,7 +62,6 @@ const handleSyncSelect = async (time: number) => {
return; return;
} }
syncTime.value = time;
finished.value = false; finished.value = false;
await getBatchDetail(); await getBatchDetail();
}; };
@ -115,7 +116,7 @@ const syncOptions = ref([
<NDropdown trigger="hover" width="trigger" :options="syncOptions" @select="handleSyncSelect"> <NDropdown trigger="hover" width="trigger" :options="syncOptions" @select="handleSyncSelect">
<NTooltip placement="left"> <NTooltip placement="left">
<template #trigger> <template #trigger>
<NButton dashed class="mr-16px w-136px" @click="handleSyncSelect(-1)"> <NButton dashed class="w-136px" :class="finished ? 'mr-16px' : 'mr-42px'" @click="handleSyncSelect(-1)">
<template #icon> <template #icon>
<div class="flex-center gap-8px"> <div class="flex-center gap-8px">
<icon-solar:refresh-outline class="text-18px" /> <icon-solar:refresh-outline class="text-18px" />
@ -130,7 +131,7 @@ const syncOptions = ref([
</NDropdown> </NDropdown>
<NTooltip v-if="finished" placement="top"> <NTooltip v-if="finished" placement="top">
<template #trigger> <template #trigger>
<icon-material-symbols:check-circle class="text-20px color-success" /> <icon-material-symbols:check-circle class="text-26px color-success" />
</template> </template>
流程批次加载完成 流程批次加载完成
</NTooltip> </NTooltip>
@ -149,4 +150,9 @@ const syncOptions = ref([
</Workflow> </Workflow>
</template> </template>
<style scoped></style> <style scoped>
:deep(.n-spin-body) {
right: 0 !important;
left: unset !important;
}
</style>