更新
This commit is contained in:
@@ -1,65 +1,73 @@
|
||||
<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"
|
||||
:name-arr="formConfig[1].selectOptions"
|
||||
@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"
|
||||
:name-arr="formConfig[1].selectOptions"
|
||||
@refreshDataList="successSubmit"></add-or-update>
|
||||
</base-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -70,9 +78,13 @@ import { getRawOthercostRulePage } from '@/api/cost/deepOthercostRule';
|
||||
import {
|
||||
getRawOthercostHisPage,
|
||||
getRawOthercostSunPage,
|
||||
exportRawOthercostSunExcel,
|
||||
exportRawOthercostHisExcel
|
||||
} from '@/api/cost/costOthercostHisDeep';
|
||||
import { parseTime } from '@/filter/code-filter';
|
||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
|
||||
import ButtonNav from '@/components/ButtonNav';
|
||||
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'recTime',
|
||||
@@ -147,6 +159,15 @@ export default {
|
||||
name: 'search',
|
||||
color: 'primary',
|
||||
},
|
||||
{
|
||||
type: 'separate',
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
btnName: '导出',
|
||||
name: 'export',
|
||||
color: 'warning',
|
||||
},
|
||||
],
|
||||
formConfig2: [
|
||||
{
|
||||
@@ -175,6 +196,15 @@ export default {
|
||||
name: 'search',
|
||||
color: 'primary',
|
||||
},
|
||||
{
|
||||
type: 'separate',
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
btnName: '导出',
|
||||
name: 'export',
|
||||
color: 'warning',
|
||||
},
|
||||
],
|
||||
listQuery: {
|
||||
statisticType: 1,
|
||||
@@ -196,6 +226,7 @@ export default {
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate,
|
||||
ButtonNav,
|
||||
},
|
||||
created() {
|
||||
const params = {
|
||||
@@ -209,6 +240,8 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
buttonClick(val) {
|
||||
this.formConfig2[1].startPlaceholder = '开始时间';
|
||||
this.formConfig2[1].endPlaceholder = '结束时间';
|
||||
switch (val.btnName) {
|
||||
case 'search':
|
||||
this.listQuery.pageNo = 1;
|
||||
@@ -231,7 +264,8 @@ export default {
|
||||
case 'export':
|
||||
this.listQuery.pageNo = 1;
|
||||
this.listQuery.pageSize = 10;
|
||||
this.listQuery.name = val.name;
|
||||
this.listQuery.name = 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'
|
||||
@@ -242,7 +276,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;
|
||||
@@ -253,9 +288,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();
|
||||
}
|
||||
@@ -279,6 +319,30 @@ export default {
|
||||
this.otherMethods(val);
|
||||
}
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
let exportURL, title;
|
||||
if (this.activeName === 'his') {
|
||||
exportURL = exportRawOthercostHisExcel;
|
||||
title = '深加工其它成本-历史成本';
|
||||
} else {
|
||||
exportURL = exportRawOthercostSunExcel;
|
||||
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>
|
||||
|
||||
Reference in New Issue
Block a user