|
|
@@ -1,4 +1,4 @@
|
|
|
-import { END_ID, START_ID } from '@/libs/logic-flow/constant';
|
|
|
+import { END_ID, END_NODE, START_ID } from '@/libs/logic-flow/constant';
|
|
|
import type { FlowNodeProperties } from './index';
|
|
|
|
|
|
interface CreateNodeOptions extends FlowNodeProperties {
|
|
|
@@ -18,6 +18,7 @@ export const DEFAULT_NODE_HEIGHT = 40;
|
|
|
|
|
|
export const ID_Start = START_ID;
|
|
|
export const ID_End = END_ID;
|
|
|
+export const ID_Back = 'back';
|
|
|
export const ID_Register = 'register';
|
|
|
export const ID_Analysis_Pulse = 'pulseAnalysis';
|
|
|
export const ID_Analysis_TongueAndFace = 'tongueAndFaceAnalysis';
|
|
|
@@ -48,7 +49,8 @@ const factory = (type: 'StartNode' | 'EndNode' | 'FlowNode', id: string, text: s
|
|
|
|
|
|
const textRef = {
|
|
|
[ID_Start]: '开始检测',
|
|
|
- [ID_End]: '返回首页',
|
|
|
+ [ID_End]: '完成检测',
|
|
|
+ [ID_Back]: '返回首页',
|
|
|
[ID_Register]: '建档',
|
|
|
[ID_Analysis_Pulse]: '脉象分析',
|
|
|
[ID_Analysis_TongueAndFace]: '舌面象分析',
|
|
|
@@ -73,14 +75,23 @@ export function start(options?: CreateNodeOptions) {
|
|
|
icon: 'start',
|
|
|
iconBackground: '#cf1322',
|
|
|
iconColor: '#fff',
|
|
|
- start: true,
|
|
|
configurable: true,
|
|
|
...options,
|
|
|
});
|
|
|
}
|
|
|
|
|
|
export function end(options?: CreateNodeOptions) {
|
|
|
- return factory('EndNode', ID_End, textRef[ID_End], {
|
|
|
+ return factory('FlowNode', ID_End, textRef[ID_End], {
|
|
|
+ icon: 'finish',
|
|
|
+ iconBackground: '#0958d9',
|
|
|
+ iconColor: '#fff',
|
|
|
+ forbidDirectSource: [ID_Start],
|
|
|
+ ...options,
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+export function back(options?: CreateNodeOptions) {
|
|
|
+ return factory(END_NODE, ID_Back, textRef[ID_Back], {
|
|
|
radius: 20,
|
|
|
...options,
|
|
|
});
|
|
|
@@ -131,7 +142,7 @@ export function pulseAnalysisReport(options?: CreateNodeOptions) {
|
|
|
icon: 'report',
|
|
|
iconBackground: '#08979c',
|
|
|
iconColor: '#fff',
|
|
|
- forbidDirectTarget: [ID_End],
|
|
|
+ forbidDirectTarget: [ID_Back],
|
|
|
...options,
|
|
|
});
|
|
|
}
|
|
|
@@ -141,7 +152,7 @@ export function tongueAndFaceAnalysisReport(options?: CreateNodeOptions) {
|
|
|
icon: 'report',
|
|
|
iconBackground: '#08979c',
|
|
|
iconColor: '#fff',
|
|
|
- forbidDirectTarget: [ID_End],
|
|
|
+ forbidDirectTarget: [ID_Back],
|
|
|
...options,
|
|
|
});
|
|
|
}
|
|
|
@@ -151,8 +162,8 @@ export function healthAnalysisReport(options?: CreateNodeOptions) {
|
|
|
icon: 'report',
|
|
|
iconBackground: '#08979c',
|
|
|
iconColor: '#fff',
|
|
|
- finish: true,
|
|
|
configurable: true,
|
|
|
+ onlyTarget: [ID_End],
|
|
|
...options,
|
|
|
});
|
|
|
}
|
|
|
@@ -162,8 +173,8 @@ export function healthAnalysisScheme(options?: CreateNodeOptions) {
|
|
|
icon: 'report',
|
|
|
iconBackground: '#08979c',
|
|
|
iconColor: '#fff',
|
|
|
- finish: true,
|
|
|
configurable: true,
|
|
|
+ onlyTarget: [ID_End],
|
|
|
...options,
|
|
|
});
|
|
|
}
|