<template>
    <div>
        <div class="mrg-b">
          <!--<drop-filter :columns="wholeLabels" :storeKey="storeKey"  :storeLabels="storeLables"  @doFilter="labels => storeLables = labels"></drop-filter>-->
            <el-table
            ref="table"
            stripe
            border
            :data="tableData"
            :filteredLabels="storeLables"
            @selection-change='handleSelectChange'>
                <table-column
                    type="selection"
                    width="45"
                    align="center">
                </table-column>
                <table-column
                label="货主">
                  <template slot-scope="scope">
                    <p>{{scope.row.ownerCode}}</p>
                    <p>{{scope.row.ownerName}}</p>
                  </template>
                </table-column>
                <table-column
                label="商品">
                  <template slot-scope="scope">
                      <p>{{scope.row.skuCode}}</p>
                      <p>{{scope.row.skuName}}</p>
                  </template>
                </table-column>
                <table-column
                label="越库收货状态">
                  <template slot-scope="scope">
                    {{$utils.keyMatcher(scope.row.status, $keys.stockIn.status).name}}
                  </template>
                </table-column>
                <table-column
                label="越库类型"
                prop="cdType">
                   <template slot-scope="scope">
                    {{$utils.keyMatcher(scope.row.cdType, $keys.crossDock.cdType).name}}
                  </template>
                </table-column>
                <table-column
                label="入库单号"
                prop="asnNo">
                </table-column>
                <table-column
                label="收货行号"
                prop="rcvLineNo">
                </table-column>
                <table-column
                label="预收数EA"
                prop="qtyPlanEa">
                </table-column>
                <table-column
                label="出库单号"
                prop="soNo">
                </table-column>
                <table-column
                label="出库单行号"
                prop="soLineNo">
                </table-column>
                <table-column
                label="操作"
                width="100"
                fixed="right">
                    <template slot-scope="scope">
                       <el-tooltip content="编辑" placement="top">
                        <el-button
                        v-auth="50800020109"
                        size="mini"
                        type="primary"
                        icon="el-icon-edit"
                        plain
                        circle
                        @click="handleEdit(scope.$index, scope.row)"></el-button></el-tooltip>
                    </template>
                </table-column>
            </el-table>
        </div>
    <div>
        <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page="currentPage"
            :page-sizes="[10, 20, 50, 100]"
            :page-size="pageSize"
            layout="total, sizes, prev, pager, next, jumper"
            :total="total">
        </el-pagination>
    </div>
</div>
</template>
<script>
export default {
  data () {
    return {

      removeSkuIds: [],
      headData: {},
      goodsData: [],
      storeKey: 'libraryGoods'
    }
  },
  props: {
    tableData: {
      type: Array,
      default: () => []
    },
    total: Number,
    pageSize: Number,
    currentPage: Number,
  },
  methods: {

    // 每页显示条数
    handleSizeChange (pageSize) {
      const query = { 'page.limitCount': pageSize, 'page.currentPage': this.currentPage }
      this.$emit('getList', query)
    },

    // 当前页码
    handleCurrentChange (currentPage) {
      const query = { 'page.limitCount': this.pageSize, 'page.currentPage': currentPage }
      this.$emit('getList', query)
    },
    getData (url, param) {
      return this.$https.post(url, param)
    },
    // 编辑行
    handleEdit (index, row) {
      const asnUrl = this.$API.CrossDock.CrossDockTaskExcuteList.getAsn
      const sonUrl = this.$API.CrossDock.CrossDockTaskExcuteList.getSon
      const allotUrl = this.$API.CrossDock.CrossDockTaskExcuteList.getAllot
      const param = { wmAsnDetailReceiveQueryBean: JSON.stringify(row) }
      this.$https.all([this.getData(asnUrl, param), this.getData(sonUrl, param), this.getData(allotUrl, param)]).then(res => {
        console.log(res)
        const asnList = res[0].rows
        const sonList = res[1].rows
        const allotList = res[2].rows
        this.$emit('handleOpenEditForm', 'edit', asnList, sonList, allotList, row)
      })
    },

    // checkbox勾选
    handleSelectChange (selection) {
      this.$emit('handleSelectChange', selection)
    }
  }
}
</script>
<style lang="scss" scoped>
    .mrg-b{
        margin-bottom: 20px;
    }
    .mrg-l{
        margin-left:10px;
    }
    .blue{
      cursor: pointer;
      color:#0682ea
    }
</style>
