<template>
    <div class="container createManage form-table">
        <el-breadcrumb separator-class="el-icon-arrow-right">
            <el-breadcrumb-item>当前位置</el-breadcrumb-item>
            <el-breadcrumb-item>{{this.$route.name[0]}}</el-breadcrumb-item>
        </el-breadcrumb>
        <div class="assetsContent">
            <div class="formDiv">
                <el-form :inline="true" :model="formInline" class="search-form-inline">
                    <el-form-item label="年月">
                        <!--<el-input v-model="formInline.userLevel" placeholder="精准/模糊查询" clearable></el-input>-->
                        <el-date-picker
                                v-model="formInline.queryTime"
                                type="month"
                                placeholder="选择月">
                        </el-date-picker>

                    </el-form-item>
                    <el-form-item>
                        <div class="btn-group marginL10">
                            <button class="vpnButton primary" type="button" @click="search()">查询</button>
                            <button class="vpnButton cancel" type="button" @click="cancel()">清空</button>
                        </div>
                    </el-form-item>
                </el-form>
            </div>
            <div class="assetsList">
                <el-scrollbar>
                    <el-table :data="tableData" style="width: 100%"  class="commonTable" size="mini" >
                        <el-table-column prop="yearMonth" label="年月" align="center"  min-width="6%"></el-table-column>
                        <el-table-column prop="month_manure_total" label="本月月度肥料总额" align="center"  min-width="6%"></el-table-column>
                        <el-table-column prop="monthAwardTotal" label="本月进步最大奖励池" align="center"  min-width="8%" :show-overflow-tooltip="true"></el-table-column>
                        <el-table-column prop="month_manure_award" label="月度肥料奖励" align="center"  min-width="8%" :show-overflow-tooltip="true"></el-table-column>
                        <el-table-column prop="goldAward" label="黄金树月奖励总额" align="center"  min-width="8%" :show-overflow-tooltip="true"></el-table-column>
                        <el-table-column prop="farmerAward" label="农场主月奖励总额" align="center"  min-width="8%" :show-overflow-tooltip="true"></el-table-column>
                        <el-table-column prop="forestStartAward" label="森林之星月奖励总额" align="center"  min-width="8%" :show-overflow-tooltip="true"></el-table-column>
                        <el-table-column prop="partnerAward" label="森田合伙人月奖励总额" align="center"  min-width="8%" :show-overflow-tooltip="true"></el-table-column>
                        <el-table-column prop="createTime" label="创建时间" align="center"  min-width="8%" :show-overflow-tooltip="true"></el-table-column>
                        <el-table-column prop="updateTime" label="修改时间" align="center"  min-width="8%" :show-overflow-tooltip="true"></el-table-column>
                    </el-table>
                </el-scrollbar>
            </div>
            <el-pagination background class="alignc" @current-change="handleCurrentChange" :current-page="page.currentPage" :page-size="page.pageSize" layout="total, prev, pager, next, jumper" :total="page.total">
            </el-pagination>
        </div>
    </div>
</template>
<script>
    import "../../../style/table.scss"
    //删除弹框
    import dialogDel from '../../../components/dialog/dialogDel'
    import workService from '../../../services/fos/work.service'
    let workHttps = new workService()
    let moment = require("moment");/*时间组件的引入*/
    export default {
        data() {
            return {
                dialogDataDetail:false,
                page: {currentPage: 1, pageSize: 14, total: 1},
                delShow: false,
                checked:'checked',
                delArr:[],
                multipleSelection: [],
                tableData: [],
                options:[],
                optionsa:[],
                optionsQl:[],
                formInline: {
                    queryTime: ''
                },
                userEmail:"",
                userMobil:"",
                belongStr:'',
                errorMsg:'',
                errorMsgEmail:'',
                errorMsgMobile:'',
                title:'',
            }
        },
        components: {},
        mounted() {
            this.search()

        },
        methods: {


            //查询
            search(){
                let vm = this;
                let param = vm.getSearchQuery()
                if(param.queryTime != undefined){
                    param.queryTime=moment(vm.formInline.queryTime).format('YYYY-MM')
                }
                vm.getDataDetail(param)
            },
            cancel(){
                this.formInline = {}
                this.page.currentPage = 1
                this.search()
            },

            //获取当前参数
            getSearchQuery(){
                let vm = this
                let searchObj = {
                    "pageNo":vm.page.currentPage,
                    "pageSize":vm.page.pageSize,
                }
                for(let key in vm.formInline){
                    if(vm.formInline[key]){
                        //key是名称
                        searchObj[key] = vm.formInline[key]
                    }
                }
                return searchObj
            },

            sizeChange(val) {
                this.page.pageSize = val;
                this.search()
            },

            handleCurrentChange(val) {
                this.page.currentPage = val;
                let param = this.getSearchQuery()
                this.getDataDetail(param)
            },

            //获取列表
            getDataDetail(param) {
                //请求接口的方法
                let vm = this;
                //请求接口的方法
                workHttps.getaward(param).then((res)=>{
                    vm.tableData = res.data.list
                    vm.page.total = Number(res.data.total)
                }).catch((err=>{
                }))
            },
        }
    }
</script>
<style lang="scss">
</style>


