|
|
@@ -1,19 +1,45 @@
|
|
|
<template>
|
|
|
<box title="消息通知">
|
|
|
<div class="l-flex__fill l-flex--col c-messageNotice">
|
|
|
- <template v-if="listData.length">
|
|
|
- <div class="l-flex__none l-flex--row c-messageNotice__header">
|
|
|
- <div class="l-flex__none col__time">时间</div>
|
|
|
- <div class="l-flex__none col__deviceName">设备名称</div>
|
|
|
- <div class="l-flex__fill col__content">内容</div>
|
|
|
- <div class="l-flex__none col__opt">操作</div>
|
|
|
+ <div class="l-flex__none l-flex--row c-messageNotice__header">
|
|
|
+ <div class="l-flex__none col__time">时间</div>
|
|
|
+ <div class="l-flex__none col__deviceName">设备名称</div>
|
|
|
+ <div class="l-flex__fill">内容</div>
|
|
|
+ </div>
|
|
|
+ <div class="l-flex__fill u-relative">
|
|
|
+ <div class="c-messageNotice__newList">
|
|
|
+ <div
|
|
|
+ v-for="(item, index) in newItems"
|
|
|
+ :key="item.id"
|
|
|
+ class="l-flex--row c-messageNotice__item new"
|
|
|
+ @click="onView(item, index)"
|
|
|
+ >
|
|
|
+ <div class="l-flex__none col__time l-flex--row">
|
|
|
+ <svg-icon
|
|
|
+ class="alarm__icon"
|
|
|
+ icon-class="v0-alarm"
|
|
|
+ :style="{ color: colors[item.level] }"
|
|
|
+ />
|
|
|
+ <div>{{ item.happenTime }}</div>
|
|
|
+ </div>
|
|
|
+ <div class="l-flex__none u-ellipsis col__deviceName">
|
|
|
+ {{ item.deviceName }}
|
|
|
+ </div>
|
|
|
+ <div class="l-flex__fill u-ellipsis">
|
|
|
+ {{ item.type }}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- <div class="l-flex__fill u-relative">
|
|
|
- <div class="c-messageNotice__newList">
|
|
|
+ <div class="c-messageNotice__list">
|
|
|
+ <vue-seamless-scroll
|
|
|
+ :data="listData"
|
|
|
+ :class-option="classOption"
|
|
|
+ >
|
|
|
<div
|
|
|
- v-for="(item, index) in newItems"
|
|
|
+ v-for="item in listData"
|
|
|
:key="item.id"
|
|
|
- class="l-flex--row c-messageNotice__item new"
|
|
|
+ class="l-flex--row c-messageNotice__item"
|
|
|
+ @click="onView(item)"
|
|
|
>
|
|
|
<div class="l-flex__none col__time l-flex--row">
|
|
|
<svg-icon
|
|
|
@@ -26,63 +52,13 @@
|
|
|
<div class="l-flex__none u-ellipsis col__deviceName">
|
|
|
{{ item.deviceName }}
|
|
|
</div>
|
|
|
- <div class="l-flex__fill u-ellipsis col__content">
|
|
|
- {{ item.type }}
|
|
|
- </div>
|
|
|
- <div class="l-flex__none col__opt">
|
|
|
- <button
|
|
|
- class="o-button alarm"
|
|
|
- @click="onView(item, index)"
|
|
|
- >
|
|
|
- 查看
|
|
|
- </button>
|
|
|
+ <div class="l-flex__fill u-ellipsis">
|
|
|
+ {{ item.deviceName }}
|
|
|
</div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- <div class="c-messageNotice__list">
|
|
|
- <vue-seamless-scroll
|
|
|
- :data="listData"
|
|
|
- :class-option="classOption"
|
|
|
- >
|
|
|
- <div
|
|
|
- v-for="item in listData"
|
|
|
- :key="item.id"
|
|
|
- class="l-flex--row c-messageNotice__item"
|
|
|
- >
|
|
|
- <div class="l-flex__none col__time l-flex--row">
|
|
|
- <svg-icon
|
|
|
- class="alarm__icon"
|
|
|
- icon-class="v0-alarm"
|
|
|
- :style="{ color: colors[item.level] }"
|
|
|
- />
|
|
|
- <div>{{ item.happenTime }}</div>
|
|
|
- </div>
|
|
|
- <div class="l-flex__none u-ellipsis col__deviceName">
|
|
|
- <auto-text
|
|
|
- class="u-text-center"
|
|
|
- :text="item.deviceName"
|
|
|
- />
|
|
|
- </div>
|
|
|
- <div class="l-flex__fill u-ellipsis col__content">
|
|
|
- <auto-text
|
|
|
- class="u-text-center"
|
|
|
- :text="item.type"
|
|
|
- />
|
|
|
- </div>
|
|
|
- <div class="l-flex__none col__opt">
|
|
|
- <button
|
|
|
- class="o-button"
|
|
|
- @click="onView(item)"
|
|
|
- >
|
|
|
- 查看
|
|
|
- </button>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </vue-seamless-scroll>
|
|
|
- </div>
|
|
|
+ </vue-seamless-scroll>
|
|
|
</div>
|
|
|
- </template>
|
|
|
- <status-wrapper v-else />
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</box>
|
|
|
</template>
|
|
|
@@ -101,8 +77,6 @@ export default {
|
|
|
data () {
|
|
|
this.$num = 0
|
|
|
return {
|
|
|
- error: false,
|
|
|
- loading: true,
|
|
|
classOption: {
|
|
|
step: 0.4
|
|
|
},
|
|
|
@@ -118,7 +92,7 @@ export default {
|
|
|
},
|
|
|
mounted () {
|
|
|
this.getDeviceAlarms()
|
|
|
- this.$timer = setInterval(this.getDeviceAlarms, 30000)
|
|
|
+ this.$timer = setInterval(this.getDeviceAlarms, 10000)
|
|
|
},
|
|
|
beforeDestroy () {
|
|
|
clearInterval(this.$timer)
|
|
|
@@ -131,36 +105,28 @@ export default {
|
|
|
this.$emit('openAlarmInfo', item)
|
|
|
},
|
|
|
getDeviceAlarms () {
|
|
|
- this.error = false
|
|
|
getDeviceAlarms(
|
|
|
addTenant({
|
|
|
pageIndex: 1,
|
|
|
pageSize: 20
|
|
|
})
|
|
|
- ).then(
|
|
|
- ({ data }) => {
|
|
|
- if (!data.length) {
|
|
|
- return
|
|
|
+ ).then(({ data }) => {
|
|
|
+ if (!data.length) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const length = data.length
|
|
|
+ const lastId = this.listData[0]?.id
|
|
|
+ for (let i = 0; i < length; i++) {
|
|
|
+ const item = data[i]
|
|
|
+ if (item.id === lastId) {
|
|
|
+ break
|
|
|
}
|
|
|
- const length = data.length
|
|
|
- const lastId = this.listData[0]?.id
|
|
|
- for (let i = 0; i < length; i++) {
|
|
|
- const item = data[i]
|
|
|
- if (item.id === lastId) {
|
|
|
- break
|
|
|
- }
|
|
|
- if (item.level === 2) {
|
|
|
- this.newAlarmList.unshift(item)
|
|
|
- }
|
|
|
+ if (item.level === 2) {
|
|
|
+ this.newAlarmList.unshift(item)
|
|
|
}
|
|
|
-
|
|
|
- this.listData = data
|
|
|
- },
|
|
|
- () => {
|
|
|
- this.error = true
|
|
|
}
|
|
|
- ).finally(() => {
|
|
|
- this.loading = false
|
|
|
+
|
|
|
+ this.listData = data
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
@@ -199,7 +165,7 @@ export default {
|
|
|
|
|
|
.alarm__icon {
|
|
|
font-size: 14px;
|
|
|
- margin-right: 4px;
|
|
|
+ margin: 0 4px 2px 0;
|
|
|
}
|
|
|
|
|
|
.col {
|
|
|
@@ -210,31 +176,10 @@ export default {
|
|
|
&__deviceName {
|
|
|
width: 95px;
|
|
|
}
|
|
|
-
|
|
|
- &__opt {
|
|
|
- width: 50px;
|
|
|
-
|
|
|
- .o-button {
|
|
|
- min-width: 32px;
|
|
|
- height: 20px;
|
|
|
- padding: 0 4px;
|
|
|
- font-size: 12px;
|
|
|
- border-radius: 2px;
|
|
|
- background-color: #2956f0;
|
|
|
- &.alarm {
|
|
|
- background-color: #f40645;
|
|
|
- color: #ffffff;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
- &__newList {
|
|
|
- animation: sparkle 2s linear infinite;
|
|
|
-
|
|
|
- &:hover {
|
|
|
- animation: none;
|
|
|
- }
|
|
|
+ &__newList .alarm__icon {
|
|
|
+ animation: sparkle 1s linear infinite;
|
|
|
}
|
|
|
|
|
|
@keyframes sparkle {
|
|
|
@@ -251,9 +196,5 @@ export default {
|
|
|
opacity: 0;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- ::v-deep.el-empty {
|
|
|
- padding: 0;
|
|
|
- }
|
|
|
}
|
|
|
</style>
|