Commit 76bbfae46ed364dec2670269bdc6e9d171d8c44f
1 parent
1598f927
perf: board component dashboard component dynamic set max value
Showing
2 changed files
with
4 additions
and
3 deletions
| @@ -42,7 +42,6 @@ export function useAlarmNotify(params: UseAlarmNotifyParams = {}) { | @@ -42,7 +42,6 @@ export function useAlarmNotify(params: UseAlarmNotifyParams = {}) { | ||
| 42 | 42 | ||
| 43 | const severityMean = alarmLevel(severity); | 43 | const severityMean = alarmLevel(severity); |
| 44 | 44 | ||
| 45 | - console.log('enter'); | ||
| 46 | notification.open({ | 45 | notification.open({ |
| 47 | message: '设备告警', | 46 | message: '设备告警', |
| 48 | duration, | 47 | duration, |
| @@ -63,8 +62,6 @@ export function useAlarmNotify(params: UseAlarmNotifyParams = {}) { | @@ -63,8 +62,6 @@ export function useAlarmNotify(params: UseAlarmNotifyParams = {}) { | ||
| 63 | ]), | 62 | ]), |
| 64 | icon: h(ExclamationCircleOutlined, { style: { color: '#faa22d' } }), | 63 | icon: h(ExclamationCircleOutlined, { style: { color: '#faa22d' } }), |
| 65 | onClose: () => { | 64 | onClose: () => { |
| 66 | - console.log('enter close'); | ||
| 67 | - // currentNotifyId = null; | ||
| 68 | key = null; | 65 | key = null; |
| 69 | }, | 66 | }, |
| 70 | btn: h( | 67 | btn: h( |
| @@ -279,9 +279,12 @@ const handleValue = (value: any) => { | @@ -279,9 +279,12 @@ const handleValue = (value: any) => { | ||
| 279 | 279 | ||
| 280 | export const update_instrument_1_value = (params: DashBoardValue) => { | 280 | export const update_instrument_1_value = (params: DashBoardValue) => { |
| 281 | const { value = 0, unit = '°C', fontColor } = params; | 281 | const { value = 0, unit = '°C', fontColor } = params; |
| 282 | + let max = value > 1 ? Number(1 + Array(String(value).length).fill(0).join('')) / 2 : 100 / 2; | ||
| 283 | + max = value > max ? max * 2 : max; | ||
| 282 | return { | 284 | return { |
| 283 | series: [ | 285 | series: [ |
| 284 | { | 286 | { |
| 287 | + max: max < 100 ? 100 : max, | ||
| 285 | data: [{ value: handleValue(value) }], | 288 | data: [{ value: handleValue(value) }], |
| 286 | detail: { | 289 | detail: { |
| 287 | formatter: `{value} ${unit ?? ''}`, | 290 | formatter: `{value} ${unit ?? ''}`, |
| @@ -289,6 +292,7 @@ export const update_instrument_1_value = (params: DashBoardValue) => { | @@ -289,6 +292,7 @@ export const update_instrument_1_value = (params: DashBoardValue) => { | ||
| 289 | }, | 292 | }, |
| 290 | }, | 293 | }, |
| 291 | { | 294 | { |
| 295 | + max: max < 100 ? 100 : max, | ||
| 292 | data: [{ value: handleValue(value) }], | 296 | data: [{ value: handleValue(value) }], |
| 293 | }, | 297 | }, |
| 294 | ], | 298 | ], |