Showing
2 changed files
with
11 additions
and
1 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) { | ... | ... |
... | ... | @@ -31,9 +31,15 @@ onMounted(() => { |
31 | 31 | |
32 | 32 | const onReceiveDataSourceMessage = (commandSource: CommandSource, message: SubscriptionUpdateMsg) => { |
33 | 33 | const { data } = commandSource |
34 | + const { chartOption } = data || {} | |
35 | + const { unit } = chartOption || {} | |
34 | 36 | const { attr } = data as NodeDataDataSourceJsonType |
35 | 37 | const { latestValue } = useLatestMessageValue(message.data, attr) |
36 | - unref(chartInstance)?.setOption({ series: [{ data: [{ value: latestValue }] }] } as EChartsOption) | |
38 | + unref(chartInstance)?.setOption({ | |
39 | + series: [{ | |
40 | + data: [{ value: latestValue }], detail: { formatter: `{value} ${unit || '℃'}` }, | |
41 | + }], | |
42 | + } as EChartsOption) | |
37 | 43 | } |
38 | 44 | |
39 | 45 | const { onMessage } = useOnMessage({ onReceiveDataSourceMessage }) | ... | ... |