Commit 5afc86d6ffd11736a1c266e8813be51e4a44da2f

Authored by xp.Huang
2 parents 527f25d4 3b8848e4

Merge branch 'fix/rule-script-metadata' into 'main_dev'

perf: 修复metadata编辑是顺序变更

See merge request yunteng/thingskit-front!1085
... ... @@ -4,7 +4,6 @@
4 4 import { BasicForm, FormActionType, FormProps, FormSchema } from '/@/components/Form';
5 5 import { computed, ref, unref, watch } from 'vue';
6 6 import { buildShortUUID } from '/@/utils/uuid';
7   - import { isNullOrUnDef } from '/@/utils/is';
8 7 import { ComponentType } from '/@/components/Form/src/types';
9 8
10 9 enum FormFieldEnum {
... ... @@ -40,8 +39,6 @@
40 39 }
41 40 );
42 41
43   - const emit = defineEmits(['update:value']);
44   -
45 42 const getPlaceholder = (label = '') => `请输入${label}`;
46 43
47 44 const getRules = (label = '') => {
... ... @@ -51,7 +48,6 @@
51 48 const mergeComponentProps = (label = '') => {
52 49 return {
53 50 placeholder: getPlaceholder(label),
54   - onBlur: handleOnBlur,
55 51 };
56 52 };
57 53
... ... @@ -77,17 +73,6 @@
77 73 ] as FormSchema[];
78 74 });
79 75
80   - const handleOnBlur = () => {
81   - const value = getFieldsValue();
82   -
83   - if (
84   - unref(list).length === Object.keys(value).length &&
85   - Object.values(value).some((item) => isNullOrUnDef(item))
86   - )
87   - return;
88   - emit('update:value', value);
89   - };
90   -
91 76 const list = ref<ListItemType[]>([{ uuid: buildShortUUID() }]);
92 77
93 78 const formListElRef = ref<Nullable<FormActionType>[]>([]);
... ...
1 1 <script lang="ts" setup>
2 2 import { Card, Select, Tag, Form, Button } from 'ant-design-vue';
3   - import { nextTick, ref, toRaw, unref, watch } from 'vue';
  3 + import { nextTick, ref, unref, watch } from 'vue';
4 4 import { MessageTypesEnum, MessageTypesNameEnum } from '../../../enum/form';
5 5 import { JSONEditor } from '/@/components/CodeEditor';
6 6 import { Icon } from '/@/components/Icon';
... ... @@ -82,7 +82,7 @@
82 82 return {
83 83 msg,
84 84 msgType,
85   - metadata: toRaw(unref(metadata)),
  85 + metadata: unref(attributeConfigurationElRef)?.getFieldsValue() || {},
86 86 javascriptFunction,
87 87 };
88 88 };
... ...