From ec355bf39a7e73acf313ea6bbca0cc4982c6413e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=9C=E7=AC=99=E6=AD=8C?= <2277317060@qq.com> Date: Mon, 25 Sep 2023 16:50:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=BE=E5=A4=87=E5=92=8C?= =?UTF-8?q?=E4=BC=A0=E6=84=9F=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/src/api/board/equipment.js | 9 ++ ruoyi-ui/src/views/board/equipment/index.vue | 98 +++++++++++++------ .../views/board/equipmentMonitoring/index.vue | 72 ++++++++------ ruoyi-ui/src/views/board/senso/index.vue | 91 ++++++++++------- 4 files changed, 170 insertions(+), 100 deletions(-) diff --git a/ruoyi-ui/src/api/board/equipment.js b/ruoyi-ui/src/api/board/equipment.js index a40c2ea..1d481d7 100644 --- a/ruoyi-ui/src/api/board/equipment.js +++ b/ruoyi-ui/src/api/board/equipment.js @@ -26,3 +26,12 @@ export function getMonitorById(query=0) { data:query }) } +// 切换状态 +export function publishControlCommand(query=0) { + return request({ + // baseURL:'/monitoring-api', + url: '/business/monitorPlatform/publishControlCommand', + method: 'POST', + data:query + }) +} diff --git a/ruoyi-ui/src/views/board/equipment/index.vue b/ruoyi-ui/src/views/board/equipment/index.vue index 15763f4..9d280b4 100644 --- a/ruoyi-ui/src/views/board/equipment/index.vue +++ b/ruoyi-ui/src/views/board/equipment/index.vue @@ -43,14 +43,18 @@
-
{{ i.deviceName }}
+
{{ i.deviceName + ' - ' + i.deviceModeFunction.functionName }}
- - + 执行 + + + + + + + +
@@ -58,19 +62,23 @@
-
+
{{ i.deviceName }}
-
- - - - - +
+
+
{{ val }}:
+
+
{{ i.deviceDataMap[val] }}
+
- 历史记录 + 历史记录
@@ -84,14 +92,14 @@ import { treeList, selectDevicesByMonitorUnitId, - getMonitorById + getMonitorById, + publishControlCommand } from '@/api/board/equipment' let getDeviceInterval = null export default { - components: { - }, + components: {}, data() { return { show: false, @@ -111,26 +119,42 @@ export default { async mounted() { await this.getData() this.sceneId = this.$store.getters.sceneId - if(this.$route.query.monitorUnitId){ + if (this.$route.query.monitorUnitId) { this.deviceId = this.$route.query.monitorUnitId - await this.treeClick({id:this.$route.query.monitorUnitId}) + await this.treeClick({id: this.$route.query.monitorUnitId}) } }, methods: { async getData() { await this.getTree() }, - switchChange(e) { - this.$confirm((this.controlList[e].deviceType === '1' ? '关闭' : '开启') + '该设备?', '提示', { + switchChange(functionIdentifier, deviceId, deviceCode,modeFunctionId) { + console.log(this.controlList) + console.log(this.controlList) + this.$confirm('确定执行么?', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => { - this.$message({ - type: 'success', - message: '成功!' - }); - this.controlList[e].deviceType === '1' ? this.controlList[e].deviceType = '0' : this.controlList[e].deviceType = '1' + publishControlCommand({ + deviceId:deviceId, + modeFunctionId:modeFunctionId, + deviceCode:deviceCode, + type:functionIdentifier, + }).then(e => { + if (e.code === 200) { + this.$message({ + type: 'success', + message: '成功!' + }); + this.controlList.find(e => e.deviceId === deviceId).deviceType === '1' ? this.controlList.find(e => e.deviceId === deviceId).deviceType = '0' : this.controlList.find(e => e.deviceId === deviceId).deviceType = '1' + }else{ + this.$message({ + type: 'info', + message: '网络错误' + }); + } + }) }).catch(() => { this.$message({ type: 'info', @@ -166,8 +190,9 @@ export default { const {data} = await getMonitorById(e.id) this.MonitorInfo = data }, - toHistory() { - this.$router.push({path: "/board/senso"}); + toHistory(e,i) { + console.log(i) + this.$router.push({path: "/board/senso",query:{id:e,deviceModeId:i}}); } }, beforeDestroy() { @@ -283,10 +308,10 @@ export default { .terminalList { position: absolute; - top: 12%; + top: 1%; left: 0%; width: 100%; - height: 85%; + height: 95%; overflow: auto; ::-webkit-scrollbar { @@ -362,6 +387,17 @@ export default { height: 16vh; } + .icon { + + background-repeat: no-repeat; + background-size: 100% 100%; + position: absolute; + top: calc(16% + 1vh); + left: calc(5% + 0.5vw); + width: 14vh; + height: 14vh; + } + .rightBg { background-image: url("~@/assets/board/equipment/right.png"); background-repeat: no-repeat; diff --git a/ruoyi-ui/src/views/board/equipmentMonitoring/index.vue b/ruoyi-ui/src/views/board/equipmentMonitoring/index.vue index acb0730..bd6b9ba 100644 --- a/ruoyi-ui/src/views/board/equipmentMonitoring/index.vue +++ b/ruoyi-ui/src/views/board/equipmentMonitoring/index.vue @@ -37,34 +37,36 @@ :header-cell-style="{ textAlign: 'center',backgroundColor:'#0a457d' }" :max-height="maxHeight"> style="width: 100%"> - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + +