<!--
  @description: 采购方式变更/退回计划工作流代办处理页
  @author: lxl
  @date： 2020-11-02 14:32
-->
<template>
  <div class="p0-16">
    <p class="page-title">
      1.业务原因
    </p>
    <table class="tableData" style="margin:10px 0px">
      <tr>
        <td>
          业务原因
        </td>
        <td colspan="3">
          {{ formData.bizReason }}
        </td>
      </tr>
    </table>
    <p class="page-title">
      2.行项目信息
    </p>
    <section class="table_border_wrap" style="margin:10px 0px">
      <el-table :data="formData.packList" stripe>
        <el-table-column type="index" label="序号" align="center" />
        <el-table-column prop="purchaseNo" label="行项目编号" min-width="150" header-align="center" align="left" />
        <el-table-column prop="purchaseCode" label="物资编码" min-width="120" header-align="center" align="left" />
        <el-table-column prop="purchaseName" label="物资名称" min-width="220" header-align="center" align="left" />
        <el-table-column label="创建时间" min-width="220" show-overflow-tooltip align="center">
          <template slot-scope="scope">
            {{ scope.row.createTime && $Moment(scope.row.createTime).format(momentDateTime) }}
          </template>
        </el-table-column>
        <el-table-column label="交货时间" min-width="220" show-overflow-tooltip align="center">
          <template slot-scope="scope">
            {{ scope.row.deliveryTime && $Moment(scope.row.deliveryTime).format(momentDateTime) }}
          </template>
        </el-table-column>
        <el-table-column prop="deliveryAddress" label="交货地点" min-width="220" show-overflow-tooltip header-align="center" align="left" />
        <el-table-column prop="purchaseBrand" label="品牌" min-width="220" show-overflow-tooltip header-align="center" align="left" />
        <el-table-column prop="purchaseBuyer" label="采购员姓名" min-width="220" show-overflow-tooltip header-align="center" align="left" />
        <!-- <el-table-column prop="purchaseClassificationParent" width="150" label="一级专业分类" header-align="center" />
        <el-table-column prop="purchaseClassification" label="二级专业分类" min-width="220" show-overflow-tooltip header-align="center" align="left" /> -->
        <el-table-column prop="purchaseDepartName" label="采购单位" min-width="220" show-overflow-tooltip header-align="center" align="left" />
        <el-table-column prop="purchasePlanNo" label="采购申请编号" min-width="220" show-overflow-tooltip header-align="center" align="left" />
        <el-table-column prop="purchaseSpecification" label="规格型号" min-width="220" show-overflow-tooltip header-align="center" align="left" />
        <el-table-column label="税率" min-width="150" show-overflow-tooltip header-align="center" align="left">
          <template slot-scope="scope">
            {{ filterDictText(taxRateList,scope.row.purchaseTaxRate) }}
          </template>
        </el-table-column>
        <el-table-column label="计量单位" min-width="180" align="center">
          <template slot-scope="scope">
            {{ filterDictText(purchaseUnitList,scope.row.purchaseUnit) }}
          </template>
        </el-table-column>
        <el-table-column prop="purchaseUserRealName" label="上报人" min-width="220" show-overflow-tooltip header-align="center" align="left" />

        <!-- <el-table-column prop="resultExeNo" label="结果执行编号" min-width="220" show-overflow-tooltip header-align="center" align="left" /> -->
        <el-table-column prop="suppliersName" label="供货厂商名称" min-width="220" show-overflow-tooltip header-align="center" align="left" />
        <el-table-column prop="tenderManager" label="技术联系人/电话" min-width="220" show-overflow-tooltip header-align="center" align="left" />
        <el-table-column label="原采购方式" min-width="220" show-overflow-tooltip header-align="center" align="center">
          <template slot-scope="scope">
            {{ filterDictText(tenderMethodList,scope.row.initTenderMethod) }}
          </template>
        </el-table-column>
        <el-table-column label="采购方式" min-width="220" show-overflow-tooltip header-align="center" align="center">
          <template slot-scope="scope">
            {{ filterDictText(tenderMethodList,scope.row.tenderMethod) }}
          </template>
        </el-table-column>
        <el-table-column prop="tenderNo" label="采购单编号" min-width="220" show-overflow-tooltip header-align="center" align="left" />
        <el-table-column label="公开/邀请" min-width="220" show-overflow-tooltip header-align="center" align="left">
          <template slot-scope="scope">
            {{ filterDictText(tenderTypeList,scope.row.tenderType) }}
          </template>
        </el-table-column>
        <el-table-column prop="purchaseNum" label="采购数量" min-width="100" header-align="center" align="right" />
        <el-table-column label="预算净单价(元)" min-width="110" header-align="center" align="right">
          <template slot-scope="scope">
            {{ scope.row.purchaseBudget && numFilter(scope.row.purchaseBudget) }}
          </template>
        </el-table-column>
        <el-table-column label="预算净总价(元)" min-width="110" header-align="center" align="right">
          <template slot-scope="scope">
            {{ scope.row.purchaseTotalBudget && numFilter(scope.row.purchaseTotalBudget) }}
          </template>
        </el-table-column>
        <el-table-column prop="remark" label="备注" min-width="220" show-overflow-tooltip header-align="center" align="left" />
      </el-table>
    </section>
  </div>
</template>
<script>
/* api*/
import { getPurchasePlanDetailsAuditPage } from '@/api/procurement/purchasplan'
/* 公用*/
import { filterDictText, numFilter } from '@/assets/js/utils' // 公用方法
export default {
  name: 'PurPlanTurnFlowDetail',
  data() {
    return {
      /* --------------字典----------------*/
      tenderTypeList: [], // 公开/邀请
      tenderMethodList: [], // 采购方式
      // collectionTypeList: [], // 是否集采
      taxRateList: [], // 税率
      purchaseUnitList: [], // 计量单位
      dictionaryType: ['tenderType', 'tenderMethod', 'taxRate', 'purchaseUnit'], // 字典请求参数
      /* ------------------------------*/
      formData: {} // 基本信息
    }
  },
  created() {
    this.loaData() // 数据初始化
    this.getGroupType() // 字典请求初始化
  },
  methods: {
    filterDictText, // 字典
    numFilter,
    // 字典请求
    getGroupType() {
      this.$store.dispatch('getGroupType', this.dictionaryType).then((data) => {
        // 遍历key存储相应的数据
        for (const key in data.bidTypeData) {
          /* 是否有数据*/
          if (data.bidTypeData[key]) {
            this[key] = data.bidTypeData[key]
          }
        }
      })
    },
    loaData() {
      const params = {
        bizAuditId: this.$route.query.id
      }
      getPurchasePlanDetailsAuditPage(params).then((res) => {
        this.formData = res.data
      })
    }
  }
}
</script>
