Commit a53b0abba0772dca3dbc71b9e92988c4fcfca360
Merge branch 'fix/edge/08-02' into 'main_dev'
fix: 云端环境中,边缘实例的边缘设备分页与边缘端不同,没有按照时间先后进行分页 See merge request yunteng/thingskit-front!1428
Showing
1 changed file
with
33 additions
and
2 deletions
1 | 1 | <script lang="ts" setup> |
2 | - import { ref } from 'vue'; | |
2 | + import { CSSProperties, h, ref } from 'vue'; | |
3 | 3 | import { EdgeDeviceItemType, EdgeInstanceItemType } from '/@/api/edgeManage/model/edgeInstance'; |
4 | 4 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
5 | 5 | import { columns, searchFormSchema } from './config'; |
... | ... | @@ -9,6 +9,8 @@ |
9 | 9 | import { useMessage } from '/@/hooks/web/useMessage'; |
10 | 10 | import { useRoute } from 'vue-router'; |
11 | 11 | import { useGo } from '/@/hooks/web/usePage'; |
12 | + import { Badge } from 'ant-design-vue'; | |
13 | + import Icon from '/@/components/Icon'; | |
12 | 14 | |
13 | 15 | defineEmits(['register']); |
14 | 16 | |
... | ... | @@ -41,6 +43,32 @@ |
41 | 43 | reload(); |
42 | 44 | }; |
43 | 45 | |
46 | + const AlarmDetailActionButton = ({ hasAlarm }: { hasAlarm?: boolean }) => | |
47 | + h( | |
48 | + Badge, | |
49 | + { offset: [0, -5] }, | |
50 | + { | |
51 | + default: () => h('span', { style: { color: '#377dff' } }, '详情'), | |
52 | + count: () => | |
53 | + h( | |
54 | + 'div', | |
55 | + { | |
56 | + style: { | |
57 | + visibility: hasAlarm ? 'visible' : 'hidden', | |
58 | + width: '14px', | |
59 | + height: '14px', | |
60 | + display: 'flex', | |
61 | + justifyContent: 'center', | |
62 | + alignItems: 'center', | |
63 | + border: '1px solid #f46161', | |
64 | + borderRadius: '50%', | |
65 | + } as CSSProperties, | |
66 | + }, | |
67 | + h(Icon, { icon: 'mdi:bell-warning', color: '#f46161', size: 12 }) | |
68 | + ), | |
69 | + } | |
70 | + ); | |
71 | + | |
44 | 72 | const [registerTable, { reload }] = useTable({ |
45 | 73 | title: '边缘设备', |
46 | 74 | columns, |
... | ... | @@ -50,6 +78,8 @@ |
50 | 78 | page: page - 1 < 0 ? 0 : page - 1, |
51 | 79 | pageSize, |
52 | 80 | textSearch, |
81 | + sortProperty: 'createdTime', | |
82 | + sortOrder: 'DESC', | |
53 | 83 | }, |
54 | 84 | edgeId.value as string |
55 | 85 | ); |
... | ... | @@ -92,7 +122,8 @@ |
92 | 122 | <TableAction |
93 | 123 | :actions="[ |
94 | 124 | { |
95 | - label: '详情', | |
125 | + // label: '详情', | |
126 | + label: AlarmDetailActionButton({ hasAlarm: !!record.alarmStatus }), | |
96 | 127 | icon: 'ant-design:eye-outlined', |
97 | 128 | onClick: handleGoDeviceDetail.bind(null, record), |
98 | 129 | }, | ... | ... |