diff --git a/.env.development b/.env.development
index 106bc12..9d520ae 100644
--- a/.env.development
+++ b/.env.development
@@ -15,7 +15,7 @@ ENV = 'development'
VUE_APP_BASE_API = 'http://192.168.99.72:7080'
VUE_APP_WS_API = 'ws://192.168.99.72:7080'
VUE_APP_WEBRTCSTREAMER_API = '127.0.0.1:8000'
-VUE_APP_SDEVID = "D003"
+VUE_APP_SDEVID = "D005"
# 是否启用 babel-plugin-dynamic-import-node插件
VUE_CLI_BABEL_TRANSPILE_MODULES = true
diff --git a/src/views/components/AccessDoor.vue b/src/views/components/AccessDoor.vue
index 239249e..ba59922 100644
--- a/src/views/components/AccessDoor.vue
+++ b/src/views/components/AccessDoor.vue
@@ -75,11 +75,11 @@ export default {
},
methods: {
toPage() {
- if (this.roles.includes('admin') || this.roles.includes('logManage:list')) {
+ if (this.roles.includes('admin') || this.roles.includes('RunningLog:list')) {
this.$router.push({
- name: 'LogManage',
+ name: 'RunningLog',
params: {
- locationIndex: 3
+ locationIndex: 1
}
})
} else {
diff --git a/src/views/components/WarehouseWarning.vue b/src/views/components/WarehouseWarning.vue
index 4e1daf7..4ef6364 100644
--- a/src/views/components/WarehouseWarning.vue
+++ b/src/views/components/WarehouseWarning.vue
@@ -70,11 +70,11 @@ export default {
},
methods: {
toPage() {
- if (this.roles.includes('admin') || this.roles.includes('logManage:list')) {
+ if (this.roles.includes('admin') || this.roles.includes('RunningLog:list')) {
this.$router.push({
- name: 'LogManage',
+ name: 'RunningLog',
params: {
- locationIndex: 2
+ locationIndex: 0
}
})
} else {
diff --git a/src/views/components/category/PreviewForm.vue b/src/views/components/category/PreviewForm.vue
index 8536c00..72afc9a 100644
--- a/src/views/components/category/PreviewForm.vue
+++ b/src/views/components/category/PreviewForm.vue
@@ -59,7 +59,7 @@
-
+
diff --git a/src/views/environmentalScreen/index.vue b/src/views/environmentalScreen/index.vue
index fa9d181..84fe9b5 100644
--- a/src/views/environmentalScreen/index.vue
+++ b/src/views/environmentalScreen/index.vue
@@ -29,48 +29,7 @@
环控数据
-
-
-
@@ -242,7 +171,7 @@
@@ -386,8 +315,10 @@ export default {
targetDeviceIps: ['192.168.99.101:5003', '192.168.99.101:6003', '192.168.99.101:5004'],
getDeviceFlag: false,
totalDeviceNum: 0,
- onlineDeviceNum: 0,
- offlineDeviceNum: 0,
+ onlineDeviceNum: 0, // 合并后的在线总数
+ offlineDeviceNum: 0, // 合并后的离线总数
+ apiOnlineNum: 0,
+ apiOfflineNum: 0,
alarmStatisticsRaw: [], // 原始告警统计数据
alarmChartData: [], // 格式化后给饼图的数据源
alarmRefreshTimer: null, // 告警数据刷新定时器
@@ -428,6 +359,24 @@ export default {
},
showScroll() {
return this.validDisplayConfigData.length > 8
+ },
+ // 统计本地配置设备的在线/离线数量
+ localDeviceStats() {
+ const stats = {
+ online: 0,
+ offline: 0
+ }
+ this.allDisplayConfigData.forEach(item => {
+ const ip = (item.IP || '').trim()
+ if (ip) {
+ if (item.NetStatus === 1) {
+ stats.online++
+ } else if (item.NetStatus === 0) {
+ stats.offline++
+ }
+ }
+ })
+ return stats
}
},
async created() {
@@ -439,26 +388,7 @@ export default {
this.getTodayHikAlarmLog()
// 初始化
window.getIframeLoading = this.getIframeLoading
- // this.allDisplayConfigData = allDeviceData
- // this.handleDeviceIpList()
- // await alarmApi.FetchYpGetSite().then((data) => {
- // if (data && data.length > 0) {
- // this.allDisplayConfigData = data
- // this.handleDeviceIpList()
- // } else {
- // this.allDisplayConfigData = []
- // }
- // })
-
- // if (this.allDeviceIds.length > 0) {
- // await this.getAllDevicesData()
- // this.calcAllAvgData() // 计算所有指标平均值
- // this.calcAQIByAvg() // 根据平均值计算AQI
- // } else {
- // console.warn('无设备IP数据')
- // this.hasValidData = false
- // }
await this.fullDataRefresh()
this.deviceConfigTimer = setInterval(() => {
this.fullDataRefresh()
@@ -583,12 +513,68 @@ export default {
},
getDevice() {
getDeviceOnoff().then(data => {
+ // 保存接口返回的原始数量
+ this.apiOnlineNum = data.online.length
+ this.apiOfflineNum = data.offline.length
this.getDeviceFlag = true
this.totalDeviceNum = data.deviceall.length
- this.onlineDeviceNum = data.online.length
- this.offlineDeviceNum = data.offline.length
- // this.onlineDevice = data.online
- // this.offDevice = data.offline
+
+ // 计算合并后的数量
+ this.calcMergedDeviceNum()
+ }).catch(error => {
+ console.error('获取设备在线离线数量失败:', error)
+ this.getDeviceFlag = true
+ this.apiOnlineNum = 0
+ this.apiOfflineNum = 0
+ this.calcMergedDeviceNum()
+ })
+ },
+ // 计算合并后的在线/离线设备数量
+ calcMergedDeviceNum() {
+ // 1. 先重新计算本地设备统计(包含IP明细)
+ const localStats = {
+ online: 0,
+ offline: 0,
+ onlineIps: [],
+ offlineIps: []
+ }
+ // 遍历所有IP非空的设备,统计数量并记录IP
+ this.allDisplayConfigData.forEach(item => {
+ const ip = (item.IP || '').trim()
+ if (ip) {
+ if (item.NetStatus === 1) {
+ localStats.online++
+ localStats.onlineIps.push({
+ ip: ip,
+ name: item.Name || '未知设备'
+ })
+ } else if (item.NetStatus === 0) {
+ localStats.offline++
+ localStats.offlineIps.push({
+ ip: ip,
+ name: item.Name || '未知设备'
+ })
+ }
+ }
+ })
+
+ // 2. 合并数量
+ this.onlineDeviceNum = this.apiOnlineNum + localStats.online
+ this.offlineDeviceNum = this.apiOfflineNum + localStats.offline
+
+ // 3. 打印详细日志(包含IP明细)
+ console.log('===== 合并后的设备数量详情 =====', {
+ // 接口返回数据
+ 接口在线数量: this.apiOnlineNum,
+ 接口离线数量: this.apiOfflineNum,
+ // 本地配置数据(含IP)
+ 本地在线数量: localStats.online,
+ 本地在线设备IP: localStats.onlineIps,
+ 本地离线数量: localStats.offline,
+ 本地离线设备IP: localStats.offlineIps,
+ // 合并后总数
+ 总在线数量: this.onlineDeviceNum,
+ 总离线数量: this.offlineDeviceNum
})
},
getVideoUrl() {
@@ -673,8 +659,8 @@ export default {
this.allDeviceIds = Array.from(ipSet)
},
/**
- * 获取所有设备的实时数据(修改:保留设备IP关联)
- */
+ * 获取所有设备的实时数据(修改:保留设备IP关联)
+ */
async getAllDevicesData() {
const allData = []
for (const ip of this.allDeviceIds) {
@@ -702,9 +688,6 @@ export default {
/**
* 计算所有设备指标的平均值(适配ON/OFF告警状态,保留单位)
*/
- /**
- * 计算所有设备指标的平均值(适配ON/OFF告警状态,保留单位)
- */
calcAllAvgData() {
if (!this.hasValidData) return
diff --git a/vue.config.js b/vue.config.js
index 5372b5f..0922101 100644
--- a/vue.config.js
+++ b/vue.config.js
@@ -6,7 +6,7 @@ function resolve(dir) {
return path.join(__dirname, dir)
}
const name = defaultSettings.title // 网址标题
-const port = 8013 // 端口配置
+const port = 7080 // 端口配置
// All configuration item explanations can be find in https://cli.vuejs.org/config/
module.exports = {
// hash 模式下可使用