<template>
    <div>
        <el-tabs type="card"  @tab-click="handleClickTabs" :value="tabIndex">
            <el-tab-pane >
                <span slot="label">待审核<el-badge :value="tabsNum.beforeAuditTotal" class="item"></el-badge></span>
            </el-tab-pane>
            <el-tab-pane>
                <span slot="label">待分配<el-badge :value="tabsNum.beforeAllocTotal" class="item"></el-badge></span>
            </el-tab-pane>
            <el-tab-pane >
                <span slot="label">已分配<el-badge :value="tabsNum.afterAllocTotal" class="item"></el-badge></span>
            </el-tab-pane>
            <el-tab-pane >
                <span slot="label">出库中<el-badge :value="tabsNum.shippingTotal" class="item"></el-badge></span>
            </el-tab-pane>
            <el-tab-pane  >
                <span slot="label">已完成<el-badge :value="tabsNum.shippedTotal" class="item"></el-badge></span>
            </el-tab-pane>
            <el-tab-pane >
                <span slot="label">已关闭<el-badge :value="tabsNum.closeTotal" class="item"></el-badge></span>
            </el-tab-pane>
            <el-tab-pane >
                <span slot="label">已取消<el-badge :value="tabsNum.cancelTotal" class="item"></el-badge></span>
            </el-tab-pane>
        </el-tabs>
        <list
            :tableData="tableList"
            :total="total"
            :tabIndex="tabIndex"
            :currentPage="currentPage"
            :pageSize="pageSize"
            :todoBool="todoBool"
            :type="type"
            @getList="handlegetList"
            @handleSelectChange="cacheSelectedIds"
            @handleOpenEditForm="handleOpenEditForm"
            @handleOpenDetail="handleOpenDetail">
        </list>
    </div>
</template>
<script>

import List from './list'
export default {
  components: {
    List
  },
  data () {
    return {
    }
  },
  props: {
    tableList: Array,
    tabsNum: Object,
    total: Number,
    currentPage: Number,
    pageSize: Number,
    type: String,
    todoBool: Boolean,
    tabIndex: String
  },
  created () {
  },

  methods: {

    handlegetList (query, mode) {
      this.$emit('getList', query, mode)
    },
    // 切换tab
    handleClickTabs (tab, event) {
      this.$emit('handleClickTabs', tab, event)
    },

    //  打开编辑窗口
    handleOpenEditForm (mode, headData, carData, goodsData) {
      this.$emit('handleOpenEditForm', mode, headData, carData, goodsData)
    },

    // 打开详情
    handleOpenDetail (mode, ...arg) {
      const index = this.tabIndex
      this.$emit('handleOpenDetail', mode, index, ...arg)
    },

    // 获得子组件列表传出的checkbox勾选id
    cacheSelectedIds (ids, rows) {
      // 传给上一级父组件
      this.$emit('cacheSelectedIds', ids, rows)
    }

  }
}
</script>
<style lang="scss" scoped>
    .mrg-b{
        margin-bottom: 20px;
    }
    .mrg-l{
        margin-left:10px;
    }
</style>
