Skip to content

Commit c6f70cc

Browse files
committed
# Conflicts: # src/views/system/menu/index.vue
2 parents f4a83c0 + b0d4e39 commit c6f70cc

File tree

17 files changed

+645
-102
lines changed

17 files changed

+645
-102
lines changed

src/components/SimpleProcessDesignerV2/src/consts.ts

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -246,15 +246,15 @@ export type AssignEmptyHandler = {
246246
export type ListenerHandler = {
247247
enable: boolean
248248
path?: string
249-
header?: ListenerParam[]
250-
body?: ListenerParam[]
249+
header?: HttpRequestParam[]
250+
body?: HttpRequestParam[]
251251
}
252-
export type ListenerParam = {
252+
export type HttpRequestParam = {
253253
key: string
254254
type: number
255255
value: string
256256
}
257-
export enum ListenerParamTypeEnum {
257+
export enum BpmHttpRequestParamTypeEnum {
258258
/**
259259
* 固定值
260260
*/
@@ -264,7 +264,7 @@ export enum ListenerParamTypeEnum {
264264
*/
265265
FROM_FORM = 2
266266
}
267-
export const LISTENER_MAP_TYPES = [
267+
export const BPM_HTTP_REQUEST_PARAM_TYPES = [
268268
{
269269
value: 1,
270270
label: '固定值'
@@ -371,13 +371,13 @@ export enum TimeUnitType {
371371
/**
372372
* 条件节点设置结构定义,用于条件节点
373373
*/
374-
export type ConditionSetting = {
374+
export type ConditionSetting = {
375375
// 条件类型
376-
conditionType?: ConditionType,
376+
conditionType?: ConditionType
377377
// 条件表达式
378-
conditionExpression?: string,
378+
conditionExpression?: string
379379
// 条件组
380-
conditionGroups?: ConditionGroup,
380+
conditionGroups?: ConditionGroup
381381
// 是否默认的条件
382382
defaultFlow?: boolean
383383
}
@@ -710,13 +710,14 @@ export type RouterSetting = {
710710
conditionGroups: ConditionGroup
711711
}
712712

713-
// ==================== 触发器相关定义 ====================
713+
// ==================== 触发器相关定义 ====================
714714
/**
715715
* 触发器节点结构定义
716716
*/
717717
export type TriggerSetting = {
718718
type: TriggerTypeEnum
719-
httpRequestSetting: HttpRequestTriggerSetting
719+
httpRequestSetting?: HttpRequestTriggerSetting
720+
normalFormSetting?: NormalFormTriggerSetting
720721
}
721722

722723
/**
@@ -727,6 +728,10 @@ export enum TriggerTypeEnum {
727728
* 发送 HTTP 请求触发器
728729
*/
729730
HTTP_REQUEST = 1,
731+
/**
732+
* 更新流程表单触发器
733+
*/
734+
UPDATE_NORMAL_FORM = 2 // TODO @jason:FORM_UPDATE?
730735
}
731736

732737
/**
@@ -736,11 +741,22 @@ export type HttpRequestTriggerSetting = {
736741
// 请求 URL
737742
url: string
738743
// 请求头参数设置
739-
header?: ListenerParam[] // TODO 需要重命名一下
744+
header?: HttpRequestParam[]
740745
// 请求体参数设置
741-
body?: ListenerParam[]
746+
body?: HttpRequestParam[]
747+
// 请求响应设置
748+
response?: Record<string, string>[]
749+
}
750+
751+
/**
752+
* 流程表单触发器配置结构定义
753+
*/
754+
export type NormalFormTriggerSetting = {
755+
// 更新表单字段
756+
updateFormFields?: Record<string, any>
742757
}
743758

744759
export const TRIGGER_TYPES: DictDataVO[] = [
745-
{ label: 'HTTP 请求', value: TriggerTypeEnum.HTTP_REQUEST }
760+
{ label: 'HTTP 请求', value: TriggerTypeEnum.HTTP_REQUEST },
761+
{ label: '修改表单数据', value: TriggerTypeEnum.UPDATE_NORMAL_FORM }
746762
]

src/components/SimpleProcessDesignerV2/src/node.ts

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ import {
1414
AssignStartUserHandlerType,
1515
AssignEmptyHandlerType,
1616
FieldPermissionType,
17-
ListenerParam
17+
HttpRequestParam,
18+
ProcessVariableEnum
1819
} from './consts'
1920
import { parseFormFields } from '@/components/FormCreate/src/utils'
2021

@@ -105,14 +106,31 @@ export function useFormFieldsPermission(defaultPermission: FieldPermissionType)
105106
getNodeConfigFormFields
106107
}
107108
}
109+
108110
/**
109-
* @description 获取表单的字段
111+
* @description 获取流程表单的字段
110112
*/
111113
export function useFormFields() {
112114
const formFields = inject<Ref<string[]>>('formFields', ref([])) // 流程表单字段
113115
return parseFormCreateFields(unref(formFields))
114116
}
115117

118+
// TODO @芋艿:后续需要把各种类似 useFormFieldsPermission 的逻辑,抽成一个通用方法。
119+
/**
120+
* @description 获取流程表单的字段和发起人字段
121+
*/
122+
export function useFormFieldsAndStartUser() {
123+
const injectFormFields = inject<Ref<string[]>>('formFields', ref([])) // 流程表单字段
124+
const formFields = parseFormCreateFields(unref(injectFormFields))
125+
// 添加发起人
126+
formFields.unshift({
127+
field: ProcessVariableEnum.START_USER_ID,
128+
title: '发起人',
129+
required: true
130+
})
131+
return formFields
132+
}
133+
116134
export type UserTaskFormType = {
117135
candidateStrategy: CandidateStrategy
118136
approveMethod: ApproveMethodType
@@ -139,20 +157,20 @@ export type UserTaskFormType = {
139157
taskCreateListenerEnable?: boolean
140158
taskCreateListenerPath?: string
141159
taskCreateListener?: {
142-
header: ListenerParam[],
143-
body: ListenerParam[]
160+
header: HttpRequestParam[]
161+
body: HttpRequestParam[]
144162
}
145163
taskAssignListenerEnable?: boolean
146164
taskAssignListenerPath?: string
147165
taskAssignListener?: {
148-
header: ListenerParam[],
149-
body: ListenerParam[]
166+
header: HttpRequestParam[]
167+
body: HttpRequestParam[]
150168
}
151169
taskCompleteListenerEnable?: boolean
152170
taskCompleteListenerPath?: string
153-
taskCompleteListener?:{
154-
header: ListenerParam[],
155-
body: ListenerParam[]
171+
taskCompleteListener?: {
172+
header: HttpRequestParam[]
173+
body: HttpRequestParam[]
156174
}
157175
signEnable: boolean
158176
reasonRequire: boolean

src/components/SimpleProcessDesignerV2/src/nodes-config/ConditionNodeConfig.vue

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,9 @@ import {
4747
SimpleFlowNode,
4848
ConditionType,
4949
COMPARISON_OPERATORS,
50-
ProcessVariableEnum
5150
} from '../consts'
5251
import { getDefaultConditionNodeName } from '../utils'
53-
import { useFormFields } from '../node'
52+
import { useFormFieldsAndStartUser } from '../node'
5453
import Condition from './components/Condition.vue'
5554
const message = useMessage() // 消息弹窗
5655
defineOptions({
@@ -176,23 +175,12 @@ const getShowText = (): string => {
176175
}
177176
return showText
178177
}
179-
180-
const fieldsInfo = useFormFields()
181-
/** 条件规则可选择的表单字段 */
182-
const fieldOptions = computed(() => {
183-
const fieldsCopy = fieldsInfo.slice()
184-
// 固定添加发起人 ID 字段
185-
fieldsCopy.unshift({
186-
field: ProcessVariableEnum.START_USER_ID,
187-
title: '发起人',
188-
required: true
189-
})
190-
return fieldsCopy
191-
})
178+
// 流程表单字段和发起人字段
179+
const fieldOptions = useFormFieldsAndStartUser()
192180
193181
/** 获取字段名称 */
194182
const getFieldTitle = (field: string) => {
195-
const item = fieldOptions.value.find((item) => item.field === field)
183+
const item = fieldOptions.find((item) => item.field === field)
196184
return item?.title
197185
}
198186

src/components/SimpleProcessDesignerV2/src/nodes-config/DelayTimerNodeConfig.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ const saveConfig = async () => {
124124
if (!valid) return false
125125
const showText = getShowText()
126126
if (!showText) return false
127+
currentNode.value.name = nodeName.value!
127128
currentNode.value.showText = showText
128129
if (configForm.value.delayType === DelayTypeEnum.FIXED_TIME_DURATION) {
129130
currentNode.value.delaySetting = {

0 commit comments

Comments
 (0)