|
|
@ -17,7 +17,7 @@ |
|
|
</el-scrollbar> |
|
|
</el-scrollbar> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<div class="elect-cont-right" style="background-color: transparent; padding: 0 !important;"> |
|
|
|
|
|
|
|
|
<div v-loading="loading" class="elect-cont-right" style="background-color: transparent; padding: 0 !important;"> |
|
|
<div class="container-right" style="height: calc(100vh - 158px) !important;background-color: transparent !important;"> |
|
|
<div class="container-right" style="height: calc(100vh - 158px) !important;background-color: transparent !important;"> |
|
|
<span class="right-top-line" /> |
|
|
<span class="right-top-line" /> |
|
|
<span class="left-bottom-line" /> |
|
|
<span class="left-bottom-line" /> |
|
|
@ -79,12 +79,11 @@ |
|
|
|
|
|
|
|
|
<div class="warning-text"> |
|
|
<div class="warning-text"> |
|
|
<i class="iconfont icon-baojingjilu" /> |
|
|
<i class="iconfont icon-baojingjilu" /> |
|
|
<div v-if="item.isWarningActive" :ref="el => setWarningRef(el, index)" class="warning-text-scroll"> |
|
|
|
|
|
|
|
|
<div v-if="item.warnList && item.warnList.length>0" :ref="el => setWarningRef(el, index)" class="warning-text-scroll"> |
|
|
<div class="scroll-wrap"> |
|
|
<div class="scroll-wrap"> |
|
|
<div v-for="(warn, warnIdx) in item.warnList" :key="warnIdx" class="scroll-item"> |
|
|
<div v-for="(warn, warnIdx) in item.warnList" :key="warnIdx" class="scroll-item"> |
|
|
{{ warn.warnValue }} |
|
|
{{ warn.warnValue }} |
|
|
</div> |
|
|
</div> |
|
|
<!-- 复制一份,用于无缝循环 --> |
|
|
|
|
|
<div v-for="(warn, warnIdx) in item.warnList" :key="'copy_'+warnIdx" class="scroll-item"> |
|
|
<div v-for="(warn, warnIdx) in item.warnList" :key="'copy_'+warnIdx" class="scroll-item"> |
|
|
{{ warn.warnValue }} |
|
|
{{ warn.warnValue }} |
|
|
</div> |
|
|
</div> |
|
|
@ -212,7 +211,9 @@ export default { |
|
|
alarmTableData: [], |
|
|
alarmTableData: [], |
|
|
alarmPageNum: 1, |
|
|
alarmPageNum: 1, |
|
|
alarmPageSize: 10, |
|
|
alarmPageSize: 10, |
|
|
alarmTotal: 0 |
|
|
|
|
|
|
|
|
alarmTotal: 0, |
|
|
|
|
|
loading: false, |
|
|
|
|
|
refreshTimer: null |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
created() { |
|
|
created() { |
|
|
@ -228,38 +229,58 @@ export default { |
|
|
this.selectFirstWarehouseNode() |
|
|
this.selectFirstWarehouseNode() |
|
|
}) |
|
|
}) |
|
|
}).catch(() => {}) |
|
|
}).catch(() => {}) |
|
|
|
|
|
|
|
|
|
|
|
// 新增:1分钟定时刷新 |
|
|
|
|
|
this.refreshTimer = setInterval(() => { |
|
|
|
|
|
this.crud.toQuery() |
|
|
|
|
|
}, 60 * 1000) |
|
|
}, |
|
|
}, |
|
|
beforeDestroy() { |
|
|
beforeDestroy() { |
|
|
this.clearAllWarningScroll() |
|
|
this.clearAllWarningScroll() |
|
|
|
|
|
// 清除轮询定时器 |
|
|
|
|
|
if (this.refreshTimer) { |
|
|
|
|
|
clearInterval(this.refreshTimer) |
|
|
|
|
|
this.refreshTimer = null |
|
|
|
|
|
} |
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
[CRUD.HOOK.beforeRefresh]() { |
|
|
[CRUD.HOOK.beforeRefresh]() { |
|
|
|
|
|
this.loading = true |
|
|
this.crud.params.page = null |
|
|
this.crud.params.page = null |
|
|
this.crud.params.size = null |
|
|
this.crud.params.size = null |
|
|
}, |
|
|
}, |
|
|
[CRUD.HOOK.afterRefresh]() { |
|
|
[CRUD.HOOK.afterRefresh]() { |
|
|
|
|
|
this.loading = false |
|
|
const apiList = this.crud.data || [] |
|
|
const apiList = this.crud.data || [] |
|
|
this.buildWarehouseCardList(apiList) |
|
|
this.buildWarehouseCardList(apiList) |
|
|
}, |
|
|
}, |
|
|
buildWarehouseCardList(apiResult) { |
|
|
buildWarehouseCardList(apiResult) { |
|
|
const apiList = this.crud.data || [] |
|
|
|
|
|
|
|
|
|
|
|
if (!Array.isArray(apiList) || apiList.length === 0) { |
|
|
|
|
|
|
|
|
if (!Array.isArray(apiResult) || apiResult.length === 0) { |
|
|
this.warehouseCardList = [] |
|
|
this.warehouseCardList = [] |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
let filterList = [] |
|
|
let filterList = [] |
|
|
if (this.selectedTreeKey?.id === 0) { |
|
|
if (this.selectedTreeKey?.id === 0) { |
|
|
filterList = apiList |
|
|
|
|
|
|
|
|
filterList = apiResult |
|
|
} else { |
|
|
} else { |
|
|
const selectFondsNo = this.selectedTreeKey?.fondsNo |
|
|
const selectFondsNo = this.selectedTreeKey?.fondsNo |
|
|
filterList = apiList.filter(item => item.warehouse.fondsNo === selectFondsNo) |
|
|
|
|
|
|
|
|
filterList = apiResult.filter(item => item.warehouse.fondsNo === selectFondsNo) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const cardList = filterList.map(item => { |
|
|
const cardList = filterList.map(item => { |
|
|
|
|
|
// 计算离线条件:lastTime为空 / 距离当前超过10分钟 |
|
|
|
|
|
let isOffline = true |
|
|
|
|
|
const lastTimeStr = item.warehouse.lastTime |
|
|
|
|
|
if (lastTimeStr) { |
|
|
|
|
|
const lastDate = new Date(lastTimeStr) |
|
|
|
|
|
const diffMs = Date.now() - lastDate.getTime() |
|
|
|
|
|
isOffline = diffMs > 10 * 60 * 1000 |
|
|
|
|
|
} |
|
|
|
|
|
// isWarningActive:离线 或者 存在报警,任意一个满足即为true |
|
|
|
|
|
// const hasWarn = Array.isArray(item.warnList) && item.warnList.length > 0 |
|
|
return { |
|
|
return { |
|
|
...item, |
|
|
...item, |
|
|
isWarningActive: Array.isArray(item.warnList) && item.warnList.length > 0 |
|
|
|
|
|
|
|
|
isWarningActive: isOffline |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
this.warehouseCardList = cardList |
|
|
this.warehouseCardList = cardList |
|
|
@ -292,7 +313,9 @@ export default { |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
this.warehouseCardList.forEach((card, idx) => { |
|
|
this.warehouseCardList.forEach((card, idx) => { |
|
|
if (!card.isWarningActive || !card.warnList || card.warnList.length <= 0) return |
|
|
|
|
|
|
|
|
// ----------删掉 !card.isWarningActive 判断,只看报警数据---------- |
|
|
|
|
|
if (!card.warnList || card.warnList.length <= 0) return |
|
|
|
|
|
|
|
|
const boxDom = this.warningRefs[idx] |
|
|
const boxDom = this.warningRefs[idx] |
|
|
if (!boxDom) return |
|
|
if (!boxDom) return |
|
|
const wrapDom = boxDom.querySelector('.scroll-wrap') |
|
|
const wrapDom = boxDom.querySelector('.scroll-wrap') |
|
|
|