feat:全局触发事件

4.新增预审前后节点
5. 新增类注入
This commit is contained in:
lvjunzhao
2025-03-31 16:20:34 +08:00
parent be33adefc7
commit 6015b7c199
4 changed files with 207 additions and 6 deletions

View File

@ -237,7 +237,8 @@ export enum NodeEventType {
//事件执行类型
export enum NodeEventExType {
API = 0, //api
LITEFLOW, //规则引擎
LITEFLOW = 1, //规则引擎
SERVICE = 2, //类注入
}
//用户节点超时处理

View File

@ -107,6 +107,8 @@ export interface ProcessConfig {
processParamConfigs: ProcessConfigParameter; //流程参数
globalStartEventConfigs: NodeEventConfig[];//全局 用户节点 结束事件
globalEndEventConfigs: NodeEventConfig[];//全局 用户节点 结束事件
globalPrequalifyBeforeEventConfigs: NodeEventConfig[];//预审前
globalPrequalifyAfterEventConfigs: NodeEventConfig[];//预审后
globalFinishEventConfigs: NodeEventConfig[];//终止事件
globalRejectEventConfigs: NodeEventConfig[];//全局退回事件
globalAgreeEventConfigs: NodeEventConfig[];//全局同意事件

View File

@ -87,6 +87,8 @@ export const processConfig: ProcessConfig = {
processParamConfigs: [], //流程参数
globalStartEventConfigs: [],//全局 用户节点 结束事件
globalEndEventConfigs: [],//全局 用户节点 结束事件
globalPrequalifyBeforeEventConfigs: [],//预审前
globalPrequalifyAfterEventConfigs: [],//预审后
globalFinishEventConfigs: [],//终止事件
globalRejectEventConfigs: [],//全局退回事件
globalAgreeEventConfigs: [],//全局同意事件

View File

@ -28,6 +28,7 @@
<a-select v-model:value="record[column.dataIndex]">
<a-select-option :value="0">{{ t('执行API') }}</a-select-option>
<a-select-option :value="1">{{ t('规则引擎') }}</a-select-option>
<a-select-option :value="2">{{ t('类注入') }}</a-select-option>
</a-select>
</template>
<template v-if="column.key === 'operateConfig'">
@ -53,6 +54,11 @@
:options="liteFlowOptions"
:field-names="{ label: 'chainName', value: 'id' }"
/>
<a-input
style="width: 100%"
v-else-if="record.type === NodeEventExType.SERVICE"
v-model:value="record['serviceName']"
/>
</template>
<template v-if="column.key === 'action'">
<DeleteTwoTone two-tone-color="#ff8080" @click="deleteStartEvent(index)" />
@ -88,6 +94,7 @@
<a-select v-model:value="record[column.dataIndex]">
<a-select-option :value="0">{{ t('执行API') }}</a-select-option>
<a-select-option :value="1">{{ t('规则引擎') }}</a-select-option>
<a-select-option :value="2">{{ t('类注入') }}</a-select-option>
</a-select>
</template>
<template v-if="column.key === 'operateConfig'">
@ -113,6 +120,11 @@
:options="liteFlowOptions"
:field-names="{ label: 'chainName', value: 'id' }"
/>
<a-input
style="width: 100%"
v-else-if="record.type === NodeEventExType.SERVICE"
v-model:value="record['serviceName']"
/>
</template>
<template v-if="column.key === 'action'">
<DeleteTwoTone two-tone-color="#ff8080" @click="deleteEndEvent(index)" />
@ -120,7 +132,139 @@
</template>
</a-table>
</a-tab-pane>
<a-tab-pane key="3" :tab="t('终止事件')">
<a-tab-pane key="3" :tab="t('全局预审前事件')">
<div class="process-top">
<a-button type="primary" @click="addGlobalPrequalifyBeforeEvent">
{{ t('添加全局预审前事件') }}
</a-button>
</div>
<a-table
:columns="columns"
:dataSource="processInfo.globalPrequalifyBeforeEventConfigs"
:pagination="false"
>
<template #headerCell="{ column }">
<template v-if="column.key === 'sort'">
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-fangxiang1" />
</svg>
</template>
</template>
<template #bodyCell="{ column, record, index }">
<template v-if="column.key === 'sort'">
<svg class="icon draggable-icon" aria-hidden="true" style="cursor: move">
<use xlink:href="#icon-paixu" />
</svg>
</template>
<template v-if="column.key === 'type'">
<a-select v-model:value="record[column.dataIndex]">
<a-select-option :value="0">{{ t('执行API') }}</a-select-option>
<a-select-option :value="1">{{ t('规则引擎') }}</a-select-option>
<a-select-option :value="2">{{ t('类注入') }}</a-select-option>
</a-select>
</template>
<template v-if="column.key === 'operateConfig'">
<!-- <a-input
v-if="record.type === NodeEventExType.API"
v-model:value="record['apiConfig'].path"
@click="showConfig(NodeEventType.START, index)"
>
<template #suffix>
<Icon icon="ant-design:ellipsis-outlined" />
</template>
</a-input> -->
<ScriptApiSelect
v-if="record.type === NodeEventExType.API"
style="width: 100%"
v-model="record['apiConfig']"
:need-hide-components="true"
/>
<a-select
style="width: 100%"
v-else-if="record.type === NodeEventExType.LITEFLOW"
v-model:value="record['liteflowId']"
:options="liteFlowOptions"
:field-names="{ label: 'chainName', value: 'id' }"
/>
<a-input
style="width: 100%"
v-else-if="record.type === NodeEventExType.SERVICE"
v-model:value="record['serviceName']"
/>
</template>
<template v-if="column.key === 'action'">
<DeleteTwoTone two-tone-color="#ff8080" @click="deletePrequalifyBeforeEvent(index)" />
</template>
</template>
</a-table>
</a-tab-pane>
<a-tab-pane key="4" :tab="t('全局预审后事件')">
<div class="process-top">
<a-button type="primary" @click="addGlobalPrequalifyAfterEvent">
{{ t('添加全局预审后事件') }}
</a-button>
</div>
<a-table
:columns="columns"
:dataSource="processInfo.globalPrequalifyAfterEventConfigs"
:pagination="false"
>
<template #headerCell="{ column }">
<template v-if="column.key === 'sort'">
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-fangxiang1" />
</svg>
</template>
</template>
<template #bodyCell="{ column, record, index }">
<template v-if="column.key === 'sort'">
<svg class="icon draggable-icon" aria-hidden="true" style="cursor: move">
<use xlink:href="#icon-paixu" />
</svg>
</template>
<template v-if="column.key === 'type'">
<a-select v-model:value="record[column.dataIndex]">
<a-select-option :value="0">{{ t('执行API') }}</a-select-option>
<a-select-option :value="1">{{ t('规则引擎') }}</a-select-option>
<a-select-option :value="2">{{ t('类注入') }}</a-select-option>
</a-select>
</template>
<template v-if="column.key === 'operateConfig'">
<!-- <a-input
v-if="record.type === NodeEventExType.API"
v-model:value="record['apiConfig'].path"
@click="showConfig(NodeEventType.START, index)"
>
<template #suffix>
<Icon icon="ant-design:ellipsis-outlined" />
</template>
</a-input> -->
<ScriptApiSelect
v-if="record.type === NodeEventExType.API"
style="width: 100%"
v-model="record['apiConfig']"
:need-hide-components="true"
/>
<a-select
style="width: 100%"
v-else-if="record.type === NodeEventExType.LITEFLOW"
v-model:value="record['liteflowId']"
:options="liteFlowOptions"
:field-names="{ label: 'chainName', value: 'id' }"
/>
<a-input
style="width: 100%"
v-else-if="record.type === NodeEventExType.SERVICE"
v-model:value="record['serviceName']"
/>
</template>
<template v-if="column.key === 'action'">
<DeleteTwoTone two-tone-color="#ff8080" @click="deletePrequalifyAfterEvent(index)" />
</template>
</template>
</a-table>
</a-tab-pane>
<a-tab-pane key="5" :tab="t('终止事件')">
<div class="process-top">
<a-button type="primary" @click="addGlobalFinishEvent">
{{ t('添加终止事件') }}
@ -148,6 +292,7 @@
<a-select v-model:value="record[column.dataIndex]">
<a-select-option :value="0">{{ t('执行API') }}</a-select-option>
<a-select-option :value="1">{{ t('规则引擎') }}</a-select-option>
<a-select-option :value="2">{{ t('类注入') }}</a-select-option>
</a-select>
</template>
<template v-if="column.key === 'operateConfig'">
@ -173,6 +318,11 @@
:options="liteFlowOptions"
:field-names="{ label: 'chainName', value: 'id' }"
/>
<a-input
style="width: 100%"
v-else-if="record.type === NodeEventExType.SERVICE"
v-model:value="record['serviceName']"
/>
</template>
<template v-if="column.key === 'action'">
<DeleteTwoTone two-tone-color="#ff8080" @click="deleteFinishEvent(index)" />
@ -180,7 +330,7 @@
</template>
</a-table>
</a-tab-pane>
<a-tab-pane key="4" :tab="t('全局退回事件')">
<a-tab-pane key="6" :tab="t('全局退回事件')">
<div class="process-top">
<a-button type="primary" @click="addGlobalRejectEvent">
{{ t('添加全局退回事件') }}
@ -208,6 +358,7 @@
<a-select v-model:value="record[column.dataIndex]">
<a-select-option :value="0">{{ t('执行API') }}</a-select-option>
<a-select-option :value="1">{{ t('规则引擎') }}</a-select-option>
<a-select-option :value="2">{{ t('类注入') }}</a-select-option>
</a-select>
</template>
<template v-if="column.key === 'operateConfig'">
@ -233,6 +384,11 @@
:options="liteFlowOptions"
:field-names="{ label: 'chainName', value: 'id' }"
/>
<a-input
style="width: 100%"
v-else-if="record.type === NodeEventExType.SERVICE"
v-model:value="record['serviceName']"
/>
</template>
<template v-if="column.key === 'action'">
<DeleteTwoTone two-tone-color="#ff8080" @click="deleteRejectEvent(index)" />
@ -240,7 +396,7 @@
</template>
</a-table>
</a-tab-pane>
<a-tab-pane key="5" :tab="t('全局同意事件')">
<a-tab-pane key="7" :tab="t('全局同意事件')">
<div class="process-top">
<a-button type="primary" @click="addGlobalAgreeEvent">
{{ t('添加全局同意事件') }}
@ -268,6 +424,7 @@
<a-select v-model:value="record[column.dataIndex]">
<a-select-option :value="0">{{ t('执行API') }}</a-select-option>
<a-select-option :value="1">{{ t('规则引擎') }}</a-select-option>
<a-select-option :value="2">{{ t('类注入') }}</a-select-option>
</a-select>
</template>
<template v-if="column.key === 'operateConfig'">
@ -293,6 +450,11 @@
:options="liteFlowOptions"
:field-names="{ label: 'chainName', value: 'id' }"
/>
<a-input
style="width: 100%"
v-else-if="record.type === NodeEventExType.SERVICE"
v-model:value="record['serviceName']"
/>
</template>
<template v-if="column.key === 'action'">
<DeleteTwoTone two-tone-color="#ff8080" @click="deleteAgreeEvent(index)" />
@ -300,7 +462,7 @@
</template>
</a-table>
</a-tab-pane>
<a-tab-pane key="6" :tab="t('挂起事件')">
<a-tab-pane key="8" :tab="t('挂起事件')">
<div class="process-top">
<a-button type="primary" @click="addGlobalSuspendedEvent">
{{ t('添加挂起事件') }}
@ -328,6 +490,7 @@
<a-select v-model:value="record[column.dataIndex]">
<a-select-option :value="0">{{ t('执行API') }}</a-select-option>
<a-select-option :value="1">{{ t('规则引擎') }}</a-select-option>
<a-select-option :value="2">{{ t('类注入') }}</a-select-option>
</a-select>
</template>
<template v-if="column.key === 'operateConfig'">
@ -353,6 +516,11 @@
:options="liteFlowOptions"
:field-names="{ label: 'chainName', value: 'id' }"
/>
<a-input
style="width: 100%"
v-else-if="record.type === NodeEventExType.SERVICE"
v-model:value="record['serviceName']"
/>
</template>
<template v-if="column.key === 'action'">
<DeleteTwoTone two-tone-color="#ff8080" @click="deleteSuspendedEvent(index)" />
@ -360,7 +528,7 @@
</template>
</a-table>
</a-tab-pane>
<a-tab-pane key="7" :tab="t('恢复事件')">
<a-tab-pane key="9" :tab="t('恢复事件')">
<div class="process-top">
<a-button type="primary" @click="addGlobalRestoreEvent">
{{ t('添加恢复事件') }}
@ -388,6 +556,7 @@
<a-select v-model:value="record[column.dataIndex]">
<a-select-option :value="0">{{ t('执行API') }}</a-select-option>
<a-select-option :value="1">{{ t('规则引擎') }}</a-select-option>
<a-select-option :value="2">{{ t('类注入') }}</a-select-option>
</a-select>
</template>
<template v-if="column.key === 'operateConfig'">
@ -413,6 +582,11 @@
:options="liteFlowOptions"
:field-names="{ label: 'chainName', value: 'id' }"
/>
<a-input
style="width: 100%"
v-else-if="record.type === NodeEventExType.SERVICE"
v-model:value="record['serviceName']"
/>
</template>
<template v-if="column.key === 'action'">
<DeleteTwoTone two-tone-color="#ff8080" @click="deleteRestoreEvent(index)" />
@ -487,6 +661,28 @@ const deleteEndEvent = (index) => {
processInfo.value.globalEndEventConfigs.splice(index, 1);
};
const addGlobalPrequalifyBeforeEvent = () => {
processInfo.value.globalPrequalifyBeforeEventConfigs.push({
type: NodeEventExType.API,
apiConfig: {},
} as NodeEventConfig);
};
const deletePrequalifyBeforeEvent = (index) => {
processInfo.value.globalPrequalifyBeforeEventConfigs.splice(index, 1);
};
const addGlobalPrequalifyAfterEvent = () => {
processInfo.value.globalPrequalifyAfterEventConfigs.push({
type: NodeEventExType.API,
apiConfig: {},
} as NodeEventConfig);
};
const deletePrequalifyAfterEvent = (index) => {
processInfo.value.globalPrequalifyAfterEventConfigs.splice(index, 1);
};
const addGlobalFinishEvent = () => {
processInfo.value.globalFinishEventConfigs.push({
type: NodeEventExType.API,