<template>
  <el-dialog
    v-dialogDrag
    title="物料明细"
    :visible.sync="open"
    width="1200px"
    append-to-body
    :before-close="beforeClose"
    @open="dialogOpen"
  >
    <el-table
      v-loading="loading"
      :data="list"
      border
      size="mini"
    >
      <el-table-column
        label="物料批次"
        align="center"
        prop="wmsLabelMasterId"
        width="150"
      />
      <el-table-column label="仓库" align="center" prop="wmsStockId" />
      <el-table-column label="区域" align="center" prop="wmsStockAreaId" />
      <el-table-column label="货位" align="center" prop="wmsStockLocationId" />
      <el-table-column
        label="物料编码"
        align="center"
        prop="erpMaterialId"
        width="300"
      />
      <el-table-column label="供应商" align="center" prop="supplierCode" />
      <el-table-column label="批次数量" align="center" prop="batchQty" />
      <el-table-column label="单位" align="center" prop="unitCode" />
    </el-table>
    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNo"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
  </el-dialog>
</template>

<script>
import { getOutStockMaterialDetailPage } from '@/api/wms/output/productionIssue'

export default {
  name: 'MaterialDetails',
  data() {
    return {
      // 遮罩层
      loading: true,
      // 总条数
      total: 0,
      // WMS 生产发料 主列表
      list: [],
      // 弹出层标题
      title: '',
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNo: 1,
        pageSize: 10,
        id: null
      }
    }
  },
  methods: {
    /** 查询列表 */
    getList() {
      this.loading = true
      // 执行查询
      getOutStockMaterialDetailPage(this.queryParams).then(response => {
        this.list = response.data.list
        this.total = response.data.total
      }).finally(() => {
        this.loading = false
      })
    },
    dialogOpen() {
      this.$nextTick(() => {
        this.getList()
      })
    },
    beforeClose(done) {
      this.list = []
      this.total = 0
      done && done()
    }
  }
}
</script>

    <style>

    </style>

