fix: bpmn-process-designer structuredClone => cloneDeep
This commit is contained in:
@@ -478,7 +478,7 @@ const elementsAlign = (align: string) => {
|
|||||||
content: '自动对齐可能造成图形变形,是否继续?',
|
content: '自动对齐可能造成图形变形,是否继续?',
|
||||||
okText: '确定',
|
okText: '确定',
|
||||||
cancelText: '取消',
|
cancelText: '取消',
|
||||||
icon: WarningOutlined as any,
|
icon: h(WarningOutlined) as any,
|
||||||
onOk() {
|
onOk() {
|
||||||
Align.trigger(SelectedElements, align);
|
Align.trigger(SelectedElements, align);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import { nextTick, onBeforeUnmount, onMounted, provide, ref, watch } from 'vue';
|
import { nextTick, onBeforeUnmount, onMounted, provide, ref, watch } from 'vue';
|
||||||
|
|
||||||
import { IconifyIcon } from '@vben/icons';
|
import { IconifyIcon } from '@vben/icons';
|
||||||
|
import { cloneDeep } from '@vben/utils';
|
||||||
|
|
||||||
import { Collapse } from 'ant-design-vue';
|
import { Collapse } from 'ant-design-vue';
|
||||||
|
|
||||||
@@ -186,9 +187,7 @@ const initFormOnChanged = (element: any) => {
|
|||||||
bpmnElement.value = activatedElement;
|
bpmnElement.value = activatedElement;
|
||||||
elementId.value = activatedElement.id;
|
elementId.value = activatedElement.id;
|
||||||
elementType.value = activatedElement.type.split(':')[1] || '';
|
elementType.value = activatedElement.type.split(':')[1] || '';
|
||||||
elementBusinessObject.value = structuredClone(
|
elementBusinessObject.value = cloneDeep(activatedElement.businessObject);
|
||||||
activatedElement.businessObject,
|
|
||||||
);
|
|
||||||
conditionFormVisible.value =
|
conditionFormVisible.value =
|
||||||
elementType.value === 'SequenceFlow' &&
|
elementType.value === 'SequenceFlow' &&
|
||||||
activatedElement.source &&
|
activatedElement.source &&
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, inject, nextTick, onMounted, ref, toRaw, watch } from 'vue';
|
import { computed, inject, nextTick, onMounted, ref, toRaw, watch } from 'vue';
|
||||||
|
|
||||||
|
import { cloneDeep } from '@vben/utils';
|
||||||
|
|
||||||
import { Form, FormItem, Select } from 'ant-design-vue';
|
import { Form, FormItem, Select } from 'ant-design-vue';
|
||||||
|
|
||||||
import { getFormSimpleList } from '#/api/bpm/form';
|
import { getFormSimpleList } from '#/api/bpm/form';
|
||||||
@@ -72,7 +74,7 @@ const resetFormList = () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// 复制原始值,填充表格
|
// 复制原始值,填充表格
|
||||||
fieldList.value = structuredClone(formData.value.fields || []);
|
fieldList.value = cloneDeep(formData.value.fields || []);
|
||||||
|
|
||||||
// 更新元素扩展属性,避免后续报错
|
// 更新元素扩展属性,避免后续报错
|
||||||
updateElementExtensions();
|
updateElementExtensions();
|
||||||
@@ -109,7 +111,7 @@ const _openFieldForm = (field: any, index: any) => {
|
|||||||
fieldPropertiesList.value = [];
|
fieldPropertiesList.value = [];
|
||||||
} else {
|
} else {
|
||||||
const FieldObject = formData.value.fields[index];
|
const FieldObject = formData.value.fields[index];
|
||||||
formFieldForm.value = structuredClone(field);
|
formFieldForm.value = cloneDeep(field);
|
||||||
// 设置自定义类型
|
// 设置自定义类型
|
||||||
// this.$set(this.formFieldForm, "typeType", !this.fieldType[field.type] ? "custom" : field.type);
|
// this.$set(this.formFieldForm, "typeType", !this.fieldType[field.type] ? "custom" : field.type);
|
||||||
formFieldForm.value.typeType = fieldType.value[
|
formFieldForm.value.typeType = fieldType.value[
|
||||||
@@ -119,13 +121,13 @@ const _openFieldForm = (field: any, index: any) => {
|
|||||||
: 'custom';
|
: 'custom';
|
||||||
// 初始化枚举值列表
|
// 初始化枚举值列表
|
||||||
field.type === 'enum' &&
|
field.type === 'enum' &&
|
||||||
(fieldEnumList.value = structuredClone(FieldObject?.values || []));
|
(fieldEnumList.value = cloneDeep(FieldObject?.values || []));
|
||||||
// 初始化约束条件列表
|
// 初始化约束条件列表
|
||||||
fieldConstraintsList.value = structuredClone(
|
fieldConstraintsList.value = cloneDeep(
|
||||||
FieldObject?.validation?.constraints || [],
|
FieldObject?.validation?.constraints || [],
|
||||||
);
|
);
|
||||||
// 初始化自定义属性列表
|
// 初始化自定义属性列表
|
||||||
fieldPropertiesList.value = structuredClone(
|
fieldPropertiesList.value = cloneDeep(
|
||||||
FieldObject?.properties?.values || [],
|
FieldObject?.properties?.values || [],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -137,14 +139,14 @@ const _openFieldOptionForm = (option: any, index: any, type: any) => {
|
|||||||
fieldOptionType.value = type;
|
fieldOptionType.value = type;
|
||||||
formFieldOptionIndex.value = index;
|
formFieldOptionIndex.value = index;
|
||||||
if (type === 'property') {
|
if (type === 'property') {
|
||||||
fieldOptionForm.value = option ? structuredClone(option) : {};
|
fieldOptionForm.value = option ? cloneDeep(option) : {};
|
||||||
return (optionModelTitle.value = '属性配置');
|
return (optionModelTitle.value = '属性配置');
|
||||||
}
|
}
|
||||||
if (type === 'enum') {
|
if (type === 'enum') {
|
||||||
fieldOptionForm.value = option ? structuredClone(option) : {};
|
fieldOptionForm.value = option ? cloneDeep(option) : {};
|
||||||
return (optionModelTitle.value = '枚举值配置');
|
return (optionModelTitle.value = '枚举值配置');
|
||||||
}
|
}
|
||||||
fieldOptionForm.value = option ? structuredClone(option) : {};
|
fieldOptionForm.value = option ? cloneDeep(option) : {};
|
||||||
return (optionModelTitle.value = '约束条件配置');
|
return (optionModelTitle.value = '约束条件配置');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import { inject, nextTick, ref, watch } from 'vue';
|
import { inject, nextTick, ref, watch } from 'vue';
|
||||||
|
|
||||||
import { IconifyIcon, PlusOutlined } from '@vben/icons';
|
import { IconifyIcon, PlusOutlined } from '@vben/icons';
|
||||||
|
import { cloneDeep } from '@vben/utils';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
@@ -96,9 +97,10 @@ const openListenerForm = (listener: any, index: number) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// 打开监听器字段编辑弹窗
|
// 打开监听器字段编辑弹窗
|
||||||
const openListenerFieldForm = (field: any, index: number) => {
|
const openListenerFieldForm = (field: any, index: number) => {
|
||||||
listenerFieldForm.value = field ? structuredClone(field) : {};
|
listenerFieldForm.value = field ? cloneDeep(field) : {};
|
||||||
editingListenerFieldIndex.value = field ? index : -1;
|
editingListenerFieldIndex.value = field ? index : -1;
|
||||||
listenerFieldFormModelVisible.value = true;
|
listenerFieldFormModelVisible.value = true;
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import { inject, nextTick, ref, watch } from 'vue';
|
import { inject, nextTick, ref, watch } from 'vue';
|
||||||
|
|
||||||
import { MenuOutlined, PlusOutlined, SelectOutlined } from '@vben/icons';
|
import { MenuOutlined, PlusOutlined, SelectOutlined } from '@vben/icons';
|
||||||
|
import { cloneDeep } from '@vben/utils';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
@@ -162,9 +163,10 @@ const saveListenerConfig = async () => {
|
|||||||
listenerFormModelVisible.value = false;
|
listenerFormModelVisible.value = false;
|
||||||
listenerForm.value = {};
|
listenerForm.value = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
// 打开监听器字段编辑弹窗
|
// 打开监听器字段编辑弹窗
|
||||||
const openListenerFieldForm = (field: any, index?: number) => {
|
const openListenerFieldForm = (field: any, index?: number) => {
|
||||||
listenerFieldForm.value = field ? structuredClone(field) : {};
|
listenerFieldForm.value = field ? cloneDeep(field) : {};
|
||||||
editingListenerFieldIndex.value = field ? index : -1;
|
editingListenerFieldIndex.value = field ? index : -1;
|
||||||
listenerFieldFormModelVisible.value = true;
|
listenerFieldFormModelVisible.value = true;
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
// 初始化表单数据
|
// 初始化表单数据
|
||||||
|
import { cloneDeep } from '@vben/utils';
|
||||||
|
|
||||||
export function initListenerForm(listener: any) {
|
export function initListenerForm(listener: any) {
|
||||||
let self = {
|
let self = {
|
||||||
...listener,
|
...listener,
|
||||||
@@ -36,7 +38,7 @@ export function initListenerType(listener: any) {
|
|||||||
if (listener.delegateExpression) listenerType = 'delegateExpressionListener';
|
if (listener.delegateExpression) listenerType = 'delegateExpressionListener';
|
||||||
if (listener.script) listenerType = 'scriptListener';
|
if (listener.script) listenerType = 'scriptListener';
|
||||||
return {
|
return {
|
||||||
...structuredClone(listener),
|
...cloneDeep(listener),
|
||||||
...listener.script,
|
...listener.script,
|
||||||
listenerType,
|
listenerType,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import { inject, nextTick, ref, toRaw, watch } from 'vue';
|
import { inject, nextTick, ref, toRaw, watch } from 'vue';
|
||||||
|
|
||||||
import { IconifyIcon } from '@vben/icons';
|
import { IconifyIcon } from '@vben/icons';
|
||||||
|
import { cloneDeep } from '@vben/utils';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
@@ -60,9 +61,7 @@ const resetAttributesList = () => {
|
|||||||
(current: any) => current.values,
|
(current: any) => current.values,
|
||||||
);
|
);
|
||||||
// 复制 显示
|
// 复制 显示
|
||||||
elementPropertyList.value = structuredClone(
|
elementPropertyList.value = cloneDeep(bpmnElementPropertyList.value ?? []);
|
||||||
bpmnElementPropertyList.value ?? [],
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const openAttributesForm = (
|
const openAttributesForm = (
|
||||||
@@ -71,7 +70,7 @@ const openAttributesForm = (
|
|||||||
) => {
|
) => {
|
||||||
editingPropertyIndex.value = index;
|
editingPropertyIndex.value = index;
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
propertyForm.value = index === -1 ? {} : structuredClone(attr);
|
propertyForm.value = index === -1 ? {} : cloneDeep(attr);
|
||||||
propertyFormModelVisible.value = true;
|
propertyFormModelVisible.value = true;
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
if (attributeFormRef.value) attributeFormRef.value.clearValidate();
|
if (attributeFormRef.value) attributeFormRef.value.clearValidate();
|
||||||
|
|||||||
Reference in New Issue
Block a user