<template>
<div class="rotationRate">
  <Query
    class="rotationRate__query"
    @getList="getList"
  ></Query>
  <List
    :list="rotationRateList"
    :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: 'RotationRate',
  components: { Query, List },
  mounted () {
    this.getList()
  },

  data () {
    return {
      query: {
        'page.currentPage': 1,
        'page.limitCount': 20,
      }, // 查询条件
      rotationRateList: [], // 报表列表
      total: 0, // 总数据量
      currentNo: 1,
      pageSize: 20,
    }
  },
  methods: {
    // 获取报表列表
    getList (query = {}) {
      const url = this.$API.summaryReport.rotationRateList
      const param = { ...this.query, ...query }
      param.quickCondition !== undefined && (param.quickCondition = `%${param.quickCondition}%`) // 避免传空值只能查到部分数据
      this.$https.post(url, param)
        .then(data => {
          this.rotationRateList = 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>
.rotationRate__query {
  margin-bottom: 20px;
}
</style>
