能源分析

This commit is contained in:
2023-09-05 15:45:59 +08:00
parent 01fe2da523
commit 9c59a7e715
29 changed files with 2203 additions and 100 deletions

View File

@@ -26,7 +26,7 @@
<script>
import { energyReportPage, energyReportPageExport } from "@/api/monitoring/energyReport";
// import { publicFormatter } from '@/utils/dict'
import { getEnergyTypeListAll } from "@/api/base/energyType"
const tableProps = [
{
prop: 'statisticName',
@@ -59,18 +59,26 @@ export default {
label: '统计方案',
param: 'statisticName'
},
{
type: 'select',
label: '能源类型',
selectOptions: [],
param: 'energyTypeId',
filterable: true
},
{
type: 'datePicker',
label: '时间',
label: '时间(必填)',
dateType: 'datetimerange',
format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: "yyyy-MM-ddTHH:mm:ss",
valueFormat: "timestamp",
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'timeVal',
defaultSelect: [],
width: 350
width: 350,
clearable: false
},
{
type: 'button',
@@ -82,7 +90,7 @@ export default {
type: 'separate'
},
{
type: this.$auth.hasPermi('monitoring:energy-limit:create') ? 'button' : '',
type: this.$auth.hasPermi('monitoring:energy-report-search:export') ? 'button' : '',
btnName: '导出',
name: 'add',
color: 'primary',
@@ -103,65 +111,49 @@ export default {
startTime: null,
endTime: null
},
energyTypeList: [],
typeList: [
{label: '合并', value: '1'},
{label: '详细', value: '2'}
],
objList: []
energyTypeList: []
};
},
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
})
this.getList();
this.formConfig[2].defaultSelect = [Date.now() - 7*24*3600000, Date.now()]
this.queryParams.startTime = this.formConfig[2].defaultSelect[0]
this.queryParams.endTime = this.formConfig[2].defaultSelect[1]
this.getList()
this.getTypeList()
},
methods: {
getTypeList() {
getEnergyTypeListAll().then((res) => {
this.formConfig[1].selectOptions = res.data || []
})
},
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.queryParams.pageNo = 1;
this.queryParams.pageNo = 1
this.queryParams.statisticName = val.statisticName
this.queryParams.startTime = val.timeVal ? val.timeVal[0] : nul
this.queryParams.endTime = val.timeVal ? val.timeVal[1] : nul
this.queryParams.energyTypeId = val.energyTypeId
this.queryParams.startTime = val.timeVal ? val.timeVal[0] : null
this.queryParams.endTime = val.timeVal ? val.timeVal[1] : null
this.getList()
break
default:
this.addOrEditTitle = '新增'
this.centervisible = true
this.$nextTick(() => {
this.$refs.energyLimit.init()
})
this.$modal.confirm('是否确认导出').then(() => {
return energyReportPageExport({...this.queryParams});
}).then(response => {
this.$download.excel(response, '能源统计查询报表.xls');
}).catch(() => {})
}
},
/** 查询列表 */
getList() {
energyReportPage({...this.queryParams}).then(response => {
let arr = response.data.list || [];
// arr&&arr.map(item => {
// this.typeList.map(i => {
// if (item.type === i.value) {
// item.type = i.label
// }
// })
// })
this.list = arr
this.list = response.data.list || [];
this.total = response.data.total;
});
},
handleClick(val) {
switch (val.type) {
case 'edit':
this.addOrEditTitle = '编辑'
this.$nextTick(() => {
this.$refs.energyLimit.init(val.data.id)
})
this.centervisible = true
break
default:
this.handleDelete(val.data)
}
}
}
};