change - 整点数据、能源预览报表添加发电量显示

main
yinq 1 week ago
parent 222d1e6746
commit 1dbc0cb528

@ -18,7 +18,7 @@ const service = axios.create({
// axios中请求配置有baseURL选项表示请求URL公共部分
baseURL: process.env.VUE_APP_BASE_API,
// 超时
timeout: 10000
timeout: 60000
})
// request拦截器

@ -142,8 +142,8 @@
<el-table-column label="B项电流" align="center" prop="ib" v-if="columns[7].visible"/>
<el-table-column label="C项电流" align="center" prop="ic" v-if="columns[8].visible"/>
<el-table-column label="功率因数" align="center" prop="glys" v-if="columns[10].visible"/>
<el-table-column label="正向有功" align="center" prop="zxyg" v-if="columns[11].visible"/>
<el-table-column label="反向有功" align="center" prop="fxyg" v-if="columns[16].visible"/>
<el-table-column label="正向有功" align="center" prop="zxyg" width="100" v-if="columns[11].visible"/>
<el-table-column label="反向有功" align="center" prop="fxyg" width="100" v-if="columns[16].visible"/>
<el-table-column label="有功功率" align="center" prop="activePower" v-if="columns[12].visible"/>
<el-table-column label="无功功率" align="center" prop="reactivePower" v-if="columns[13].visible"/>
<el-table-column label="记录时间" align="center" prop="recordTime" width="180" v-if="columns[9].visible">

@ -103,12 +103,24 @@
>导出
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="info"
plain
icon="el-icon-sort"
size="mini"
@click="toggleExpandAll"
>展开/折叠
</el-button>
</el-col>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<el-table
v-if="refreshTable"
:default-expand-all="isExpandAll"
header-cell-class-name="columnClassName"
id="bootstrap-table"
v-loading="loading"
@ -125,16 +137,22 @@
min-width="120"
/>
<el-table-column
v-if="time.title && time.colspan == 1"
v-if="time.title && time.colspan == 2"
:key="time.title"
:label="time.title"
>
<el-table-column
min-width="140"
:key="time.title + '_' + time.field"
min-width="120"
:key="time.field"
:label="'耗量(' + measurementUnit + ')'"
:prop="time.field"
/>
<el-table-column
min-width="120"
:key="time.powerField"
:label="'发电量(' + measurementUnit + ')'"
:prop="time.powerField"
/>
</el-table-column>
</template>
</el-table>
@ -178,6 +196,10 @@ export default {
multiple: true,
//
showSearch: true,
//
refreshTable: true,
//
isExpandAll: false,
//
dataList: null,
// List
@ -437,33 +459,35 @@ export default {
myChart.setOption(option)
energyPreviewReportList(this.queryParams).then((response) => {
this.dataList = this.handleTree(response.data,'objId')
this.loading = false
this.dataList = this.handleTree(response.data, 'objId');
this.loading = false
const data = response.data || []
if (data.length === 0) return
this.totalConsumption = data.reduce((sum, item) => {
return sum + parseFloat(item.expendSum || 0);
}, 0);
if (parseFloat(data[0].expendSum) > 0){
const keys = Object.keys(data[0])
const filteredKeys = keys.filter(key => key && !['unitName', 'state', 'expendSum', 'type'].includes(key))
const filteredKeys = keys.filter(item => item.includes('dateData|'));
const yData = filteredKeys.map(key => {
return data.reduce((sum, item) => sum + parseFloat(item[key] || 0), 0).toFixed(2)
})
const timeData = filteredKeys.map(key => key.split('expend')[1] + ':00:00')
const timeData = filteredKeys.map(key => key.split('dateData|')[1] + ':00:00')
const sortedData = timeData.map((time, index) => ({
name: time,
value: parseFloat(yData[index]),
time: new Date(time).getTime()
})).sort((a, b) => a.time - b.time)
})).sort((a, b) => b.time - a.time);
console.log(sortedData)
const xAxisData = sortedData.map(item => item.name.split(':')[0])
const seriesData = sortedData.map(item => item.value)
myChart.setOption({
dataZoom: [{
show: true,
@ -488,9 +512,18 @@ export default {
data: seriesData
}]
})
}
})
},
/** 展开/折叠操作 */
toggleExpandAll() {
this.refreshTable = false
this.isExpandAll = !this.isExpandAll
this.$nextTick(() => {
this.refreshTable = true
})
},
/** 查询用户列表 */
getList(dateList) {
this.loading = true
@ -512,20 +545,21 @@ export default {
title: '耗量合计(' + this.measurementUnit + ')',
align: 'center',
rowspan: 2
},
{
field: 'powerExpendSum',
title: '发电量合计(' + this.measurementUnit + ')',
align: 'center',
rowspan: 2
}
)
for (let i in columns) {
this.timeList.push({
title: columns[i],
align: 'center',
colspan: 1,
field: 'expend' + columns[i].substring(0, 13)
})
this.energyList.push({
colspan: 2,
field: 'expend' + columns[i].substring(0, 13),
title: '耗量(' + this.measurementUnit + ')',
align: 'center',
rowspan: 1
powerField: 'powerExpend' + columns[i].substring(0, 13),
})
}
},

