<!--
  @description: 采购成本下降情况
  @Modifier: haoFx
  @routerPath:
  @date: 2021-05-25-12:03
-->
<template>
  <div class="sum_Wrap">
    <el-table
      ref="smallTable"
      v-loading="loading"
      :data="tableData"
    >
      <el-table-column type="index" label="序号" width="60px" align="center" />
      <el-table-column
        header-align="center"
        prop="tenderMethod"
        label="采购方式"
        width="170"
      />
      <el-table-column
        header-align="center"
        prop="offerAvgHalfTotalMoney"
        label="报价总价（万元）"
        width="170"
        align="right"
      />
      <el-table-column
        header-align="center"
        prop="transactionTotalMoney"
        label="成交总价（万元）"
        width="170"
        align="right"
      />
      <el-table-column
        header-align="center"
        prop="costMoney"
        label="节约额（万元）"
        min-width="170"
        align="right"
      />
      <el-table-column
        header-align="center"
        prop="costRate"
        label="节约率"
        min-width="170"
        align="right"
      />
      <el-table-column
        header-align="center"
        prop="purchaseRate"
        label="采购占比"
        min-width="170"
        align="right"
      />
    </el-table>
  </div>
</template>

<script>
/* 公共方法*/
import { filterDictText, numFilter, moneyFormat } from '@/assets/js/utils' // 字典方法
export default {
  name: 'DeclineInProcurementCostsTableComp',
  props: {
    tableData: {
      type: Array,
      default: () => []
    },
    loading: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      /* --------------字典----------------*/
      tender_methodList: [], // 采购方式
      collectionTypeList: [], // 是否集采
      purchaseUnitList: [], // 计量单位
      taxRateList: [], // 税率
      dictionaryType: [
        'tender_method',
        'collectionType',
        'purchaseUnit',
        'taxRate'
      ] // 字典请求参数
    }
  },
  created() {
    this.getGroupType() // 字典请求初始化
  },
  methods: {
    filterDictText, // 字典
    numFilter, // 金额
    moneyFormat, // 金额千分位
    // 字典请求
    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]
          }
        }
      })
    }
  }
}
</script>

<style lang="less">

</style>
