|
|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
import React from 'react';
|
|
|
|
|
import styles from '@/components/FlowEditor/node/style/baseOther.module.less';
|
|
|
|
|
import { Handle, Position, useStore } from '@xyflow/react';
|
|
|
|
|
import { isJSON } from '@/utils/common';
|
|
|
|
|
import { deserializeValue } from '@/utils/common';
|
|
|
|
|
import cronstrue from 'cronstrue/i18n';
|
|
|
|
|
|
|
|
|
|
interface NodeContentData {
|
|
|
|
|
@ -94,18 +94,18 @@ const renderSpecialNodeHandles = (isStartNode: boolean, isEndNode: boolean, data
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
))}
|
|
|
|
|
{dataIns.length > 0 && dataIns.map((_, index) => (
|
|
|
|
|
<Handle
|
|
|
|
|
key={`input-handle-${index}`}
|
|
|
|
|
type="target"
|
|
|
|
|
position={Position.Left}
|
|
|
|
|
id={dataIns[index].name || `input-${index}`}
|
|
|
|
|
style={{
|
|
|
|
|
...handleStyles.data,
|
|
|
|
|
top: `${70 + apiIns.length * 20 + index * 20}px`
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
))}
|
|
|
|
|
{dataIns.length > 0 && dataIns.map((_, index) => (
|
|
|
|
|
<Handle
|
|
|
|
|
key={`input-handle-${index}`}
|
|
|
|
|
type="target"
|
|
|
|
|
position={Position.Left}
|
|
|
|
|
id={dataIns[index].name || `input-${index}`}
|
|
|
|
|
style={{
|
|
|
|
|
...handleStyles.data,
|
|
|
|
|
top: `${70 + apiIns.length * 20 + index * 20}px`
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
))}
|
|
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
@ -179,22 +179,26 @@ const renderRegularNodeHandles = (dataIns: any[], dataOuts: any[], apiIns: any[]
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const formatFooter = (data: any) => {
|
|
|
|
|
switch (data.type) {
|
|
|
|
|
case 'WAIT':
|
|
|
|
|
const { duration } = data.customDef;
|
|
|
|
|
const hours = Math.floor(duration / 3600);
|
|
|
|
|
const minutes = Math.floor((duration % 3600) / 60);
|
|
|
|
|
const seconds = Math.floor(duration % 60);
|
|
|
|
|
return `${hours}小时${minutes}分钟${seconds}秒`;
|
|
|
|
|
case 'CYCLE':
|
|
|
|
|
const { intervalSeconds } = data.customDef;
|
|
|
|
|
return cronstrue.toString(intervalSeconds, { locale: 'zh_CN' });
|
|
|
|
|
case 'EVENTSEND':
|
|
|
|
|
case 'EVENTLISTENE':
|
|
|
|
|
const { name } = data.customDef;
|
|
|
|
|
return `事件: ${name}`;
|
|
|
|
|
default:
|
|
|
|
|
return '这个类型还没开发';
|
|
|
|
|
try {
|
|
|
|
|
switch (data.type) {
|
|
|
|
|
case 'WAIT':
|
|
|
|
|
const { duration } = deserializeValue(data.customDef);
|
|
|
|
|
const hours = Math.floor(duration / 3600);
|
|
|
|
|
const minutes = Math.floor((duration % 3600) / 60);
|
|
|
|
|
const seconds = Math.floor(duration % 60);
|
|
|
|
|
return `${hours}小时${minutes}分钟${seconds}秒`;
|
|
|
|
|
case 'CYCLE':
|
|
|
|
|
const { intervalSeconds } = deserializeValue(data.customDef);
|
|
|
|
|
return cronstrue.toString(intervalSeconds, { locale: 'zh_CN' });
|
|
|
|
|
case 'EVENTSEND':
|
|
|
|
|
case 'EVENTLISTENE':
|
|
|
|
|
const { name } = data.customDef;
|
|
|
|
|
return `事件: ${name}`;
|
|
|
|
|
default:
|
|
|
|
|
return '这个类型还没开发';
|
|
|
|
|
}
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.log(e);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|