<!--
  @description: 项目规则之单一来源采购组件
  @author: gmy
  @date: 2020-8-4 10:33:58
-->
<template>
  <table class="tableData">
    <!-- 紧急采购-报价截止时间 -->
    <tr>
      <td>
        紧急采购
      </td>
      <td>
        {{ filterDictText(emergencyProcurementList, dataRule.isEmergencyProcurement) }}
      </td>
      <td>
        <!-- isEdit 是否点击变更字段 布尔值 true已点击 false未点击 点击展示编辑 否则就是查看 -->
        <span v-if="!otherData.isEdit">报价有效期</span>
        <el-form-item v-if="otherData.isEdit" :rules="rules.quoteValidity" label="报价有效期" prop="quoteValidity" />
      </td>
      <td>
        <span v-if="!otherData.isEdit">{{ $Moment(dataRule.quoteValidity).format(momentDate) }}</span>
        <el-date-picker
          v-if="otherData.isEdit"
          v-model="dataRule.quoteValidity"
          :picker-options="disabledPickerOptions"
          :value-format="elValueFormatDate"
          type="date"
          placeholder="选择日期时间"
        />
      </td>
      <!-- <td>
          <span>首轮报价截止时间</span>
        </td>
        <td>
          <span v-if="!otherData.isEdit">{{ $Moment(dataRule.quoteEndTime).format(momentDateTime) }}</span>
        </td> -->
    </tr>
    <!--    报价有效期  强制上传应答文件     -->
    <tr>
      <td>
        强制上传应答文件
      </td>
      <td>
        {{ filterDictText(uploadReplyFileList, dataRule.isUploadReplyFile) }}
      </td>
      <td>
        币种
      </td>
      <td>
        {{ filterDictText(currencyList, dataRule.currency) }}
      </td>
    </tr>
    <!--    付款方式  币种       -->
    <tr>
      <td>
        付款方式
      </td>
      <td colspan="3">
        {{ filterDictText(payTypelist, dataRule.payType) }}
      </td>
    </tr>
    <!--    币种-是否含运费       -->
    <tr>
      <td>
        是否含运费
      </td>
      <td>
        {{ filterDictText(containsFreightList, dataRule.isContainsFreight) }}
      </td>
      <td>
        报价要求
      </td>
      <td>
        {{ filterDictText(quoteType, dataRule.quoteType) }}
      </td>
    </tr>
    <!--   公示结束时间-物资公司联系人       -->
    <!-- isEmergencyProcurement 00 不是紧急采购 01 紧急采购 -->
    <tr v-if="dataRule.isEmergencyProcurement==='00'">
      <td>
        公示结束时间
      </td>
      <td colspan="3">
        {{ dataRule.publicityEndTime && $Moment(dataRule.publicityEndTime).format(momentDateTime) }}
      </td>
    </tr>
    <tr>
      <td>
        评审办法
      </td>
      <td colspan="3">
        {{ filterDictText(reviewMethod, dataRule.reviewMethod) }}
      </td>
    </tr>
    <tr>
      <td>
        是否收取标书费
      </td>
      <td :colspan="dataRule.isReceiveTenderDocumentPrice === '01' ? '' : '3'">
        {{ filterDictText(documentPrice, dataRule.isReceiveTenderDocumentPrice) }}
      </td>
      <td v-if="dataRule.isReceiveTenderDocumentPrice === '01'">
        <el-form-item ref="documentPrice" :rules="rules.documentPrice" label="标书费金额" prop="documentPrice" />
      </td>
      <td v-if="dataRule.isReceiveTenderDocumentPrice === '01'">
        {{ dataRule.protProjectDocumentPriceList[0].documentPrice }}
      </td>
    </tr>
    <tr>
      <td>
        供应商分类
      </td>
      <td>
        {{ dataRule.supplierCategory && filterDictText(supplierCategoryList, dataRule.supplierCategory) }}
      </td>
      <td>
        供应商属性
      </td>
      <td>
        {{ dataRule.supplierAttribute && filterDictText(supplierAttributeList, dataRule.supplierAttribute) }}
      </td>
    </tr>
    <!-- isEmergencyProcurement 00 不是紧急采购 01 紧急采购 -->
    <tr v-if="dataRule.isEmergencyProcurement==='00'">
      <td>
        联系地址
      </td>
      <td colspan="3">
        {{ dataRule.materialContactAddress }}
      </td>
    </tr>
    <!-- 拟采购物资、施工或服务的说明 -->
    <tr>
      <td>
        拟采购物资、施工或服务的说明
      </td>
      <td colspan="3">
        {{ dataRule.purchasingMaterialsExplain }}
      </td>
    </tr>
    <!-- 采用单一来源的原因及说明 -->
    <tr>
      <td>
        采用单一来源的原因及说明
      </td>
      <td colspan="3">
        {{ dataRule.singleSourceExplain }}
      </td>
    </tr>
  </table>
</template>

<script>
/* 公用方法*/
import { procurementProjectGroupMixin } from '../../mixins/procurementProjectGroupMixin'// 立项采购-字典
import { procurementProjectMixins } from '../../mixins/procurementProjectMixins'// 立项采购-公用方法参数
import { filterDictText } from '@/assets/js/utils'
export default {
  name: 'ProcurementProjectAdd',
  mixins: [procurementProjectGroupMixin, procurementProjectMixins],
  props: {
    // 规则信息
    dataRule: {
      type: Object,
      default: () => {
        return {}
      }
    },
    // 其他数据
    otherData: {
      type: Object,
      default: () => {
        return {}
      }
    }
  },
  data() {
    return {
      // 校验输入内容
      rules: {
        quoteEndTime: [{ required: true, message: '请选择', trigger: 'blur' }], // 报价截止时间
        quoteValidity: [{ required: true, message: '请选择', trigger: 'blur' }] // 报价有效期
      }
    }
  },

  created() {
    // 调用项目规则字典方法
    this.initqueryProcurementProjectRuleInitInfo()
  },
  methods: {
    filterDictText, // 引入字典值替换文本通用方法
    // 保存或提交时 组装数据然后返回
    assemblyData() {
      const data = {
        id: this.dataRule.id,
        isEmergencyProcurement: this.dataRule.isEmergencyProcurement, // 紧急采购
        quoteValidity: this.dataRule.quoteValidity ? this.$Moment(this.dataRule.quoteValidity).format(this.momentSaveFormat) : '', // 报价有效期
        isReceiveTenderBailPrice: this.dataRule.isReceiveTenderBailPrice, // 是否收取保证金
        isReceiveTenderDocumentPrice: this.dataRule.isReceiveTenderDocumentPrice, // 是否收取标书费
        protProjectDocumentPriceList: this.dataRule.protProjectDocumentPriceList, // 标书费金额
        protProjectBailPriceList: this.dataRule.protProjectBailPriceList, // 保证金金额
        isUploadReplyFile: this.dataRule.isUploadReplyFile, // 强制上传应答文件
        isContainsFreight: this.dataRule.isContainsFreight, // 是否含运费
        currency: this.dataRule.currency, // 币种
        payType: this.dataRule.payType, // 付费方式
        purchasingMaterialsExplain: this.dataRule.purchasingMaterialsExplain, //  拟采购物资、施工或服务的说明
        singleSourceExplain: this.dataRule.singleSourceExplain // 采用单一来源的原因及说明
      }
      // 返回
      return data
    }
  }
}
</script>

<style lang="less" scoped>
  /deep/.el-form-item--small.el-form-item{
    margin-bottom: 0;
  }
</style>

