<template>
  <el-dialog
    v-dialogDrag
    title="查看领料明细"
    :visible.sync="open"
    width="800px"
    append-to-body
    @open="dialogOpen"
  >
    <el-table
      v-loading="loading"
      :data="list"
      border
      size="mini"
    >
      <el-table-column
        label="物料编码"
        align="center"
        prop="materialNo"
        width="160"
        show-overflow-tooltip
      />
      <el-table-column
        label="物料名称"
        align="center"
        prop="materialName"
        width="160"
        show-overflow-tooltip
      />
      <el-table-column label="规格型号" align="center" prop="materialModels" />
      <el-table-column label="物料类别" align="center" prop="categoryNumber" />
      <el-table-column label="需求数量" align="center" prop="needQty" />
      <el-table-column label="单位" align="center" prop="unitName" />
    </el-table>
    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNo"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
  </el-dialog>
</template>

<script>
import { getProductionmaterialDetailPage } from '@/api/wms/orders/productPicking'

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

  <style>

  </style>

