<!--
 * @Description: 采购计划-行项目信息
 * @Author:lxl
 * @Date: 2020-11-03 14:19:56
-->
<template>
  <div>
    <el-table ref="smallTable" v-loading="loading" :data="lineItemData">
      <el-table-column
        type="index"
        label="序号"
        width="60"
        align="center"
        fixed
      />
      <el-table-column
        header-align="center"
        min-width="150"
        align="left"
        prop="purchaseNo"
        label="行项目编号"
        fixed="left"
      />
      <el-table-column
        header-align="center"
        min-width="110"
        align="center"
        prop="purchaseCode"
        label="物资编码"
        fixed="left"
      />
      <!-- 物资名称-暂时隐藏 -->
      <!-- <el-table-column
        header-align="center"
        align="left"
        prop="purchaseName"
        min-width="230"
        label="物资名称"
        fixed
      /> -->
      <!-- 物资描述 -->
      <el-table-column
        header-align="center"
        align="left"
        prop="purchaseSpecification"
        min-width="230"
        label="物资描述"
      />
      <el-table-column
        header-align="center"
        min-width="220"
        prop="purchaseDepartName"
        label="采购单位"
      />
      <el-table-column
        header-align="center"
        align="left"
        prop="purchaseBrand"
        min-width="220"
        label="品牌"
      />
      <el-table-column
        header-align="center"
        align="left"
        prop="purchaseClassificationParent"
        min-width="180"
        label="一级专业分类"
      />
      <el-table-column
        header-align="center"
        align="left"
        prop="purchaseClassification"
        min-width="180"
        label="二级专业分类"
      />
      <el-table-column
        header-align="center"
        align="center"
        width="100"
        label="计量单位"
      >
        <template slot-scope="scope">
          {{ filterDictText(purchaseUnitList,scope.row.purchaseUnit) }}
        </template>
      </el-table-column>
      <el-table-column header-align="center" label="税率（%）" align="left" min-width="150">
        <template slot-scope="scope">
          {{ filterDictText(taxRateList,scope.row.purchaseTaxRate) }}
        </template>
      </el-table-column>
      <el-table-column
        header-align="center"
        align="right"
        prop="purchaseNum"
        min-width="110"
        label="数量"
      />
      <el-table-column
        header-align="center"
        align="right"
        min-width="140"
        label="预算净单价（元）"
      >
        <template slot-scope="scope">
          <p>{{ scope.row.purchaseBudget && numFilter(scope.row.purchaseBudget) }}</p>
        </template>
      </el-table-column>
      <el-table-column
        header-align="center"
        align="right"
        min-width="140"
        label="预算净总价（元）"
      >
        <template slot-scope="scope">
          <p>{{ scope.row.purchaseTotalBudget && numFilter(scope.row.purchaseTotalBudget) }}</p>
        </template>
      </el-table-column>
      <el-table-column
        header-align="center"
        align="center"
        min-width="150"
        prop="deliveryTime"
        label="到货日期"
      />
      <el-table-column
        header-align="center"
        align="left"
        min-width="220"
        prop="deliveryAddress"
        label="到货地点"
      />
      <!-- 采购人 查看和审核时不显示此字段 isShowpurcDepart 布尔值 true显示 false隐藏-->
      <el-table-column
        v-if="lineItemOtherData.isShowpurcDepart"
        header-align="center"
        align="left"
        min-width="230"
        prop="purchaseDepartName"
        label="采购人"
      />
      <el-table-column
        header-align="center"
        align="left"
        prop="remark"
        label="备注"
      />
      <el-table-column
        fixed="right"
        header-align="center"
        label="附件"
        align="center"
        width="140"
      >
        <template slot-scope="scope">
          <el-link
            v-if="scope.row.isContainAttachment==='1'"
            :underline="false"
            size="mini"
            plain
            type="primary"
            @click="checkAccessory(scope.row)"
          >
            查看
          </el-link>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
/* 公共方法*/
import { procurementPlanGrounpMixins } from '@views/procurement/procurementPlan/mixins/procurementPlanGroupMixins' // 字典信息
import { numFilter, filterDictText } from '@/assets/js/utils' // 金额转换千分位
export default {
  name: 'ProcurementPlanLineItemComp',
  mixins: [procurementPlanGrounpMixins],
  props: {
    lineItemData: {
      type: Array,
      default: function() {
        return []
      }
    },
    loading: {
      type: Boolean,
      default: false
    },
    lineItemOtherData: {
      type: Object,
      default: function() {
        return {
          isShowpurcDepart: true // 是否显示采购人字段 框架计划的审批及详情页面，隐藏行项目处的采购人默认显示
        }
      }
    }
  },
  data() {
    return {
    }
  },
  methods: {
    filterDictText, // 数据字典
    numFilter, // 金额补零
    // 附件查看
    checkAccessory(row) {
      this.$emit('checkFile', row, true)
    }
  }
}
</script>

<style lang='less'>
</style>