@ -121,6 +121,9 @@
<el-table-column label="计量设备编号" align="center" prop="monitorCode" v-if="columns[1].visible"/>
<el-table-column label="计量设备名称" align="center" prop="monitorName" v-if="columns[12].visible"/>
<el-table-column label="耗量" align="center" prop="expend" v-if="columns[3].visible"/>
<el-table-column label="仪表值" align="center" prop="instrumentValue" v-if="columns[2].visible"/>
<el-table-column label="发电量" align="center" prop="powerExpend" v-if="columns[13].visible"/>
<el-table-column label="反向有功仪表值" align="center" prop="powerValue" v-if="columns[14].visible"/>
<el-table-column label="记录时间" align="center" prop="recordTime" width="180" v-if="columns[4].visible">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.recordTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
@ -136,7 +139,6 @@
<span>{{ parseTime(scope.row.endTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="仪表值" align="center" prop="instrumentValue" v-if="columns[2].visible"/>
<el-table-column label="修改标识" align="center" prop="updateFlag" v-if="columns[7].visible">
<template slot-scope="scope">
<dict-tag :options="dict.type.update_flag" :value="scope.row.updateFlag"/>
@ -183,11 +185,17 @@
<el-form-item label="计量设备名称" prop="monitorName">
<el-input v-model="form.monitorName" placeholder="计量设备名称" disabled/>
</el-form-item>
<el-form-item label="耗量" prop="expend">
<el-input v-model="form.expend" placeholder="请输入耗量"/>
</el-form-item>
<el-form-item label="仪表值" prop="instrumentValue">
<el-input v-model="form.instrumentValue" placeholder="请输入仪表值"/>
</el-form-item>
<el-form-item label="耗量" prop="expend">
<el-input v-model="form.expend" placeholder="请输入耗量"/>
<el-form-item label="发电量" prop="powerExpend">
<el-input v-model="form.powerExpend" placeholder="请输入发电量"/>
</el-form-item>
<el-form-item label="反向有功仪表值" prop="powerValue">
<el-input v-model="form.powerValue" placeholder="请输入反向有功仪表值"/>
</el-form-item>
<!-- <el-form-item label="记录时间" prop="recordTime">-->
<!-- <el-date-picker clearable-->
@ -293,6 +301,8 @@ export default {
recordTime: null,
beginTime: null,
endTime: null,
powerExpend: null,
powerValue: null,
updateFlag: null
},
//
@ -306,7 +316,7 @@ export default {
columns: [
{ key: 0, label: `主键标识`, visible: false },
{ key: 1, label: `计量设备编号`, visible: true },
{ key: 2, label: `仪表值`, visible: true },
{ key: 2, label: `仪表值`, visible: false },
{ key: 3, label: `耗量`, visible: true },
{ key: 4, label: `记录时间`, visible: false },
{ key: 5, label: `开始时间`, visible: true },
@ -316,7 +326,9 @@ export default {
{ key: 9, label: `创建时间`, visible: false },
{ key: 10, label: `更新人`, visible: false },
{ key: 11, label: `更新时间`, visible: false },
{ key: 12, label: `计量设备名称`, visible: true }
{ key: 12, label: `计量设备名称`, visible: true },
{ key: 13, label: `发电量`, visible: true },
{ key: 14, label: `反向有功仪表值`, visible: false },
]
}
},

Loading…
Cancel
Save