Showing
1 changed file
with
15 additions
and
8 deletions
| 1 | <script lang="ts" setup> | 1 | <script lang="ts" setup> |
| 2 | import { nextTick, onMounted, onUnmounted, reactive, ref, unref } from 'vue'; | 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 | import { PageWrapper } from '/@/components/Page'; | 4 | import { PageWrapper } from '/@/components/Page'; |
| 5 | import { BasicTable, useTable } from '/@/components/Table'; | 5 | import { BasicTable, useTable } from '/@/components/Table'; |
| 6 | import { realTimeDataColumns } from '../../config/detail.config'; | 6 | import { realTimeDataColumns } from '../../config/detail.config'; |
| @@ -31,6 +31,9 @@ | @@ -31,6 +31,9 @@ | ||
| 31 | key?: string; | 31 | key?: string; |
| 32 | value?: string; | 32 | value?: string; |
| 33 | time?: number; | 33 | time?: number; |
| 34 | + type?: string; | ||
| 35 | + boolClose?: string; | ||
| 36 | + boolOpen?: string; | ||
| 34 | } | 37 | } |
| 35 | 38 | ||
| 36 | const props = defineProps<{ | 39 | const props = defineProps<{ |
| @@ -214,6 +217,14 @@ | @@ -214,6 +217,14 @@ | ||
| 214 | open(); | 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 | onUnmounted(() => close()); | 228 | onUnmounted(() => close()); |
| 218 | </script> | 229 | </script> |
| 219 | 230 | ||
| @@ -252,13 +263,9 @@ | @@ -252,13 +263,9 @@ | ||
| 252 | </template> | 263 | </template> |
| 253 | <section class="min-h-16 flex flex-col justify-between"> | 264 | <section class="min-h-16 flex flex-col justify-between"> |
| 254 | <div class="flex font-bold text-lg mb-4 gap-2"> | 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 | <div class="text-xs flex items-center">{{ item.unit }}</div> | 269 | <div class="text-xs flex items-center">{{ item.unit }}</div> |
| 263 | </div> | 270 | </div> |
| 264 | <div class="text-dark-800 text-xs"> | 271 | <div class="text-dark-800 text-xs"> |