|
@@ -41,6 +41,7 @@ export function useFlowDesigner(lfContainer: Ref<HTMLDivElement | undefined>) {
|
|
|
approveMode: 'or',
|
|
approveMode: 'or',
|
|
|
timeoutHours: undefined as number | undefined,
|
|
timeoutHours: undefined as number | undefined,
|
|
|
timeoutAction: 'remind',
|
|
timeoutAction: 'remind',
|
|
|
|
|
+ approveTimeField: '',
|
|
|
ccUsers: '',
|
|
ccUsers: '',
|
|
|
})
|
|
})
|
|
|
|
|
|
|
@@ -138,7 +139,7 @@ export function useFlowDesigner(lfContainer: Ref<HTMLDivElement | undefined>) {
|
|
|
// 只保存当前节点类型相关的属性,避免不同类型节点属性互相污染
|
|
// 只保存当前节点类型相关的属性,避免不同类型节点属性互相污染
|
|
|
const props: Record<string, any> = JSON.parse(JSON.stringify(defaultProps))
|
|
const props: Record<string, any> = JSON.parse(JSON.stringify(defaultProps))
|
|
|
if (type === 'approval-node') {
|
|
if (type === 'approval-node') {
|
|
|
- props.assigneeType = 'ROLE'
|
|
|
|
|
|
|
+ props.assigneeType = nodeProps.assigneeType ?? 'ROLE'
|
|
|
props.assigneeValue = nodeProps.assigneeValue ?? ''
|
|
props.assigneeValue = nodeProps.assigneeValue ?? ''
|
|
|
props.approveMode = nodeProps.approveMode ?? 'or'
|
|
props.approveMode = nodeProps.approveMode ?? 'or'
|
|
|
props.timeoutHours = nodeProps.timeoutHours
|
|
props.timeoutHours = nodeProps.timeoutHours
|
|
@@ -158,14 +159,21 @@ export function useFlowDesigner(lfContainer: Ref<HTMLDivElement | undefined>) {
|
|
|
Object.assign(nodeProps, getDefaultProps(data.type))
|
|
Object.assign(nodeProps, getDefaultProps(data.type))
|
|
|
// 兼容旧格式:approver + approveType -> 新格式
|
|
// 兼容旧格式:approver + approveType -> 新格式
|
|
|
if (data.type === 'approval-node') {
|
|
if (data.type === 'approval-node') {
|
|
|
- const assigneeType = 'ROLE'
|
|
|
|
|
|
|
+ const supportedTypes = ['ROLE', 'SELF']
|
|
|
|
|
+ let assigneeType = cloned.assigneeType ?? 'ROLE'
|
|
|
let assigneeValue = cloned.assigneeValue ?? ''
|
|
let assigneeValue = cloned.assigneeValue ?? ''
|
|
|
const approveMode = cloned.approveMode ?? cloned.approveType ?? 'or'
|
|
const approveMode = cloned.approveMode ?? cloned.approveType ?? 'or'
|
|
|
- if (!cloned.assigneeValue && cloned.approver) {
|
|
|
|
|
|
|
+ if (!cloned.assigneeType && !cloned.assigneeValue && cloned.approver) {
|
|
|
|
|
+ assigneeType = 'ROLE'
|
|
|
assigneeValue = cloned.approver
|
|
assigneeValue = cloned.approver
|
|
|
}
|
|
}
|
|
|
- // 旧数据中的 USER/SELF/LEADER 不再支持,统一清空让用户重新选择员工角色
|
|
|
|
|
- if (cloned.assigneeType && cloned.assigneeType !== 'ROLE') {
|
|
|
|
|
|
|
+ // 当前设计器只支持 ROLE / SELF,其它旧类型降级为 ROLE 并清空值
|
|
|
|
|
+ if (!supportedTypes.includes(assigneeType)) {
|
|
|
|
|
+ assigneeType = 'ROLE'
|
|
|
|
|
+ assigneeValue = ''
|
|
|
|
|
+ }
|
|
|
|
|
+ // SELF 不需要审批角色值
|
|
|
|
|
+ if (assigneeType === 'SELF') {
|
|
|
assigneeValue = ''
|
|
assigneeValue = ''
|
|
|
}
|
|
}
|
|
|
nodeProps.assigneeType = assigneeType
|
|
nodeProps.assigneeType = assigneeType
|
|
@@ -591,12 +599,13 @@ export function useFlowDesigner(lfContainer: Ref<HTMLDivElement | undefined>) {
|
|
|
if (startNodes.length === 0) return '流程图缺少开始节点'
|
|
if (startNodes.length === 0) return '流程图缺少开始节点'
|
|
|
if (endNodes.length === 0) return '流程图缺少结束节点'
|
|
if (endNodes.length === 0) return '流程图缺少结束节点'
|
|
|
if (startNodes.length > 1) return '流程图只能有一个开始节点'
|
|
if (startNodes.length > 1) return '流程图只能有一个开始节点'
|
|
|
- // 检查审批节点是否选择了审批角色
|
|
|
|
|
|
|
+ // 检查审批节点是否配置了审批对象
|
|
|
for (const node of nodes) {
|
|
for (const node of nodes) {
|
|
|
if (node.type === 'approval-node' || node.type === 'approval') {
|
|
if (node.type === 'approval-node' || node.type === 'approval') {
|
|
|
const props = node.properties || {}
|
|
const props = node.properties || {}
|
|
|
|
|
+ const assigneeType = props.assigneeType ?? 'ROLE'
|
|
|
const assigneeValue = props.assigneeValue || props.approver
|
|
const assigneeValue = props.assigneeValue || props.approver
|
|
|
- if (!assigneeValue) {
|
|
|
|
|
|
|
+ if (assigneeType === 'ROLE' && !assigneeValue) {
|
|
|
return `审批节点 "${node.text || node.name}" 未选择审批角色`
|
|
return `审批节点 "${node.text || node.name}" 未选择审批角色`
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|