152 lines
3.4 KiB
Vue
152 lines
3.4 KiB
Vue
|
<template>
|
||
|
<div class="app-container">
|
||
|
|
||
|
<!-- 搜索工作栏 -->
|
||
|
<search-bar
|
||
|
:formConfigs="formConfig"
|
||
|
ref="searchBarForm"
|
||
|
@headBtnClick="buttonClick"
|
||
|
/>
|
||
|
<!-- 列表 -->
|
||
|
<base-table
|
||
|
:page="queryParams.pageNo"
|
||
|
:limit="queryParams.pageSize"
|
||
|
:table-props="tableProps"
|
||
|
:table-data="list"
|
||
|
:max-height="tableH"
|
||
|
/>
|
||
|
<pagination
|
||
|
:page.sync="queryParams.pageNo"
|
||
|
:limit.sync="queryParams.pageSize"
|
||
|
:total="total"
|
||
|
@pagination="getList"
|
||
|
/>
|
||
|
</div>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
import { getEnergyQuantityRealtimePage } from "@/api/base/energyQuantityRealtime";
|
||
|
import { getEnergyTypeListAll } from "@/api/base/energyType";
|
||
|
// import { publicFormatter } from '@/utils/dict'
|
||
|
const tableProps = [
|
||
|
{
|
||
|
prop: 'bindObjectName',
|
||
|
label: '统计对象'
|
||
|
},
|
||
|
{
|
||
|
prop: 'bindObjectType',
|
||
|
label: '能源类型'
|
||
|
},
|
||
|
{
|
||
|
prop: 'startValue',
|
||
|
label: '初始值'
|
||
|
},
|
||
|
{
|
||
|
prop: 'endValue',
|
||
|
label: '当前值'
|
||
|
},
|
||
|
{
|
||
|
prop: 'diffValue',
|
||
|
label: '差值'
|
||
|
},
|
||
|
{
|
||
|
prop: 'amount',
|
||
|
label: '金额'
|
||
|
}
|
||
|
]
|
||
|
export default {
|
||
|
name: "EnergyPlc",
|
||
|
data() {
|
||
|
return {
|
||
|
formConfig: [
|
||
|
{
|
||
|
type: 'select',
|
||
|
label: '能源类型',
|
||
|
selectOptions: [],
|
||
|
param: 'energyTypeId'
|
||
|
},
|
||
|
{
|
||
|
type: 'datePicker',
|
||
|
label: '时间',
|
||
|
dateType: 'datetimerange',
|
||
|
format: 'yyyy-MM-dd HH:mm:ss',
|
||
|
valueFormat: "timestamp",
|
||
|
rangeSeparator: '-',
|
||
|
startPlaceholder: '开始时间',
|
||
|
endPlaceholder: '结束时间',
|
||
|
param: 'timeVal',
|
||
|
defaultSelect: [],
|
||
|
width: 350
|
||
|
},
|
||
|
{
|
||
|
type: 'button',
|
||
|
btnName: '查询',
|
||
|
name: 'search',
|
||
|
color: 'primary'
|
||
|
},
|
||
|
{
|
||
|
type: 'separate'
|
||
|
},
|
||
|
{
|
||
|
type: this.$auth.hasPermi('base:energy-quantity-realtime:export') ? 'button' : '',
|
||
|
btnName: '导出',
|
||
|
name: 'export',
|
||
|
color: 'primary',
|
||
|
plain: true
|
||
|
}
|
||
|
],
|
||
|
tableProps,
|
||
|
tableH: this.tableHeight(260),
|
||
|
// 总条数
|
||
|
total: 0,
|
||
|
// 班次基础信息列表
|
||
|
list: [],
|
||
|
// 查询参数
|
||
|
queryParams: {
|
||
|
pageNo: 1,
|
||
|
pageSize: 20,
|
||
|
energyTypeId: '',
|
||
|
startTime: null,
|
||
|
endTime: null
|
||
|
}
|
||
|
};
|
||
|
},
|
||
|
created() {
|
||
|
window.addEventListener('resize', () => {
|
||
|
this.tableH = this.tableHeight(260)
|
||
|
})
|
||
|
this.getList();
|
||
|
this.getTypeList()
|
||
|
},
|
||
|
methods: {
|
||
|
buttonClick(val) {
|
||
|
console.log(val)
|
||
|
switch (val.btnName) {
|
||
|
case 'search':
|
||
|
this.queryParams.pageNo = 1;
|
||
|
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:
|
||
|
console.log('导出')
|
||
|
}
|
||
|
},
|
||
|
/** 查询列表 */
|
||
|
getList() {
|
||
|
getEnergyQuantityRealtimePage(this.queryParams).then(response => {
|
||
|
this.list = response.data.list || [];
|
||
|
this.total = response.data.total;
|
||
|
});
|
||
|
},
|
||
|
getTypeList() {
|
||
|
getEnergyTypeListAll().then((res) => {
|
||
|
console.log(res)
|
||
|
this.formConfig[0].selectOptions = res.data || []
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
</script>
|