Showing
26 changed files
with
51 additions
and
28 deletions
... | ... | @@ -135,11 +135,11 @@ |
135 | 135 | time: 0, |
136 | 136 | }; |
137 | 137 | }) as any; |
138 | - const { data } = message; | |
139 | - const alarmList = data?.data; | |
138 | + const { data, update } = message; | |
139 | + const alarmList = data?.data || update; | |
140 | 140 | const uniData = getReduce(alarmList); //去重得到最新的事件对象 |
141 | 141 | |
142 | - if (!data?.data.length) return; | |
142 | + // if (!data?.data.length) return; | |
143 | 143 | uniData.forEach((item) => { |
144 | 144 | alarmStatusList.value?.forEach((item1) => { |
145 | 145 | if (item.entityId.id == item1.id) { | ... | ... |
... | ... | @@ -147,8 +147,9 @@ |
147 | 147 | |
148 | 148 | const updateFn = (message: ReceiveAlarmDataCmdsMessageType) => { |
149 | 149 | const { data } = message || {}; |
150 | + if (!data?.data) return; | |
150 | 151 | const tableList = ref<any>( |
151 | - data?.data.map((item) => { | |
152 | + data?.data?.map((item) => { | |
152 | 153 | return { |
153 | 154 | time: item.createdTime, |
154 | 155 | device: item.originatorName, | ... | ... |
... | ... | @@ -104,7 +104,7 @@ |
104 | 104 | const updateFn: MultipleDataFetchUpdateFn = async (message, deviceId, attribute) => { |
105 | 105 | forEachGroupMessage(message, deviceId, attribute, (attribute, value) => { |
106 | 106 | controlList.value.forEach((item) => { |
107 | - if (item.id === deviceId && item.attribute === attribute) { | |
107 | + if (item.id === deviceId && item.attribute === attribute && value) { | |
108 | 108 | item.checked = Boolean(getNumberValue(value)); |
109 | 109 | } |
110 | 110 | }); | ... | ... |
... | ... | @@ -79,6 +79,7 @@ |
79 | 79 | const updateFn: DataFetchUpdateFn = (message, attribute) => { |
80 | 80 | const { data = {} } = message; |
81 | 81 | const [latest] = data[attribute] || []; |
82 | + if (!latest.length) return; | |
82 | 83 | const [timespan, value] = latest; |
83 | 84 | time.value = timespan; |
84 | 85 | currentValue.value = Number(value); | ... | ... |
... | ... | @@ -65,6 +65,7 @@ |
65 | 65 | const updateFn: DataFetchUpdateFn = (message, attribute) => { |
66 | 66 | const { data = {} } = message; |
67 | 67 | const [latest] = data[attribute] || []; |
68 | + if (!latest.length) return; | |
68 | 69 | const [timespan, value] = latest; |
69 | 70 | time.value = timespan; |
70 | 71 | currentValue.value = isNaN(value as unknown as number) ? 0 : Number(value); | ... | ... |
... | ... | @@ -166,6 +166,7 @@ |
166 | 166 | const updateFn: DataFetchUpdateFn = (message, attribute) => { |
167 | 167 | const { data = {} } = message; |
168 | 168 | const [latest] = data[attribute] || []; |
169 | + if (!latest.length) return; | |
169 | 170 | const [timespan, value] = latest; |
170 | 171 | time.value = timespan; |
171 | 172 | updateChart(isNaN(value as unknown as number) ? 0 : Number(value)); | ... | ... |
... | ... | @@ -177,6 +177,7 @@ |
177 | 177 | const updateFn: DataFetchUpdateFn = (message, attribute) => { |
178 | 178 | const { data = {} } = message; |
179 | 179 | const [latest] = data[attribute] || []; |
180 | + if (!latest.length) return; | |
180 | 181 | const [timespan, value] = latest; |
181 | 182 | time.value = timespan; |
182 | 183 | updateChart(isNaN(value as unknown as number) ? 0 : Number(value)); | ... | ... |
... | ... | @@ -261,7 +261,7 @@ |
261 | 261 | const updateFn: MultipleDataFetchUpdateFn = (message, deviceId, attribute) => { |
262 | 262 | forEachGroupMessage(message, deviceId, attribute, (attribute, value) => { |
263 | 263 | series.value.forEach((item) => { |
264 | - if (item.id === deviceId && item.attribute === attribute) { | |
264 | + if (item.id === deviceId && item.attribute === attribute && value) { | |
265 | 265 | item.value = getNumberValue(value); |
266 | 266 | // time.value = timespan; |
267 | 267 | } | ... | ... |
... | ... | @@ -148,6 +148,7 @@ |
148 | 148 | const updateFn: DataFetchUpdateFn = (message, attribute) => { |
149 | 149 | const { data = {} } = message; |
150 | 150 | const [latest] = data[attribute] || []; |
151 | + if (!latest.length) return; | |
151 | 152 | const [timespan, value] = latest; |
152 | 153 | time.value = timespan; |
153 | 154 | updateChart(isNaN(value as unknown as number) ? 0 : Number(value)); | ... | ... |
... | ... | @@ -181,6 +181,7 @@ |
181 | 181 | const updateFn: DataFetchUpdateFn = (message, attribute) => { |
182 | 182 | const { data = {} } = message; |
183 | 183 | const [latest] = data[attribute] || []; |
184 | + if (!latest.length) return; | |
184 | 185 | const [timespan, value] = latest; |
185 | 186 | time.value = timespan; |
186 | 187 | updateChart(isNaN(value as unknown as number) ? 0 : Number(value)); | ... | ... |
... | ... | @@ -157,6 +157,7 @@ |
157 | 157 | const updateFn: DataFetchUpdateFn = (message, attribute) => { |
158 | 158 | const { data = {} } = message; |
159 | 159 | const [latest] = data[attribute] || []; |
160 | + if (!latest.length) return; | |
160 | 161 | const [timespan, value] = latest; |
161 | 162 | time.value = timespan; |
162 | 163 | updateChartFn(isNaN(value as unknown as number) ? 0 : Number(value)); | ... | ... |
... | ... | @@ -32,7 +32,7 @@ |
32 | 32 | ); |
33 | 33 | const options = deviceList |
34 | 34 | .filter((item) => item.tbDeviceId === deviceRecord.deviceId) |
35 | - .map((item) => ({ ...item, label: item.name, value: item.tbDeviceId })); | |
35 | + .map((item) => ({ ...item, label: item.alias || item.name, value: item.tbDeviceId })); | |
36 | 36 | |
37 | 37 | const attKey = dataSource.map((item) => ({ |
38 | 38 | ...item, | ... | ... |
... | ... | @@ -47,6 +47,7 @@ |
47 | 47 | const updateFn: DataFetchUpdateFn = (message, attribute) => { |
48 | 48 | const { data = {} } = message; |
49 | 49 | const [latest] = data[attribute] || []; |
50 | + if (!latest.length) return; | |
50 | 51 | const [timespan, value] = latest; |
51 | 52 | time.value = timespan; |
52 | 53 | isOpenClose.value = Boolean(getNumberValue(value)); | ... | ... |
... | ... | @@ -49,6 +49,7 @@ |
49 | 49 | const updateFn: DataFetchUpdateFn = (message, attribute) => { |
50 | 50 | const { data = {} } = message; |
51 | 51 | const [latest] = data[attribute] || []; |
52 | + if (!latest.length) return; | |
52 | 53 | const [timespan, value] = latest; |
53 | 54 | time.value = timespan; |
54 | 55 | isOpenClose.value = Boolean(getNumberValue(value)); | ... | ... |
... | ... | @@ -13,12 +13,12 @@ |
13 | 13 | component: 'Input', |
14 | 14 | defaultValue: option.unit, |
15 | 15 | }, |
16 | - { | |
17 | - field: ComponentConfigFieldEnum.SHOW_DEVICE_NAME, | |
18 | - label: '显示设备名称', | |
19 | - component: 'Checkbox', | |
20 | - defaultValue: option.showDeviceName, | |
21 | - }, | |
16 | + // { | |
17 | + // field: ComponentConfigFieldEnum.SHOW_DEVICE_NAME, | |
18 | + // label: '显示设备名称', | |
19 | + // component: 'Checkbox', | |
20 | + // defaultValue: option.showDeviceName, | |
21 | + // }, | |
22 | 22 | ], |
23 | 23 | showActionButtonGroup: false, |
24 | 24 | labelWidth: 120, | ... | ... |
... | ... | @@ -86,7 +86,11 @@ |
86 | 86 | const getDesign = computed(() => { |
87 | 87 | const { persetOption, option } = props.config; |
88 | 88 | const { dataSource = [] } = option || {}; |
89 | - const { unit: presetUnit, fontColor: presetFontColor } = persetOption || {}; | |
89 | + const { | |
90 | + unit: presetUnit, | |
91 | + fontColor: presetFontColor, | |
92 | + // lineColor: persetLineColor, | |
93 | + } = persetOption || {}; | |
90 | 94 | |
91 | 95 | return { |
92 | 96 | dataSource: dataSource?.map((item) => { |
... | ... | @@ -97,12 +101,11 @@ |
97 | 101 | unit: unit ?? presetUnit, |
98 | 102 | fontColor: fontColor ?? presetFontColor, |
99 | 103 | attribute, |
100 | - attributeName, | |
101 | - attributeRename, | |
104 | + attributeName: attributeRename || attributeName, | |
102 | 105 | showDeviceName, |
103 | - deviceName, | |
104 | - deviceRename, | |
106 | + deviceName: deviceRename || deviceName, | |
105 | 107 | id: deviceId, |
108 | + // lineColor: lineColor || persetLineColor, | |
106 | 109 | }; |
107 | 110 | }), |
108 | 111 | }; |
... | ... | @@ -117,12 +120,16 @@ |
117 | 120 | unref(getDesign).dataSource.map((item) => { |
118 | 121 | return { |
119 | 122 | type: 'line', |
120 | - name: `${item.showDeviceName || item.deviceRename || item.deviceName} - ${ | |
121 | - item.attributeRename || item.attributeName | |
122 | - }`, | |
123 | + name: `${item.deviceName} - ${item.attributeName}`, | |
123 | 124 | data: [] as { name: string; value: number }[], |
124 | 125 | id: item.id, |
125 | 126 | attribute: item.attribute, |
127 | + // itemStyle: { | |
128 | + // color: item.lineColor, | |
129 | + // }, | |
130 | + // lineStyle: { | |
131 | + // color: item.lineColor, | |
132 | + // }, | |
126 | 133 | }; |
127 | 134 | }) |
128 | 135 | ); |
... | ... | @@ -131,15 +138,13 @@ |
131 | 138 | |
132 | 139 | const updateFn: MultipleDataFetchUpdateFn = async (message, deviceId, attribute) => { |
133 | 140 | legendData.value = unref(getDesign).dataSource.map((item) => { |
134 | - return `${item.deviceRename || item.deviceName} - ${ | |
135 | - item.attributeRename || item.attributeName | |
136 | - }`; | |
141 | + return `${item.deviceName} - ${item.attributeName}`; | |
137 | 142 | }); |
138 | 143 | const list: IList | any = {}; |
139 | 144 | forEachGroupMessage(message, deviceId, attribute, (attribute, value, timespan) => { |
140 | 145 | list.time = timespan || list.time; |
141 | 146 | series.value.forEach((item) => { |
142 | - if (item.id === deviceId && item.attribute === attribute) { | |
147 | + if (item.id === deviceId && item.attribute === attribute && value) { | |
143 | 148 | item.data.push({ |
144 | 149 | name: formatToDateTime(list.time, 'HH:mm:ss'), |
145 | 150 | value: value, |
... | ... | @@ -169,6 +174,8 @@ |
169 | 174 | type, |
170 | 175 | name, |
171 | 176 | data, |
177 | + // itemStyle, | |
178 | + // lineStyle, | |
172 | 179 | }; |
173 | 180 | }) |
174 | 181 | ), | ... | ... |
... | ... | @@ -34,6 +34,7 @@ |
34 | 34 | const updateFn: DataFetchUpdateFn = (message, attribute) => { |
35 | 35 | const { data = {} } = message; |
36 | 36 | const [info] = data[attribute] || []; |
37 | + if (!info.length) return; | |
37 | 38 | const [timespan, value] = info; |
38 | 39 | currentValue.value = value; |
39 | 40 | time.value = timespan; | ... | ... |
... | ... | @@ -43,6 +43,7 @@ |
43 | 43 | const updateFn: DataFetchUpdateFn = (message, attribute) => { |
44 | 44 | const { data = {} } = message; |
45 | 45 | const [latest] = data[attribute] || []; |
46 | + if (!latest.length) return; | |
46 | 47 | const [timespan, value] = latest; |
47 | 48 | currentValue.value = value; |
48 | 49 | time.value = timespan; | ... | ... |
... | ... | @@ -89,7 +89,7 @@ |
89 | 89 | const updateFn: MultipleDataFetchUpdateFn = (message, deviceId, attribute) => { |
90 | 90 | forEachGroupMessage(message, deviceId, attribute, (attribute, value, timespan) => { |
91 | 91 | percentList.value.forEach((item) => { |
92 | - if (item.id === deviceId && item.attribute === attribute) { | |
92 | + if (item.id === deviceId && item.attribute === attribute && value) { | |
93 | 93 | item.value = getNumberValue(value); |
94 | 94 | time.value = timespan; |
95 | 95 | } | ... | ... |
... | ... | @@ -75,7 +75,7 @@ |
75 | 75 | const updateFn: MultipleDataFetchUpdateFn = (message, deviceId, attribute) => { |
76 | 76 | forEachGroupMessage(message, deviceId, attribute, (attribute, value, timespan) => { |
77 | 77 | updateSvgList.value.forEach((item) => { |
78 | - if (item.id === deviceId && item.attribute === attribute) { | |
78 | + if (item.id === deviceId && item.attribute === attribute && value) { | |
79 | 79 | item.value = getNumberValue(value); |
80 | 80 | time.value = timespan; |
81 | 81 | } | ... | ... |