Browse Source

bug修复

master
xuhuajiao 2 months ago
parent
commit
0296a5d28e
  1. 4
      src/views/components/AccessDoor.vue
  2. 119
      src/views/environmentalScreen/index.js
  3. 31
      src/views/environmentalScreen/index.vue
  4. 44
      src/views/home.vue
  5. 119
      src/views/storeManage/warehouse3D/archivesStorage/index.js
  6. 37
      src/views/storeManage/warehouse3D/archivesStorage/index.vue
  7. 50
      src/views/system/archiveStatistics/mixins/statistics.js

4
src/views/components/AccessDoor.vue

@ -8,12 +8,12 @@
</p>
</h3>
<el-table ref="table" style="min-width: 100%;" :height="height" :data="tableData" class="warehose-el-table" stripe @row-click="toPage">
<el-table-column prop="time" label="时间" align="center" width="100">
<el-table-column prop="time" label="时间" align="center" min-width="65">
<template slot-scope="scope">
<div>{{ scope.row.time | parseTime }}</div>
</template>
</el-table-column>
<el-table-column label="姓名" align="center" width="120">
<el-table-column label="姓名" align="center" min-width="60">
<template slot-scope="scope">
<div>{{ scope.row.name }}</div>
</template>

119
src/views/environmentalScreen/index.js

