From b71e210a9f1f2bf8a8d717d41aee86e9f515e116 Mon Sep 17 00:00:00 2001 From: xuhuajiao <13476289682@163.com> Date: Mon, 10 Aug 2026 17:19:42 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AB=99=E7=82=B9=E6=8A=A5=E8=AD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/assetDevice/index.js | 26 +- src/views/assetManage/monitor/index.vue | 637 +++++++++++------------- src/views/home.vue | 46 +- 3 files changed, 341 insertions(+), 368 deletions(-) diff --git a/src/api/assetDevice/index.js b/src/api/assetDevice/index.js index fa28434..0b4ec9d 100644 --- a/src/api/assetDevice/index.js +++ b/src/api/assetDevice/index.js @@ -27,9 +27,18 @@ export function FetchInitDeviceInfo(params) { } // 根据仓库iD获取全部设备 -export function FetchDeviceAlllByWarehouseId(params) { +export function FetchDeviceAllByWarehouseId(params) { return request({ - url: 'api/device/getDeviceAlllByWarehouseId', + url: 'api/device/getDeviceAllByWarehouseId', + method: 'get', + params + }) +} + +// 站点监控 +export function FetchWarehouseMonitoring(params) { + return request({ + url: 'api/warehouse/warehouseMonitoring', method: 'get', params }) @@ -78,6 +87,15 @@ export function FetchDevicePasswordById(params) { }) } +// 获取实时报警信息 +export function FetchRealtimeAlarms(params) { + return request({ + url: 'api/warehouse/getRealtimeAlarms', + method: 'get', + params + }) +} + export default { FetchFondsWarehouseTree, FetchWarehouseTree, @@ -88,5 +106,7 @@ export default { FetchDeviceTypeTree, FetchDeviceDetailsById, FetchDevicePasswordById, - FetchDeviceAlllByWarehouseId + FetchDeviceAllByWarehouseId, + FetchWarehouseMonitoring, + FetchRealtimeAlarms } diff --git a/src/views/assetManage/monitor/index.vue b/src/views/assetManage/monitor/index.vue index bfd34b5..1fced43 100644 --- a/src/views/assetManage/monitor/index.vue +++ b/src/views/assetManage/monitor/index.vue @@ -16,12 +16,12 @@ /> - +
-
+
-
+
-

{{ item.warehouseName || '仓库' }}

-

面积:{{ item.warehouseArea || '0' }} ㎡

+

{{ item.warehouse.warehouseName || '仓库' }}

+

面积:{{ item.warehouse.warehouseArea || '0' }} ㎡

-
-

{{ item.administrator }}

-

{{ item.contactPhone }}

+

{{ item.warehouse.administrator }}

+

 {{ item.warehouse.contactPhone }}

-

最后同步时间: {{ item.lastSyncTime | parseTime }}

+

最后同步时间: {{ item.warehouse.lastTime | parseTime }}

@@ -54,48 +53,64 @@
  • 当日进出 -

    {{ item.todayInCount || '0' }}次

    +

    {{ item.todayInCount || 0 }}次

  • 本月进出 -

    {{ item.todayInCount || '0' }}次

    +

    {{ item.monthlyInCount || 0 }}次

  • 本月入库 -

    {{ item.todayInCount || '0' }}次

    +

    {{ item.monthlyInboundCount || 0 }}次

  • 本月出库 -

    {{ item.todayInCount || '0' }}次

    +

    {{ item.monthlyOutboundCount || 0 }}次

  • 本月出入库异动 -

    {{ item.todayInCount || '0' }}次

    +

    {{ item.fluctuationCount || 0 }}次

  • 本月重点资产异动 -

    {{ item.todayInCount || '0' }}次

    +

    {{ item.fluctuationImportantCount || 0 }}次

-
- {{ item.warningText }} +
+
+
+ {{ warn.warnValue }} +
+ +
+ {{ warn.warnValue }} +
+
- -
- + +
+
- - + +
@@ -106,24 +121,20 @@ diff --git a/src/views/home.vue b/src/views/home.vue index e0f402f..df5213f 100644 --- a/src/views/home.vue +++ b/src/views/home.vue @@ -145,7 +145,7 @@

- 报警设备 + 报警信息

- - + + @@ -182,6 +182,7 @@ import serverProgress from '@/views/components/echarts/serverProgress.vue' import { FetchInitBaseInfo } from '@/api/stockTask/index' import { FetchSystemInfo } from '@/api/home/cpu/index' import { FetchInitStockTakeBill, FetchInitInOutBill } from '@/api/asset/index' +import { FetchRealtimeAlarms } from '@/api/assetDevice/index' import { mapGetters } from 'vuex' import { swiper, swiperSlide } from 'vue-awesome-swiper' import 'swiper/dist/css/swiper.css' @@ -251,7 +252,9 @@ export default { }, slidesPerView: 'auto' }, - alarmData: [] + alarmData: [], + // 报警轮询定时器 + alarmTimer: null } }, computed: { @@ -267,8 +270,12 @@ export default { this.getInitStockTakeBill(true) this.getInitInOutBill(true) // 初始化出入库 this.getSystemInfo() + this.getRealtimeAlarms() }, mounted() { + // 开启报警30秒轮询 + this.startAlarmPoll() + // 盘点表格滚动监听 this.$nextTick(() => { if (this.$refs.stockTableRef) { @@ -298,7 +305,26 @@ export default { } }) }, + beforeDestroy() { + // 组件销毁清除定时器,防止后台持续请求 + this.clearAlarmPoll() + }, methods: { + // 启动报警轮询 30s + startAlarmPoll() { + this.clearAlarmPoll() + this.alarmTimer = setInterval(() => { + this.getRealtimeAlarms() + }, 30000) + }, + // 清除报警轮询 + clearAlarmPoll() { + if (this.alarmTimer) { + clearInterval(this.alarmTimer) + this.alarmTimer = null + } + }, + handleMainData() { const param = { 'userId': this.user.id @@ -466,6 +492,16 @@ export default { sysFilesPercentage: 0 } this.getSystemInfo() + }, + // 获取实时报警信息 + getRealtimeAlarms() { + FetchRealtimeAlarms().then(res => { + if (res.code !== 500) { + this.alarmData = res + } else { + this.alarmData = [] + } + }) } } }