<template>
  <el-dialog
    v-dialogDrag
    :title="title"
    :visible.sync="open"
    width="1200px"
    append-to-body
    @open="dialogOpen"
  >
    <!-- 列表 -->
    <el-table
      v-loading="loading"
      :data="list"
      border
      size="mini"
    >
      <el-table-column
        label="入库仓库"
        align="center"
        prop="erpStockId"
        width="150"
        show-overflow-tooltip
      />
      <el-table-column
        label="入库区域"
        align="center"
        prop="wmsStoreAreaId"
        width="150"
        show-overflow-tooltip
      />
      <el-table-column
        label="入库货位"
        align="center"
        prop="wmsStoreLocation"
        width="150"
        show-overflow-tooltip
      />
      <el-table-column
        label="物料批次"
        align="center"
        prop="materialLots"
        width="120"
        show-overflow-tooltip
      />
      <el-table-column
        label="采购订单"
        align="center"
        prop="purchaseOrderNo"
        width="120"
      />
      <el-table-column
        label="物料编码"
        align="center"
        prop="materialNo"
        width="150"
      />
      <el-table-column label="到货数量" align="center" prop="receiptQty" />
      <!-- <el-table-column label="检验状态" align="center" prop="testStatus" /> -->
      <el-table-column label="单位" align="center" prop="unitCode" />
      <el-table-column
        label="供应商"
        align="center"
        prop="supplierName"
        width="150"
        show-overflow-tooltip
      />
      <el-table-column
        label="登记时间"
        align="center"
        prop="receiptTime"
        width="160"
      >
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.receiptTime) }}</span>
        </template>
      </el-table-column>
      <el-table-column label="登记人" align="center" prop="receiptPerson" />
      <el-table-column label="检验结果" align="center" prop="testResult">
        <template slot-scope="scope">
          <dict-tag :type="DICT_TYPE.WMS_TEST_RESULT" :value="scope.row.testResult" />
        </template>
      </el-table-column>
      <el-table-column
        label="检验单号"
        align="center"
        prop="inspectionNo"
        width="150"
        show-overflow-tooltip
      />
      <el-table-column label="检验人" align="center" prop="testPerson" />
      <el-table-column
        label="检验时间"
        align="center"
        prop="testTime"
        width="160"
      >
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.testTime) }}</span>
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页组件 -->
    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNo"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 对话框(添加 / 修改) -->
  </el-dialog>
</template>

<script>
import { getIncomingStockedDetailPage } from '@/api/wms/incoming/wareHousing'

export default {
  name: 'SaleOrderDetail',
  components: {
  },
  data() {
    return {

      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 销售订单明细列表
      list: [],
      // 弹出层标题
      title: '',
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNo: 1,
        pageSize: 10,
        incomingStockNo: '',
        createTime: []
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      }
    }
  },
  methods: {
    /** 查询列表 */
    getList() {
      this.loading = true
      // 执行查询
      getIncomingStockedDetailPage(this.queryParams).then(response => {
        this.list = response.data.list
        this.total = response.data.total
      }).finally(() => {
        this.loading = false
      })
    },
    dialogOpen() {
      this.getList()
    }
  }
}
</script>

