Commit 3cd4b2010853bd11e2fdf1715eabaf5c9b9b83a0
Merge remote-tracking branch 'origin/fix/zfl' into perf/main_dev
Showing
6 changed files
with
21 additions
and
10 deletions
... | ... | @@ -148,6 +148,7 @@ export const getFormSchemas = (event: EventTypeEnum): FormSchema[] => { |
148 | 148 | [FormFieldsEnum.SERVICE]: undefined, |
149 | 149 | [FormFieldsEnum.CUSTOM_COMMAND]: null, |
150 | 150 | [FormFieldsEnum.WAY]: CommandWayEnum.ONE_WAY, |
151 | + [FormFieldsEnum.THINGS_MODEL]: null, | |
151 | 152 | }) |
152 | 153 | }, |
153 | 154 | } |
... | ... | @@ -205,6 +206,9 @@ export const getFormSchemas = (event: EventTypeEnum): FormSchema[] => { |
205 | 206 | formModel[FormFieldsEnum.THINGS_MODEL] = value ? options : null |
206 | 207 | formModel.callType = options.callType |
207 | 208 | }, |
209 | + onChange(value: string | number | undefined) { // 因为select不会执行清除选择 所以使用change时间 | |
210 | + if (!value) formModel[FormFieldsEnum.THINGS_MODEL] = null | |
211 | + }, | |
208 | 212 | onOptionsChange(options: ThingsModel[]) { |
209 | 213 | const service = formModel[FormFieldsEnum.SERVICE] |
210 | 214 | if (service) { | ... | ... |
... | ... | @@ -60,7 +60,7 @@ export const formSchemas = (componentKey?: string): FormSchema[] => { |
60 | 60 | formModel[ContentDataFieldsEnum.ATTR] = null |
61 | 61 | }, |
62 | 62 | filterOption: (inputValue: string, option: DeviceItemType) => { |
63 | - option.alias?.includes?.(inputValue) || option.name?.includes?.(inputValue) | |
63 | + return option.alias?.includes?.(inputValue) || option.name?.includes?.(inputValue) | |
64 | 64 | }, |
65 | 65 | } |
66 | 66 | }, |
... | ... | @@ -89,8 +89,9 @@ export const formSchemas = (componentKey?: string): FormSchema[] => { |
89 | 89 | onSelect(value: string, option: ThingsModelItemType) { |
90 | 90 | formModel[ContentDataFieldsEnum.ATTR_INFO] = value && option ? toRaw(unref(option)) : null |
91 | 91 | }, |
92 | - filterOption: (inputValue: string, option: ThingsModelItemType) => | |
93 | - option.name.includes(inputValue), | |
92 | + filterOption: (inputValue: string, option: ThingsModelItemType) => { | |
93 | + return option.name.includes(inputValue) | |
94 | + }, | |
94 | 95 | } |
95 | 96 | }, |
96 | 97 | }, | ... | ... |
... | ... | @@ -51,9 +51,9 @@ const handleSubmit = async () => { |
51 | 51 | |
52 | 52 | const handleSetFormValues = async () => { |
53 | 53 | const { dataSourceJson } = unref(getNodeData) || {} |
54 | - const { deviceId, attr, chartOption, deviceProfileId, deviceProfileTemplateId, attrInfo } = dataSourceJson || {} | |
54 | + const { deviceId, attr, chartOption, deviceProfileId, deviceProfileTemplateId, attrInfo, deviceInfo } = dataSourceJson || {} | |
55 | 55 | await nextTick() |
56 | - unref(dataSourceElRef)?.setFieldsValue({ deviceId, attr, deviceProfileId, attrInfo, deviceProfileTemplateId }) | |
56 | + unref(dataSourceElRef)?.setFieldsValue({ deviceId, attr, deviceProfileId, attrInfo, deviceProfileTemplateId, deviceInfo }) | |
57 | 57 | setFieldsValue({ ...chartOption }) |
58 | 58 | } |
59 | 59 | ... | ... |
... | ... | @@ -55,9 +55,9 @@ const handleSubmit = async () => { |
55 | 55 | |
56 | 56 | const handleSetFormValues = async () => { |
57 | 57 | const { dataSourceJson } = unref(getNodeData) || {} |
58 | - const { deviceId, attr, chartOption, deviceProfileId, attrInfo, deviceProfileTemplateId } = dataSourceJson || {} | |
58 | + const { deviceId, attr, chartOption, deviceProfileId, attrInfo, deviceProfileTemplateId, deviceInfo } = dataSourceJson || {} | |
59 | 59 | await nextTick() |
60 | - unref(dataSourceElRef)?.setFieldsValue({ deviceId, attr, deviceProfileId, attrInfo, deviceProfileTemplateId }) | |
60 | + unref(dataSourceElRef)?.setFieldsValue({ deviceId, attr, deviceProfileId, attrInfo, deviceInfo, deviceProfileTemplateId }) | |
61 | 61 | setFieldsValue({ ...chartOption }) |
62 | 62 | } |
63 | 63 | ... | ... |
... | ... | @@ -36,9 +36,15 @@ onMounted(() => { |
36 | 36 | |
37 | 37 | const onReceiveDataSourceMessage = (commandSource: CommandSource, message: SubscriptionUpdateMsg) => { |
38 | 38 | const { data } = commandSource |
39 | + const { chartOption } = data || {} | |
40 | + const { unit } = chartOption || {} | |
39 | 41 | const { attr } = data as NodeDataDataSourceJsonType |
40 | 42 | const { latestValue } = useLatestMessageValue(message.data, attr) |
41 | - unref(chartInstance)?.setOption({ series: [{ data: [{ value: latestValue }] }] } as EChartsOption) | |
43 | + unref(chartInstance)?.setOption({ | |
44 | + series: [{ | |
45 | + data: [{ value: latestValue }], detail: { formatter: `{value} ${unit || '℃'}` }, | |
46 | + }], | |
47 | + } as EChartsOption) | |
42 | 48 | } |
43 | 49 | |
44 | 50 | const { onMessage } = useOnMessage({ onReceiveDataSourceMessage }) | ... | ... |
... | ... | @@ -32,9 +32,9 @@ const dataSourceElRef = ref<Nullable<InstanceType<typeof DataSourceForm>>>() |
32 | 32 | |
33 | 33 | const handleSetFormValues = async () => { |
34 | 34 | const { dataSourceJson } = unref(getNodeData) || {} |
35 | - const { deviceId, attr, chartOption, deviceProfileId, deviceProfileTemplateId, attrInfo } = dataSourceJson || {} | |
35 | + const { deviceId, attr, chartOption, deviceProfileId, deviceProfileTemplateId, attrInfo, deviceInfo } = dataSourceJson || {} | |
36 | 36 | await nextTick() |
37 | - unref(dataSourceElRef)?.setFieldsValue({ deviceId, attr, deviceProfileId, deviceProfileTemplateId, attrInfo }) | |
37 | + unref(dataSourceElRef)?.setFieldsValue({ deviceId, attr, deviceProfileId, deviceProfileTemplateId, attrInfo, deviceInfo }) | |
38 | 38 | setFieldsValue({ ...chartOption }) |
39 | 39 | } |
40 | 40 | ... | ... |