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

main
yinq 1 week ago
parent 222d1e6746
commit 1dbc0cb528

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

@ -142,8 +142,8 @@
<el-table-column label="B项电流" align="center" prop="ib" v-if="columns[7].visible"/> <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="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="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="zxyg" width="100" 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="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="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="reactivePower" v-if="columns[13].visible"/>
<el-table-column label="记录时间" align="center" prop="recordTime" width="180" v-if="columns[9].visible"> <el-table-column label="记录时间" align="center" prop="recordTime" width="180" v-if="columns[9].visible">

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

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