<template>
  <div>
    <div class="form-content" v-if="noticeType == 1">
      <el-form
        ref="formInfo"
        :model="parameter"
        label-width="auto"
        v-loading="loading"
        label-position="left"
      >
        <div class="rows" @click="handleOver">
          <div class="rows-left">
            <div class="rows-hr"></div>
          </div>
          <div class="rows-title">
            <div class="text-overflow">基本信息</div>
          </div>
          <i
            :class="!flexAuto ? 'el-icon-arrow-right' : 'el-icon-arrow-down'"
            style="margin-left: 10px"
          ></i>
        </div>
        <div :class="!flexAuto ? 'auto' : 'classNone'">
          <el-row :gutter="24">
            <el-col :span="6">
              <el-form-item label="项目编号" prop="projectNumber">
                <el-input
                  :disabled="currentNode == 1 ? false : true"
                  v-model="parameter.projectNumber"
                  placeholder="请输入项目编号"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="项目标题" prop="noticeTitle">
                <el-input
                  :disabled="currentNode == 1 ? false : true"
                  v-model="parameter.noticeTitle"
                  placeholder="请输入项目标题"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="组织单位" prop="affiliatedOrgName">
                <el-input
                  :disabled="currentNode == 1 ? false : true"
                  v-model="parameter.affiliatedOrgName"
                  placeholder="请输入组织单位"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="采购单位" prop="procureOrgName">
                <el-input
                  :disabled="currentNode == 1 ? false : true"
                  v-model="parameter.procureOrgName"
                  placeholder="请选择采购单位"
                >
                </el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24">
            <el-col :span="6">
              <el-form-item label="是否集中采购" prop="matIfPlat">
                <dict-select
                  dictCode="cglx-ywlx"
                  :hasDefaultOption="true"
                  :disabled="currentNode == 1 ? false : true"
                  style="width: 100%"
                  v-model="parameter.matIfPlat"
                  placeholder="请选择是否集中采购"
                />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="采购类型" prop="procureType">
                <dict-select
                  dictCode="cglx-cglx"
                  :hasDefaultOption="true"
                  :disabled="currentNode == 1 ? false : true"
                  style="width: 100%"
                  v-model="parameter.procureType"
                  placeholder="请选择采购类型"
                />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="是否含税价" prop="isTax">
                <dict-select
                  dictCode="cglx-jjfs"
                  :hasDefaultOption="true"
                  :disabled="currentNode == 1 ? false : true"
                  style="width: 100%"
                  v-model="parameter.isTax"
                  placeholder="请选择是否含税价"
                />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="发布方式" prop="releaseMethod">
                <dict-select
                  dictCode="cglx-fbfs"
                  :hasDefaultOption="true"
                  :disabled="currentNode == 1 ? false : true"
                  style="width: 100%"
                  v-model="parameter.releaseMethod"
                  placeholder="请选择发布方式"
                />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24" style="display: flex; flex-wrap: wrap">
            <el-col :span="6" key="2" v-if="parameter.releaseMethod == 2">
              <el-form-item
                label="供应商"
                prop="vendorName"
                class="input-select-item"
              >
                <el-tooltip
                  width="250"
                  placement="top-start"
                  effect="light"
                  :content="parameter.vendorName"
                >
                  <el-input
                    :disabled="currentNode == 1 ? false : true"
                    v-model="parameter.vendorName"
                    @focus="openVendor"
                    placeholder="请选择供应商"
                  >
                  </el-input>
                </el-tooltip>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="报价方式" prop="quotationMethod">
                <dict-select
                  dictCode="cglx-fkfs"
                  :hasDefaultOption="true"
                  :disabled="currentNode == 1 ? false : true"
                  style="width: 100%"
                  v-model="parameter.quotationMethod"
                  placeholder="请选择报价方式"
                />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item
                class="form-flex"
                label="挂账时间"
                prop="pendingTime"
              >
                <dict-select
                  dictCode="cdsj"
                  :hasDefaultOption="true"
                  :disabled="currentNode == 1 ? false : true"
                  style="width: 100%"
                  v-model="parameter.pendingTime"
                  placeholder="请选择挂账时间"
                />
                <div class="append">月</div>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="有无保证金" prop="hasBond">
                <dict-select
                  dictCode="cglx-ywbzj"
                  :hasDefaultOption="true"
                  :disabled="currentNode == 1 ? false : true"
                  style="width: 100%"
                  v-model="parameter.hasBond"
                  placeholder="请选择有无保证金"
                />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item
                label="投标文件是否必传"
                prop="isBidDocumentsUpload"
              >
                <dict-select
                  dictCode="sfsctbwj"
                  :hasDefaultOption="true"
                  clearable
                  :disabled="currentNode == 1 ? false : true"
                  style="width: 100%"
                  v-model="parameter.isBidDocumentsUpload"
                  placeholder="请选择投标文件是否必传"
                />
              </el-form-item>
            </el-col>
            <el-col :span="6" v-if="parameter.quotationMethod == 2">
              <el-form-item
                class="form-flex"
                label="承兑时间"
                prop="acceptanceTime"
              >
                <dict-select
                  dictCode="cdsj"
                  :hasDefaultOption="true"
                  :disabled="currentNode == 1 ? false : true"
                  style="width: 100%"
                  v-model="parameter.acceptanceTime"
                  placeholder="请选择承兑时间"
                />
                <div class="append">月</div>
              </el-form-item>
            </el-col>

            <el-col :span="6" v-if="parameter.hasBond == 1">
              <el-form-item label="保证金（元）" prop="bond">
                <el-input
                  :disabled="currentNode == 1 ? false : true"
                  v-model="parameter.bond"
                  placeholder="请输入保证金"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6" v-if="parameter.procureType == 4">
              <el-form-item label="报价轮次" prop="quotationRounds">
                <el-input
                  clearable
                  v-model="parameter.quotationRounds"
                  placeholder="请输入报价轮次"
                  :disabled="currentNode == 1 ? false : true"
                  @input="changeRounds"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="报价模板" prop="quotationTemplateName">
                <el-input
                  clearable
                  @focus="handleTemplate"
                  prefix-icon="el-icon-search"
                  :disabled="currentNode == 1 ? false : true"
                  v-model="parameter.quotationTemplateName"
                  placeholder="请选择报价模板"
                >
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="中标结果有效期（天）" prop="winBidValidity">
                <el-input
                  :disabled="currentNode == 1 ? false : true"
                  v-model="parameter.winBidValidity"
                  placeholder="请输入中标结果有效期（天）"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="立项联系人" prop="affiliatedUserName">
                <el-input
                  :disabled="currentNode == 1 ? false : true"
                  v-model="parameter.affiliatedUserName"
                  placeholder="请输入联系人"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="联系方式" prop="contactsPhone">
                <el-input
                  :disabled="currentNode == 1 ? false : true"
                  v-model="parameter.contactsPhone"
                  placeholder="请输入联系方式"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6" v-if="this.parameter.procureType != 3">
              <el-form-item label="评标方式" prop="evaluationMode">
                <dict-select
                  dictCode="cglx-pbfs"
                  :hasDefaultOption="true"
                  :disabled="currentNode == 1 ? false : true"
                  style="width: 100%"
                  v-model="parameter.evaluationMode"
                  placeholder="请选择评标方式"
                />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="评标办法" prop="evaluationMethod">
                <dict-select
                  dictCode="cglx-pbff"
                  :hasDefaultOption="true"
                  :disabled="currentNode == 1 ? false : true"
                  style="width: 100%"
                  v-model="parameter.evaluationMethod"
                  placeholder="请选择评标方法"
                />
              </el-form-item>
            </el-col>
            <el-col :span="6" v-if="parameter.evaluationMethod == 2">
              <el-form-item label="评标人" prop="expertList">
                <span slot="label" style="display: inline-block">
                  评标人
                  <el-tooltip
                    effect="dark"
                    content="请选择至少三位评标人并且为奇数个数"
                    placement="bottom"
                  >
                    <i style="font-size: 16px" class="el-icon-question" />
                  </el-tooltip>
                </span>
                <el-input
                  clearable
                  type="areatext"
                  @focus="openExpert"
                  key="0"
                  :disabled="currentNode == 1 ? false : true"
                  v-model="parameter.expertList"
                  placeholder="请选择评标人"
                >
                </el-input>
              </el-form-item>
            </el-col>

            <el-col :span="6">
              <el-form-item label="投标开始时间" prop="biddingStartTime">
                <el-date-picker
                  :disabled="currentNode == 1 ? false : true"
                  type="datetime"
                  value-format="yyyy-MM-dd HH:mm:ss"
                  style="width: 100%"
                  v-model="parameter.biddingStartTime"
                  placeholder="请选择投标开始时间"
                ></el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="投标结束时间" prop="biddingEndTime">
                <el-date-picker
                  :disabled="currentNode == 1 ? false : true"
                  type="datetime"
                  value-format="yyyy-MM-dd HH:mm:ss"
                  style="width: 100%"
                  v-model="parameter.biddingEndTime"
                  placeholder="请选择投标结束时间"
                ></el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item
                label="澄清补遗截止时间"
                prop="clarificationSupplementDeadlineTime"
              >
                <el-date-picker
                  :disabled="currentNode == 1 ? false : true"
                  type="datetime"
                  value-format="yyyy-MM-dd HH:mm:ss"
                  style="width: 100%"
                  v-model="parameter.clarificationSupplementDeadlineTime"
                  placeholder="请选择澄清补遗截止时间"
                ></el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item
                label="供货商提出问题的截止时间"
                prop="raisingQuestionsDeadlineTime"
              >
                <el-date-picker
                  :disabled="currentNode == 1 ? false : true"
                  type="datetime"
                  value-format="yyyy-MM-dd HH:mm:ss"
                  style="width: 100%"
                  v-model="parameter.raisingQuestionsDeadlineTime"
                  placeholder="请选择供货商提出问题的截止时间"
                ></el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="响应截止时间" prop="responseTimeDeadline">
                <el-date-picker
                  :disabled="currentNode == 1 ? false : true"
                  type="datetime"
                  value-format="yyyy-MM-dd HH:mm:ss"
                  style="width: 100%"
                  v-model="parameter.responseTimeDeadline"
                  placeholder="请选择响应截止时间"
                ></el-date-picker>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24">
            <el-col :span="24">
              <el-form-item label="项目内容" prop="establishmentName">
                <quill-editor
                  v-model="parameter.establishmentName"
                  style="height: 120px"
                  ref="myQuillEditor"
                  :disabled="currentNode == 1 ? false : true"
                >
                </quill-editor>
              </el-form-item>
            </el-col>
          </el-row>
          <div class="rows" style="margin-top: 50px; margin-bottom: 0px">
            <div class="rows-left">
              <div class="rows-hr"></div>
            </div>
            <div class="rows-title">
              <div class="text-overflow">
                <el-tabs v-model="activeName">
                  <el-tab-pane name="1" label="招标文件"> </el-tab-pane>
                  <el-tab-pane
                    name="2"
                    label="评标信息"
                    v-if="parameter.evaluationMethod == 2"
                  >
                  </el-tab-pane>
                </el-tabs>
              </div>
            </div>
          </div>
          <div v-if="activeName == 1">
            <el-table
              class="down"
              :data="dataList"
              border
              stripe
              style="width: 100%"
            >
              <el-table-column prop="name" label="文件名称"></el-table-column>
              <el-table-column prop="size" label="文件大小">
                <template slot-scope="scope">
                  <span>{{ scope.row.fileSize }}</span>
                </template>
              </el-table-column>
              <el-table-column prop="createTime" label="上传时间">
                <template slot-scope="scope">
                  <div>
                    {{ scope.row.createTime }}
                  </div>
                </template>
              </el-table-column>
              <el-table-column width="150px" label="操作">
                <template slot-scope="scope">
                  <el-button size="small" type="text">
                    <a
                      target="_blank"
                      @click="downloadFile(scope.row.name, scope.row.url)"
                      >下载</a
                    >
                  </el-button>
                </template>
              </el-table-column>
            </el-table>
          </div>
          <div v-if="activeName == 2 && parameter.evaluationMethod == 2">
            <el-table
              :border="true"
              stripe
              fit
              size="mini"
              row-key="id"
              ref="multipleSelection"
              default-expand-all
              :data="scoreData"
              :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
            >
              <el-table-column
                prop="evaluationItemPname"
                min-width="100px"
                class-name="el-table-lable-box"
                label="评分大项"
                align="center"
                resizable
              >
                <template slot-scope="scope">
                  <div v-if="scope.row.children">
                    {{ scope.row.evaluationItemPname }}
                  </div>
                </template>
              </el-table-column>
              <el-table-column
                label="评分细项"
                min-width="160"
                align="center"
                prop="evaluationItemCode"
              >
                <template slot-scope="scope">
                  <el-input
                    clearable
                    v-if="!scope.row.children"
                    type="textarea"
                    :disabled="
                      scope.row.evaluationItemCode == '价格得分' ? true : false
                    "
                    v-model="scope.row.evaluationItemCode"
                    placeholder="请输入评分细项"
                  ></el-input>
                </template>
              </el-table-column>
              <el-table-column
                label="评分标准"
                min-width="160"
                align="center"
                prop="evaluationStandard"
              >
                <template slot-scope="scope">
                  <el-input
                    clearable
                    v-if="!scope.row.children"
                    type="textarea"
                    v-model="scope.row.evaluationStandard"
                    placeholder="请输入评分标准"
                  ></el-input>
                </template>
              </el-table-column>
              <el-table-column
                align="center"
                label="分值"
                min-width="140"
                prop="evaluationScore"
              >
                <template slot-scope="scope">
                  <el-input-number
                    v-model="scope.row.evaluationScore"
                    controls-position="right"
                    :min="0"
                    v-if="!scope.row.children"
                    :precision="0"
                    @change="handleInput(scope.row)"
                    :max="100"
                  ></el-input-number>
                  <div v-else>
                    {{ scope.row.score }}
                  </div>
                </template>
              </el-table-column>
              <el-table-column
                min-width="120px"
                v-if="currentNode == 1"
                align="center"
                label="操作"
              >
                <template slot-scope="scope">
                  <el-button
                    type="text"
                    plain
                    size="small"
                    v-if="scope.row.children"
                    @click="LowerBtn(scope.row)"
                    >添加下级</el-button
                  >
                  <el-button
                    type="text"
                    plain
                    size="small"
                    v-if="
                      !scope.row.children &&
                      scope.row.evaluationItemCode != '价格得分'
                    "
                    @click="deleteLevel(scope.row, scope.$index)"
                    >删除</el-button
                  >
                </template>
              </el-table-column>
            </el-table>
          </div>
        </div>

        <div class="rows">
          <div class="rows-left">
            <div class="rows-hr"></div>
          </div>
          <div class="rows-title" style="display: flex; align-items: center">
            <div class="text-overflow">明细信息</div>
          </div>
        </div>
        <el-table
          ref="singleTable"
          class="table"
          :data="parameter.detailsList"
          style="width: 100%"
          highlight-current-row
          :cell-style="{'text-align': 'center'}"
          :header-cell-style="{'text-align': 'center'}"
        >
          <el-table-column fixed type="index" width="55" label="序号" />
          <el-table-column
            label="企业物料编号"
            min-width="120"
            show-overflow-tooltip
            prop="matCode"
          >
          </el-table-column>
          <el-table-column
            label="平台物料编号"
            min-width="120"
            show-overflow-tooltip
            prop="matPlatcode"
          >
          </el-table-column>
          <el-table-column label="物料名称" min-width="110" prop="matName">
          </el-table-column>
          <el-table-column label="物料牌号" min-width="110" prop="matMaterial">
          </el-table-column>
          <el-table-column
            label="数量"
            min-width="110"
            prop="matNum"
            show-overflow-tooltip
          >
          </el-table-column>
          <el-table-column
            label="最高限价(元)"
            min-width="110"
            prop="maximumPriceLimit"
          >
          </el-table-column>
          <el-table-column label="需求日期" min-width="130" prop="demandDate">
          </el-table-column>
          <el-table-column label="计划编号" min-width="100" prop="planCode">
          </el-table-column>
          <el-table-column
            label="送货地址"
            min-width="160"
            prop="unloadAddress"
          >
          </el-table-column>
          <el-table-column label="企业补充说明" min-width="160" prop="remarks">
          </el-table-column>
          <el-table-column label="规格型号" min-width="130" prop="matSpec">
          </el-table-column>
          <el-table-column label="计量单位" min-width="60" prop="matUnit">
          </el-table-column>
          <el-table-column label="品牌/产地" min-width="100" prop="matBrand">
          </el-table-column>
          <el-table-column label="基础扩展" min-width="140" prop="matBaseExt">
          </el-table-column>
          <el-table-column label="其他扩展" min-width="140" prop="matOtherExt">
          </el-table-column>
          <el-table-column label="税率" min-width="60" prop="taxRate">
          </el-table-column>

          <el-table-column label="挂账时间" min-width="100" prop="pendingTime">
          </el-table-column>
          <el-table-column
            v-if="parameter.payMethod == 2"
            label="承兑时间"
            min-width="100"
            prop="acceptanceTime"
          >
          </el-table-column>
        </el-table>
      </el-form>
    </div>
    <div class="form-content" v-if="noticeType == 2">
      <el-form
        ref="formInfo"
        :model="parameter"
        label-width="auto"
        label-position="left"
        :rules="rules"
      >
        <div class="rows" @click="handleOver">
          <div class="rows-left">
            <div class="rows-hr"></div>
          </div>
          <div class="rows-title">
            <div class="text-overflow">基本信息</div>
          </div>
          <i
            :class="!flexAuto ? 'el-icon-arrow-right' : 'el-icon-arrow-down'"
            style="margin-left: 10px"
          ></i>
        </div>
        <div :class="!flexAuto ? 'auto' : 'classNone'">
          <el-row :gutter="24">
            <el-col :span="6">
              <el-form-item label="组织单位" prop="affiliatedOrgName">
                <el-input
                  disabled
                  v-model="parameter.affiliatedOrgName"
                  placeholder="请输入组织单位"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="采购单位" prop="procureOrgName">
                <el-input
                  :disabled="currentNode == 1 ? false : true"
                  v-model="parameter.procureOrgName"
                  placeholder="请选择采购单位"
                >
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="公告标题" prop="noticeTitle">
                <el-input
                  :disabled="currentNode == 1 ? false : true"
                  v-model="parameter.noticeTitle"
                  placeholder="请输入公告标题"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="项目名称" prop="projectLedgerName">
                <el-input
                  @focus="openProject"
                  :disabled="currentNode == 1 ? false : true"
                  prefix-icon="el-icon-search"
                  v-model="parameter.projectLedgerName"
                  placeholder="请选择项目"
                >
                </el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24">
            <el-col :span="6">
              <el-form-item label="项目编号" prop="projectLedgerCode">
                <el-input
                  v-model="parameter.projectLedgerCode"
                  placeholder="项目编号"
                  :disabled="currentNode == 1 ? false : true"
                >
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="项目类型" prop="applicationType">
                <dict-select
                  dictCode="xmlx"
                  :hasDefaultOption="true"
                  @change="changeProjectType"
                  style="width: 100%"
                  :disabled="currentNode == 1 ? false : true"
                  v-model="parameter.applicationType"
                  placeholder="请选择项目类型"
                />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="采购类型" prop="procureType">
                <dict-select
                  dictCode="cglx-cglx"
                  :hasDefaultOption="true"
                  :disabled="currentNode == 1 ? false : true"
                  @select="changeType"
                  style="width: 100%"
                  v-model="parameter.procureType"
                  placeholder="请选择采购类型"
                />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="是否含税价" prop="isTax">
                <dict-select
                  dictCode="cgsq-bjfs"
                  :hasDefaultOption="true"
                  :disabled="currentNode == 1 ? false : true"
                  style="width: 100%"
                  v-model="parameter.isTax"
                  placeholder="请选择是否含税价"
                />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24" style="display: flex; flex-wrap: wrap">
            <el-col :span="6">
              <el-form-item label="发布方式" prop="releaseMethod">
                <dict-select
                  dictCode="cglx-fbfs"
                  :hasDefaultOption="true"
                  :disabled="
                    (parameter.procureType == 7 ||
                      parameter.procureType == 1) &&
                    currentNode == 1
                      ? false
                      : true
                  "
                  clearable
                  style="width: 100%"
                  v-model="parameter.releaseMethod"
                  placeholder="请选择发布方式"
                />
              </el-form-item>
            </el-col>
            <el-col :span="6" v-if="parameter.releaseMethod == 2">
              <el-form-item
                label="供应商"
                prop="vendorName"
                class="input-select-item"
              >
                <el-tooltip
                  width="250"
                  placement="bottom"
                  effect="light"
                  :content="parameter.vendorName"
                >
                  <el-input
                    @focus="openVendor"
                    prefix-icon="el-icon-search"
                    v-model="parameter.vendorName"
                    :disabled="currentNode == 1 ? false : true"
                    placeholder="请选择供应商"
                  >
                  </el-input>
                </el-tooltip>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="付款方式" prop="quotationMethod">
                <dict-select
                  dictCode="cglx-fkfs"
                  :hasDefaultOption="true"
                  clearable
                  style="width: 100%"
                  :disabled="currentNode == 1 ? false : true"
                  @change="changeMethod"
                  v-model="parameter.quotationMethod"
                  placeholder="请选择付款方式"
                />
              </el-form-item>
            </el-col>
            <el-col :span="6" v-if="parameter.quotationMethod == 2">
              <el-form-item label="承兑时间" prop="acceptanceTime">
                <dict-select
                  dictCode="cdsj"
                  :hasDefaultOption="true"
                  clearable
                  :disabled="currentNode == 1 ? false : true"
                  style="width: 100%"
                  v-model="parameter.acceptanceTime"
                  placeholder="请选择承兑时间"
                />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="挂账时间" prop="pendingTime">
                <dict-select
                  dictCode="cdsj"
                  :hasDefaultOption="true"
                  clearable
                  :disabled="currentNode == 1 ? false : true"
                  style="width: 100%"
                  v-model="parameter.pendingTime"
                  placeholder="请选择挂账时间"
                />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="资质要求" prop="hasQualification">
                <dict-select
                  dictCode="cglx-zzyq"
                  :hasDefaultOption="true"
                  clearable
                  :disabled="currentNode == 1 ? false : true"
                  style="width: 100%"
                  v-model="parameter.hasQualification"
                  placeholder="请选择资质要求"
                />
              </el-form-item>
            </el-col>
            <el-col :span="6" v-if="parameter.hasQualification == 2">
              <el-form-item label="资质标签" prop="qualificationsCoutent">
                <el-select
                  style="width: 100%"
                  multiple
                  :disabled="currentNode == 1 ? false : true"
                  v-model="parameter.qualificationsCoutentName"
                  placeholder="请选择资质标签"
                >
                  <el-option
                    v-for="item in qualificationsList"
                    :key="item.id"
                    :label="item.name"
                    :value="item.code"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="有无保证金" prop="hasBond">
                <dict-select
                  dictCode="cglx-ywbzj"
                  :hasDefaultOption="true"
                  clearable
                  :disabled="currentNode == 1 ? false : true"
                  style="width: 100%"
                  v-model="parameter.hasBond"
                  placeholder="请选择有无保证金"
                />
              </el-form-item>
            </el-col>
            <el-col :span="6" v-if="parameter.hasBond == 1">
              <el-form-item label="保证金（元）" prop="bond">
                <el-input
                  clearable
                  type="number"
                  :disabled="currentNode == 1 ? false : true"
                  v-model="parameter.bond"
                  placeholder="请输入保证金"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="标书费（元）" prop="documentFee">
                <el-input
                  clearable
                  type="number"
                  :disabled="currentNode == 1 ? false : true"
                  v-model="parameter.documentFee"
                  placeholder="请输入标书费"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item
                label="投标文件是否必传"
                prop="isBidDocumentsUpload"
              >
                <dict-select
                  dictCode="sfsctbwj"
                  :hasDefaultOption="true"
                  clearable
                  :disabled="currentNode == 1 ? false : true"
                  style="width: 100%"
                  v-model="parameter.isBidDocumentsUpload"
                  placeholder="请选择投标文件是否必传"
                />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="立项联系人" prop="affiliatedUserName">
                <el-input
                  clearable
                  :disabled="currentNode == 1 ? false : true"
                  v-model="parameter.affiliatedUserName"
                  placeholder="请输入联系人"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="联系方式" prop="contactsPhone">
                <el-input
                  clearable
                  type="number"
                  :disabled="currentNode == 1 ? false : true"
                  v-model="parameter.contactsPhone"
                  placeholder="请输入联系方式"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="报价轮次" prop="quotationRounds">
                <el-input
                  clearable
                  :disabled="
                    parameter.procureType != 4 && currentNode == 1
                      ? false
                      : true
                  "
                  v-model="parameter.quotationRounds"
                  placeholder="请输入报价轮次"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="报价模板" prop="quotationTemplateName">
                <el-input
                  clearable
                  suffix-icon="el-icon-search"
                  @focus="handleTemplate"
                  :disabled="currentNode == 1 ? false : true"
                  v-model="parameter.quotationTemplateName"
                  placeholder="请选择报价模板"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6" v-if="this.parameter.procureType != 3">
              <el-form-item label="评标方式" prop="evaluationMode">
                <dict-select
                  dictCode="cglx-pbfs"
                  :hasDefaultOption="true"
                  clearable
                  :disabled="currentNode == 1 ? false : true"
                  style="width: 100%"
                  v-model="parameter.evaluationMode"
                  placeholder="请选择评标方式"
                />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="评标方法" prop="evaluationMethod">
                <dict-select
                  dictCode="cglx-pbff"
                  :hasDefaultOption="true"
                  clearable
                  :disabled="currentNode == 1 ? false : true"
                  style="width: 100%"
                  v-model="parameter.evaluationMethod"
                  placeholder="请选择评标方法"
                />
              </el-form-item>
            </el-col>
            <el-col :span="6" v-if="parameter.evaluationMethod == 2">
              <el-form-item prop="expertList">
                <span slot="label" style="display: inline-block">
                  评标人
                  <el-tooltip
                    effect="dark"
                    content="请选择至少三位评标人并且为奇数个数"
                    placement="bottom"
                  >
                    <i style="font-size: 16px" class="el-icon-question" />
                  </el-tooltip>
                </span>
                <el-input
                  clearable
                  type="areatext"
                  @focus="openExpert"
                  key="0"
                  :disabled="currentNode == 1 ? false : true"
                  v-model="parameter.expertList"
                  placeholder="请选择评标人"
                >
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="响应截止时间" prop="responseTimeDeadline">
                <el-date-picker
                  clearable
                  type="datetime"
                  value-format="yyyy-MM-dd HH:mm:ss"
                  style="width: 100%"
                  :disabled="currentNode == 1 ? false : true"
                  v-model="parameter.responseTimeDeadline"
                  placeholder="请选择响应截止时间"
                ></el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="投标开始时间" prop="biddingStartTime">
                <el-date-picker
                  clearable
                  type="datetime"
                  value-format="yyyy-MM-dd HH:mm:ss"
                  style="width: 100%"
                  :disabled="currentNode == 1 ? false : true"
                  v-model="parameter.biddingStartTime"
                  placeholder="请选择投标开始时间"
                ></el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="投标结束时间" prop="biddingEndTime">
                <el-date-picker
                  clearable
                  type="datetime"
                  value-format="yyyy-MM-dd HH:mm:ss"
                  style="width: 100%"
                  :disabled="currentNode == 1 ? false : true"
                  v-model="parameter.biddingEndTime"
                  placeholder="请选择投标结束时间"
                ></el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item
                label="澄清补遗截止时间"
                prop="clarificationSupplementDeadlineTime"
              >
                <el-date-picker
                  clearable
                  type="datetime"
                  value-format="yyyy-MM-dd HH:mm:ss"
                  style="width: 100%"
                  :disabled="currentNode == 1 ? false : true"
                  v-model="parameter.clarificationSupplementDeadlineTime"
                  placeholder="请选择澄清补遗截止时间"
                ></el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item
                label="供货商提出问题的截止时间"
                prop="raisingQuestionsDeadlineTime"
              >
                <el-date-picker
                  clearable
                  type="datetime"
                  value-format="yyyy-MM-dd HH:mm:ss"
                  style="width: 100%"
                  :disabled="currentNode == 1 ? false : true"
                  v-model="parameter.raisingQuestionsDeadlineTime"
                  placeholder="请选择供货商提出问题的截止时间"
                ></el-date-picker>
              </el-form-item>
            </el-col>

            <el-col :span="6">
              <el-form-item label="中标结果有效期（天）" prop="winBidValidity">
                <el-input
                  clearable
                  :disabled="currentNode == 1 ? false : true"
                  v-model="parameter.winBidValidity"
                  placeholder="请输入中标结果有效期（天）"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="预算类型" prop="fundType">
                <dict-select
                  dictCode="xmyslx"
                  :hasDefaultOption="true"
                  style="width: 100%"
                  :disabled="currentNode == 1 ? false : true"
                  v-model="parameter.fundType"
                  placeholder="请选择预算类型"
                />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item
                label="采购包或标段预算/规模(万元)"
                prop="fundScale"
              >
                <el-input
                  :disabled="currentNode == 1 ? false : true"
                  v-model="parameter.fundScale"
                  placeholder="自动计算明细最高限价总和"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24"> </el-row>
          <el-row :gutter="24">
            <el-col :span="24">
              <el-form-item label="公告内容" prop="establishmentName">
                <TinymceEditor
                  v-model="parameter.establishmentName"
                  ref="tinymceEditorRef"
                ></TinymceEditor>
              </el-form-item>
            </el-col>
          </el-row>
        </div>
        <div class="rows" style="margin-top: 50px; margin-bottom: 0px">
          <div class="rows-left">
            <div class="rows-hr"></div>
          </div>
          <div class="rows-title">
            <div class="text-overflow">
              <el-tabs v-model="activeName" @tab-click="handleClick">
                <el-tab-pane name="1" label="招标文件"> </el-tab-pane>
                <el-tab-pane
                  name="2"
                  label="评标信息"
                  v-if="parameter.evaluationMethod == 2"
                >
                </el-tab-pane>
              </el-tabs>
            </div>
          </div>
        </div>
        <div v-if="activeName == 1">
          <el-table
            class="down"
            :data="dataList"
            border
            stripe
            style="width: 100%"
          >
            <el-table-column prop="name" label="文件名称"></el-table-column>
            <el-table-column prop="size" label="文件大小">
              <template slot-scope="scope">
                <span>{{ scope.row.fileSize }}</span>
              </template>
            </el-table-column>
            <el-table-column prop="createTime" label="上传时间">
              <template slot-scope="scope">
                <div>
                  {{ scope.row.createTime }}
                </div>
              </template>
            </el-table-column>
            <el-table-column width="150px" label="操作">
              <template slot-scope="scope">
                <el-button size="small" type="text">
                  <a
                    target="_blank"
                    @click="downloadFile(scope.row.name, scope.row.url)"
                    >下载</a
                  >
                </el-button>
              </template>
            </el-table-column>
          </el-table>
        </div>
        <div v-if="activeName == 2 && parameter.evaluationMethod == 2">
          <el-table
            :border="true"
            stripe
            fit
            size="mini"
            :key="activeName == 2"
            row-key="id"
            ref="multipleSelection"
            default-expand-all
            :data="scoreData"
            :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
          >
            <el-table-column
              prop="evaluationItemPname"
              min-width="100px"
              class-name="el-table-lable-box"
              label="评分大项"
              align="center"
              resizable
            >
            </el-table-column>
            <el-table-column
              label="评分细项"
              min-width="180"
              align="center"
              prop="evaluationItemCode"
            >
            </el-table-column>
            <el-table-column
              label="评分标准"
              min-width="180"
              align="center"
              prop="evaluationStandard"
            >
            </el-table-column>
            <el-table-column
              align="center"
              label="分值"
              min-width="140"
              prop="evaluationScore"
            >
            </el-table-column>
          </el-table>
        </div>
      </el-form>
      <el-form
        ref="formInfo2"
        :model="parameter"
        label-width="auto"
        label-position="right"
        :rules="rules"
      >
        <!-- <div>
          <el-button
            icon="el-icon-plus"
            type="primary"
            size="mini"
            style="margin-left: 10px"
            @click="addTableList"
            >添加</el-button
          > 
        </div>-->
        <!-- 服务 -->
        <div class="rows">
          <div class="rows-left">
            <div class="rows-hr"></div>
          </div>
          <div class="rows-title" style="display: flex; align-items: center">
            <div class="text-overflow">明细信息</div>
          </div>
        </div>
        <el-table
          ref="singleTable"
          :data="parameter.detailsList"
          row-key="id"
          border
          @expand-change="expandChange"
          v-if="parameter.applicationType == 1"
          highlight-current-row
          :cell-style="{'text-align': 'center'}"
          :header-cell-style="{'text-align': 'center'}"
          :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
        >
          <el-table-column type="expand" header-cell-class-name="className">
            <template slot-scope="scope">
              <el-table
                :row-key="scope.row.id"
                :data="scope.row.children"
                class="two-list"
                :cell-style="{'text-align': 'center'}"
                :header-cell-style="{'text-align': 'center'}"
              >
                <el-table-column min-width="150" prop="matName" label="名称">
                  <template slot-scope="scope">
                    <el-input
                      v-model="scope.row.matName"
                      clearable
                      :disabled="currentNode == 1 ? false : true"
                      placeholder="名称"
                    ></el-input>
                  </template>
                </el-table-column>
                <el-table-column
                  min-width="160"
                  prop="payTerm"
                  label="付款条件"
                >
                  <template slot-scope="scope">
                    <el-input
                      v-model="scope.row.payTerm"
                      clearable
                      :disabled="currentNode == 1 ? false : true"
                      placeholder="付款条件"
                    ></el-input>
                  </template>
                </el-table-column>
                <!-- <el-table-column
                    min-width="120"
                    prop="payFrequency"
                    label="付款次数"
                  >
                    <template slot-scope="scope">
                      <el-input
                        type="Number"
                        v-model="scope.row.payFrequency"
                        clearable
                        placeholder="付款次数"
                      ></el-input>
                    </template>
                  </el-table-column> -->
                <el-table-column
                  min-width="110"
                  prop="payRatio"
                  label="付款比例(%)"
                >
                  <template slot-scope="scope">
                    <el-input
                      type="Number"
                      min="1"
                      :disabled="currentNode == 1 ? false : true"
                      @input="inputAmoount(scope.row)"
                      v-model="scope.row.payRatio"
                      clearable
                      placeholder="付款比例(%)"
                    ></el-input>
                  </template>
                </el-table-column>
                <el-table-column
                  min-width="130"
                  prop="payAmount"
                  label="付款金额(万元)"
                >
                  <template slot-scope="scope">
                    <el-input
                      type="Number"
                      v-model="scope.row.payAmount"
                      clearable
                      placeholder="付款金额"
                      disabled
                    ></el-input>
                  </template>
                </el-table-column>
                <el-table-column min-width="160" prop="remarks" label="备注">
                  <template slot-scope="scope">
                    <el-input
                      v-model="scope.row.remarks"
                      clearable
                      :disabled="currentNode == 1 ? false : true"
                      placeholder="备注"
                    ></el-input>
                  </template>
                </el-table-column>
                <el-table-column label="新增" width="130px">
                  <template slot="header" slot-scope="scope">
                    <div>
                      <el-button
                        icon="el-icon-plus"
                        type="text"
                        size="mini"
                        v-if="currentNode == 1"
                        @click="addChildren(scope.row)"
                      >
                        付款条件添加
                      </el-button>
                    </div>
                  </template>
                  <template slot-scope="scope">
                    <el-button
                      icon="el-icon-delete"
                      circle
                      type="danger"
                      v-if="currentNode == 1"
                      size="small"
                      @click="delChildren(scope.row, scope.$index)"
                    >
                    </el-button>
                  </template>
                </el-table-column>
              </el-table>
            </template>
          </el-table-column>
          <el-table-column prop="detailType" min-width="60" label="类型"
            >服务</el-table-column
          >
          <el-table-column label="服务名称" min-width="150" prop="matName">
            <template slot-scope="scope">
              <el-input
                clearable
                :disabled="currentNode == 1 ? false : true"
                v-model="scope.row.matName"
                placeholder="服务名称"
              ></el-input>
            </template>
          </el-table-column>
          <el-table-column label="服务内容" min-width="150" prop="matOtherExt">
            <template slot-scope="scope">
              <el-input
                clearable
                :disabled="currentNode == 1 ? false : true"
                v-model="scope.row.matOtherExt"
                placeholder="请输入服务内容"
              ></el-input>
            </template>
          </el-table-column>
          <el-table-column label="服务范围" min-width="170" prop="matBaseExt">
            <template slot-scope="scope">
              <el-input
                clearable
                :disabled="currentNode == 1 ? false : true"
                v-model="scope.row.matBaseExt"
                placeholder="服务范围"
              ></el-input>
            </template>
          </el-table-column>
          <el-table-column
            label="开始时间"
            min-width="150"
            prop="serviceStartTime"
          >
            <template slot-scope="scope">
              <el-date-picker
                v-model="scope.row.serviceStartTime"
                type="date"
                :disabled="currentNode == 1 ? false : true"
                placeholder="开始时间"
                value-format="yyyy-MM-dd"
                format="yyyy-MM-dd"
                style="width: 100%"
              >
              </el-date-picker>
            </template>
          </el-table-column>
          <el-table-column
            label="结束时间"
            min-width="150"
            prop="serviceEndTime"
          >
            <template slot-scope="scope">
              <el-date-picker
                v-model="scope.row.serviceEndTime"
                type="date"
                :disabled="currentNode == 1 ? false : true"
                placeholder="结束时间"
                value-format="yyyy-MM-dd"
                format="yyyy-MM-dd"
                style="width: 100%"
              >
              </el-date-picker>
            </template>
          </el-table-column>
          <el-table-column label="预估金额(万元)" min-width="150" prop="amount">
            <template slot-scope="scope">
              <el-input
                clearable
                :disabled="currentNode == 1 ? false : true"
                type="Number"
                v-model="scope.row.amount"
                placeholder="预估金额(万元)"
              ></el-input>
            </template>
          </el-table-column>
          <el-table-column label="备注" min-width="150" prop="remark">
            <template slot-scope="scope">
              <el-input
                clearable
                :disabled="currentNode == 1 ? false : true"
                type="textarea"
                v-model="scope.row.remark"
                placeholder="备注"
              ></el-input>
            </template>
          </el-table-column>
          <el-table-column label="操作" width="130px">
            <template slot-scope="scope" slot="header">
              <div>
                <el-button
                  icon="el-icon-plus"
                  type="primary"
                  size="mini"
                  v-if="currentNode == 1"
                  circle
                  @click="addTable(scope.row)"
                ></el-button>
              </div>
            </template>
            <template slot-scope="scope">
              <el-button
                icon="el-icon-delete"
                circle
                type="danger"
                v-if="currentNode == 1"
                size="small"
                @click="delTable(scope.row, scope.$index)"
              ></el-button>
            </template>
          </el-table-column>
        </el-table>
        <!-- 工程 -->
        <el-table
          ref="singleTable"
          :data="parameter.detailsList"
          style="width: 100%"
          row-key="id"
          v-if="parameter.applicationType == 2"
          highlight-current-row
          :cell-style="{'text-align': 'center'}"
          :header-cell-style="{'text-align': 'center'}"
          :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
        >
          <el-table-column fixed type="index" width="55" label="序号" />

          <el-table-column label="明细类型" min-width="150" prop="detailType">
            <template slot-scope="scope">
              <dict-select
                dictCode="xmlx"
                v-if="parameter.applicationType == 2"
                :hasDefaultOption="true"
                clearable
                style="width: 100%"
                v-model="scope.row.detailType"
                placeholder="请选择明细类型"
              />
              <div v-if="parameter.applicationType == 1">
                {{ scope.row.detailType ? '服务' : '服务' }}
              </div>
            </template>
          </el-table-column>
          <el-table-column label="名称" min-width="150" prop="matName">
            <template slot-scope="scope">
              <el-input
                clearable
                v-model="scope.row.matName"
                placeholder="请输入名称"
              ></el-input>
            </template>
          </el-table-column>
          <el-table-column label="服务内容" min-width="150" prop="matOtherExt">
            <template slot-scope="scope">
              <el-input
                clearable
                v-model="scope.row.matOtherExt"
                placeholder="请输入服务内容"
              ></el-input>
            </template>
          </el-table-column>
          <el-table-column label="服务范围" min-width="150" prop="matBaseExt">
            <template slot-scope="scope">
              <el-input
                clearable
                v-model="scope.row.matBaseExt"
                placeholder="请输入服务范围"
              ></el-input>
            </template>
          </el-table-column>
          <el-table-column
            label="开始时间"
            min-width="170"
            prop="serviceStartTime"
          >
            <template slot-scope="scope">
              <el-date-picker
                v-model="scope.row.serviceStartTime"
                type="date"
                placeholder="开始时间"
                value-format="yyyy-MM-dd"
                format="yyyy-MM-dd"
                style="width: 100%"
              >
              </el-date-picker>
            </template>
          </el-table-column>
          <el-table-column
            label="结束时间"
            min-width="170"
            prop="serviceEndTime"
          >
            <template slot-scope="scope">
              <el-date-picker
                v-model="scope.row.serviceEndTime"
                type="date"
                placeholder="结束时间"
                value-format="yyyy-MM-dd"
                format="yyyy-MM-dd"
                style="width: 100%"
              >
              </el-date-picker>
            </template>
          </el-table-column>

          <el-table-column label="图号/规格型号" min-width="170" prop="matSpec">
            <template slot-scope="scope">
              <el-input
                clearable
                v-model="scope.row.matSpec"
                placeholder="请输入图号/规格型号"
              ></el-input>
            </template>
          </el-table-column>
          <el-table-column
            label="项目描述"
            min-width="170"
            prop="projectDescript"
          >
            <template slot-scope="scope">
              <el-input
                clearable
                type="textarea"
                v-model="scope.row.projectDescript"
                placeholder="请输入项目描述"
              ></el-input>
            </template>
          </el-table-column>
          <el-table-column label="计量单位" min-width="170" prop="matUnit">
            <template slot-scope="scope">
              <el-input
                clearable
                v-model="scope.row.matUnit"
                placeholder="请输入计量单位"
              ></el-input>
            </template>
          </el-table-column>
          <el-table-column
            label="数量"
            min-width="140"
            v-if="parameter.applicationType == 2"
            show-overflow-tooltip
            prop="matNum"
          >
            <template slot-scope="scope">
              <el-form-item
                :prop="`detailsList.${scope.$index}.matNum`"
                :rules="rules.matNum"
                label-width="0px"
                style="margin-bottom: 0px"
              >
                <el-input
                  v-model="scope.row.matNum"
                  placeholder="请输入数量"
                  clearable
                ></el-input>
              </el-form-item>
            </template>
          </el-table-column>
          <el-table-column
            label="预估金额(万元)"
            min-width="160"
            show-overflow-tooltip
            prop="amount"
          >
            <template slot-scope="scope">
              <el-input
                clearable
                type="Number"
                v-model="scope.row.amount"
                placeholder="请输入预估金额"
              ></el-input>
            </template>
          </el-table-column>
          <el-table-column label="备注" min-width="170" prop="remark">
            <template slot-scope="scope">
              <el-input
                clearable
                type="textarea"
                v-model="scope.row.remark"
                placeholder="请输入备注"
              ></el-input>
            </template>
          </el-table-column>
          <el-table-column
            fixed="right"
            align="right"
            width="90px"
            label="操作"
            :index="999"
          >
            <template slot-scope="scope" slot="header">
              <div>
                <el-button
                  icon="el-icon-plus"
                  type="warning"
                  size="mini"
                  circle
                  @click="addTable(scope.row)"
                ></el-button>
              </div>
            </template>
            <template slot-scope="scope">
              <el-button
                type="text"
                plain
                size="small"
                v-if="scope.row.children"
                @click="LowerBtn(scope.row)"
                >添加下级</el-button
              >
              <el-button
                type="text"
                plain
                size="small"
                icon="el-icon-close"
                @click="delTable(scope.$index, scope.row)"
              />
            </template>
          </el-table-column>
        </el-table>
      </el-form>
    </div>
    <!-- 选择评标人 -->
    <expertUesrs @addexpert="handleAdd" :useOrgList="expertData" ref="expert" />

    <!-- 选择报价模板 -->
    <quotationTemplateDialog @template="openTemplate" ref="template" />
    <supplierDialog
      @vendor="getSupplierList"
      :useOrgList="supplierList"
      ref="poolUnits"
    />
  </div>