@ -1,4 +1,5 @@
export const allDeviceData = [{
export const allDeviceData = [
{
'id': 1,
'ParentID': 0,
'SubClass': 0,
@ -6,7 +7,8 @@ export const allDeviceData = [{
'Name': '环境监控',
'NetStatus': 1,
'SUBTYPE': '1'
}, {
},
{
'id': 11303,
'ParentID': 1,
'SubClass': 0,
@ -14,63 +16,116 @@ export const allDeviceData = [{
'Name': '温湿度',
'NetStatus': 1,
'SUBTYPE': '17'
}, {
'id': 11355,
},
{
'id': 11519,
'ParentID': 1,
'SubClass': 0,
'IP': '192.168.99.102:5003:3',
'Name': '环境监测3_3',
'IP': '',
'Name': '空调红外控制',
'NetStatus': 1,
'SUBTYPE': '25'
}, {
'id': 11379,
'SUBTYPE': '1'
},
{
'id': 11520,
'ParentID': 1,
'SubClass': 0,
'IP': '192.168.99.102:5004:2',
'Name': '环境监测2_2',
'IP': '192.168.99.101:6003',
'Name': '开关量',
'NetStatus': 1,
'SUBTYPE': '25'
}, {
'id': 11403,
'SUBTYPE': '11'
},
{
'id': 11605,
'ParentID': 1,
'SubClass': 0,
'IP': '192.168.99.102:5005',
'Name': '环境监测1',
'IP': '192.168.99.000',
'Name': 'PM2.5 浓度',
'NetStatus': 1,
'SUBTYPE': '25'
}, {
'id': 11440,
'SUBTYPE': '101'
},
{
'id': 11606,
'ParentID': 1,
'SubClass': 0,
'IP': '192.168.99.001',
'Name': 'PM10浓度',
'NetStatus': 1,
'SUBTYPE': '101'
},
{
'id': 11607,
'ParentID': 1,
'SubClass': 0,
'IP': '192.168.99.002',
'Name': 'TWOC',
'NetStatus': 1,
'SUBTYPE': '101'
},
{
'id': 11608,
'ParentID': 1,
'SubClass': 0,
'IP': '192.168.99.003',
'Name': '二氧化碳',
'NetStatus': 1,
'SUBTYPE': '101'
},
{
'id': 11609,
'ParentID': 1,
'SubClass': 0,
'IP': '192.168.99.004',
'Name': '甲醛',
'NetStatus': 1,
'SUBTYPE': '101'
},
{
'id': 11682,
'ParentID': 1,
'SubClass': 0,
'IP': '192.168.99.101:5004',
'Name': '壁挂升降空气净化机',
'NetStatus': 1,
'SUBTYPE': '11'
}, {
'id': 11486,
},
{
'id': 11695,
'ParentID': 1,
'SubClass': 0,
'IP': '192.168.99.101:5003',
'Name': '恒湿净化一体机',
'NetStatus': 1,
'SUBTYPE': '11'
}, {
'id': 11519,
},
{
'id': 11728,
'ParentID': 1,
'SubClass': 0,
'IP': '',
'Name': '空调红外控制',
'IP': '192.168.99.102:5005',
'Name': '环境监测1',
'NetStatus': 1,
'SUBTYPE': '1'
}, {
'id': 11520,
'SUBTYPE': '25'
},
{
'id': 11800,
'ParentID': 1,
'SubClass': 0,
'IP': '192.168.99.101:6003',
'Name': '开关量',
'IP': '192.168.99.102:5003.3',
'Name': '环境监测3_3',
'NetStatus': 1,
'SUBTYPE': '11'
}]
'SUBTYPE': '25'
},
{
'id': 11824,
'ParentID': 1,
'SubClass': 0,
'IP': '192.168.99.102:5004.2',
'Name': '环境监测2_2',
'NetStatus': 1,
'SUBTYPE': '25'
}
]
export const mockIpData = {
// 温湿度

31
src/views/environmentalScreen/index.vue

@ -155,34 +155,41 @@ export default {
await alarmApi.FetchYpGetSite().then((data) => {
if (data && data.length > 0) {
this.allDisplayConfigData = data
// IP
this.handleDeviceIpList()
} else {
this.allDisplayConfigData = []
}
// this.allDisplayConfigData = allDeviceData
})
//
// +
if (this.allDeviceIds.length > 0) {
this.currentDeviceName = this.ipToNameMap[this.allDeviceIds[0]] || ''
await this.getRealTimeData(this.allDeviceIds[0])
console.log('初始加载IP数据:', this.allDeviceIds[0])
} else {
console.warn('无有效设备IP,停止轮询')
this.newAlarm = []
}
},
mounted() {
this.iframeWin = this.$refs.myIframe?.contentWindow
if (this.allDeviceIds.length > 0) {
//
this.dataTimer = setInterval(async() => {
const currentIp = this.getNextIp()
this.currentDeviceName = this.ipToNameMap[currentIp] || ''
await this.getRealTimeData(currentIp)
}, 10000)
console.log(`启动IP轮询,共${this.allDeviceIds.length}个有效IP:`, this.allDeviceIds)
} else {
console.warn('无有效设备IP,停止轮询')
this.newAlarm = []
}
},
mounted() {
this.iframeWin = this.$refs.myIframe?.contentWindow
// if (this.allDeviceIds.length > 0) {
// this.dataTimer = setInterval(async() => {
// const currentIp = this.getNextIp()
// this.currentDeviceName = this.ipToNameMap[currentIp] || ''
// await this.getRealTimeData(currentIp)
// }, 10000)
// console.log(`IP${this.allDeviceIds.length}IP`, this.allDeviceIds)
// }
// echarts
this.echartsTimer = setInterval(() => {
@ -228,6 +235,8 @@ export default {
*/
getNextIp() {
if (this.allDeviceIds.length === 0) return ''
//
this.currentIpIndex = this.currentIpIndex % this.allDeviceIds.length
const ip = this.allDeviceIds[this.currentIpIndex]
this.currentIpIndex = (this.currentIpIndex + 1) % this.allDeviceIds.length
console.log(`轮询切换 - 当前IP:${ip},下一个索引:${this.currentIpIndex}`)

44
src/views/home.vue

@ -205,7 +205,7 @@ import { FetchWaitBorrower } from '@/api/archivesManage/lendManage'
import alarmApi from '@/api/home/alarm'
// import { allDeviceData, mockIpData } from '@/views/environmentalScreen/index.js'
// // mock
// mock
// const mockFetchDataForIP = (params) => {
// return new Promise((resolve) => {
// setTimeout(() => {
@ -310,7 +310,8 @@ export default {
ipToNameMap: {}, // IP
currentDeviceName: '', //
currentIpIndex: 0, // IP
excludeIpList: ['192.168.99.101:6003'] // IP
excludeIpList: ['192.168.99.101:6003'], // IP
dataTimer: null //
}
},
computed: {
@ -318,12 +319,16 @@ export default {
'roles'
])
},
beforeDestroy() {
if (this.dataTimer) {
clearInterval(this.dataTimer)
this.dataTimer = null
console.log('轮询定时器已清除')
}
},
async created() {
this.getWaitBorrower()
// console.log('allDeviceData:', allDeviceData)
// this.allDisplayConfigData = allDeviceData
// this.handleDeviceIpList()
//
await alarmApi.FetchYpGetSite().then((data) => {
if (data && data.length > 0) {
@ -333,28 +338,37 @@ export default {
} else {
this.allDisplayConfigData = []
}
// this.allDisplayConfigData = allDeviceData
// this.handleDeviceIpList()
})
//
// +
if (this.allDeviceIds.length > 0) {
this.currentDeviceName = this.ipToNameMap[this.allDeviceIds[0]] || ''
await this.getRealTimeData(this.allDeviceIds[0])
console.log('初始加载IP数据:', this.allDeviceIds[0])
} else {
console.warn('无有效设备IP,停止轮询')
this.newAlarm = []
}
},
mounted() {
if (this.allDeviceIds.length > 0) {
//
this.dataTimer = setInterval(async() => {
const currentIp = this.getNextIp()
this.currentDeviceName = this.ipToNameMap[currentIp] || ''
await this.getRealTimeData(currentIp)
}, 10000)
console.log(`启动IP轮询,共${this.allDeviceIds.length}个有效IP:`, this.allDeviceIds)
} else {
console.warn('无有效设备IP,停止轮询')
this.newAlarm = []
}
},
mounted() {
// if (this.allDeviceIds.length > 0) {
// this.dataTimer = setInterval(async() => {
// const currentIp = this.getNextIp()
// this.currentDeviceName = this.ipToNameMap[currentIp] || ''
// await this.getRealTimeData(currentIp)
// }, 10000)
// console.log(`IP${this.allDeviceIds.length}IP`, this.allDeviceIds)
// }
},
methods: {
/**
* 处理设备IP列表去重+排除+名称映射
@ -383,6 +397,8 @@ export default {
*/
getNextIp() {
if (this.allDeviceIds.length === 0) return ''
//
this.currentIpIndex = this.currentIpIndex % this.allDeviceIds.length
const ip = this.allDeviceIds[this.currentIpIndex]
this.currentIpIndex = (this.currentIpIndex + 1) % this.allDeviceIds.length
console.log(`轮询切换 - 当前IP:${ip},下一个索引:${this.currentIpIndex}`)

119
src/views/storeManage/warehouse3D/archivesStorage/index.js

@ -1,4 +1,5 @@
export const allDeviceData = [{
export const allDeviceData = [
{
'id': 1,
'ParentID': 0,
'SubClass': 0,
@ -6,7 +7,8 @@ export const allDeviceData = [{
'Name': '环境监控',
'NetStatus': 1,
'SUBTYPE': '1'
}, {
},
{
'id': 11303,
'ParentID': 1,
'SubClass': 0,
@ -14,63 +16,116 @@ export const allDeviceData = [{
'Name': '温湿度',
'NetStatus': 1,
'SUBTYPE': '17'
}, {
'id': 11355,
},
{
'id': 11519,
'ParentID': 1,
'SubClass': 0,
'IP': '192.168.99.102:5003:3',
'Name': '环境监测3_3',
'IP': '',
'Name': '空调红外控制',
'NetStatus': 1,
'SUBTYPE': '25'
}, {
'id': 11379,
'SUBTYPE': '1'
},
{
'id': 11520,
'ParentID': 1,
'SubClass': 0,
'IP': '192.168.99.102:5004:2',
'Name': '环境监测2_2',
'IP': '192.168.99.101:6003',
'Name': '开关量',
'NetStatus': 1,
'SUBTYPE': '25'
}, {
'id': 11403,
'SUBTYPE': '11'
},
{
'id': 11605,
'ParentID': 1,
'SubClass': 0,
'IP': '192.168.99.102:5005',
'Name': '环境监测1',
'IP': '192.168.99.000',
'Name': 'PM2.5 浓度',
'NetStatus': 1,
'SUBTYPE': '25'
}, {
'id': 11440,
'SUBTYPE': '101'
},
{
'id': 11606,
'ParentID': 1,
'SubClass': 0,
'IP': '192.168.99.001',
'Name': 'PM10浓度',
'NetStatus': 1,
'SUBTYPE': '101'
},
{
'id': 11607,
'ParentID': 1,
'SubClass': 0,
'IP': '192.168.99.002',
'Name': 'TWOC',
'NetStatus': 1,
'SUBTYPE': '101'
},
{
'id': 11608,
'ParentID': 1,
'SubClass': 0,
'IP': '192.168.99.003',
'Name': '二氧化碳',
'NetStatus': 1,
'SUBTYPE': '101'
},
{
'id': 11609,
'ParentID': 1,
'SubClass': 0,
'IP': '192.168.99.004',
'Name': '甲醛',
'NetStatus': 1,
'SUBTYPE': '101'
},
{
'id': 11682,
'ParentID': 1,
'SubClass': 0,
'IP': '192.168.99.101:5004',
'Name': '壁挂升降空气净化机',
'NetStatus': 1,
'SUBTYPE': '11'
}, {
'id': 11486,
},
{
'id': 11695,
'ParentID': 1,
'SubClass': 0,
'IP': '192.168.99.101:5003',
'Name': '恒湿净化一体机',
'NetStatus': 1,
'SUBTYPE': '11'
}, {
'id': 11519,
},
{
'id': 11728,
'ParentID': 1,
'SubClass': 0,
'IP': '',
'Name': '空调红外控制',
'IP': '192.168.99.102:5005',
'Name': '环境监测1',
'NetStatus': 1,
'SUBTYPE': '1'
}, {
'id': 11520,
'SUBTYPE': '25'
},
{
'id': 11800,
'ParentID': 1,
'SubClass': 0,
'IP': '192.168.99.101:6003',
'Name': '开关量',
'IP': '192.168.99.102:5003.3',
'Name': '环境监测3_3',
'NetStatus': 1,
'SUBTYPE': '11'
}]
'SUBTYPE': '25'
},
{
'id': 11824,
'ParentID': 1,
'SubClass': 0,
'IP': '192.168.99.102:5004.2',
'Name': '环境监测2_2',
'NetStatus': 1,
'SUBTYPE': '25'
}
]
export const mockIpData = {
// 温湿度

37
src/views/storeManage/warehouse3D/archivesStorage/index.vue

@ -112,18 +112,26 @@ export default {
await alarmApi.FetchYpGetSite().then((data) => {
if (data && data.length > 0) {
this.allDisplayConfigData = data
// IP
this.handleDeviceIpList()
} else {
this.allDisplayConfigData = []
}
// this.allDisplayConfigData = allDeviceData
// this.handleDeviceIpList()
})
// +
if (this.allDeviceIds.length > 0) {
//
this.currentDeviceName = this.ipToNameMap[this.allDeviceIds[0]] || ''
await this.getRealTimeData(this.allDeviceIds[0])
console.log('初始加载IP数据:', this.allDeviceIds[0])
//
this.timer = setInterval(async() => {
const currentIp = this.getNextIp()
this.currentDeviceName = this.ipToNameMap[currentIp] || ''
await this.getRealTimeData(currentIp)
}, 10000)
console.log(`启动IP轮询,共${this.allDeviceIds.length}个有效IP:`, this.allDeviceIds)
} else {
console.warn('无有效设备IP,停止轮询')
this.newAlarm = []
@ -134,15 +142,15 @@ export default {
_this.iframeWin = this.$refs.myIframe.contentWindow
window.addEventListener('message', this.handleMessageEvent)
if (this.allDeviceIds.length > 0) {
this.timer = setInterval(async() => {
const currentIp = _this.getNextIp()
//
_this.currentDeviceName = _this.ipToNameMap[currentIp] || ''
await _this.getRealTimeData(currentIp)
}, 10000)
console.log(`启动IP轮询,共${this.allDeviceIds.length}个有效IP:`, this.allDeviceIds)
}
// if (this.allDeviceIds.length > 0) {
// this.timer = setInterval(async() => {
// const currentIp = _this.getNextIp()
// //
// _this.currentDeviceName = _this.ipToNameMap[currentIp] || ''
// await _this.getRealTimeData(currentIp)
// }, 10000)
// console.log(`IP${this.allDeviceIds.length}IP`, this.allDeviceIds)
// }
},
beforeDestroy() {
if (this.timer) {
@ -172,16 +180,17 @@ export default {
},
/**
* 获取下一个轮询IP循环切换
* 获取下一个轮询IP循环切换
*/
getNextIp() {
if (this.allDeviceIds.length === 0) return ''
//
this.currentIpIndex = this.currentIpIndex % this.allDeviceIds.length
const ip = this.allDeviceIds[this.currentIpIndex]
this.currentIpIndex = (this.currentIpIndex + 1) % this.allDeviceIds.length
console.log(`轮询切换 - 当前IP:${ip},下一个索引:${this.currentIpIndex}`)
return ip
},
/**
* 处理iframe消息事件
*/

50
src/views/system/archiveStatistics/mixins/statistics.js

@ -62,30 +62,64 @@ export const statisticsCrud = {
// 组件共用方法
methods: {
// 档案借阅统计
// getBorrowerNumSta() {
// FetchInitBorrowerNumStatistics().then(res => {
// if (res) {
// delete res.total
// // 固定排序 '在库档案', '已借档案', '待借档案', '逾期档案', '异常档案'
// const borrowerArr = []
// for (const i in res) {
// const obj = {}
// obj.name = i
// obj.value = res[i]
// if (i === 'inStorage') {
// obj.sequence = 1
// } else if (i === 'borrow') {
// obj.sequence = 2
// } else if (i === 'waitBorrow') {
// obj.sequence = 3
// } else if (i === 'overdue') {
// obj.sequence = 4
// } else if (i === 'abnormal') {
// obj.sequence = 5
// }
// borrowerArr.push(obj)
// }
// this.arrSortByKey(borrowerArr, 'sequence', false)
// borrowerArr.forEach(item => {
// this.lendData.push(item.value)
// console.log(this.lendData)
// })
// }
// })
// },
getBorrowerNumSta() {
FetchInitBorrowerNumStatistics().then(res => {
if (res) {
delete res.total
// 固定排序 '在库档案', '已借档案', '待借档案', '逾期档案', '异常档案'
// 新的固定排序: '逾期档案', '已借档案', '在库档案'
const borrowerArr = []
for (const i in res) {
const obj = {}
obj.name = i
obj.value = res[i]
if (i === 'inStorage') {
// 重新定义排序序号
if (i === 'overdue') { // 逾期档案 - 第1位
obj.sequence = 1
} else if (i === 'borrow') {
} else if (i === 'borrow') { // 已借档案 - 第2位
obj.sequence = 2
} else if (i === 'waitBorrow') {
} else if (i === 'inStorage') { // 在库档案 - 第3位
obj.sequence = 3
} else if (i === 'overdue') {
obj.sequence = 4
} else if (i === 'abnormal') {
obj.sequence = 5
}
// 只添加需要的三类数据,过滤掉待借、异常档案
if (obj.sequence) {
borrowerArr.push(obj)
}
}
// 按sequence排序
this.arrSortByKey(borrowerArr, 'sequence', false)
// 清空原有数据(避免多次调用累加)
this.lendData = []
borrowerArr.forEach(item => {
this.lendData.push(item.value)
})

Loading…
Cancel
Save