<template>
<div class="standardWhAge">
  <Query
    class="standardWhAge__query"
    @getList="getList"
  ></Query>
  <List
    :list="standardWhAgeList"
    :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: 'StandardWhAge',
  components: { Query, List },
  mounted () {
    this.getList()
  },

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