Commit ea07f522514a52d4cbdaadb03980ff139156f01a
Merge branch 'ww' into 'main'
perf: board component dashboard component dynamic set max value See merge request huang/yun-teng-iot-front!348
Showing
5 changed files
with
14 additions
and
4 deletions
| ... | ... | @@ -9,12 +9,14 @@ interface UseAlarmNotifyParams { |
| 9 | 9 | alarmNotifyStatus?: AlarmStatus; |
| 10 | 10 | interval?: number; |
| 11 | 11 | color?: string; |
| 12 | + duration?: number; | |
| 12 | 13 | } |
| 13 | 14 | |
| 14 | 15 | export function useAlarmNotify(params: UseAlarmNotifyParams = {}) { |
| 15 | 16 | const { |
| 16 | 17 | alarmNotifyStatus = AlarmStatus.ACTIVE_UN_ACK, |
| 17 | 18 | interval = import.meta.env.VITE_ALARM_NOTIFY_POLLING_INTERVAL_TIME, |
| 19 | + duration = import.meta.env.VITE_ALARM_NOTIFY_DURATION, | |
| 18 | 20 | color = 'orange', |
| 19 | 21 | } = params; |
| 20 | 22 | const alarmNotifyStatusMean = AlarmStatusMean[alarmNotifyStatus]; |
| ... | ... | @@ -40,10 +42,9 @@ export function useAlarmNotify(params: UseAlarmNotifyParams = {}) { |
| 40 | 42 | |
| 41 | 43 | const severityMean = alarmLevel(severity); |
| 42 | 44 | |
| 43 | - console.log('enter'); | |
| 44 | 45 | notification.open({ |
| 45 | 46 | message: '设备告警', |
| 46 | - duration: null, | |
| 47 | + duration, | |
| 47 | 48 | key, |
| 48 | 49 | description: h('div', {}, [ |
| 49 | 50 | h('div', { style: { marginRight: '5px' } }, [ |
| ... | ... | @@ -61,8 +62,6 @@ export function useAlarmNotify(params: UseAlarmNotifyParams = {}) { |
| 61 | 62 | ]), |
| 62 | 63 | icon: h(ExclamationCircleOutlined, { style: { color: '#faa22d' } }), |
| 63 | 64 | onClose: () => { |
| 64 | - console.log('enter close'); | |
| 65 | - // currentNotifyId = null; | |
| 66 | 65 | key = null; |
| 67 | 66 | }, |
| 68 | 67 | btn: h( | ... | ... |
| ... | ... | @@ -279,9 +279,12 @@ const handleValue = (value: any) => { |
| 279 | 279 | |
| 280 | 280 | export const update_instrument_1_value = (params: DashBoardValue) => { |
| 281 | 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 | 284 | return { |
| 283 | 285 | series: [ |
| 284 | 286 | { |
| 287 | + max: max < 100 ? 100 : max, | |
| 285 | 288 | data: [{ value: handleValue(value) }], |
| 286 | 289 | detail: { |
| 287 | 290 | formatter: `{value} ${unit ?? ''}`, |
| ... | ... | @@ -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 | 296 | data: [{ value: handleValue(value) }], |
| 293 | 297 | }, |
| 294 | 298 | ], | ... | ... |
| ... | ... | @@ -73,6 +73,7 @@ declare global { |
| 73 | 73 | VITE_GENERATE_UI: string; |
| 74 | 74 | VITE_CONTENT_SECURITY_POLICY: boolean; |
| 75 | 75 | VITE_ALARM_NOTIFY_POLLING_INTERVAL_TIME: number; |
| 76 | + VITE_ALARM_NOTIFY_DURATION: number; | |
| 76 | 77 | } |
| 77 | 78 | |
| 78 | 79 | declare function parseInt(s: string | number, radix?: number): number; | ... | ... |