<template>
  <el-dialog
    v-dialogDrag
    title="查看"
    :visible.sync="open"
    width="800px"
    append-to-body
    :before-close="beforeClose"
    @open="dialogOpen"
  >

    <el-table :data="list" border size="mini">
      <el-table-column label="产品编码" align="center" prop="productCode" />
      <el-table-column
        label="产品名称"
        align="center"
        prop="productName"
        width="120"
        show-overflow-tooltip
      />
      <el-table-column label="计划销售数量" align="center" prop="planQty" />
      <el-table-column label="单位" align="center" prop="unitCode" />
      <el-table-column label="出库数量" align="center" prop="sendQty" />
      <el-table-column
        label="操作"
        align="center"
        class-name="small-padding fixed-width"
        fixed="right"
        width="120"
      >
        <template slot-scope="scope">
          <el-button
            v-hasPermi="['wms:sale-out-order-detail:update']"
            size="mini"
            type="text"
            icon="el-icon-view"
            @click="handleView(scope.row)"
          >查看</el-button>
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页组件 -->
    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNo"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
    <!-- 查看 -->
    <ViewIssue ref="viewIssue" />
  </el-dialog>
</template>

<script>
import { getToOutedDetailPage } from '@/api/wms/output/salesIssue'
import ViewIssue from '../components/ViewIssue.vue'

export default {
  components: {
    ViewIssue
  },
  data() {
    return {
      // 遮罩层
      loading: false,
      buttonLoading: false,
      // 总条数
      total: 0,
      // WMS 生产发料 主列表
      list: [],
      // 弹出层标题
      title: '',
      // 是否显示弹出层
      open: false,
      // 显示搜索条件
      showSearch: true,
      searching: false,
      currentData: {},
      // 查询参数
      queryParams: {
        pageNo: 1,
        pageSize: 10,
        saleOrderDetailId: ''
      }
    }
  },
  methods: {
    /** 查询列表 */
    getList() {
      this.loading = true
      // 执行查询
      getToOutedDetailPage(this.queryParams).then(response => {
        this.list = response.data.list
        this.total = response.data.total
      }).finally(() => {
        this.loading = false
      })
    },
    // 查看
    handleView(row) {
      const { id } = row
      this.$refs.viewIssue.queryParams.id = id
      this.$refs.viewIssue.open = true
    },
    dialogOpen() {
      this.getList()
    },
    beforeClose(done) {
      this.list = []
      this.total = 0
      done && done()
    }
  }
}
</script>

  <style>
  </style>

