Commit 5afc86d6ffd11736a1c266e8813be51e4a44da2f
Merge branch 'fix/rule-script-metadata' into 'main_dev'
perf: 修复metadata编辑是顺序变更 See merge request yunteng/thingskit-front!1085
Showing
2 changed files
with
2 additions
and
17 deletions
@@ -4,7 +4,6 @@ | @@ -4,7 +4,6 @@ | ||
4 | import { BasicForm, FormActionType, FormProps, FormSchema } from '/@/components/Form'; | 4 | import { BasicForm, FormActionType, FormProps, FormSchema } from '/@/components/Form'; |
5 | import { computed, ref, unref, watch } from 'vue'; | 5 | import { computed, ref, unref, watch } from 'vue'; |
6 | import { buildShortUUID } from '/@/utils/uuid'; | 6 | import { buildShortUUID } from '/@/utils/uuid'; |
7 | - import { isNullOrUnDef } from '/@/utils/is'; | ||
8 | import { ComponentType } from '/@/components/Form/src/types'; | 7 | import { ComponentType } from '/@/components/Form/src/types'; |
9 | 8 | ||
10 | enum FormFieldEnum { | 9 | enum FormFieldEnum { |
@@ -40,8 +39,6 @@ | @@ -40,8 +39,6 @@ | ||
40 | } | 39 | } |
41 | ); | 40 | ); |
42 | 41 | ||
43 | - const emit = defineEmits(['update:value']); | ||
44 | - | ||
45 | const getPlaceholder = (label = '') => `请输入${label}`; | 42 | const getPlaceholder = (label = '') => `请输入${label}`; |
46 | 43 | ||
47 | const getRules = (label = '') => { | 44 | const getRules = (label = '') => { |
@@ -51,7 +48,6 @@ | @@ -51,7 +48,6 @@ | ||
51 | const mergeComponentProps = (label = '') => { | 48 | const mergeComponentProps = (label = '') => { |
52 | return { | 49 | return { |
53 | placeholder: getPlaceholder(label), | 50 | placeholder: getPlaceholder(label), |
54 | - onBlur: handleOnBlur, | ||
55 | }; | 51 | }; |
56 | }; | 52 | }; |
57 | 53 | ||
@@ -77,17 +73,6 @@ | @@ -77,17 +73,6 @@ | ||
77 | ] as FormSchema[]; | 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 | const list = ref<ListItemType[]>([{ uuid: buildShortUUID() }]); | 76 | const list = ref<ListItemType[]>([{ uuid: buildShortUUID() }]); |
92 | 77 | ||
93 | const formListElRef = ref<Nullable<FormActionType>[]>([]); | 78 | const formListElRef = ref<Nullable<FormActionType>[]>([]); |
1 | <script lang="ts" setup> | 1 | <script lang="ts" setup> |
2 | import { Card, Select, Tag, Form, Button } from 'ant-design-vue'; | 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 | import { MessageTypesEnum, MessageTypesNameEnum } from '../../../enum/form'; | 4 | import { MessageTypesEnum, MessageTypesNameEnum } from '../../../enum/form'; |
5 | import { JSONEditor } from '/@/components/CodeEditor'; | 5 | import { JSONEditor } from '/@/components/CodeEditor'; |
6 | import { Icon } from '/@/components/Icon'; | 6 | import { Icon } from '/@/components/Icon'; |
@@ -82,7 +82,7 @@ | @@ -82,7 +82,7 @@ | ||
82 | return { | 82 | return { |
83 | msg, | 83 | msg, |
84 | msgType, | 84 | msgType, |
85 | - metadata: toRaw(unref(metadata)), | 85 | + metadata: unref(attributeConfigurationElRef)?.getFieldsValue() || {}, |
86 | javascriptFunction, | 86 | javascriptFunction, |
87 | }; | 87 | }; |
88 | }; | 88 | }; |