<!--
  @description: 订单验收信息
  @Modifier: haofengxian
  @routerPath:
  @date: 2021-2-26-11:23
-->
<template>
  <div>
    <p class="page-title">
      5.验收情况
    </p>
    <el-table ref="smallTable" v-loading="loading" :data="tableData">
      <el-table-column
        type="index"
        label="序号"
        align="center"
        width="60"
        fixed
      />
      <el-table-column
        prop="zysbh"
        label="验收任务编号"
        header-align="center"
        align="center"
        min-width="150"
        fixed
      />
      <el-table-column
        prop="zysh"
        label="验收行"
        header-align="center"
        align="center"
        min-width="150"
        fixed
      />
      <el-table-column
        prop="zysms"
        label="验收任务描述"
        header-align="center"
        min-width="230"
        fixed
      />
      <el-table-column
        prop="statu"
        label="状态"
        min-width="180"
        header-align="center"
      />
      <el-table-column
        prop=" zhxm"
        label="发货计划行"
        min-width="180"
        header-align="center"
      />
      <el-table-column
        prop="ebeln"
        label="采购凭证编号"
        min-width="200"
        header-align="center"
      />
      <el-table-column
        prop="ebelp"
        label="采购凭证的项目编号"
        width="150"
        header-align="center"
        align="center"
      />
      <el-table-column
        prop="menge"
        label="采购订单数量"
        min-width="200"
        header-align="center"
      />
      <el-table-column
        prop="zfhsl"
        label="发货数量"
        min-width="200"
        header-align="center"
      />
      <el-table-column
        prop="zdyssl"
        label="待验收数量"
        min-width="200"
        header-align="center"
      />
      <el-table-column
        prop="werks"
        label="工厂"
        min-width="200"
        header-align="center"
      />
      <el-table-column
        prop="lifnr"
        label="供应商或债权人的帐号"
        min-width="200"
        header-align="center"
      />
      <el-table-column
        prop="lifnr1"
        label="供应商或债权人的帐号"
        min-width="200"
        header-align="center"
      />
      <el-table-column
        prop="matnr"
        label="物料编号"
        min-width="200"
        header-align="center"
      />
      <el-table-column
        prop="zyjdhrq"
        label="预计到货时间"
        min-width="200"
        header-align="center"
      />
      <el-table-column
        prop="zdhsj"
        label="到货日期"
        width="130"
        header-align="center"
        align="center"
      >
        <template slot-scope="scope">
          {{ scope.row.zdhsj && $Moment(scope.row.zdhsj).format(momentDate) }}
        </template>
      </el-table-column>
      <el-table-column
        prop="zyssl"
        label="验收数量"
        min-width="200"
        header-align="center"
      />
      <el-table-column
        prop="meins"
        label="基本计量单位"
        min-width="200"
        header-align="center"
      />
      <el-table-column
        prop="ykPlaner"
        label="计划员"
        min-width="200"
        header-align="center"
      />
      <el-table-column
        prop="zflag1"
        label="需厂商配合现场验收"
        min-width="200"
        header-align="center"
      />
      <el-table-column
        prop="zcsxm"
        label="厂商姓名"
        min-width="200"
        header-align="center"
      />
      <el-table-column
        prop="zjlsj"
        label="记录时间"
        width="140"
        header-align="center"
        align="center"
      />
      <el-table-column
        prop="zbhgsl"
        label="不合格数量"
        min-width="200"
        header-align="center"
      />
      <el-table-column
        prop="zqksm"
        label="情况说明"
        min-width="200"
        header-align="center"
      />
      <el-table-column
        prop="zcreateddate"
        label="创建日期"
        min-width="200"
        header-align="center"
        align="center"
      >
        <template slot-scope="scope">
          {{ scope.row.zcreateddate && $Moment(scope.row.zcreateddate).format(momentDate) }}
        </template>
      </el-table-column>
      <el-table-column
        prop="zcreatedby"
        label="创建人"
        min-width="200"
        header-align="center"
      />
      <el-table-column
        prop="zchangeddate"
        label="修改日期"
        width="130"
        header-align="center"
        align="center"
      >
        <template slot-scope="scope">
          {{ scope.row.zchangeddate && $Moment(scope.row.zchangeddate).format(momentDate) }}
        </template>
      </el-table-column>
      <el-table-column
        prop="zchangedby"
        label="修改人"
        min-width="200"
        header-align="center"
      />
      <el-table-column
        prop="zdldate"
        label="指标结果的录入日期"
        width="130"
        header-align="center"
      >
        <template slot-scope="scope">
          {{ scope.row.zdldate && $Moment(scope.row.zdldate).format(momentDate) }}
        </template>
      </el-table-column>
      <el-table-column
        prop="zdldate"
        label="操作"
        width="200"
        header-align="center"
        fixed="right"
        align="center"
      >
        <template slot-scope="scope">
          <el-link
            type="primary"
            @click.stop="acceptanceResult(scope.row)"
          >
            [验收结果]
          </el-link>
          <el-link
            type="primary"
            @click.stop="invoiceInfo(scope.row)"
          >
            [发票信息]
          </el-link>
        </template>
      </el-table-column>
    </el-table>
    <pagination :pagination-data="paginationData" @change="getSapAcceptanceCertificateList" />
    <!--发票信息-->
    <acceptanceSituationinvoiceInfoDialog ref="acceptanceSituationinvoiceInfo" />
    <!--验收结果-->
    <acceptanceSituationResultDialog ref="acceptanceSituationResult" />
  </div>
</template>

<script>
/* api*/
import { sapAcceptanceCertificateList } from '@api/procurement/purchasplan'
/* 组件*/
import acceptanceSituationinvoiceInfoDialog from './acceptanceSituationinvoiceInfo-dialog'
import acceptanceSituationResultDialog from './acceptanceSituationResult-dialog'
import pagination from '@comp/common/pagination/pagination' // 分页组件
import { ListMixin } from '@/mixins/ListMixin' // 分页
export default {
  name: 'ProcurementOrderAcceptanceInfoDetail',
  components: {
    pagination, // 分页
    acceptanceSituationinvoiceInfoDialog, // 发票信息
    acceptanceSituationResultDialog // 验收结果
  },
  mixins: [ListMixin],
  data() {
    return {
      loading: true,
      tableData: []
    }
  },
  created() {
    this.getSapAcceptanceCertificateList()
  },
  methods: {
    // Sap验收单信息列表
    getSapAcceptanceCertificateList() {
      const params = {
        ...this.paginationData,
        sapOrderCode: this.$route.params.sapOrderCode // 验收任务编号
      }
      sapAcceptanceCertificateList(params).then(res => {
        const { data: { records, total }} = res
        this.tableData = records
        this.paginationData.total = total
        this.loading = false
      }).catch(() => {
        this.loading = false
      })
    },
    // 验收结果
    acceptanceResult(row) {
      this.$refs.acceptanceSituationResult.acceptanceResultDetail(row)
    },
    // 发票信息
    invoiceInfo(row) {
      this.$refs.acceptanceSituationinvoiceInfo.invoiceInfoDetail(row)
    }
  }
}
</script>

<style scoped>

</style>
