<template>
  <el-dialog
    v-dialogDrag
    :title="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="saleOrderNo" />
      <el-table-column label="出库状态" align="center" prop="outStatus">
        <template slot-scope="scope">
          <dict-tag :type="DICT_TYPE.WMS_ISSUE_STATUS" :value="scope.row.outStatus" />
        </template>
      </el-table-column>
      <el-table-column label="产品编码" align="center" prop="productCode" />
      <el-table-column
        label="产品名称"
        align="center"
        prop="productName"
        width="300"
      />
      <el-table-column label="交货时间" align="center" prop="deliveryTime">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.deliveryTime) }}</span>
        </template>
      </el-table-column>
      <el-table-column label="计划销售数量" align="center" prop="planQty" />
      <el-table-column label="累计已出库数量" align="center" prop="sendQty" />
      <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 { getToOutDetailPage } from '@/api/wms/output/salesIssue'

export default {
  data() {
    return {
      // 遮罩层
      loading: true,
      // 总条数
      total: 0,
      // WMS 生产发料 主列表
      list: [],
      // 弹出层标题
      title: '',
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNo: 1,
        pageSize: 10,
        id: null,
        saleOutNo: null
      }
    }
  },
  methods: {
    /** 查询列表 */
    getList() {
      this.loading = true
      // 执行查询
      getToOutDetailPage(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>

