实时监控图表优化

main
Lufaneng 11 months ago
parent 364c1cfe96
commit 97120d57da

@ -148,6 +148,9 @@
<div class="search">
<el-date-picker value-format="YYYY-MM-DD" v-model="recdDate" type="date" placeholder="请选择时间" />
<el-button type="primary" :loading="lineDataLoading" @click="getLineData"></el-button>
<div class="info_item">当前功率{{ energyParams.activePower }}</div>
<div class="info_item">今日峰值{{ maxEnergy }}kW</div>
<div class="info_item">平均功率{{ agvEnergy }}kW</div>
</div>
<Linechart :lineData="lineData"></Linechart>
</div>
@ -236,15 +239,36 @@ function transformHourlyData(data) {
const lineData = ref([])
const recdDate = ref(dayjs().add(-1, 'day').format('YYYY-MM-DD'))
const lineDataLoading = ref(false)
const agvEnergy = ref(0)
const maxEnergy = ref(0)
const getLineData = () => {
lineDataLoading.value = true
RPC.post('/lightm/rtu/his', { commUid: commit_uid, recdDate: recdDate.value }).then(res => {
lineData.value = transformHourlyData(res)
// RPC.post('/lightm/rtu/his', { commUid: commit_uid, recdDate: recdDate.value }).then(res => {
// lineData.value = transformHourlyData(res)
// }).finally(() => {
// lineDataLoading.value = false
// })
RPC.post('/lightm/rtu/minHis', { CommUid: commit_uid, recdDate: recdDate.value }).then((res) => {
//
// console.log(res)
agvEnergy.value = res.agvEnergy?.toFixed(3)
maxEnergy.value = res.maxEnergy?.toFixed(3)
lineData.value = transformminHisData(res.minutesEnergy)
}).finally(() => {
lineDataLoading.value = false
})
}
getLineData()
const transformminHisData = arr => {
if (!arr) return
return arr.map(item => {
return {
name: dayjs(item.record_time).format('HH:mm'),
value: item.energy
}
})
}
// getLineData()
//
const powerPhases = ref([
@ -403,8 +427,11 @@ const getInfo = () => {
})
RPC.post('/m9z/getDeviceStatus2', { comm_uid: commit_uid }).then((res) => {
//
if (res.Loops?.length === 10) {
info.value = res
}
})
getLineData()
// RPC.post('/m9z/getDeviceSunRiseTime', { comm_uid: commit_uid }).then(res => {
// sunriseTime.value = res.Sunrise ? dayjs(res.Sunrise).format('HH:mm:ss') : ''
@ -995,6 +1022,14 @@ onUnmounted(() => {
border-color: #006eff;
margin-left: 20px;
}
.info_item {
color: #fff;
margin-left: 20px;
border: 0.5px solid #00E0F4;
padding: 5px 10px;
border-radius: 5px;
}
}
}
</style>

@ -59,7 +59,7 @@ export default defineConfig({
open: true,
proxy: {
'/jsonrpc': {
target: 'https://lamp-dev.ruixininfo.com',
target: 'https://cd-databoard-lamp.ruixininfo.com',
changeOrigin: true,
secure: false,
},

Loading…
Cancel
Save