Showing
1 changed file
with
15 additions
and
8 deletions
1 | 1 | <script lang="ts" setup> |
2 | 2 | import { nextTick, onMounted, onUnmounted, reactive, ref, unref } from 'vue'; |
3 | - import { List, Button, Card } from 'ant-design-vue'; | |
3 | + import { List, Button, Card, Tooltip } from 'ant-design-vue'; | |
4 | 4 | import { PageWrapper } from '/@/components/Page'; |
5 | 5 | import { BasicTable, useTable } from '/@/components/Table'; |
6 | 6 | import { realTimeDataColumns } from '../../config/detail.config'; |
... | ... | @@ -31,6 +31,9 @@ |
31 | 31 | key?: string; |
32 | 32 | value?: string; |
33 | 33 | time?: number; |
34 | + type?: string; | |
35 | + boolClose?: string; | |
36 | + boolOpen?: string; | |
34 | 37 | } |
35 | 38 | |
36 | 39 | const props = defineProps<{ |
... | ... | @@ -214,6 +217,14 @@ |
214 | 217 | open(); |
215 | 218 | }); |
216 | 219 | |
220 | + const formatValue = (item: DataSource) => { | |
221 | + return item.type === DataTypeEnum.IS_BOOL | |
222 | + ? !!Number(item.value) | |
223 | + ? item.boolOpen | |
224 | + : item.boolClose | |
225 | + : item.value || '--'; | |
226 | + }; | |
227 | + | |
217 | 228 | onUnmounted(() => close()); |
218 | 229 | </script> |
219 | 230 | |
... | ... | @@ -252,13 +263,9 @@ |
252 | 263 | </template> |
253 | 264 | <section class="min-h-16 flex flex-col justify-between"> |
254 | 265 | <div class="flex font-bold text-lg mb-4 gap-2"> |
255 | - <div>{{ | |
256 | - item.type === DataTypeEnum.IS_BOOL | |
257 | - ? !!Number(item.value) | |
258 | - ? item.boolOpen | |
259 | - : item.boolClose | |
260 | - : item.value || '--' | |
261 | - }}</div> | |
266 | + <Tooltip :title="formatValue(item)" placement="topLeft"> | |
267 | + <div class="truncate">{{ formatValue(item) }}</div> | |
268 | + </Tooltip> | |
262 | 269 | <div class="text-xs flex items-center">{{ item.unit }}</div> |
263 | 270 | </div> |
264 | 271 | <div class="text-dark-800 text-xs"> | ... | ... |