<!--
 @description: 采购员-创建采购单-项目信息可编辑模块
 @author: gmy
 @date: 2020-8-4 10:08:58
-->
<template>
  <div>
    <!--  otherParameter.issourceType布尔值 true表示B类采购单 false未非B类采购单 -->
    <table class="from_table">
      <tr>
        <td> <el-form-item label="采购单编号" /></td>
        <td>
          <!--          <el-input v-model="formData.tenderNo" :disabled="tenderNoStatus" placeholder="采购单编号" maxlength="200" clearable />-->
          {{ formData.tenderNo }}
        </td>
        <td> <el-form-item ref="tenderName" label="采购单名称" prop="tenderName" /></td>
        <td v-if="otherParameter.isEdit">
          <el-input
            v-model.trim="formData.tenderName"
            placeholder="最多允许输入100个汉字"
            maxlength="100"
            show-word-limit
            class="show-word-limit-padding"
            clearable
          />
        </td>
        <td v-if="!otherParameter.isEdit">
          <el-tooltip :content="formData.tenderName" effect="dark" placement="top-start">
            <el-input
              v-model.trim="formData.tenderName"
              :disabled="!otherParameter.isEdit"
              placeholder="最多允许输入100个汉字"
              maxlength="100"
              show-word-limit
              class="show-word-limit-padding"
              clearable
            />
          </el-tooltip>
        </td>
      </tr>
      <tr>
        <td>
          <el-form-item label="采购方式" prop="tenderMethod" />
        </td>
        <td>
          <!--          <el-select v-model="formData.tenderMethod" :placeholder="language.Pleasechoose" disabled style="width: 100%" clearable>
            <el-option
              v-for="item in tender_methodList"
              :key="item.id"
              :label="item.typename"
              :value="item.typecode"
            />
          </el-select>-->
          <span>{{ filterDictText(tender_methodList,formData.tenderMethod ) }}</span>
        </td>
        <td> <el-form-item label="采购组织形式" /></td>
        <!--     采购员采购组织形式默认文本     -->
        <td>
          <p>{{ filterDictText(plan_purchase_organizationList,formData.tenderOrgMethod ) }}</p>
        </td>
      </tr>
      <!--    systemType 00 集团内    -->
      <tr>
        <td>
          <el-form-item ref="tenderType" label="公开/邀请" prop="tenderType" />
        </td>
        <td>
          {{ filterDictText(tenderTypeList, formData.tenderType) }}
          <!-- <el-radio-group v-model="formData.tenderType" :disabled="radioType">
            <el-radio
              v-for="(item) in tenderTypeList"
              :key="item.typecode"
              :label="item.typecode"
            >
              {{ item.typename }}
            </el-radio>
          </el-radio-group> -->
        </td>
        <td>
          <el-form-item ref="purchaseIndustryName" label="项目类型" prop="purchaseIndustryName" />
        </td>
        <td>
          <el-radio-group v-model="formData.purchaseIndustryName">
            <el-radio
              v-for="(item) in purchaseIndustryNameList"
              :key="item.typecode"
              :label="item.typecode"
            >
              {{ item.typename }}
            </el-radio>
          </el-radio-group>
        </td>
      </tr>
      <tr>
        <td> <el-form-item ref="buyersName" label="执行单位" prop="buyersName" /></td>
        <td>
          <el-input v-model="formData.buyersName" :disabled="true" placeholder="执行单位" />
        </td>
        <td> <el-form-item ref="buyersLinkerName" label="执行单位联系人" prop="buyersLinkerName" /></td>
        <td>
<!--          <el-input v-model.trim="formData.buyersLinkerName" placeholder="最多允许输入20个汉字" maxlength="20" clearable />-->
          {{ formData.buyersLinkerName}}
        </td>
      </tr>
      <tr>
        <td> <el-form-item ref="buyersLinkerTel" label="联系电话" prop="buyersLinkerTel" /></td>
        <td>
          <gx-input
            v-model.trim="formData.buyersLinkerTel"
            gx-placeholder="checkLinktel"
            gx-maxlength="varchar20"
            clearable
          />
        </td>
        <td> <el-form-item ref="buyersLinkerEmail" label="邮箱" prop="buyersLinkerEmail" /></td>
        <td>
          <gx-input
            v-model.trim="formData.buyersLinkerEmail"
            gx-placeholder="placeholderText100"
            gx-maxlength="varchar100"
            clearable
          />
        </td>
      </tr>
      <tr>
        <td>
          <el-form-item ref="budgetTotalMoney" label="采购单净预算(元)" prop="budgetTotalMoney" />
        </td>
        <td>{{ formData.budgetTotalMoney }}</td>
        <td>
          <el-form-item ref="budgetTotalTaxMoney" label="采购单含税总预算(元)" prop="budgetTotalTaxMoney" />
        </td>
        <td>{{ formData.budgetTotalTaxMoney }}</td>
      </tr>
      <!--采用该采购方式说明信息-->
      <tr>
        <td>
          <el-form-item ref="tendermethodRemarks" label="说明信息" prop="tendermethodRemarks" />
        </td>
        <td colspan="3">
          <gx-input
            v-model.trim="formData.tendermethodRemarks"
            :autosize="{ minRows: 3, maxRows: 3 }"
            gx-placeholder="placeholderText1000"
            gx-maxlength="varchar1000"
            type="textarea"
            style="width: 96%"
          />
        </td>
      </tr>
      <!--内部附件信息-->
      <tr>
        <td>
          <el-form-item ref="buyersLinkerAddress" label="内部附件信息" prop="buyersLinkerAddress" />
        </td>
        <td colspan="3">
          <upload
            ref="upload"
            :data="insideTenderProjectFileType"
            :auto-delete="true"
            :auto-upload="true"
            file-ref="fileRef"
            title=""
          />
        </td>
      </tr>
    </table>
  </div>
</template>

<script>
/* 公共方法 */
import { filterDictText } from '@/assets/js/utils'// 常用方法
/* 公共字典*/
import { procurementGroupMixins } from '@/views/procurement/mixins/procurementGrounpMixins'

/* 组件*/
import upload from '@comp/common/updownload/upload' // 附件上传组件
// vuex
import { mapGetters } from 'vuex'
export default {
  name: 'ProjectmessageAddVue',
  components: {
    upload // 文件下载
  },
  mixins: [procurementGroupMixins],
  props: {
    // 采购信息数据
    formData: {
      type: Object,
      default: () => {
        return {}
      }
    },
    // 其他参数
    otherParameter: {
      type: Object,
      default: () => {
        return {}
      }
    },
    insideTenderProjectFileType: {
      type: Object,
      default: () => {
        return {}
      }
    }
  },
  data() {
    return {
      radioType: false,
      tenderNoStatus: true,
      editType: false // 时间与备注是否可编辑 集团内不可编辑 集团外用户可编辑
    }
  },
  computed: {
    /* language 国际化*/
    ...mapGetters(['language'])
  },
  watch: {
    'formData.tenderMethod'(val) {
      // 采购方式为单一来源 项目类型默认邀请且禁用
      if (val === '12') {
        this.formData.tenderType = '01'
        this.radioType = true
        return
      }
      if (val === '11' && !this.otherParameter.isEdit) {
        this.radioType = true
        return
      }
      this.radioType = false
      return
    }
  },
  created() {
    // 查询采购项目字典数据
    this.initProjectBase()
    // 查询项目字典
    this.initWebTypeGroup()
  },
  methods: {
    filterDictText
  }
}
</script>

<style scoped>

</style>
