From c30feb4b500e7536011497038b394d1d25318754 Mon Sep 17 00:00:00 2001
From: z_yu <1534695664@qq.com>
Date: Tue, 16 Aug 2022 17:12:15 +0800
Subject: [PATCH] =?UTF-8?q?3D=E5=BA=93=E6=88=BF=E6=A1=A3=E6=A1=88=E5=BA=93?=
=?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=98=BE=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/thirdApi/index.js | 11 +
src/assets/styles/yxk-admin.scss | 4 +-
.../deviceManage/module/bindParams.vue | 2 +-
.../warehouse3D/archivesStorage/index.vue | 225 +++++++++---------
4 files changed, 132 insertions(+), 110 deletions(-)
create mode 100644 src/api/thirdApi/index.js
diff --git a/src/api/thirdApi/index.js b/src/api/thirdApi/index.js
new file mode 100644
index 0000000..4a69c0f
--- /dev/null
+++ b/src/api/thirdApi/index.js
@@ -0,0 +1,11 @@
+import request from '@/utils/request'
+
+export function getRealTimeData(data) {
+ return request({
+ url: 'api/thirdapi/getrealtimedata',
+ method: 'post',
+ data
+ })
+}
+
+export default { getRealTimeData }
diff --git a/src/assets/styles/yxk-admin.scss b/src/assets/styles/yxk-admin.scss
index f807bc4..d5a7215 100644
--- a/src/assets/styles/yxk-admin.scss
+++ b/src/assets/styles/yxk-admin.scss
@@ -1140,13 +1140,13 @@ input[type='number'] {
.screen-env-list{
display: flex;
li{
- flex: 1;
+ // flex: 0;
display: flex;
flex-wrap: nowrap;
align-items: center;
align-content: center;
justify-content: center;
- // width: calc(100%/6);
+ width: calc(100%/6);
height: 80px;
margin-right: 20px;
background: url('~@/assets/images/data_border_default.png') no-repeat;
diff --git a/src/views/storeManage/deviceManage/module/bindParams.vue b/src/views/storeManage/deviceManage/module/bindParams.vue
index fa74e0b..3bfd5ad 100644
--- a/src/views/storeManage/deviceManage/module/bindParams.vue
+++ b/src/views/storeManage/deviceManage/module/bindParams.vue
@@ -53,7 +53,7 @@ export default {
]
},
params: [],
- form: {},
+ form: { paramId: '', paramName: '', unit: '' },
deviceInfoId: null,
loading: false,
bindParamsVisible: false
diff --git a/src/views/storeManage/warehouse3D/archivesStorage/index.vue b/src/views/storeManage/warehouse3D/archivesStorage/index.vue
index 6d0f51c..30b7a77 100644
--- a/src/views/storeManage/warehouse3D/archivesStorage/index.vue
+++ b/src/views/storeManage/warehouse3D/archivesStorage/index.vue
@@ -5,47 +5,46 @@
- -
+
-
-
60
-
温度℃
+
{{ topDisplayData.DAK_DIV_TOP_001.curValue }}
+
温度{{ topDisplayData.DAK_DIV_TOP_001.unit }}
- -
+
-
-
60
-
湿度%
+
{{ topDisplayData.DAK_DIV_TOP_002.curValue }}
+
湿度{{ topDisplayData.DAK_DIV_TOP_002.unit }}
- -
+
-
-
60
-
CO2ppm
+
{{ topDisplayData.DAK_DIV_TOP_003.curValue }}
+
CO2{{ topDisplayData.DAK_DIV_TOP_003.unit }}
- -
+
-
-
60
-
VOCmg/m³
+
{{ topDisplayData.DAK_DIV_TOP_004.curValue }}
+
VOC{{ topDisplayData.DAK_DIV_TOP_004.unit }}
- -
-
+
-
-
60
-
PM2.5ug/m³
+
{{ topDisplayData.DAK_DIV_TOP_005.curValue }}
+
PM2.5{{ topDisplayData.DAK_DIV_TOP_005.unit }}
- -
-
+
-
+
-
60
-
PM10ug/m³
+
{{ topDisplayData.DAK_DIV_TOP_006.curValue }}
+
PM10{{ topDisplayData.DAK_DIV_TOP_006.unit }}
@@ -102,47 +101,83 @@
import WarehouseWarning from '@/views/components/WarehouseWarning'
import SecurityDoor from '@/views/components/SecurityDoor'
import displayConfigApi from '@/api/storeManage/displayConfig'
+import thirdApi from '@/api/thirdApi'
export default {
name: 'FullView',
components: { WarehouseWarning, SecurityDoor },
data() {
return {
roomId: 'D6490DA3D4261E8C26D0E3',
- TopDisplayConfigData: [],
- OaoDisplayConfigData: [],
- topDisplayData: []
+ allDisplayConfigData: [],
+ displayConfigData: [],
+ url: '',
+ allDeviceIds: [],
+ oaoMessage: [],
+ topDisplayData: {
+ DAK_DIV_TOP_001: {
+ show: false,
+ curValue: '',
+ unit: '',
+ curstatus: 0
+ },
+ DAK_DIV_TOP_002: {
+ show: false,
+ curValue: '',
+ unit: '',
+ curstatus: 0
+ },
+ DAK_DIV_TOP_003: {
+ show: false,
+ curValue: '',
+ unit: '',
+ curstatus: 0
+ },
+ DAK_DIV_TOP_004: {
+ show: false,
+ curValue: '',
+ unit: '',
+ curstatus: 0
+ },
+ DAK_DIV_TOP_005: {
+ show: false,
+ curValue: '',
+ unit: '',
+ curstatus: 0
+ },
+ DAK_DIV_TOP_006: {
+ show: false,
+ curValue: '',
+ unit: '',
+ curstatus: 0
+ }
+ }
// ,
// iframeWin: null,
// timer: null, // 定时器id 滚动表格
// isScroll: false // 是否滚动
}
},
- created() {
+ async created() {
window.getIframeLoading = this.getIframeLoading // 把vue实例中的方法引用给window对象
- displayConfigApi.list({ storeroomId: this.roomId }).then((data) => {
- this.TopDisplayConfigData = data.filter((item) => { return item.divPosition.includes('TOP') })
- this.OaoDisplayConfigData = data.filter((item) => { return item.divPosition.includes('OAO') })
- })
- const topDeviceIds = []
- const oaoDeviceIds = []
- this.TopDisplayConfigData.forEach(element => {
+ this.allDisplayConfigData = await displayConfigApi.list({ storeroomId: this.roomId })
+ this.allDisplayConfigData.forEach(element => {
if (element.isDisplay && element.bindState) {
- topDeviceIds.push(element.deviceInfo.id)
- }
- })
- this.OaoDisplayConfigData.forEach(element => {
- if (element.isDisplay && element.bindState) {
- oaoDeviceIds.push(element.deviceInfo.id)
+ this.allDeviceIds.push(element.deviceInfo.deviceId)
+ if (!this.url) {
+ this.url = 'http://' + element.deviceInfo.deviceIp + ':' + element.deviceInfo.devicePort
+ }
}
})
+ this.displayConfigData = this.allDisplayConfigData.filter((item) => { return item.isDisplay && item.bindState })
+ await this.getRealTimeData()
},
mounted() {
const _this = this
_this.iframeWin = this.$refs.myIframe.contentWindow
// inframe 加载完成之后
- document.getElementById('myIframe').onload = function() {
- _this.deviceState()
- }
+ // document.getElementById('myIframe').onload = function() {
+ // _this.deviceState()
+ // }
window.addEventListener('message', this.handleMessageDevice)
},
methods: {
@@ -150,44 +185,19 @@ export default {
getIframeLoading(value) {
// console.log(`我是iframe传过来的参数:${value}`)
if (value === 'false') {
- console.log(this.OaoDisplayConfigData)
- this.OaoDisplayConfigData.forEach(element => {
- if (!element.isDisplay || !element.bindState) {
+ this.allDisplayConfigData.forEach(element => {
+ if ((!element.isDisplay || !element.bindState) && element.divPosition.includes('CAM')) {
this.handleHide(element.divPosition)
}
})
- this.handleAlarm('DAK_MO_OAO_003')
+ // this.handleAlarm('DAK_MO_OAO_003')
+ this.deviceState()
}
},
// 传入设备状态data / 给iframe传初始值
deviceState(e) {
this.iframeWin.postMessage({
- data: [
- {
- id: 'DAK_MO_OAO_001',
- wendu: 6,
- sidu: 10,
- alarmState: false
- },
- {
- id: 'DAK_MO_OAO_002',
- wendu: 2,
- sidu: 5,
- alarmState: false
- },
- {
- id: 'DAK_MO_OAO_003',
- wendu: 3,
- sidu: 1,
- alarmState: false
- },
- {
- id: 'DAK_MO_OAO_004',
- wendu: 6,
- sidu: 6,
- alarmState: false
- }
- ]
+ data: this.oaoMessage
}, '*')
},
// 点击查看设备状况 / 密集架列号
@@ -223,44 +233,45 @@ export default {
} else {
return ''
}
+ },
+ getRealTimeData() {
+ thirdApi.getRealTimeData({ ids: this.allDeviceIds, url: this.url }).then((data) => {
+ this.displayConfigData.forEach(element => {
+ if (element.divPosition.includes('TOP') && element.deviceSpecParams[0]) {
+ const result = data.find((item) => {
+ return item.property_id === element.deviceSpecParams[0].paramId && item.device_id === element.deviceInfo.deviceId
+ })
+ this.$set(this.topDisplayData, element.divPosition, {
+ show: true,
+ curValue: result.curvalue,
+ unit: result.unit,
+ curstatus: result.curstatus
+ })
+ } else {
+ const wenduParamId = element.deviceSpecParams.find((item) => { return item.paramName === '温度' })?.paramId
+ const siduParamId = element.deviceSpecParams.find((item) => { return item.paramName === '湿度' })?.paramId
+ let wendu = {}
+ let sidu = {}
+ if (wenduParamId) {
+ wendu = data.find((item) => {
+ return item.property_id === wenduParamId && item.device_id === element.deviceInfo.deviceId
+ })
+ }
+ if (siduParamId) {
+ sidu = data.find((item) => {
+ return item.property_id === siduParamId && item.device_id === element.deviceInfo.deviceId
+ })
+ }
+ this.oaoMessage.push({
+ id: element.divPosition,
+ wendu: (wendu?.curvalue) ? (wendu?.curvalue) : '-',
+ sidu: (sidu?.curvalue) ? (sidu?.curvalue) : '-',
+ alarmState: (wendu && wendu.curstatus === '1') || (sidu && sidu.curstatus === '1')
+ })
+ }
+ })
+ })
}
- // table滚动
- // tableRefScroll() {
- // clearInterval(this.timer) // 清除定时器
- // const table = this.$refs.table // 获取DOM元素
- // const bodyWrapper = table.bodyWrapper // 获取表格中承载数据的div元素
- // this.addTableRefScroll(bodyWrapper)
- // // 鼠标移入
- // bodyWrapper.onmouseover = () => {
- // clearInterval(this.timer)
- // }
- // // 鼠标移出
- // bodyWrapper.onmouseout = () => {
- // this.addTableRefScroll(bodyWrapper)
- // }
- // },
- // addTableRefScroll(bodyWrapper) {
- // let scrollTop = bodyWrapper.scrollTop
- // this.timer = setInterval(() => {
- // scrollTop = bodyWrapper.scrollTop
- // bodyWrapper.scrollTop += 5
- // if (scrollTop === bodyWrapper.scrollTop) {
- // if (this.isScroll) {
- // scrollTop = 0
- // bodyWrapper.scrollTop = 0
- // } else {
- // if (this.flag === 1) {
- // this.currentPage++
- // this.handleSearch() // 函数中需要清楚定时器
- // }
- // }
- // }
- // }, 100)
- // },
- // handleSearch() {
- // // 清楚定时器
- // clearInterval(this.timer)
- // }
}
}