This commit is contained in:
2024-09-10 15:19:44 +08:00
parent 09cce6c613
commit e237737830
99 changed files with 14597 additions and 9267 deletions

View File

@@ -1,64 +1,72 @@
<template>
<div class="app-container energyOverlimitLog">
<div v-show="activeName === 'his'">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<div>
<div style="background: #f2f4f9; height: 40px; width: 100%">
<ButtonNav :menus="['历史成本', '成本查询']" @change="currentMenu">
<template v-slot:tab1>
<div>历史成本</div>
</template>
<template v-slot:tab2>
<div>成本查询</div>
</template>
</ButtonNav>
</div>
<div v-show="activeName === 'now'">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig2"
ref="searchBarForm2"
@headBtnClick="buttonClick" />
<div class="app-container energyOverlimitLog">
<div v-show="activeName === 'his'">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
</div>
<div v-show="activeName === 'now'">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig2"
ref="searchBarForm2"
@headBtnClick="buttonClick" />
</div>
<!-- 列表 -->
<div v-if="activeName === 'his'">
<base-table
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-props="tableProps"
:table-data="tableData"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
</div>
<div v-if="activeName === 'now'">
<base-table
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-props="tableProps2"
:table-data="tableData2"
:max-height="tableH" />
</div>
<pagination
:page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize"
:total="listQuery.total"
@pagination="getDataList" />
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="50%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
<el-tabs v-model="activeName" @tab-click="toggleTab">
<el-tab-pane label="历史成本" name="his"></el-tab-pane>
<el-tab-pane label="成本查询" name="now"></el-tab-pane>
</el-tabs>
<!-- 列表 -->
<div v-if="activeName === 'his'">
<base-table
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-props="tableProps"
:table-data="tableData"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
</div>
<div v-if="activeName === 'now'">
<base-table
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-props="tableProps2"
:table-data="tableData2"
:max-height="tableH" />
</div>
<pagination
:page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize"
:total="listQuery.total"
@pagination="getDataList" />
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="50%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</template>
@@ -66,9 +74,16 @@
import AddOrUpdate from './add-or-updata';
import basicPage from '@/mixins/basic-page';
import { getEnergyTypePage } from '@/api/base/energyType';
import { getEnergyHisPage, getEnergyRealtimePage } from '@/api/cost/costEnergy';
import {
getEnergyHisPage,
getEnergyRealtimePage,
exportEnergyRealtimeExcel,
exportEnergyHisExcel,
} from '@/api/cost/costEnergy';
import { parseTime } from '@/filter/code-filter';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import ButtonNav from '@/components/ButtonNav';
const tableProps = [
{
prop: 'recTime',
@@ -170,6 +185,15 @@ export default {
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
formConfig2: [
{
@@ -197,6 +221,15 @@ export default {
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
listQuery: {
statisticType: 1,
@@ -218,6 +251,7 @@ export default {
},
components: {
AddOrUpdate,
ButtonNav,
},
created() {
const params = {
@@ -231,6 +265,8 @@ export default {
},
methods: {
buttonClick(val) {
this.formConfig2[1].startPlaceholder = '开始时间';
this.formConfig2[1].endPlaceholder = '结束时间';
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
@@ -253,7 +289,8 @@ export default {
case 'export':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.energyTypeId = val.name;
this.listQuery.energyTypeId = val.name || null;
this.listQuery.statisticType = val.statisticType || 1;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
@@ -264,7 +301,8 @@ export default {
console.log(val);
}
},
toggleTab() {
currentMenu(val) {
this.activeName = val === '历史成本' ? 'his' : 'now';
if (this.activeName === 'his') {
this.$refs.searchBarForm.resetForm();
this.listQuery.name = null;
@@ -275,9 +313,14 @@ export default {
this.getDataList();
} else {
this.$refs.searchBarForm2.resetForm();
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
this.listQuery.startTime = parseTime(start).substr(0, 10) + ' 00:00:00';
this.listQuery.endTime = parseTime(end).substr(0, 10) + ' 23:59:59';
this.formConfig2[1].startPlaceholder = parseTime(start).substr(0, 10);
this.formConfig2[1].endPlaceholder = parseTime(end).substr(0, 10);
this.listQuery.name = null;
this.listQuery.startTime = null;
this.listQuery.endTime = null;
this.listQuery.pageNo = 1;
this.getDataList2();
}
@@ -305,6 +348,30 @@ export default {
this.otherMethods(val);
}
},
/** 导出按钮操作 */
handleExport() {
let exportURL, title;
if (this.activeName === 'his') {
exportURL = exportEnergyHisExcel;
title = '能源成本-历史成本';
} else {
exportURL = exportEnergyRealtimeExcel;
title = '能源成本-成本查询';
}
// 处理查询参数
let params = { ...this.listQuery };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal
.confirm('是否确认导出所有数据项?')
.then(() => {
return exportURL(params);
})
.then((response) => {
this.$download.excel(response, title + '报表.xls');
})
.catch(() => {});
},
},
};
</script>