Merge pull request '1' (#302) from projects/mesxc-zjl into projects/mesxc-test

Reviewed-on: #302
This commit is contained in:
朱菊兰 2024-04-03 09:02:11 +08:00
commit 5f5e0ffc69
2 changed files with 190 additions and 179 deletions

View File

@ -18,9 +18,9 @@ VUE_APP_TITLE = MES系统
# VUE_APP_BASE_API = 'http://192.168.2.173:48080' # VUE_APP_BASE_API = 'http://192.168.2.173:48080'
# VUE_APP_BASE_API = 'http://192.168.1.49:48082' # VUE_APP_BASE_API = 'http://192.168.1.49:48082'
# VUE_APP_BASE_API = 'http://192.168.1.8:48082' # VUE_APP_BASE_API = 'http://192.168.1.8:48082'
VUE_APP_BASE_API = 'http://192.168.4.173:48082' # VUE_APP_BASE_API = 'http://192.168.4.173:48082'
# VUE_APP_BASE_API = 'http://192.168.1.104:48082' # VUE_APP_BASE_API = 'http://192.168.1.104:48082'
# VUE_APP_BASE_API = 'http://192.168.0.33:48082' VUE_APP_BASE_API = 'http://192.168.0.33:48082'
# VUE_APP_BASE_API = 'http://192.168.1.62:48082' # VUE_APP_BASE_API = 'http://192.168.1.62:48082'
# VUE_APP_BASE_API = 'http://192.168.1.78:48082' # VUE_APP_BASE_API = 'http://192.168.1.78:48082'
# VUE_APP_BASE_API = 'http://192.168.1.47:48082' # VUE_APP_BASE_API = 'http://192.168.1.47:48082'

View File

@ -1,185 +1,196 @@
<template> <template>
<div class="app-container" id='energyReportBox'> <div
class="app-container"
<!-- 搜索工作栏 --> id="energyReportBox">
<search-bar <!-- 搜索工作栏 -->
:formConfigs="formConfig" <search-bar
ref="searchBarForm" :formConfigs="formConfig"
:isFold="isFold" ref="searchBarForm"
@headBtnClick="buttonClick" :isFold="isFold"
/> @headBtnClick="buttonClick" />
<!-- 列表 --> <!-- 列表 -->
<base-table <base-table
:page="queryParams.pageNo" :page="queryParams.pageNo"
:limit="queryParams.pageSize" :limit="queryParams.pageSize"
:table-props="tableProps" :table-props="tableProps"
:table-data="list" :table-data="list"
:max-height="tableH" :max-height="tableH" />
/> <pagination
<pagination :page.sync="queryParams.pageNo"
:page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
:limit.sync="queryParams.pageSize" :total="total"
:total="total" @pagination="getList" />
@pagination="getList" </div>
/>
</div>
</template> </template>
<script> <script>
import { energyReportPageAuto, energyReportPageExportAuto } from "@/api/monitoring/energyReport" import {
import { getEnergyTypeListAll } from "@/api/base/energyType"; energyReportPageAuto,
import { publicFormatter } from '@/utils/dict' energyReportPageExportAuto,
import { parseTime } from '@/utils/ruoyi' } from '@/api/monitoring/energyReport';
import { getEnergyTypeListAll } from '@/api/base/energyType';
import { publicFormatter } from '@/utils/dict';
import { parseTime } from '@/utils/ruoyi';
const tableProps = [ const tableProps = [
{ {
prop: 'statisticType', prop: 'statisticType',
label: '统计类型', label: '统计类型',
filter: publicFormatter('statistic_type') filter: publicFormatter('statistic_type'),
}, },
{ {
prop: 'startTime', prop: 'startTime',
label: '开始时间', label: '开始时间',
filter: parseTime, filter: parseTime,
minWidth: 160 minWidth: 160,
}, },
{ {
prop: 'endTime', prop: 'endTime',
label: '结束时间', label: '结束时间',
filter: parseTime, filter: parseTime,
minWidth: 160 minWidth: 160,
}, },
{ {
prop: 'statisticName', prop: 'statisticName',
label: '统计方案' label: '统计方案',
}, },
{ {
prop: 'energyType', prop: 'energyType',
label: '能源类型' label: '能源类型',
}, },
{ {
prop: 'startNum', prop: 'startNum',
label: '抄表数(起始)' label: '抄表数(起始)',
}, },
{ {
prop: 'endNum', prop: 'endNum',
label: '抄表数(结束)' label: '抄表数(结束)',
}, },
{ {
prop: 'useNum', prop: 'useNum',
label: '消耗量' label: '消耗量',
} },
] ];
export default { export default {
name: "EnergyLimit", name: 'EnergyLimit',
data() { data() {
return { return {
isFold: false, isFold: false,
formConfig: [ formConfig: [
{ {
type: 'select', type: 'select',
label: '能源类型', label: '能源类型',
selectOptions: [], selectOptions: [],
param: 'energyTypeId', param: 'energyTypeId',
filterable: true filterable: true,
}, },
{ {
type: 'select', type: 'select',
label: '统计类型', label: '统计类型',
selectOptions: this.getDictDatas(this.DICT_TYPE.STATISTIC_TYPE), selectOptions: this.getDictDatas(this.DICT_TYPE.STATISTIC_TYPE),
labelField: 'label', labelField: 'label',
valueField: 'value', valueField: 'value',
param: 'statisticType' param: 'statisticType',
}, },
{ {
type: 'datePicker', type: 'datePicker',
label: '时间', label: '时间',
dateType: 'datetimerange', dateType: 'datetimerange',
format: 'yyyy-MM-dd HH:mm:ss', format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: "timestamp", valueFormat: 'timestamp',
rangeSeparator: '-', rangeSeparator: '-',
startPlaceholder: '开始时间', startPlaceholder: '开始时间',
endPlaceholder: '结束时间', endPlaceholder: '结束时间',
param: 'timeVal', param: 'timeVal',
defaultSelect: [], defaultSelect: [],
width: 350 width: 350,
}, },
{ {
type: 'button', type: 'button',
btnName: '查询', btnName: '查询',
name: 'search', name: 'search',
color: 'primary' color: 'primary',
}, },
{ {
type: 'separate' type: 'separate',
}, },
{ {
type: this.$auth.hasPermi('monitoring:energy-report:export') ? 'button' : '', type: this.$auth.hasPermi('monitoring:energy-report:export')
btnName: '导出', ? 'button'
name: 'add', : '',
color: 'primary', btnName: '导出',
plain: true name: 'add',
} color: 'primary',
], plain: true,
tableProps, },
tableH: this.tableHeight(260), ],
// tableProps,
total: 0, tableH: this.tableHeight(260),
// //
list: [], total: 0,
// //
queryParams: { list: [],
pageNo: 1, //
pageSize: 20, queryParams: {
energyTypeId: null, pageNo: 1,
statisticType: null, pageSize: 20,
startTime: null, energyTypeId: null,
endTime: null statisticType: null,
} startTime: null,
}; endTime: null,
}, },
created() { };
window.addEventListener('resize', () => { },
this.tableH = this.tableHeight(260) created() {
this.isFold = this.searchBarWidth('energyReportBox', 1198) window.addEventListener('resize', this._eventListeners);
}) this.getList();
this.getList() this.getTypeList();
this.getTypeList() },
}, mounted() {
mounted() { this.isFold = this.searchBarWidth('energyReportBox', 1198);
this.isFold = this.searchBarWidth('energyReportBox', 1198) },
}, destroyed() {
methods: { window.removeEventListener('resize', this._eventListeners);
getTypeList() { },
getEnergyTypeListAll().then((res) => { methods: {
this.formConfig[0].selectOptions = res.data || [] _eventListeners() {
// this.energyTypeList = res.data || [] this.tableH = this.tableHeight(260);
}) this.isFold = this.searchBarWidth('energyReportBox', 1198);
}, },
buttonClick(val) { getTypeList() {
switch (val.btnName) { getEnergyTypeListAll().then((res) => {
case 'search': this.formConfig[0].selectOptions = res.data || [];
this.queryParams.pageNo = 1 // this.energyTypeList = res.data || []
this.queryParams.energyTypeId = val.energyTypeId });
this.queryParams.statisticType = val.statisticType },
this.queryParams.startTime = val.timeVal ? val.timeVal[0] : null buttonClick(val) {
this.queryParams.endTime = val.timeVal ? val.timeVal[1] : null switch (val.btnName) {
this.getList() case 'search':
break this.queryParams.pageNo = 1;
default: this.queryParams.energyTypeId = val.energyTypeId;
this.$modal.confirm('是否确认导出').then(() => { this.queryParams.statisticType = val.statisticType;
return energyReportPageExportAuto({...this.queryParams}); this.queryParams.startTime = val.timeVal ? val.timeVal[0] : null;
}).then(response => { this.queryParams.endTime = val.timeVal ? val.timeVal[1] : null;
this.$download.excel(response, '能源统计报表.xls'); this.getList();
}).catch(() => {}) break;
} default:
}, this.$modal
/** 查询列表 */ .confirm('是否确认导出')
getList() { .then(() => {
energyReportPageAuto(this.queryParams).then(response => { return energyReportPageExportAuto({ ...this.queryParams });
this.list = response.data.list || []; })
this.total = response.data.total; .then((response) => {
}); this.$download.excel(response, '能源统计报表.xls');
} })
} .catch(() => {});
}
},
/** 查询列表 */
getList() {
energyReportPageAuto(this.queryParams).then((response) => {
this.list = response.data.list || [];
this.total = response.data.total;
});
},
},
}; };
</script> </script>