<!--
  @description:采购计划-计划结果执行分配列表表格组件
  @Modifier: haofengxian
  @routerPath:
  @date: 2021-2-22-11:00
-->
<template>
  <el-table
    ref="smallTable"
    v-loading="false"
    :data="tableData"
    select-on-indeterminate
    :row-key="getRowKeys"
    @selection-change="handleSelectionChange"
  >
    <el-table-column
      type="selection"
      reserve-selection
      width="60px"
      align="center"
      fixed="left"
    />
    <el-table-column
      type="index"
      label="序号"
      width="60px"
      align="center"
      fixed="left"
    />
    <el-table-column min-width="150" prop="purchaseNo" label="行项目编号" header-align="center" align="left" fixed="left" />
    <el-table-column min-width="110" prop="purchaseCode" label="物资编码" header-align="center" align="left" fixed="left" />
    <el-table-column min-width="220" prop="purchaseName" label="物资名称" header-align="center" align="left" fixed="left" />
    <el-table-column min-width="150" label="采购方式" align="center">
      <template slot-scope="scope">
        {{ filterDictText(tenderMethodList,scope.row.tenderMethod) }}
      </template>
    </el-table-column>
    <el-table-column min-width="220" prop="suppliersName" label="供货厂商" header-align="center" align="left" />
    <el-table-column min-width="150" prop="purchaseBrand" label="品牌" header-align="center" align="left" />
    <el-table-column prop="purchaseClassificationParent" width="150" label="一级专业分类" header-align="center" />
    <el-table-column min-width="150" prop="purchaseClassification" label="二级专业分类" header-align="center" align="left" />
    <el-table-column min-width="220" prop="purchaseSpecification" label="物资描述" header-align="center" align="left" />
    <el-table-column min-width="150" prop="resultExeNo" label="结果执行编号" align="center" />
    <el-table-column min-width="150" prop="tenderManager" label="采购员" align="center" />
    <el-table-column min-width="80" label="是否集采" align="center">
      <template slot-scope="scope">
        {{ filterDictText(collectionTypeList,scope.row.collectionType) }}
      </template>
    </el-table-column>
    <el-table-column min-width="100" prop="purchaseNum" label="数量" header-align="center" align="right" />
    <el-table-column min-width="80" label="计量单位" align="center">
      <template slot-scope="scope">
        {{ filterDictText(purchaseUnitList,scope.row.purchaseUnit) }}
      </template>
    </el-table-column>
    <el-table-column min-width="110" label="预算净单价(元)" header-align="center" align="right">
      <template slot-scope="scope">
        {{ scope.row.purchaseBudget && numFilter(scope.row.purchaseBudget) }}
      </template>
    </el-table-column>
    <el-table-column min-width="110" label="预算净总价(元)" header-align="center" align="right">
      <template slot-scope="scope">
        {{ scope.row.purchaseTotalBudget && numFilter(scope.row.purchaseTotalBudget) }}
      </template>
    </el-table-column>
    <el-table-column min-width="150" label="税率(%)" header-align="center" align="left">
      <template slot-scope="scope">
        {{ filterDictText(taxRateList,scope.row.purchaseTaxRate) }}
      </template>
    </el-table-column>
    <el-table-column sortable="custom" min-width="110" label="交货日期" align="center">
      <template slot-scope="scope">
        {{ scope.row.deliveryTime && $Moment(scope.row.deliveryTime).format(momentDate) }}
      </template>
    </el-table-column>
    <el-table-column min-width="220" prop="deliveryAddress" label="交货地点" header-align="center" align="left" />
    <el-table-column min-width="220" prop="purchaseDepartName" label="采购单位" header-align="center" align="left" />
    <el-table-column min-width="130" prop="planManagerName" label="计划负责人" header-align="center" align="left" />
    <el-table-column min-width="150" prop="remark" label="备注" header-align="center" align="left" />
    <el-table-column min-width="130" prop="purchaseDepartName" label="上报人" header-align="center" align="left" />
    <el-table-column min-width="150" prop="purchasePlanNo" label="采购计划编号" header-align="center" align="left" />
    <el-table-column min-width="150" prop="purchasePlanName" label="采购计划名称" header-align="center" align="left" />
    <el-table-column
      sortable="custom"
      min-width="110"
      label="创建日期"
      align="center"
    >
      <template slot-scope="scope">
        {{ scope.row.createTime && $Moment(scope.row.createTime).format(momentDate) }}
      </template>
    </el-table-column>
    <el-table-column
      sortable="custom"
      min-width="110"
      label="批准日期"
      align="center"
    >
      <template slot-scope="scope">
        {{ scope.row.approvalTime && $Moment(scope.row.approvalTime).format(momentDate) }}
      </template>
    </el-table-column>
    <el-table-column width="80" label="附件" fixed="right" align="center">
      <template slot-scope="scope">
        <el-link v-if="scope.row.isContainAttachment==='1'" type="primary" @click.stop="checkAccessory(scope.row)">
          查看
        </el-link>
      </template>
    </el-table-column>
  </el-table>
</template>
<script>
/* 公用方法*/
import { procurementPlanGrounpMixins } from '@views/procurement/procurementPlan/mixins/procurementPlanGroupMixins' // 字典信息
import { filterDictText, numFilter } from '@/assets/js/utils' // 字典方法
export default {
  name: 'ResultAffirmTableComp',
  mixins: [procurementPlanGrounpMixins],
  props: {
    tableData: {
      type: Array,
      default: () => []
    }
  },
  methods: {
    filterDictText,
    numFilter,
    // 附件查看
    checkAccessory(row) {
      this.$emit('checkFile', row, true)
    },
    // 获取row的key值优化表格的渲染
    getRowKeys(row) {
      return row.planDetailId
    },
    // 选择事件
    handleSelectionChange(row) {
      this.$emit('MultipleData', row)
    },
    // 清除复选框选择
    clearSel() {
      this.$refs.smallTable.clearSelection()
    }
  }
}
</script>
