<template>
<div class="combine">
  <Query
    class="combine__query"
    @getList="getList"
  ></Query>
  <List
    :list="combineList"
    :total="total"
    :currentNo="currentNo"
    :pageSize="pageSize"
    @getList="getList"
  ></List>
</div>
</template>

<script>
import Query from './components/Query'
import List from './components/List'

export default {
  name: 'Combine',
  components: { Query, List },
  mounted () {
    this.getList()
  },

  data () {
    return {
      query: {
        'page.currentPage': 1,
        'page.limitCount': 20,
      }, // 查询条件
      combineList: [], // 报表列表
      total: 0, // 总数据量
      currentNo: 1,
      pageSize: 20,
    }
  },
  methods: {
    // 获取报表列表
    getList (query = {}) {
      const url = this.$API.summaryReport.combineList
      const param = { ...this.query, ...query }
      param.quickCondition !== undefined && (param.quickCondition = `%${param.quickCondition}%`) // 避免传空值只能查到部分数据
      this.$https.post(url, param)
        .then(data => {
          this.combineList = data.rows
          this.total = data.total
          this.currentNo = data.currentPage
          this.pageSize = data.limit
        })
    },
    // 勾选变化, 缓存id
    // cacheSelectedIds (ids) {
    //   this.selectedIds = ids
    // }
  },
}
</script>

<style lang="scss" scoped>
.combine__query {
  margin-bottom: 20px;
}
</style>
