<template>
    <basic-container>
        <!-- 用电统计 -->
        <el-tabs v-model="tabPosition" class="demo-tabs" @tab-change="tabPositionChange">
            <el-tab-pane label="月度统计" name="monthlyElectricity"></el-tab-pane>
            <el-tab-pane label="年度统计" name="annualElectricity"></el-tab-pane>
        </el-tabs>
        <avue-crud :option="option" :table-loading="loading" :data="data" v-model="form" v-model:page="page" ref="crud"
            @row-update="rowUpdate" @row-save="rowSave" @search-change="searchChange" @search-reset="searchReset"
            @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
            @refresh-change="refreshChange" @on-load="onLoad">
            <template #menu-left>
                <el-button icon="el-icon-download" type="success">导出</el-button>
            </template>
        </avue-crud>
    </basic-container>
</template>

<script>
import optionColumnData from './js/optionColumnData';
export default {
    data(){
        return{
            tabPosition:'monthlyElectricity',
            loading: false,
            data: [],
            form: {},
            page: {
                pageSize: 10,
                currentPage: 1,
                total: 0,
            },
            option: {
                height: 'auto',
                calcHeight: 32,
                tip: false,
                simplePage: true,
                searchShow: true,
                searchMenuSpan: 6,
                searchIcon: true,
                searchIndex: 3,
                tree: false,
                border: true,
                index: true,
                selection: false,
                viewBtn: false,
                delBtn: false,
                addBtn: false,
                editBtn: false,
                editBtnText: '修改',
                addBtnIcon: ' ',
        viewBtnIcon: ' ',
        delBtnIcon: ' ',
        editBtnIcon: ' ',
                viewBtnText: '详情',
                labelWidth: 120,
                searchLabelWidth: 120,
                menu: false,
                menuWidth: 220,
                dialogWidth: 1200,
                dialogClickModal: false,
                searchEnter: true,
                excelBtn: false,
                filterBtn: true,
                searchShowBtn: false,
                columnSort: true,
                excelBtn: true,
                columnSort: true,
                showOverflowTooltip: true,
                searchLabelPosition:'left',
searchLabelPosition:'left',
 searchGutter:24,
  searchSpan:6,
menuAlign: 'left',
gridBtn:false,
searchMenuPosition:'right',
align: 'center',
                column: []
            }
        }
    },
    mounted(){
        this.option.column = optionColumnData[this.tabPosition]
    },
    methods:{
        tabPositionChange(val){
            this.option.column = optionColumnData[this.tabPosition]
        },
        searchReset() {
            this.query = {};
            this.onLoad(this.page);
        },
        searchChange(params, done) {
            // this.query = params;
            // this.page.currentPage = 1;
            // this.onLoad(this.page, params);
            done();
        },
        currentChange(currentPage) {
            this.page.currentPage = currentPage;
        },
        sizeChange(pageSize) {
            this.page.pageSize = pageSize;
        },
        refreshChange() {
            this.onLoad(this.page, this.query);
        },
        onLoad(){

        }
    }
}
</script>

<style></style>