<template>
  <div class="normal-card">
    <time-select @timeChange="timeChange" @clearSelect="clearSelect" v-if="tool.checkAuth($route.name,'read')"></time-select>
    <list :list="oneData" v-if="tool.checkAuth($route.name,'read')"></list>
    <!--分页-->
    <pagination :total="total" :pageSize="param.content.pageSize" :currentPage="param.content.pageNumber" @pageChange="pageChange">
    </pagination>
  </div>
</template>

<script>
import Pagination from '@/components/pagination/Pagination'
import SelectPanl from '@/SManagement/submitedit_one/components/SelectPanl'
import TimeSelect from '@/SManagement/submitedit_one/components/TimeSelect'

import list from '@/SManagement/submitedit_one/components/list'
import { log } from '@antv/g2plot/lib/utils'
export default {
  name: 'index',
  data () {
    return {
      param: {
          "classname": "saletool.submitedit.submitedit",
          "method": "select_submitlist",
          "content": {
              "nocache":true,
              "onceonly":1,
              "pageNumber": 1,
              "pageSize": 9,
              "where":{
                  "begdate":"",
                  "enddate":""
              }
          }
      },
      oneData:[],
      total: 0,
    }
  },
  components: {
    Pagination,
    SelectPanl,
    list,
    TimeSelect
  },
  computed: {
  },
  watch: {
  },
  created () {
    this.getSubmitEditAction()
  },
  methods: {
    //获取所有一事一报
    async getSubmitEditAction () {
      let res = await this.$api.requested(this.param)
      this.oneData = res.data
      this.total = res.total
      console.log(this.oneData);
      
    },
    pageChange (n) {
      this.param.content.pageNumber = n
      this.getSubmitEditAction() 
    },
    timeChange(time) {
      this.param.content.where.begdate = time[0]
      this.param.content.where.enddate = time[1]
      this.param.content.pageNumber = 1
      this.getSubmitEditAction()
    },
    clearSelect() {
      this.param.content.where.begdate = ''
      this.param.content.where.enddate = ''
      this.param.content.pageNumber = 1
      this.getSubmitEditAction()
    }
  },
};
</script>

<style scoped>
* {
  box-sizing: border-box;
}
.normal-card {
  min-height: 100%;
  padding: 18px 20px 30px 10px;
  position: relative;
}
.el-pagination {
  position: absolute;
  right: 16px;
  bottom: 0;
}
/deep/.el-empty {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%,-50%);
}
</style>