|
@@ -39,6 +39,7 @@ export function useFlowDesigner(lfContainer: Ref<HTMLDivElement | undefined>) {
|
|
|
const nodeProps = reactive<Record<string, any>>({
|
|
const nodeProps = reactive<Record<string, any>>({
|
|
|
assigneeType: 'ROLE',
|
|
assigneeType: 'ROLE',
|
|
|
assigneeValue: '',
|
|
assigneeValue: '',
|
|
|
|
|
+ nodeKey: '',
|
|
|
approveMode: 'or',
|
|
approveMode: 'or',
|
|
|
timeoutHours: undefined as number | undefined,
|
|
timeoutHours: undefined as number | undefined,
|
|
|
timeoutAction: 'remind',
|
|
timeoutAction: 'remind',
|
|
@@ -131,6 +132,7 @@ export function useFlowDesigner(lfContainer: Ref<HTMLDivElement | undefined>) {
|
|
|
return {
|
|
return {
|
|
|
assigneeType: 'ROLE',
|
|
assigneeType: 'ROLE',
|
|
|
assigneeValue: '',
|
|
assigneeValue: '',
|
|
|
|
|
+ nodeKey: '',
|
|
|
approveMode: 'or',
|
|
approveMode: 'or',
|
|
|
timeoutHours: undefined,
|
|
timeoutHours: undefined,
|
|
|
timeoutAction: 'remind',
|
|
timeoutAction: 'remind',
|
|
@@ -152,6 +154,7 @@ export function useFlowDesigner(lfContainer: Ref<HTMLDivElement | undefined>) {
|
|
|
if (type === 'approval-node') {
|
|
if (type === 'approval-node') {
|
|
|
props.assigneeType = nodeProps.assigneeType ?? 'ROLE'
|
|
props.assigneeType = nodeProps.assigneeType ?? 'ROLE'
|
|
|
props.assigneeValue = nodeProps.assigneeValue ?? ''
|
|
props.assigneeValue = nodeProps.assigneeValue ?? ''
|
|
|
|
|
+ props.nodeKey = nodeProps.nodeKey ?? ''
|
|
|
props.approveMode = nodeProps.approveMode ?? 'or'
|
|
props.approveMode = nodeProps.approveMode ?? 'or'
|
|
|
props.timeoutHours = nodeProps.timeoutHours
|
|
props.timeoutHours = nodeProps.timeoutHours
|
|
|
props.timeoutAction = nodeProps.timeoutAction ?? 'remind'
|
|
props.timeoutAction = nodeProps.timeoutAction ?? 'remind'
|
|
@@ -198,7 +201,7 @@ 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 supportedTypes = ['ROLE', 'SELF']
|
|
|
|
|
|
|
+ const supportedTypes = ['ROLE', 'SELF', 'EXTERNAL']
|
|
|
let assigneeType = cloned.assigneeType ?? 'ROLE'
|
|
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'
|
|
@@ -206,17 +209,18 @@ export function useFlowDesigner(lfContainer: Ref<HTMLDivElement | undefined>) {
|
|
|
assigneeType = 'ROLE'
|
|
assigneeType = 'ROLE'
|
|
|
assigneeValue = cloned.approver
|
|
assigneeValue = cloned.approver
|
|
|
}
|
|
}
|
|
|
- // 当前设计器只支持 ROLE / SELF,其它旧类型降级为 ROLE 并清空值
|
|
|
|
|
|
|
+ // 当前设计器支持 ROLE / SELF / EXTERNAL,其它旧类型降级为 ROLE 并清空值
|
|
|
if (!supportedTypes.includes(assigneeType)) {
|
|
if (!supportedTypes.includes(assigneeType)) {
|
|
|
assigneeType = 'ROLE'
|
|
assigneeType = 'ROLE'
|
|
|
assigneeValue = ''
|
|
assigneeValue = ''
|
|
|
}
|
|
}
|
|
|
- // SELF 不需要审批角色值
|
|
|
|
|
- if (assigneeType === 'SELF') {
|
|
|
|
|
|
|
+ // SELF / EXTERNAL 不需要审批角色值
|
|
|
|
|
+ if (assigneeType === 'SELF' || assigneeType === 'EXTERNAL') {
|
|
|
assigneeValue = ''
|
|
assigneeValue = ''
|
|
|
}
|
|
}
|
|
|
nodeProps.assigneeType = assigneeType
|
|
nodeProps.assigneeType = assigneeType
|
|
|
nodeProps.assigneeValue = assigneeValue
|
|
nodeProps.assigneeValue = assigneeValue
|
|
|
|
|
+ nodeProps.nodeKey = cloned.nodeKey ?? ''
|
|
|
nodeProps.approveMode = approveMode
|
|
nodeProps.approveMode = approveMode
|
|
|
nodeProps.timeoutHours = cloned.timeoutHours ?? undefined
|
|
nodeProps.timeoutHours = cloned.timeoutHours ?? undefined
|
|
|
nodeProps.timeoutAction = cloned.timeoutAction ?? 'remind'
|
|
nodeProps.timeoutAction = cloned.timeoutAction ?? 'remind'
|
|
@@ -665,6 +669,7 @@ export function useFlowDesigner(lfContainer: Ref<HTMLDivElement | undefined>) {
|
|
|
if (endNodes.length === 0) return '流程图缺少结束节点'
|
|
if (endNodes.length === 0) return '流程图缺少结束节点'
|
|
|
if (startNodes.length > 1) return '流程图只能有一个开始节点'
|
|
if (startNodes.length > 1) return '流程图只能有一个开始节点'
|
|
|
// 检查审批节点是否配置了审批对象
|
|
// 检查审批节点是否配置了审批对象
|
|
|
|
|
+ const externalNodeKeys = new Set<string>()
|
|
|
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 || {}
|
|
@@ -673,6 +678,19 @@ export function useFlowDesigner(lfContainer: Ref<HTMLDivElement | undefined>) {
|
|
|
if (assigneeType === 'ROLE' && !assigneeValue && props.subNodesEnabled !== true) {
|
|
if (assigneeType === 'ROLE' && !assigneeValue && props.subNodesEnabled !== true) {
|
|
|
return `审批节点 "${node.text || node.name}" 未选择审批角色`
|
|
return `审批节点 "${node.text || node.name}" 未选择审批角色`
|
|
|
}
|
|
}
|
|
|
|
|
+ if (assigneeType === 'EXTERNAL') {
|
|
|
|
|
+ if (props.subNodesEnabled === true) {
|
|
|
|
|
+ return `审批节点 "${node.text || node.name}" 使用外部指定审批人时不支持子节点`
|
|
|
|
|
+ }
|
|
|
|
|
+ const nodeKey = String(props.nodeKey || '').trim()
|
|
|
|
|
+ if (!nodeKey) {
|
|
|
|
|
+ return `审批节点 "${node.text || node.name}" 未填写节点编码(nodeKey)`
|
|
|
|
|
+ }
|
|
|
|
|
+ if (externalNodeKeys.has(nodeKey)) {
|
|
|
|
|
+ return `节点编码 "${nodeKey}" 重复,请保证每个外部指定节点编码唯一`
|
|
|
|
|
+ }
|
|
|
|
|
+ externalNodeKeys.add(nodeKey)
|
|
|
|
|
+ }
|
|
|
if (props.subNodesEnabled === true) {
|
|
if (props.subNodesEnabled === true) {
|
|
|
const subNodes = props.subNodes || []
|
|
const subNodes = props.subNodes || []
|
|
|
if (subNodes.length === 0) {
|
|
if (subNodes.length === 0) {
|