Browse Source

提交 设备箱

wangqin
Joe 10 months ago
parent
commit
db1ea5327e
  1. 89
      ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/SmartDevice/index.vue
  2. 9
      ruoyi-ui/src/views/JiHeExpressway/scss/reset.scss

89
ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/SmartDevice/index.vue

@ -8,6 +8,7 @@
<Descriptions :list="list" :data="data" style="gap: 18px" /> <Descriptions :list="list" :data="data" style="gap: 18px" />
</ElTabPane> </ElTabPane>
<ElTabPane label="设备参数" name="second"> <ElTabPane label="设备参数" name="second">
<div class="no-data" v-if="!devicesList.length" v-loading="secondLoading">暂无设备参数</div>
<Descriptions :list="devicesList" style="gap: 18px;" column="5"> <Descriptions :list="devicesList" style="gap: 18px;" column="5">
<template v-for="item in devicesList.slice(0, -1)" #[`content-${getSlotKey(item.key)}`]="{ data }"> <template v-for="item in devicesList.slice(0, -1)" #[`content-${getSlotKey(item.key)}`]="{ data }">
<span>{{ data.text }}</span> <span>{{ data.text }}</span>
@ -32,7 +33,7 @@ import Video from "@screen/components/Video"
import LineChart from './components/LineChart/index.vue'; import LineChart from './components/LineChart/index.vue';
import Switcher from '@screen/pages/service/PublishingChannelManagement/components/Switcher.vue'; import Switcher from '@screen/pages/service/PublishingChannelManagement/components/Switcher.vue';
import { getRoadInfoByStakeMark, getOrganizationName, getProduct } from "@screen/pages/Home/components/RoadAndEvents/utils/httpList.js" import { getRoadInfoByStakeMark, getProduct } from "@screen/pages/Home/components/RoadAndEvents/utils/httpList.js"
import { dialogDelayVisible } from "./../mixin" import { dialogDelayVisible } from "./../mixin"
import request from "@/utils/request"; import request from "@/utils/request";
import { Message } from 'element-ui'; import { Message } from 'element-ui';
@ -53,6 +54,7 @@ export default {
return { return {
activeName: 'first', activeName: 'first',
releaseVisible: false, releaseVisible: false,
secondLoading: true,
data: { data: {
deviceName: "LH24", deviceName: "LH24",
roadName: "G35济泽高速", roadName: "G35济泽高速",
@ -113,11 +115,6 @@ export default {
this.dialogData.brand = data.brand; this.dialogData.brand = data.brand;
}) })
getOrganizationName(this.dialogData.iotDeviceId)
.then(data => {
this.dialogData.organizationName = data?.organizationName;
})
const roadInfo = await getRoadInfoByStakeMark(this.dialogData.stakeMark); const roadInfo = await getRoadInfoByStakeMark(this.dialogData.stakeMark);
if (roadInfo) this.data.roadName = roadInfo.roadName; if (roadInfo) this.data.roadName = roadInfo.roadName;
@ -128,50 +125,52 @@ export default {
url: `/business/device/properties/latest/${this.dialogData.iotDeviceId}`, url: `/business/device/properties/latest/${this.dialogData.iotDeviceId}`,
method: "get", method: "get",
params: {} params: {}
}).then(result => { })
if (result.code != 200) return; .then(result => {
const [deviceInfo] = result.data; if (result.code != 200) return;
const [deviceInfo] = result.data;
const typeMap = { const typeMap = {
ac: '220v', ac: '220v',
dc: '12v', dc: '12v',
} }
for (const key in deviceInfo.formatValue) { for (const key in deviceInfo.formatValue) {
// electricity // electricity
// voltage // voltage
if (key.includes('electricity')) { if (key.includes('electricity')) {
const args = key.match(/[a-z]+|[0-9]+$/g); const args = key.match(/[a-z]+|[0-9]+$/g);
const type = args[0], num = args.slice(-1)[0], prefix = args.slice(0, 2).join('_'); const type = args[0], num = args.slice(-1)[0], prefix = args.slice(0, 2).join('_');
this.devicesList.push( this.devicesList.push(
{ {
label: `支路${num}${typeMap[type]}) 电压`, label: `支路${num}${typeMap[type]}) 电压`,
key: `${prefix}_voltage_${num}`, key: `${prefix}_voltage_${num}`,
text: deviceInfo.formatValue[`${prefix}_voltage_${num}`], text: deviceInfo.formatValue[`${prefix}_voltage_${num}`],
gridColumn: 3 gridColumn: 3
}, },
{ {
label: '电流', label: '电流',
key: `${prefix}_electricity_${num}`, key: `${prefix}_electricity_${num}`,
text: deviceInfo.formatValue[key], text: deviceInfo.formatValue[key],
gridColumn: 2, gridColumn: 2,
state: deviceInfo.value[key] > 0 state: deviceInfo.value[key] > 0
} }
); );
}
} }
} this.devicesList.push({
this.devicesList.push({ label: '风扇',
label: '风扇', key: `fan_status`,
key: `fan_status`, text: { 0: '正常', 1: '开' }[deviceInfo.formatValue['fan_status']] || '-',
text: { 0: '正常', 1: '开' }[deviceInfo.formatValue['fan_status']] || '-', gridColumn: 5
gridColumn: 5 })
// this.data = result.rows;
// this.total = result.total;
})
.finally(() => {
this.secondLoading = false
}) })
// this.data = result.rows;
// this.total = result.total;
}).finally(() => {
// closeLoading();
})
}, },
methods: { methods: {
handleSwitcherChange(value, data) { handleSwitcherChange(value, data) {

9
ruoyi-ui/src/views/JiHeExpressway/scss/reset.scss

@ -42,4 +42,13 @@ body {
background-color: rgba(13, 95, 121, 0.6); background-color: rgba(13, 95, 121, 0.6);
} }
} }
.no-data {
display: flex;
align-items: center;
justify-content: center;
color: #fff;
width: 100%;
height: 100%;
}
} }

Loading…
Cancel
Save