|
@@ -203,6 +203,34 @@ function toWorkflowCopyIdsCommaString(value: unknown): string {
|
|
|
return String(value).trim();
|
|
return String(value).trim();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+/**
|
|
|
|
|
+ * 共锁 / 解除共锁:设计器提交表单不维护隔离方式、隔离点、上锁人等(由关联任务在运行时解析)。
|
|
|
|
|
+ * 保存/导出流程 JSON 时清空同步进 data 的上述字段,避免与表单语义不一致。
|
|
|
|
|
+ * - coLock:保留 formId、isolationNodeUuid(上锁任务)、coLockPersons
|
|
|
|
|
+ * - unlockCoLock:保留 formId、isolationNodeUuid(共锁任务)、coLockPersons(与所选共锁任务同步,供下游使用)
|
|
|
|
|
+ */
|
|
|
|
|
+function sanitizeCoLockFamilyNodeDataForExport(
|
|
|
|
|
+ processedData: Record<string, any>,
|
|
|
|
|
+ reactFlowNodeType: string | undefined
|
|
|
|
|
+): Record<string, any> {
|
|
|
|
|
+ const dataType = processedData?.type as string | undefined;
|
|
|
|
|
+ const isCoLock =
|
|
|
|
|
+ isWorkflowCoLockType(reactFlowNodeType) || isWorkflowCoLockType(dataType);
|
|
|
|
|
+ const isUnlockCoLock =
|
|
|
|
|
+ isWorkflowUnlockCoLockType(reactFlowNodeType) || isWorkflowUnlockCoLockType(dataType);
|
|
|
|
|
+ if (!isCoLock && !isUnlockCoLock) {
|
|
|
|
|
+ return processedData;
|
|
|
|
|
+ }
|
|
|
|
|
+ return {
|
|
|
|
|
+ ...processedData,
|
|
|
|
|
+ isolationType: '',
|
|
|
|
|
+ isolationPoints: [],
|
|
|
|
|
+ isolationNode: [],
|
|
|
|
|
+ lockPerson: '',
|
|
|
|
|
+ workerUserId: '',
|
|
|
|
|
+ };
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
// 节点配置
|
|
// 节点配置
|
|
|
const nodeConfigs = [
|
|
const nodeConfigs = [
|
|
|
{
|
|
{
|
|
@@ -1253,15 +1281,19 @@ export default function ProcessDesigner() {
|
|
|
// 将 responsible 转换为 workerUserId,并确保值是字符串
|
|
// 将 responsible 转换为 workerUserId,并确保值是字符串
|
|
|
// 同时提取四个模板代码字段到顶层
|
|
// 同时提取四个模板代码字段到顶层
|
|
|
const { responsible, smsTemplateCode, messageTemplateCode, emailTemplateCode, appTemplateCode, ...restData } = mergedData;
|
|
const { responsible, smsTemplateCode, messageTemplateCode, emailTemplateCode, appTemplateCode, ...restData } = mergedData;
|
|
|
- const processedData = {
|
|
|
|
|
- ...restData,
|
|
|
|
|
- workerUserId: responsible !== undefined && responsible !== null && responsible !== ''
|
|
|
|
|
- ? String(responsible)
|
|
|
|
|
- : '',
|
|
|
|
|
- copyDeptIds: toWorkflowCopyIdsCommaString((restData as any).copyDeptIds),
|
|
|
|
|
- copyUserIds: toWorkflowCopyIdsCommaString((restData as any).copyUserIds),
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
|
|
+ const processedData = sanitizeCoLockFamilyNodeDataForExport(
|
|
|
|
|
+ {
|
|
|
|
|
+ ...restData,
|
|
|
|
|
+ workerUserId:
|
|
|
|
|
+ responsible !== undefined && responsible !== null && responsible !== ''
|
|
|
|
|
+ ? String(responsible)
|
|
|
|
|
+ : '',
|
|
|
|
|
+ copyDeptIds: toWorkflowCopyIdsCommaString((restData as any).copyDeptIds),
|
|
|
|
|
+ copyUserIds: toWorkflowCopyIdsCommaString((restData as any).copyUserIds),
|
|
|
|
|
+ },
|
|
|
|
|
+ n.type
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
const nodeObj: any = {
|
|
const nodeObj: any = {
|
|
|
uuid: n.id,
|
|
uuid: n.id,
|
|
|
type: n.type,
|
|
type: n.type,
|
|
@@ -2607,15 +2639,19 @@ export default function ProcessDesigner() {
|
|
|
// 将 responsible 转换为 workerUserId,并确保值是字符串
|
|
// 将 responsible 转换为 workerUserId,并确保值是字符串
|
|
|
// 同时提取四个模板代码字段到顶层
|
|
// 同时提取四个模板代码字段到顶层
|
|
|
const { responsible, smsTemplateCode, messageTemplateCode, emailTemplateCode, appTemplateCode, ...restData } = mergedData;
|
|
const { responsible, smsTemplateCode, messageTemplateCode, emailTemplateCode, appTemplateCode, ...restData } = mergedData;
|
|
|
- const processedData = {
|
|
|
|
|
- ...restData,
|
|
|
|
|
- workerUserId: responsible !== undefined && responsible !== null && responsible !== ''
|
|
|
|
|
- ? String(responsible)
|
|
|
|
|
- : '',
|
|
|
|
|
- copyDeptIds: toWorkflowCopyIdsCommaString((restData as any).copyDeptIds),
|
|
|
|
|
- copyUserIds: toWorkflowCopyIdsCommaString((restData as any).copyUserIds),
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
|
|
+ const processedData = sanitizeCoLockFamilyNodeDataForExport(
|
|
|
|
|
+ {
|
|
|
|
|
+ ...restData,
|
|
|
|
|
+ workerUserId:
|
|
|
|
|
+ responsible !== undefined && responsible !== null && responsible !== ''
|
|
|
|
|
+ ? String(responsible)
|
|
|
|
|
+ : '',
|
|
|
|
|
+ copyDeptIds: toWorkflowCopyIdsCommaString((restData as any).copyDeptIds),
|
|
|
|
|
+ copyUserIds: toWorkflowCopyIdsCommaString((restData as any).copyUserIds),
|
|
|
|
|
+ },
|
|
|
|
|
+ n.type
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
const nodeObj: any = {
|
|
const nodeObj: any = {
|
|
|
uuid: n.id,
|
|
uuid: n.id,
|
|
|
type: n.type,
|
|
type: n.type,
|
|
@@ -2726,13 +2762,17 @@ export default function ProcessDesigner() {
|
|
|
// 将 responsible 转换为 workerUserId,并确保值是字符串
|
|
// 将 responsible 转换为 workerUserId,并确保值是字符串
|
|
|
// 同时提取四个模板代码字段到顶层
|
|
// 同时提取四个模板代码字段到顶层
|
|
|
const { responsible, smsTemplateCode, messageTemplateCode, emailTemplateCode, appTemplateCode, ...restData } = mergedData;
|
|
const { responsible, smsTemplateCode, messageTemplateCode, emailTemplateCode, appTemplateCode, ...restData } = mergedData;
|
|
|
- const processedData = {
|
|
|
|
|
- ...restData,
|
|
|
|
|
- workerUserId: responsible !== undefined && responsible !== null && responsible !== ''
|
|
|
|
|
- ? String(responsible)
|
|
|
|
|
- : '',
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
|
|
+ const processedData = sanitizeCoLockFamilyNodeDataForExport(
|
|
|
|
|
+ {
|
|
|
|
|
+ ...restData,
|
|
|
|
|
+ workerUserId:
|
|
|
|
|
+ responsible !== undefined && responsible !== null && responsible !== ''
|
|
|
|
|
+ ? String(responsible)
|
|
|
|
|
+ : '',
|
|
|
|
|
+ },
|
|
|
|
|
+ n.type
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
const nodeObj: any = {
|
|
const nodeObj: any = {
|
|
|
uuid: n.id,
|
|
uuid: n.id,
|
|
|
type: n.type,
|
|
type: n.type,
|
|
@@ -2861,15 +2901,19 @@ export default function ProcessDesigner() {
|
|
|
// 将 responsible 转换为 workerUserId,并确保值是字符串
|
|
// 将 responsible 转换为 workerUserId,并确保值是字符串
|
|
|
// 同时提取四个模板代码字段到顶层
|
|
// 同时提取四个模板代码字段到顶层
|
|
|
const { responsible, smsTemplateCode, messageTemplateCode, emailTemplateCode, appTemplateCode, ...restData } = mergedData;
|
|
const { responsible, smsTemplateCode, messageTemplateCode, emailTemplateCode, appTemplateCode, ...restData } = mergedData;
|
|
|
- const processedData = {
|
|
|
|
|
- ...restData,
|
|
|
|
|
- workerUserId: responsible !== undefined && responsible !== null && responsible !== ''
|
|
|
|
|
- ? String(responsible)
|
|
|
|
|
- : '',
|
|
|
|
|
- copyDeptIds: toWorkflowCopyIdsCommaString((restData as any).copyDeptIds),
|
|
|
|
|
- copyUserIds: toWorkflowCopyIdsCommaString((restData as any).copyUserIds),
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
|
|
+ const processedData = sanitizeCoLockFamilyNodeDataForExport(
|
|
|
|
|
+ {
|
|
|
|
|
+ ...restData,
|
|
|
|
|
+ workerUserId:
|
|
|
|
|
+ responsible !== undefined && responsible !== null && responsible !== ''
|
|
|
|
|
+ ? String(responsible)
|
|
|
|
|
+ : '',
|
|
|
|
|
+ copyDeptIds: toWorkflowCopyIdsCommaString((restData as any).copyDeptIds),
|
|
|
|
|
+ copyUserIds: toWorkflowCopyIdsCommaString((restData as any).copyUserIds),
|
|
|
|
|
+ },
|
|
|
|
|
+ n.type
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
const nodeObj: any = {
|
|
const nodeObj: any = {
|
|
|
uuid: n.id,
|
|
uuid: n.id,
|
|
|
type: n.type,
|
|
type: n.type,
|
|
@@ -3002,15 +3046,19 @@ export default function ProcessDesigner() {
|
|
|
// 将 responsible 转换为 workerUserId,并确保值是字符串
|
|
// 将 responsible 转换为 workerUserId,并确保值是字符串
|
|
|
// 同时提取四个模板代码字段到顶层
|
|
// 同时提取四个模板代码字段到顶层
|
|
|
const { responsible, smsTemplateCode, messageTemplateCode, emailTemplateCode, appTemplateCode, ...restData } = mergedData;
|
|
const { responsible, smsTemplateCode, messageTemplateCode, emailTemplateCode, appTemplateCode, ...restData } = mergedData;
|
|
|
- const processedData = {
|
|
|
|
|
- ...restData,
|
|
|
|
|
- workerUserId: responsible !== undefined && responsible !== null && responsible !== ''
|
|
|
|
|
- ? String(responsible)
|
|
|
|
|
- : '',
|
|
|
|
|
- copyDeptIds: toWorkflowCopyIdsCommaString((restData as any).copyDeptIds),
|
|
|
|
|
- copyUserIds: toWorkflowCopyIdsCommaString((restData as any).copyUserIds),
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
|
|
+ const processedData = sanitizeCoLockFamilyNodeDataForExport(
|
|
|
|
|
+ {
|
|
|
|
|
+ ...restData,
|
|
|
|
|
+ workerUserId:
|
|
|
|
|
+ responsible !== undefined && responsible !== null && responsible !== ''
|
|
|
|
|
+ ? String(responsible)
|
|
|
|
|
+ : '',
|
|
|
|
|
+ copyDeptIds: toWorkflowCopyIdsCommaString((restData as any).copyDeptIds),
|
|
|
|
|
+ copyUserIds: toWorkflowCopyIdsCommaString((restData as any).copyUserIds),
|
|
|
|
|
+ },
|
|
|
|
|
+ n.type
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
// 导出时将id字段改为uuid,但值保持不变
|
|
// 导出时将id字段改为uuid,但值保持不变
|
|
|
// 将 nodeName 和 nodeIcon 从 data 中提取到顶层,方便后端识别,但保留 data 中的原始字段
|
|
// 将 nodeName 和 nodeIcon 从 data 中提取到顶层,方便后端识别,但保留 data 中的原始字段
|
|
|
const nodeObj: any = {
|
|
const nodeObj: any = {
|