fix(sj_map_reduce): 修复工作流表单赋值问题
This commit is contained in:
parent
1b66376f9d
commit
ddeac22bed
@ -2,7 +2,11 @@
|
|||||||
import { ref, watch } from 'vue';
|
import { ref, watch } from 'vue';
|
||||||
import CronInput from '@sa/cron-input';
|
import CronInput from '@sa/cron-input';
|
||||||
import { type FormInst, type FormItemRule } from 'naive-ui';
|
import { type FormInst, type FormItemRule } from 'naive-ui';
|
||||||
import { blockStrategyRecordOptions, triggerTypeOptions, workFlowNodeStatusOptions } from '@/constants/business';
|
import {
|
||||||
|
blockStrategyRecordOptions,
|
||||||
|
workflowTriggerTypeOptions as triggerTypeOptions,
|
||||||
|
workFlowNodeStatusOptions
|
||||||
|
} from '@/constants/business';
|
||||||
import { $t } from '@/locales';
|
import { $t } from '@/locales';
|
||||||
import { fetchGetAllGroupNameList } from '@/service/api';
|
import { fetchGetAllGroupNameList } from '@/service/api';
|
||||||
import { isNotNull } from '@/utils/common';
|
import { isNotNull } from '@/utils/common';
|
||||||
@ -165,6 +169,7 @@ const rules: Record<RuleKey, FormItemRule> = {
|
|||||||
<NInputNumber
|
<NInputNumber
|
||||||
v-else
|
v-else
|
||||||
v-model:value="form.triggerInterval as number"
|
v-model:value="form.triggerInterval as number"
|
||||||
|
:min="1"
|
||||||
class="w-full"
|
class="w-full"
|
||||||
placeholder="请输入触发间隔"
|
placeholder="请输入触发间隔"
|
||||||
>
|
>
|
||||||
@ -176,7 +181,7 @@ const rules: Record<RuleKey, FormItemRule> = {
|
|||||||
<NGrid :cols="24" x-gap="20">
|
<NGrid :cols="24" x-gap="20">
|
||||||
<NGi :span="8">
|
<NGi :span="8">
|
||||||
<NFormItem path="executorTimeout" label="执行超时时间">
|
<NFormItem path="executorTimeout" label="执行超时时间">
|
||||||
<NInputNumber v-model:value="form.executorTimeout" placeholder="请输入超时时间">
|
<NInputNumber v-model:value="form.executorTimeout" placeholder="请输入超时时间" :min="1">
|
||||||
<template #suffix>秒</template>
|
<template #suffix>秒</template>
|
||||||
</NInputNumber>
|
</NInputNumber>
|
||||||
</NFormItem>
|
</NFormItem>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, watch } from 'vue';
|
import { onMounted, ref, watch } from 'vue';
|
||||||
import { $t } from '@/locales';
|
import { $t } from '@/locales';
|
||||||
import NodeWrap from './modules/nodes/node-wrap.vue';
|
import NodeWrap from './modules/nodes/node-wrap.vue';
|
||||||
import StartNode from './modules/nodes/start-node.vue';
|
import StartNode from './modules/nodes/start-node.vue';
|
||||||
@ -57,12 +57,48 @@ watch(
|
|||||||
const onZoom = (n: number) => {
|
const onZoom = (n: number) => {
|
||||||
zoom.value += 10 * n;
|
zoom.value += 10 * n;
|
||||||
|
|
||||||
|
if (n > 0) {
|
||||||
|
const workflowBodyDom: HTMLDivElement | null = document.querySelector('.workflow-body');
|
||||||
|
if (workflowBodyDom) {
|
||||||
|
if (zoom.value <= 160) {
|
||||||
|
workflowBodyDom.scrollTo({ left: (280 * zoom.value) / 100, behavior: 'smooth' });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (zoom.value > 160) {
|
||||||
|
workflowBodyDom.scrollTo({ left: (420 * zoom.value) / 100, behavior: 'smooth' });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (zoom.value > 200) {
|
||||||
|
workflowBodyDom.scrollTo({ left: (520 * zoom.value) / 100, behavior: 'smooth' });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (zoom.value <= 10) {
|
if (zoom.value <= 10) {
|
||||||
zoom.value = 10;
|
zoom.value = 10;
|
||||||
} else if (zoom.value >= 300) {
|
} else if (zoom.value >= 300) {
|
||||||
zoom.value = 300;
|
zoom.value = 300;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleWeel = (e: WheelEvent) => {
|
||||||
|
e.preventDefault();
|
||||||
|
// @ts-expect-error ts-migrate(2339)
|
||||||
|
const wheelDelta = e.wheelDelta;
|
||||||
|
|
||||||
|
if (wheelDelta < 0) {
|
||||||
|
onZoom(-1);
|
||||||
|
} else {
|
||||||
|
onZoom(1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
const workflowDom: HTMLDivElement | null = document.querySelector('.workflow');
|
||||||
|
if (workflowDom) {
|
||||||
|
workflowDom.onwheel = (ev: WheelEvent) => handleWeel(ev);
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -73,7 +109,7 @@ const onZoom = (n: number) => {
|
|||||||
<div>
|
<div>
|
||||||
<NTooltip>
|
<NTooltip>
|
||||||
<template #trigger>
|
<template #trigger>
|
||||||
<NButton type="info" size="small" strong @click="onZoom(-1)">
|
<NButton size="small" strong circle @click="onZoom(-1)">
|
||||||
<icon-ant-design:minus-outlined />
|
<icon-ant-design:minus-outlined />
|
||||||
</NButton>
|
</NButton>
|
||||||
</template>
|
</template>
|
||||||
@ -82,7 +118,7 @@ const onZoom = (n: number) => {
|
|||||||
<span class="ml-8px mr-8px text-18px text-#333639 dark:text-#d6d6d6">{{ zoom }}%</span>
|
<span class="ml-8px mr-8px text-18px text-#333639 dark:text-#d6d6d6">{{ zoom }}%</span>
|
||||||
<NTooltip>
|
<NTooltip>
|
||||||
<template #trigger>
|
<template #trigger>
|
||||||
<NButton type="info" size="small" strong @click="onZoom(1)">
|
<NButton size="small" strong circle @click="onZoom(1)">
|
||||||
<icon-ant-design:plus-outlined />
|
<icon-ant-design:plus-outlined />
|
||||||
</NButton>
|
</NButton>
|
||||||
</template>
|
</template>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { $t } from '@/locales';
|
import { $t } from '@/locales';
|
||||||
import { transformRecordToNumberOption, transformRecordToOption } from '@/utils/common';
|
import { transformRecordToNumberOption } from '@/utils/common';
|
||||||
|
|
||||||
export const yesOrNoRecord: Record<Api.Common.YesOrNo, App.I18n.I18nKey> = {
|
export const yesOrNoRecord: Record<Api.Common.YesOrNo, App.I18n.I18nKey> = {
|
||||||
'0': 'common.yesOrNo.no',
|
'0': 'common.yesOrNo.no',
|
||||||
@ -30,13 +30,13 @@ export const alarmTypeRecord: Record<Api.NotifyRecipient.AlarmType, App.I18n.I18
|
|||||||
4: 'page.notifyRecipient.lark',
|
4: 'page.notifyRecipient.lark',
|
||||||
5: 'page.notifyRecipient.webhook'
|
5: 'page.notifyRecipient.webhook'
|
||||||
};
|
};
|
||||||
export const alarmTypeRecordOptions = transformRecordToOption(alarmTypeRecord);
|
export const alarmTypeRecordOptions = transformRecordToNumberOption(alarmTypeRecord);
|
||||||
|
|
||||||
export const alarmWebhookTypeRecord: Record<Api.NotifyRecipient.AlarmTypeWebhook, App.I18n.I18nKey> = {
|
export const alarmWebhookTypeRecord: Record<Api.NotifyRecipient.AlarmTypeWebhook, App.I18n.I18nKey> = {
|
||||||
1: 'page.notifyRecipient.form.applicationJson',
|
1: 'page.notifyRecipient.form.applicationJson',
|
||||||
2: 'page.notifyRecipient.form.applicationXWwwFormUrlencoded'
|
2: 'page.notifyRecipient.form.applicationXWwwFormUrlencoded'
|
||||||
};
|
};
|
||||||
export const alarmWebhookTypeRecordOptions = transformRecordToOption(alarmWebhookTypeRecord);
|
export const alarmWebhookTypeRecordOptions = transformRecordToNumberOption(alarmWebhookTypeRecord);
|
||||||
|
|
||||||
export const systemTaskType: Record<Api.NotifyConfig.SystemTaskType, App.I18n.I18nKey> = {
|
export const systemTaskType: Record<Api.NotifyConfig.SystemTaskType, App.I18n.I18nKey> = {
|
||||||
1: 'common.systemTaskType.retry',
|
1: 'common.systemTaskType.retry',
|
||||||
@ -130,7 +130,7 @@ export const failStrategyRecord: Record<Api.Common.FailStrategy, App.I18n.I18nKe
|
|||||||
2: 'common.failStrategy.items.blockage'
|
2: 'common.failStrategy.items.blockage'
|
||||||
};
|
};
|
||||||
|
|
||||||
export const failStrategyOptions = transformRecordToOption(failStrategyRecord);
|
export const failStrategyOptions = transformRecordToNumberOption(failStrategyRecord);
|
||||||
|
|
||||||
/** 判定逻辑 */
|
/** 判定逻辑 */
|
||||||
export const logicalConditionRecord: Record<Api.Common.LogicalCondition, string> = {
|
export const logicalConditionRecord: Record<Api.Common.LogicalCondition, string> = {
|
||||||
@ -138,7 +138,7 @@ export const logicalConditionRecord: Record<Api.Common.LogicalCondition, string>
|
|||||||
2: 'or'
|
2: 'or'
|
||||||
};
|
};
|
||||||
|
|
||||||
export const logicalConditionOptions = transformRecordToOption(logicalConditionRecord);
|
export const logicalConditionOptions = transformRecordToNumberOption(logicalConditionRecord);
|
||||||
|
|
||||||
/** 表达式类型 */
|
/** 表达式类型 */
|
||||||
export const expressionRecord: Record<Api.Common.Expression, string> = {
|
export const expressionRecord: Record<Api.Common.Expression, string> = {
|
||||||
@ -147,7 +147,7 @@ export const expressionRecord: Record<Api.Common.Expression, string> = {
|
|||||||
3: 'QL'
|
3: 'QL'
|
||||||
};
|
};
|
||||||
|
|
||||||
export const expressionOptions = transformRecordToOption(expressionRecord);
|
export const expressionOptions = transformRecordToNumberOption(expressionRecord);
|
||||||
|
|
||||||
/** 请求类型 */
|
/** 请求类型 */
|
||||||
export const contentTypeRecord: Record<Api.Common.ContentType, string> = {
|
export const contentTypeRecord: Record<Api.Common.ContentType, string> = {
|
||||||
@ -155,7 +155,7 @@ export const contentTypeRecord: Record<Api.Common.ContentType, string> = {
|
|||||||
2: 'application/x-www-form-urlencoded'
|
2: 'application/x-www-form-urlencoded'
|
||||||
};
|
};
|
||||||
|
|
||||||
export const contentTypeOptions = transformRecordToOption(contentTypeRecord);
|
export const contentTypeOptions = transformRecordToNumberOption(contentTypeRecord);
|
||||||
|
|
||||||
/** 执行器类型 */
|
/** 执行器类型 */
|
||||||
export const executorTypeRecord: Record<Api.Common.ExecutorType, App.I18n.I18nKey> = {
|
export const executorTypeRecord: Record<Api.Common.ExecutorType, App.I18n.I18nKey> = {
|
||||||
@ -212,6 +212,10 @@ export const triggerTypeRecord: Record<Api.Job.TriggerType, App.I18n.I18nKey> =
|
|||||||
|
|
||||||
export const triggerTypeOptions = transformRecordToNumberOption(triggerTypeRecord);
|
export const triggerTypeOptions = transformRecordToNumberOption(triggerTypeRecord);
|
||||||
|
|
||||||
|
export const workflowTriggerTypeOptions = transformRecordToNumberOption(triggerTypeRecord).filter(
|
||||||
|
item => item.value !== 99
|
||||||
|
);
|
||||||
|
|
||||||
export const taskBatchStatusRecord: Record<Api.Common.TaskBatchStatus, App.I18n.I18nKey> = {
|
export const taskBatchStatusRecord: Record<Api.Common.TaskBatchStatus, App.I18n.I18nKey> = {
|
||||||
1: 'common.taskBatchStatus.items.waiting',
|
1: 'common.taskBatchStatus.items.waiting',
|
||||||
2: 'common.taskBatchStatus.items.running',
|
2: 'common.taskBatchStatus.items.running',
|
||||||
@ -326,7 +330,7 @@ export const workFlowNodeStatusRecord: Record<Api.Common.WorkFlowNodeStatus, App
|
|||||||
1: 'common.workFlowNodeStatus.items.open'
|
1: 'common.workFlowNodeStatus.items.open'
|
||||||
};
|
};
|
||||||
|
|
||||||
export const workFlowNodeStatusOptions = transformRecordToOption(workFlowNodeStatusRecord);
|
export const workFlowNodeStatusOptions = transformRecordToNumberOption(workFlowNodeStatusRecord);
|
||||||
|
|
||||||
export const jobStatusEnum: Workflow.JobTagType = {
|
export const jobStatusEnum: Workflow.JobTagType = {
|
||||||
0: {
|
0: {
|
||||||
|
@ -131,15 +131,6 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
|||||||
width: 200,
|
width: 200,
|
||||||
render: row => {
|
render: row => {
|
||||||
const options = [
|
const options = [
|
||||||
{
|
|
||||||
label: $t('common.execute'),
|
|
||||||
key: 'execute',
|
|
||||||
click: () => execute(row.id!)
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'divider',
|
|
||||||
key: 'd1'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
label: $t('common.copy'),
|
label: $t('common.copy'),
|
||||||
key: 'copy',
|
key: 'copy',
|
||||||
@ -153,35 +144,48 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
|||||||
label: $t('common.batchList'),
|
label: $t('common.batchList'),
|
||||||
key: 'batchList',
|
key: 'batchList',
|
||||||
click: () => batch(row.id!)
|
click: () => batch(row.id!)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'divider',
|
||||||
|
key: 'd2'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
show: hasAuth('R_ADMIN'),
|
||||||
|
type: 'render',
|
||||||
|
key: 'delete',
|
||||||
|
render: () => (
|
||||||
|
<div class="flex-center">
|
||||||
|
<NPopconfirm onPositiveClick={() => handleDelete(row.id!)}>
|
||||||
|
{{
|
||||||
|
default: () => $t('common.confirmDelete'),
|
||||||
|
trigger: () => (
|
||||||
|
<NButton quaternary size="small">
|
||||||
|
{$t('common.delete')}
|
||||||
|
</NButton>
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
</NPopconfirm>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
function onSelect(key: string) {
|
const onSelect = (key: string) => {
|
||||||
options.filter(o => o.key === key)[0].click!();
|
const fun = options.filter(o => o.key === key)[0].click;
|
||||||
}
|
if (fun) fun();
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class="flex-center gap-8px">
|
<div class="flex-center gap-8px">
|
||||||
<NButton text type="warning" ghost size="small" onClick={() => edit(row.id!)}>
|
<NButton text type="warning" ghost size="small" onClick={() => edit(row.id!)}>
|
||||||
{$t('common.edit')}
|
{$t('common.edit')}
|
||||||
</NButton>
|
</NButton>
|
||||||
{hasAuth('R_ADMIN') ? (
|
|
||||||
<>
|
<n-divider vertical />
|
||||||
<n-divider vertical />
|
|
||||||
<NPopconfirm onPositiveClick={() => handleDelete(row.id!)}>
|
<NButton text type="error" ghost size="small" onClick={() => execute(row.id!)}>
|
||||||
{{
|
{$t('common.execute')}
|
||||||
default: () => $t('common.confirmDelete'),
|
</NButton>
|
||||||
trigger: () => (
|
|
||||||
<NButton text type="error" ghost size="small">
|
|
||||||
{$t('common.delete')}
|
|
||||||
</NButton>
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
</NPopconfirm>
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
''
|
|
||||||
)}
|
|
||||||
|
|
||||||
<n-divider vertical />
|
<n-divider vertical />
|
||||||
|
|
||||||
@ -320,5 +324,3 @@ function handleExport() {
|
|||||||
</NCard>
|
</NCard>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped></style>
|
|
||||||
|
Loading…
Reference in New Issue
Block a user