</template>
  
  <script>
import {helper} from '../../../public/hotent.helper.js'
import req from '@/request.js'
import basicData from '@/api/basicData'
import {quillEditor} from 'vue-quill-editor' //调用编辑器
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'
import utils from '@/hotent-ui-util.js'
import expertUesrs from '@/components/dialog/expertUesrs.vue'
import quotationTemplateDialog from '@/components/dialog/quotationTemplateDialog.vue'
import supplierDialog from '@/components/dialog/supplierDialog.vue'
import TinymceEditor from '@/components/TinymceEditor/TinymceEditor.vue'

export default {
  components: {
    quillEditor,
    expertUesrs,
    quillEditor,
    quotationTemplateDialog,
    supplierDialog,
    TinymceEditor,
  },
  data() {
    return {
      parameter: {},
      loading: false,
      flexAuto: true,
      dataList: [],
      saveFlag: true,
      expertData: [],
      currentNode: 1,
      noticeType: '',
      supplierList: [],
      qualificationsList: [],
      activeName: 1,
      url: '',
      scoreData: [],
      activeList: [
        {
          value: '1',
          name: '招标文件',
        },
        {
          value: '2',
          name: '评分信息',
        },
      ],
    }
  },
  mounted() {
    this.selectTree()
    this.getQualifications()
    this.currentNode = this.$route.query.node
    window.saveData = this.saveData
    window.relationData = this.relationData
    this.id = utils.getUrlKey('id')
    this.node = utils.getUrlKey('node')
    if (this.id) {
      req
        .post(
          window.context.portal +
            '/matApproval/v1/getNoticeTypeById?id=' +
            this.id
        )
        .then((res) => {
          this.noticeType = res.data.value
          if (this.noticeType == 1) {
            this.url = '/matApproval/v1/getDataById'
          }
          if (this.noticeType == 2) {
            this.url = '/projectApproval/v1/getDataById'
          }
          req
            .post(window.context.portal + this.url + '?id=' + this.id)
            .then((res) => {
              if (res.data.value) {
                this.parameter = res.data.value
                if (this.parameter.detailsList) {
                  this.parameter.detailsList.forEach((item) => {
                    if (item.payInfoList && item.payInfoList.length) {
                      item.children = item.payInfoList
                    }
                  })
                }
                if (
                  this.parameter.accessoryList &&
                  this.parameter.accessoryList.length != 0
                ) {
                  this.dataList = this.parameter.accessoryList
                }
                if (
                  this.parameter.matApprovalQualificationList &&
                  this.parameter.matApprovalQualificationList.length
                ) {
                  this.parameter.qualificationsCoutentName =
                    this.parameter.matApprovalQualificationList.map((item) => {
                      return item.qualificationTypeValue
                    })
                }
                this.parameter.expertList = ''
                if (this.parameter.projectEvaluationExpertList) {
                  this.parameter.expertList =
                    this.parameter.projectEvaluationExpertList
                      .map((item) => {
                        return item.fullname
                      })
                      .join(',')
                }
                if (this.parameter.zbDocument != undefined) {
                  delete this.parameter.zbDocument.id
                  this.dataList = this.parameter.zbDocument.accessoryList
                }
                if (this.parameter.evaTemplate.descriptionList.length == 0) {
                  this.selectTree()
                } else {
                  this.scoreData.forEach((item) => {
                    item.evaluationItemPname = item.subjectName
                    this.parameter.evaTemplate.descriptionList.forEach(
                      (val) => {
                        if (item.id == val.evaluationItemPid) {
                          item.children.push(val)
                        }
                      }
                    )
                  })
                }
                this.parameter.vendorName =
                  this.parameter.approvalInviteVendorList
                    .map((item) => {
                      return item.vendorName
                    })
                    .join(',')
              }
            })
        })
    }
  },
  methods: {
    handleClick() {},
    // 获取资质标签内容
    getQualifications() {
      let params = {
        querys: [],
        pageBean: {
          pageSize: -1,
          page: -1,
        },
      }
      this.$http
        .post('${portal}/bizQualificationCategory/v1/page', params)
        .then((res) => {
          if (res.data.state) {
            this.qualificationsList = res.data.value.rows
          }
        })
    },
    // 打开评标人弹窗
    openExpert() {
      this.$refs.expert.add()
    },
    // 选择评标人
    handleAdd(list) {
      this.expertData = []
      this.expertData = list
      this.parameter.projectEvaluationExpertList = list
      this.parameter.expertList = list
        .map((item) => {
          return item.fullname
        })
        .join(',')
      this.$forceUpdate()
    },
    // 选择评标模板
    handleTemplate() {
      this.$refs.template.add(this.parameter)
    },
    // 获取评标模板数据
    openTemplate(data) {
      console.log(data, 'data')
      this.parameter.quotationTemplateDetailApprovalList = []
      this.parameter.quotationTemplateDetailApprovalList = data
      this.parameter.quotationTemplate = data[0].id
      this.parameter.quotationTemplateName = data[0].name
      this.$forceUpdate()
    },
    //下载按钮回调
    downloadFile(name, url) {
      var a = document.createElement('a')
      var event = new MouseEvent('click')
      a.download = name
      a.target = '_blank'
      a.href = url
      a.dispatchEvent(event)
    },
    handleOver() {
      this.flexAuto = !this.flexAuto
    },
    changeRounds(val) {
      if (val > 1) {
        this.parameter.procureType = 6
      }
    },
    // 打开供应商弹窗
    openVendor() {
      this.$refs.poolUnits.add(this.parameter)
    },
    // 获取供应商数据
    getSupplierList(list) {
      this.parameter.approvalInviteVendorList = []
      list.forEach((item) => {
        this.parameter.approvalInviteVendorList.push({
          vendorId: item.id,
          vendorCode: item.code,
          vendorName: item.name,
          projectApprovalType: 1,
        })
      })
      this.supplierList = list
      this.parameter.vendorName = list
        .map((item) => {
          return item.name
        })
        .join(',')
    },
    //查询评标分类树结构
    selectTree() {
      this.scoreData = []
      basicData.bizEvaluationItemSelectTree().then((res) => {
        this.scoreData = res.value[0].children
        this.scoreData.forEach((item) => {
          item.evaluationItemPname = item.subjectName
          item.evaluationScore = 0
        })
      })
    },
    // 综合评标法添加子级
    LowerBtn(row) {
      row.children.push({
        evaluationItemCode: '',
        evaluationStandard: '',
        evaluationScore: 0,
        evaluationItemPid: row.id,
        id: Math.random() + '',
      })
      if (row.subjectName == '商务部分') {
        row.children[0].evaluationItemCode = '价格得分'
      }
      this.$forceUpdate()
    },
    deleteLevel(row, index) {
      this.scoreData = this.delFlatten(this.scoreData, row.id)
    },
    // 子节点删除
    delFlatten(arr, id) {
      arr.map((item) => {
        if (item.children !== undefined) {
          for (let i = 0; i < item.children.length; i++) {
            if (item.children[i].id === id) {
              item.children = item.children.filter((items) => {
                return items.id !== id
              })
            }
          }
        }
        if (Array.isArray(item.children)) {
          this.delFlatten(item.children, id)
        }
      })
      return arr
    },
    handleInput(val) {
      console.log(val)
      let sum = 0
      this.scoreData.forEach((item) => {
        item.children.forEach((e, index) => {
          if (
            e.evaluationItemPid == item.id &&
            item.subjectName == '技术部分' &&
            item.subjectName != '商务部分'
          ) {
            sum += e.evaluationScore
            item.score = sum
          }
          if (
            e.evaluationItemPid == item.id &&
            item.subjectName == '商务部分'
          ) {
            item.score = 100 - sum
            if (val.id != e.id) {
              e.evaluationScore = item.score - val.evaluationScore
            }
          }
        })
      })
    },
    /* 保存 */
    saveData() {
      this.parameter.detailsList.forEach((item) => {
        delete item.id
      })
      if (this.saveFlag) {
        //如果是第一个节点他可以保存数据，否则不需要进行数据操作
        if (this.node == 1) {
          this.parameter.releaseStatus = '1'
          if (this.noticeType == 1) {
            this.url = '/matApproval/v1/saveOrUpdate'
          }
          if (this.noticeType == 2) {
            this.url = '/projectApproval/v1/saveOrUpdate'
          }
          this.$http
            .post('${portal}' + this.url, this.parameter)
            .then((res) => {
              console.log(res, '调用结果')
              if (res.data.state) {
                this.id = res.data.value.id
                let params = {
                  type: 'saveData',
                  state: true,
                  businessKey: this.id, // todo 确认id字段是否正确 用接口返回值做businessKey
                  sysCode: '',
                }
                params.vars = {
                  // props1: this.forms.props1,
                  //   noticeReleaseUserAccount: this.form.noticeReleaseUserAccount,
                }
                hotent.sendMessage(params)
                this.saveFlag = false
              }
            })
        } else {
          let params = {
            type: 'saveData',
            state: true,
            businessKey: this.id, // 流程地址参数id
            sysCode: '',
          }
          hotent.sendMessage(params)
          this.isFirst = false
        }
      } else {
        let params = {
          type: 'saveData',
          state: true,
          businessKey: this.id, // 流程地址参数id
          sysCode: '',
        }
        params.vars = {
          //   noticeReleaseUserAccount: this.form.noticeReleaseUserAccount,
        }
        hotent.sendMessage(params)
        this.isFirst = false
      }
      // }
    },
    relationData(data) {
      console.log(data, 'data')
      this.noticeType = data[0].noticeType
      if (this.noticeType == 1) {
        this.url = '/matApproval/v1/getDataById'
      }
      if (this.noticeType == 2) {
        this.url = '/projectApproval/v1/getDataById'
      }
      this.loading = true
      this.$http
        .post('${portal}' + this.url + '?id=' + data[0].id)
        .then((res) => {
          this.loading = false
          this.parameter = res.data.value
          if (
            this.parameter.accessoryList &&
            this.parameter.accessoryList.length != 0
          ) {
            this.dataList = this.parameter.accessoryList
          }
          this.parameter.expertList = ''
          if (this.parameter.projectEvaluationExpertList) {
            this.parameter.expertList =
              this.parameter.projectEvaluationExpertList
                .map((item) => {
                  return item.fullname
                })
                .join(',')
          }
          if (this.parameter.zbDocument != undefined) {
            delete this.parameter.zbDocument.id
            this.dataList = this.parameter.zbDocument.accessoryList
          }
          if (
            this.parameter.matApprovalQualificationList &&
            this.parameter.matApprovalQualificationList.length
          ) {
            this.parameter.qualificationsCoutentName =
              this.parameter.matApprovalQualificationList.map((item) => {
                return item.qualificationTypeValue
              })
          }
          if (this.parameter.detailsList) {
            this.parameter.detailsList.forEach((item) => {
              if (item.payInfoList && item.payInfoList.length) {
                item.children = item.payInfoList
              }
            })
          }
          this.scoreData.forEach((item) => {
            item.evaluationItemPname = item.subjectName
            this.parameter.evaTemplate.descriptionList.forEach((val) => {
              if (item.id == val.evaluationItemPid) {
                item.children.push(val)
              }
            })
          })
          this.parameter.vendorName = this.parameter.approvalInviteVendorList
            .map((item) => {
              return item.vendorName
            })
            .join(',')
        })
    },
  },
}
</script>
  
  <style lang="scss" scoped>
.form-content {
  overflow-x: hidden;
}
.rows:first-of-type {
  cursor: pointer;
}
.auto {
  display: none;
}
.classNone {
  display: block;
}
/deep/.el-table-lable-box .cell {
  display: flex;
  justify-content: center;
}
.form-flex {
  /deep/.el-form-item__content {
    display: flex;
    align-items: center;
  }
}
.append {
  width: 10%;
  background-color: #f5f7fa;
  color: #909399;
  vertical-align: middle;
  display: table-cell;
  position: relative;
  border: 1px solid #dcdfe6;
  border-radius: 4px;
  padding: 0 10px;
  white-space: nowrap;
  text-align: center;
}
</style>