|
|
|
@ -113,8 +113,11 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="env-main-right"> |
|
|
|
<!-- 环控实时报警 --> |
|
|
|
<warehouse-warning :height="'calc(100% - 38px)'" /> |
|
|
|
<AccessDoor :height="'calc(100% - 40px)'" /> |
|
|
|
<!-- 门禁出入记录 --> |
|
|
|
<AccessDoor :height="'calc(100% - 40px)'" size="5" /> |
|
|
|
<!-- 警告记录 --> |
|
|
|
<div class="env-item container-wrap"> |
|
|
|
<span class="right-top-line" /> |
|
|
|
<span class="left-bottom-line" /> |
|
|
|
@ -138,17 +141,17 @@ import AccessDoor from '@/views/components/AccessDoor' |
|
|
|
import { statisticsCrud } from '@/views/system/archiveStatistics/mixins/statistics' |
|
|
|
import displayConfigApi from '@/api/storeManage/displayConfig' |
|
|
|
import alarmApi from '@/api/home/alarm' |
|
|
|
// import { allDeviceData, mockIpData } from './index.js' |
|
|
|
// 同步mock方法 |
|
|
|
// const mockFetchDataForIP = (params) => { |
|
|
|
// return new Promise((resolve) => { |
|
|
|
// setTimeout(() => { |
|
|
|
// const ip = params.ip |
|
|
|
// const result = mockIpData[ip] || { code: 200, message: '操作成功', data: [], timestamp: Date.now() } |
|
|
|
// resolve(result.data) |
|
|
|
// }, 500) |
|
|
|
// }) |
|
|
|
// } |
|
|
|
import { allDeviceData, mockIpData } from './index.js' |
|
|
|
|
|
|
|
const mockFetchDataForIP = (params) => { |
|
|
|
return new Promise((resolve) => { |
|
|
|
setTimeout(() => { |
|
|
|
const ip = params.ip |
|
|
|
const result = mockIpData[ip] || { code: 200, message: '操作成功', data: [], timestamp: Date.now() } |
|
|
|
resolve(result.data) |
|
|
|
}, 500) |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
export default { |
|
|
|
name: 'EnvironmentalScreen', |
|
|
|
@ -254,17 +257,17 @@ export default { |
|
|
|
|
|
|
|
// 初始化逻辑 |
|
|
|
window.getIframeLoading = this.getIframeLoading |
|
|
|
// this.allDisplayConfigData = allDeviceData |
|
|
|
// this.handleDeviceIpList() |
|
|
|
this.allDisplayConfigData = allDeviceData |
|
|
|
this.handleDeviceIpList() |
|
|
|
|
|
|
|
await alarmApi.FetchYpGetSite().then((data) => { |
|
|
|
if (data && data.length > 0) { |
|
|
|
this.allDisplayConfigData = data |
|
|
|
this.handleDeviceIpList() |
|
|
|
} else { |
|
|
|
this.allDisplayConfigData = [] |
|
|
|
} |
|
|
|
}) |
|
|
|
// 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() |
|
|
|
@ -308,7 +311,6 @@ export default { |
|
|
|
) |
|
|
|
|
|
|
|
if (this.cameraList.length > 0) { |
|
|
|
// 更新海康配置为目标摄像头的信息 |
|
|
|
const targetCamera = this.cameraList[0].deviceInfo |
|
|
|
this.hkConfig = { |
|
|
|
username: targetCamera.deviceAccount || 'admin', |
|
|
|
@ -386,9 +388,9 @@ export default { |
|
|
|
const allData = [] |
|
|
|
for (const ip of this.allDeviceIds) { |
|
|
|
try { |
|
|
|
// const data = await mockFetchDataForIP({ ip }) |
|
|
|
// 真实请求 |
|
|
|
const data = await alarmApi.FetchDataForIP({ ip }) |
|
|
|
const data = await mockFetchDataForIP({ ip }) |
|
|
|
// 真实请求 |
|
|
|
// const data = await alarmApi.FetchDataForIP({ ip }) |
|
|
|
// 过滤需要的指标并添加到总数据 |
|
|
|
const filtered = data.filter(item => this.keepIndicators.includes(item.subName)) |
|
|
|
if (filtered.length > 0) { |
|
|
|
@ -429,7 +431,6 @@ export default { |
|
|
|
case 'PM2.5浓度': |
|
|
|
sumMap.pm25.sum += value |
|
|
|
sumMap.pm25.count++ |
|
|
|
// 只记录第一个非空单位(确保单位统一) |
|
|
|
if (!sumMap.pm25.unit && unit) sumMap.pm25.unit = unit |
|
|
|
break |
|
|
|
case 'TVOC': |
|
|
|
@ -523,7 +524,6 @@ export default { |
|
|
|
const co2 = parseFloat(this.avgData.co2) |
|
|
|
|
|
|
|
let aqi = 0 |
|
|
|
// 业务判定逻辑(可根据实际需求调整阈值) |
|
|
|
if (pm25 > 50 || pm10 > 100 || formaldehyde > 0.1 || co2 > 1000) { |
|
|
|
aqi = Math.floor(Math.random() * 50) + 100 |
|
|
|
this.aqiStatus = '污染' |
|
|
|
|