|
1
|
1
|
<script setup lang="ts">
|
|
2
|
2
|
import { computed, nextTick, onMounted, reactive, unref } from 'vue'
|
|
3
|
|
-import { Divider, Tag } from 'ant-design-vue'
|
|
|
3
|
+import { Tag } from 'ant-design-vue'
|
|
|
4
|
+import { useIntervalFn } from '@vueuse/core'
|
|
4
|
5
|
import { ScrollList } from './ScrollList'
|
|
5
|
6
|
import { fetchAlarmList } from '@/api/alarm'
|
|
6
|
7
|
import type { AlarmListItemType } from '@/api/alarm/model'
|
|
...
|
...
|
@@ -14,10 +15,6 @@ const props = defineProps<{ |
|
14
|
15
|
config: CreateComponentType
|
|
15
|
16
|
}>()
|
|
16
|
17
|
|
|
17
|
|
-const getCellBounds = computed(
|
|
18
|
|
- () => props.config.cellBounds || { width: 290, height: 230, x: 0, y: 0 },
|
|
19
|
|
-)
|
|
20
|
|
-
|
|
21
|
18
|
const contentDataStore = useContentDataStore()
|
|
22
|
19
|
|
|
23
|
20
|
const initOptions = reactive<{
|
|
...
|
...
|
@@ -67,7 +64,7 @@ onMounted(async () => { |
|
67
|
64
|
// 预览模式
|
|
68
|
65
|
await initFetchAlarmList()
|
|
69
|
66
|
if (initOptions.polling)
|
|
70
|
|
- setInterval(initFetchAlarmList, initOptions.polling * 1000)
|
|
|
67
|
+ useIntervalFn(initFetchAlarmList, (initOptions.polling || 30) * 1000)
|
|
71
|
68
|
}
|
|
72
|
69
|
else {
|
|
73
|
70
|
const statusList = Object.values(AlarmStatusEnum)
|
|
...
|
...
|
@@ -90,16 +87,13 @@ onMounted(async () => { |
|
90
|
87
|
<div class="seamless-scroll w-full h-full flex justify-center items-center overflow-y-scroll">
|
|
91
|
88
|
<ScrollList
|
|
92
|
89
|
v-model="initOptions.scroll" :single-wait-time="initOptions.interval" :list="initOptions.alarmList"
|
|
93
|
|
- :limit-scroll-num="10" :is-rem-unit="true" :delay="10" :wheel="true" hover :style="{
|
|
94
|
|
- width: `${getCellBounds.width}px`,
|
|
95
|
|
- height: `${getCellBounds.height}px`,
|
|
96
|
|
- }"
|
|
|
90
|
+ :is-rem-unit="true" :delay="10" :wheel="true" hover
|
|
97
|
91
|
>
|
|
98
|
|
- <div v-for="(item, index) in initOptions.alarmList" :key="index" class="flex flex-col items-start h-15 px-2">
|
|
99
|
|
- <p class="text-xs">
|
|
|
92
|
+ <div v-for="(item, index) in initOptions.alarmList" :key="index" class="flex flex-col items-start p-2 border-gray-600 border-b border-solid border-t-transparent border-l-transparent border-r-transparent">
|
|
|
93
|
+ <div class="text-xs mb-2">
|
|
100
|
94
|
<span>设备:</span>
|
|
101
|
95
|
<span class="ml-1">{{ item.deviceAlias || item.deviceName }}</span>
|
|
102
|
|
- </p>
|
|
|
96
|
+ </div>
|
|
103
|
97
|
<div class="flex items-center justify-between -mt-2 text-xs">
|
|
104
|
98
|
<span>时间:</span>
|
|
105
|
99
|
<span class="ml-1">{{ item.startTs }}</span>
|
|
...
|
...
|
@@ -107,19 +101,17 @@ onMounted(async () => { |
|
107
|
101
|
{{ AlarmStatusNameEnum[item.status] }}
|
|
108
|
102
|
</Tag>
|
|
109
|
103
|
</div>
|
|
110
|
|
- <Divider class="mt-2 divider" />
|
|
111
|
104
|
</div>
|
|
112
|
105
|
</ScrollList>
|
|
113
|
106
|
</div>
|
|
114
|
107
|
</template>
|
|
115
|
108
|
|
|
116
|
109
|
<style scoped lang="less">
|
|
117
|
|
-.seamless-scroll::-webkit-scrollbar {
|
|
118
|
|
- display: none;
|
|
|
110
|
+.seamless-scroll {
|
|
|
111
|
+
|
|
|
112
|
+ ::-webkit-scrollbar {
|
|
|
113
|
+ display: none;
|
|
119
|
114
|
|
|
120
|
|
- .divider {
|
|
121
|
|
- height: 0.3px;
|
|
122
|
|
- background-color: black;
|
|
123
|
115
|
}
|
|
124
|
116
|
}
|
|
125
|
117
|
</style> |
...
|
...
|
|