Browse Source

站点监控完善

master
xuhuajiao 4 weeks ago
parent
commit
5f3f22104d
  1. 4
      .env.development
  2. 12
      src/api/assetDevice/index.js
  3. 162
      src/views/assetManage/monitor/index.vue
  4. 2
      src/views/assetManage/stocktaking/index.vue
  5. 2
      src/views/home.vue

4
.env.development

@ -3,8 +3,8 @@ ENV = 'development'
# 接口地址 # 接口地址
# 许镇-本地服地址 # 许镇-本地服地址
VUE_APP_BASE_API = 'http://192.168.99.63:15000'
# VUE_APP_BASE_API = 'http://192.168.99.101:15000'
# VUE_APP_BASE_API = 'http://192.168.99.63:15000'
VUE_APP_BASE_API = 'http://192.168.99.101:15000'
VUE_APP_WEBRTCSTREAMER_API = '127.0.0.1:8000' VUE_APP_WEBRTCSTREAMER_API = '127.0.0.1:8000'
# 是否启用 babel-plugin-dynamic-import-node插件 # 是否启用 babel-plugin-dynamic-import-node插件

12
src/api/assetDevice/index.js

@ -96,6 +96,15 @@ export function FetchRealtimeAlarms(params) {
}) })
} }
// 历史报警信息
export function FetchInitAlarmsLog(params) {
return request({
url: 'api/warehouse/initAlarmsLog',
method: 'get',
params
})
}
export default { export default {
FetchFondsWarehouseTree, FetchFondsWarehouseTree,
FetchWarehouseTree, FetchWarehouseTree,
@ -108,5 +117,6 @@ export default {
FetchDevicePasswordById, FetchDevicePasswordById,
FetchDeviceAllByWarehouseId, FetchDeviceAllByWarehouseId,
FetchWarehouseMonitoring, FetchWarehouseMonitoring,
FetchRealtimeAlarms
FetchRealtimeAlarms,
FetchInitAlarmsLog
} }

162
src/views/assetManage/monitor/index.vue

@ -78,7 +78,7 @@
</ul> </ul>
<div class="warning-text"> <div class="warning-text">
<i v-if="item.isWarningActive" 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.isWarningActive" :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">
@ -90,6 +90,8 @@
</div> </div>
</div> </div>
</div> </div>
<div v-else style="font-size: 12px; color: #999; flex: 1;">暂无报警信息</div>
<i class="el-icon-more" style="font-size: 12px; cursor: pointer;" @click.stop="handleMoreClick(item)" />
</div> </div>
</el-card> </el-card>
@ -117,11 +119,44 @@
<hkVideo ref="hkVideoRef" :hk-config="hkConfig" /> <hkVideo ref="hkVideoRef" :hk-config="hkConfig" />
</div> </div>
</el-dialog> </el-dialog>
<!-- ==========新增历史报警弹窗========== -->
<el-dialog
title="历史报警信息"
append-to-body
width="900px"
:visible.sync="alarmDialogVisible"
>
<el-table
ref="table"
class="archives-table"
stripe
style="width: 100%;"
height="calc(100vh - 530px)"
:data="alarmTableData"
>
<el-table-column prop="warehouseName" label="仓库名称" />
<el-table-column prop="warnValue" label="报警信息" />
<el-table-column prop="startTime" label="报警时间" width="160">
<template slot-scope="scope">
{{ scope.row.startTime | parseTime }}
</template>
</el-table-column>
</el-table>
<el-pagination
style="margin-top:16px;text-align:right;"
:current-page="alarmPageNum"
:page-size="alarmPageSize"
:total="alarmTotal"
layout="total, prev, pager, next"
@current-change="alarmPageChange"
/>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import crudDevice, { FetchFondsWarehouseTree, FetchDeviceAllByWarehouseId } from '@/api/assetDevice/index'
import crudDevice, { FetchFondsWarehouseTree, FetchDeviceAllByWarehouseId, FetchInitAlarmsLog } from '@/api/assetDevice/index'
import CRUD, { presenter, header, crud } from '@crud/crud' import CRUD, { presenter, header, crud } from '@crud/crud'
import hkVideo from '@/views/components/hkVideo.vue' import hkVideo from '@/views/components/hkVideo.vue'
@ -169,7 +204,15 @@ export default {
password: null, password: null,
ip: null, ip: null,
port: null port: null
}
},
// ==========data==========
alarmDialogVisible: false,
alarmLoading: false,
alarmWarehouseNo: '',
alarmTableData: [],
alarmPageNum: 1,
alarmPageSize: 10,
alarmTotal: 0
} }
}, },
created() { created() {
@ -199,52 +242,6 @@ export default {
this.buildWarehouseCardList(apiList) this.buildWarehouseCardList(apiList)
}, },
buildWarehouseCardList(apiResult) { buildWarehouseCardList(apiResult) {
// ========== 使mock apiList ==========
// const apiList = [
// {
// warehouse: {
// id: 1,
// warehouseNo: 'S00101',
// warehouseName: '',
// warehouseArea: '1200',
// administrator: '',
// contactPhone: '13800138000',
// fondsNo: 'S001',
// lastTime: '2026-08-07 10:20:30'
// },
// todayInCount: 0,
// monthlyInCount: 11,
// monthlyInboundCount: 99,
// monthlyOutboundCount: 0,
// fluctuationCount: 0,
// fluctuationImportantCount: 0,
// warnList: []
// },
// {
// warehouse: {
// id: 2,
// warehouseNo: 'S00201',
// warehouseName: '',
// warehouseArea: '800',
// administrator: '',
// contactPhone: '13900139000',
// fondsNo: 'S002',
// lastTime: '2026-08-07 09:10:20'
// },
// todayInCount: 0,
// monthlyInCount: 0,
// monthlyInboundCount: 0,
// monthlyOutboundCount: 0,
// fluctuationCount: 0,
// fluctuationImportantCount: 0,
// warnList: [
// { warnValue: 'A001' },
// { warnValue: '11111' }
// ]
// }
// ]
// ========== mock ==========
const apiList = this.crud.data || [] const apiList = this.crud.data || []
if (!Array.isArray(apiList) || apiList.length === 0) { if (!Array.isArray(apiList) || apiList.length === 0) {
@ -309,22 +306,19 @@ export default {
let timer = null let timer = null
const scrollStep = () => { const scrollStep = () => {
//
wrapDom.style.transition = 'transform 0.6s ease-in-out' wrapDom.style.transition = 'transform 0.6s ease-in-out'
offset += itemHeight offset += itemHeight
wrapDom.style.transform = `translateY(-${offset}px)` wrapDom.style.transform = `translateY(-${offset}px)`
timer = setTimeout(() => { timer = setTimeout(() => {
//
if (offset >= totalOriginHeight) { if (offset >= totalOriginHeight) {
wrapDom.style.transition = 'none' wrapDom.style.transition = 'none'
offset = 0 offset = 0
wrapDom.style.transform = `translateY(0px)` wrapDom.style.transform = `translateY(0px)`
//
wrapDom.offsetHeight wrapDom.offsetHeight
} }
scrollStep() scrollStep()
}, 3000) // 3s
}, 3000)
} }
const stop = () => { const stop = () => {
@ -370,41 +364,12 @@ export default {
handleClose() { handleClose() {
this.hkVideoVisible = false this.hkVideoVisible = false
}, },
// async openWarehouseCamera(cardItem) {
// const warehouseNo = cardItem.warehouseNo
// try {
// //
// const res = await FetchDeviceAllByWarehouseId()
// const allDevices = res || []
// // 1.
// // 2.warehouseNo === warehouseNo
// const ballDevices = allDevices.filter(d => {
// return d.deviceTypeName === '' && d.warehouseNo === warehouseNo
// })
// if (ballDevices.length === 0) {
// this.$message.info('')
// return
// }
// console.log('', ballDevices)
// // id
// this.handleViewVideo(ballDevices[0].id)
// } catch (err) {
// console.error('', err)
// this.$message.error('')
// }
// },
async openWarehouseCamera(cardItem) { async openWarehouseCamera(cardItem) {
const warehouseId = cardItem.id const warehouseId = cardItem.id
try { try {
// warehouseId
const res = await FetchDeviceAllByWarehouseId({ warehouseId }) const res = await FetchDeviceAllByWarehouseId({ warehouseId })
const allDevices = res || [] const allDevices = res || []
// allDevices
const ballDevices = allDevices.filter(d => d.deviceTypeName === '网络高清球机') const ballDevices = allDevices.filter(d => d.deviceTypeName === '网络高清球机')
if (ballDevices.length === 0) { if (ballDevices.length === 0) {
@ -441,6 +406,37 @@ export default {
console.error('打开视频失败:', err) console.error('打开视频失败:', err)
this.$message.error('获取监控设备信息失败') this.$message.error('获取监控设备信息失败')
} }
},
// handleMoreClick
handleMoreClick(item) {
this.alarmWarehouseNo = item.warehouse.warehouseNo
this.alarmPageNum = 1
this.alarmDialogVisible = true
this.getAlarmList()
},
//
async getAlarmList() {
this.alarmLoading = true
try {
const param = {
warehouseNo: this.alarmWarehouseNo,
pageNum: this.alarmPageNum,
pageSize: this.alarmPageSize
}
const res = await FetchInitAlarmsLog(param)
this.alarmTableData = res.records || []
this.alarmTotal = res.total || 0
} catch (e) {
this.$message.error('查询历史报警失败')
} finally {
this.alarmLoading = false
}
},
//
alarmPageChange(page) {
this.alarmPageNum = page
this.getAlarmList()
} }
} }
} }
@ -533,7 +529,6 @@ export default {
} }
} }
.warning-text { .warning-text {
color: #F65163;
font-size: 14px; font-size: 14px;
font-weight: 600; font-weight: 600;
border-top: 1px solid #ebeef5; border-top: 1px solid #ebeef5;
@ -546,6 +541,7 @@ export default {
.iconfont { .iconfont {
flex-shrink: 0; flex-shrink: 0;
color: #F65163;
} }
.warning-text-scroll { .warning-text-scroll {
flex: 1; flex: 1;

2
src/views/assetManage/stocktaking/index.vue

@ -528,7 +528,7 @@ export default {
methods: { methods: {
[CRUD.HOOK.beforeRefresh]() { [CRUD.HOOK.beforeRefresh]() {
// //
console.log('this.user', this.user)
// console.log('this.user', this.user)
this.crud.params.billNo = this.query.billNo this.crud.params.billNo = this.query.billNo
this.crud.params.warehouseId = this.query.warehouseId this.crud.params.warehouseId = this.query.warehouseId
this.crud.params.status = this.query.status this.crud.params.status = this.query.status

2
src/views/home.vue

@ -452,7 +452,7 @@ export default {
} else { } else {
this.inOutData.push(...list) this.inOutData.push(...list)
} }
console.log(res)
// console.log(res)
if (res.current >= res.pages) { if (res.current >= res.pages) {
this.inOutPage.hasMore = false this.inOutPage.hasMore = false
} else { } else {

Loading…
Cancel
Save