<template>
  <div class="ele-body">
    <el-card shadow="never" v-loading="loading">
      <search @search="reload" ref="searchRef"></search>
      <ele-pro-table
        ref="table"
        :columns="columns"
        max-height="68vh"
        :datasource="datasource"
        cache-key="pickingDetails"
        highlight-current-row
        @refresh="refresh"
      >
        <template v-slot:status="{ row }">
          <el-tag
            :type="row.status == '0' ? 'danger' : 'success'"
            effect="dark"
            >{{
              row.status == '0'
                ? '未领料'
                : row.status == '1'
                ? '已领料'
                : row.status == '2'
                ? '已出库'
                : ''
            }}</el-tag
          >
        </template>
      </ele-pro-table>
    </el-card>
  </div>
</template>

<script>
  import { getPage } from '@/api/pick/pickApply';
  import search from './components/search.vue';

  export default {
    name: 'pickApply',
    components: {
      search
    },
    data() {
      return {
        dataList: [],
        loading: false
      };
    },

    computed: {
      // 表格列配置
      columns() {
        return [
          {
            columnKey: 'index',
            label: '序号',
            type: 'index',
            width: 55,
            align: 'center',
            showOverflowTooltip: true
          },
  
          {
            prop: 'code',
            label: '领料单编号',
            align: 'center'
          },

       

          {
            prop: '',
            label: '关联工单编号',
            align: 'center'
          },

          {
            prop: '',
            label: '仓库名称',
            align: 'center'
          },

          {
            prop: 'executorName',
            label: '领料人',
            align: 'center'
          },

          {
            prop: 'createTime',
            label: '领料时间',
            align: 'center'
          },
          {
            prop: 'status',
            slot: 'status',
            label: '状态',
            align: 'center'
          },

          {
            prop: '',
            label: '操作',
            width: 80,
            align: 'center',
            resizable: false,
            fixed: 'right',
            slot: 'action'
          }
        ];
      }
    },

    methods: {
      /* 表格数据源 */
      datasource({ page, limit, where }) {
        return getPage({
          ...where,
          pageNum: page,
          size: limit
        });
      }
    },
    created() {}
  };
</script>

<style lang="scss" scoped></style>
