<!--
  @description: 项目规则-招标详情
  @author: gmy
  @date: 2020-8-04 10:28:58
-->
<template>
  <div>
    <table class="tableData">
      <!-- 紧急采购-报价截止时间 -->
      <tr>
        <td>
          <span>紧急采购</span>
        </td>
        <td>
          <span
            v-for="(item) in emergencyProcurementList"
            v-if=" dataRule.isEmergencyProcurement===item.typecode"
            :key="item.id"
          >{{ item.typename }}</span>
        </td>
        <td>
          <!-- isEdit 是否点击变更字段 布尔值 true已点击 false未点击 点击展示编辑 否则就是查看 -->
          <span v-if="!otherData.isEdit">报价截止时间</span>
          <el-form-item v-if="otherData.isEdit" :rules="rules.quoteEndTime" label="报价截止时间" prop="quoteEndTime" />
        </td>
        <td>
          <!-- isEdit 是否点击变更字段 布尔值 true已点击 false未点击 点击展示编辑 否则就是查看 -->
          <span v-if="!otherData.isEdit&&dataRule.quoteEndTime">{{ $Moment(dataRule.quoteEndTime).format(momentDateTime) }}</span>
          <el-date-picker
            v-if="otherData.isEdit"
            v-model="dataRule.quoteEndTime"
            :picker-options="disabledPickerOptions"
            :format="elValueFormat"
            :value-format="elValueFormat"
            :default-time="defaultTimeDateTime"
            type="datetime"
            placeholder="选择日期时间"
          />
        </td>
      </tr>
      <!--    报价有效期  强制上传应答文件     -->
      <tr>
        <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&&dataRule.quoteValidity">{{ $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-for="(item,index) in uploadReplyFileList"
            v-if=" dataRule.isUploadReplyFile===item.typecode"
            :key="index"
          >{{ item.typename }}</span>
        </td>
      </tr>
      <!--    付款方式  是否含运费       -->
      <tr>
        <td>
          <span>币种</span>
        </td>
        <td>
          <span v-if="dataRule.currency">{{ filterDictText(currencyList, dataRule.currency) }}</span>
          <span>人民币</span>
        </td>
        <td>
          <span>是否含运费</span>
        </td>
        <td>
          <span>{{ filterDictText(containsFreightList, dataRule.isContainsFreight) }}</span>
        </td>
      </tr>
      <tr>
        <td>
          <span>询价方式</span>
        </td>
        <td>
          <span>{{ filterDictText(protproject_quoteMethodList, dataRule.quoteMethod) }}</span>
        </td>
        <td>
          评审办法
        </td>
        <td>
          {{ filterDictText(reviewMethod, dataRule.reviewMethod) }}
        </td>
      </tr>
      <!--   报价要求       -->
      <tr>
        <td>
          <span>报价要求</span>
        </td>
        <td colspan="3">
          <span>{{ filterDictText(quoteType, dataRule.quoteType) }}</span>
        </td>
      </tr>
      <tr>
        <td>
          供应商分类
        </td>
        <td v-if="dataRule.supplierCategory" colspan="3">
          {{ filterDictText(supplierCategoryList, dataRule.supplierCategory?dataRule.supplierCategory.join(','):dataRule.supplierCategory) }}
        </td>
      </tr>
      <!--   报价要求       -->
      <tr>
        <td>
          供应商属性
        </td>
        <td colspan="3">
          {{ filterDictText(supplierAttributeList, dataRule.supplierAttribute?dataRule.supplierAttribute.join(','):dataRule.supplierAttribute) }}
        </td>
      </tr>
    </table>
  </div>
</template>

<script>
/* 公用方法*/
import { filterDictText } from '@/assets/js/utils'
import { procurementProjectGroupMixin } from '../../mixins/procurementProjectGroupMixin'// 立项采购-字典
import { procurementProjectMixins } from '../../mixins/procurementProjectMixins'// 立项采购-公用方法参数
/* 混合开发方法-参数字段*/
import { commonMxin } from '@/mixins/commonMxin'// 字典信息
/* 公共组件*/
// import money from '@comp/common/money/money' // 金币组件
// vuex
import { mapGetters } from 'vuex'
export default {
  name: 'ProcurementProjectAdd',
  components: {
    // money
  },
  mixins: [procurementProjectGroupMixin, procurementProjectMixins, commonMxin],
  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' }] // 报价有效期
      }
    }
  },
  computed: {
    /* language 国际化*/
    ...mapGetters(['language'])
  },
  created() {
    // 调用项目规则字典方法
    this.initqueryProcurementProjectRuleInitInfo()
  },
  methods: {
    filterDictText, // 引入字典值替换文本通用方法
    // 保存或提交时 组装数据然后返回
    assemblyData() {
      const data = {
        id: this.dataRule.id,
        quoteEndTime: this.dataRule.quoteEndTime ? this.$Moment(this.dataRule.quoteEndTime).format(this.momentSaveFormat) : '', // 报价截止时间
        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, // 付费方式
        isEmergencyProcurement: this.dataRule.isEmergencyProcurement, // 是否紧急采购
        quoteType: this.dataRule.quoteType // 报价要求
      }
      // 返回
      return data
    }
  }
}
</script>

<style lang="less" scoped>

  /deep/.show-word-limit-padding{
    .el-input__inner{
      padding-right: 70px;
    }
  }
</style>

