<template>
  <div class="edit-add-detail">
    <div class="crumbs">
      <Breadcrumb
        :breadcrumbOpt="breadcrumbOpt"
        svg-name="#icon-anjuan"
        @breadcrumb-click="handleClose"
      />
    </div>
    <div class="form-content" v-loading="loading">
      <el-steps :active="activeName" simple style="margin-bottom: 20px">
        <el-step
          title="立项信息"
          icon="el-icon-info"
          @click.native="changeTab('1')"
        >
        </el-step>
        <el-step
          title="物料信息"
          icon="el-icon-info"
          @click.native="changeTab('2')"
        >
        </el-step>
        <el-step
          title="招标信息"
          icon="el-icon-info"
          @click.native="changeTab('3')"
        >
        </el-step>
        <el-step
          title="评标信息"
          @click.native="changeTab('4')"
          icon="el-icon-info"
          v-if="parameter.evaluationMethod == 2"
        >
        </el-step>
      </el-steps>
      <div v-if="activeName == 1" class="div-content">
        <el-form
          ref="formInfo1"
          :model="parameter"
          label-width="auto"
          label-position="left"
        >
          <el-row :gutter="24">
            <el-col :span="8">
              <el-form-item label="组织单位" prop="affiliatedOrgName">
                <el-input
                  disabled
                  v-model="parameter.affiliatedOrgName"
                  placeholder="请输入组织单位"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="采购单位" prop="procureOrgName">
                <el-input
                  :readonly="this.breadcrumbOpt[1].breadcrumbName == '详情'"
                  v-model="parameter.procureOrgName"
                  placeholder="请选择采购单位"
                >
                  <el-button
                    slot="append"
                    v-if="this.breadcrumbOpt[1].breadcrumbName != '详情'"
                    @click="purchasingUnitsBtn"
                    icon="el-icon-search"
                  ></el-button>
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="公告标题" prop="noticeTitle">
                <el-input
                  :readonly="this.breadcrumbOpt[1].breadcrumbName == '详情'"
                  v-model="parameter.noticeTitle"
                  placeholder="请输入公告标题"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24">
            <el-col :span="8">
              <el-form-item label="是否集中采购" prop="matIfPlat">
                <dict-select
                  dictCode="cglx-ywlx"
                  :hasDefaultOption="true"
                  :readonly="this.breadcrumbOpt[1].breadcrumbName == '详情'"
                  style="width: 100%"
                  v-model="parameter.matIfPlat"
                  placeholder="请选择是否集中采购"
                />
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="采购类型" prop="procureType">
                <dict-select
                  dictCode="cglx-cglx"
                  :hasDefaultOption="true"
                  :readonly="this.breadcrumbOpt[1].breadcrumbName == '详情'"
                  style="width: 100%"
                  v-if="parameter.procureType !== 6"
                  v-model="parameter.procureType"
                  placeholder="请选择采购类型"
                />
                <div v-else>谈判采购（多轮）</div>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="是否含税价" prop="isTax">
                <dict-select
                  dictCode="cgsq-bjfs"
                  :hasDefaultOption="true"
                  :readonly="this.breadcrumbOpt[1].breadcrumbName == '详情'"
                  style="width: 100%"
                  v-model="parameter.isTax"
                  placeholder="请选择是否含税价"
                />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24">
            <el-col :span="8">
              <el-form-item label="发布方式" prop="releaseMethod">
                <dict-select
                  dictCode="cglx-fbfs"
                  :readonly="this.breadcrumbOpt[1].breadcrumbName == '详情'"
                  :hasDefaultOption="true"
                  style="width: 100%"
                  v-model="parameter.releaseMethod"
                  placeholder="请选择发布方式"
                />
              </el-form-item>
            </el-col>
            <el-col :span="8" v-if="parameter.releaseMethod == 2">
              <el-form-item
                label="供应商"
                prop="supplierName"
                class="input-select-item"
              >
                <el-input
                  :readonly="this.breadcrumbOpt[1].breadcrumbName == '详情'"
                  v-model="parameter.vendorName"
                  placeholder="请选择供应商"
                >
                  <el-button
                    slot="append"
                    v-if="this.breadcrumbOpt[1].breadcrumbName != '详情'"
                    @click="openVendor"
                    icon="el-icon-search"
                  ></el-button>
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="付款方式" prop="quotationMethod">
                <dict-select
                  dictCode="cglx-fkfs"
                  :hasDefaultOption="true"
                  :readonly="this.breadcrumbOpt[1].breadcrumbName == '详情'"
                  style="width: 100%"
                  v-model="parameter.quotationMethod"
                  placeholder="请选择付款方式"
                />
              </el-form-item>
            </el-col>
            <el-col :span="8" v-if="parameter.quotationMethod == 2">
              <el-form-item
                class="form-flex"
                label="承兑时间"
                prop="acceptanceTime"
              >
                <dict-select
                  dictCode="cdsj"
                  :hasDefaultOption="true"
                  :readonly="this.breadcrumbOpt[1].breadcrumbName == '详情'"
                  style="width: 100%"
                  v-model="parameter.acceptanceTime"
                  placeholder="请选择承兑时间"
                />
                <div class="append">月</div>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item
                class="form-flex"
                label="挂账时间"
                prop="pendingTime"
              >
                <dict-select
                  dictCode="cdsj"
                  :hasDefaultOption="true"
                  :readonly="this.breadcrumbOpt[1].breadcrumbName == '详情'"
                  style="width: 100%"
                  v-model="parameter.pendingTime"
                  placeholder="请选择挂账时间"
                />
                <div class="append">月</div>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="有无保证金" prop="hasBond">
                <dict-select
                  dictCode="cglx-ywbzj"
                  :hasDefaultOption="true"
                  :readonly="this.breadcrumbOpt[1].breadcrumbName == '详情'"
                  style="width: 100%"
                  v-model="parameter.hasBond"
                  placeholder="请选择有无保证金"
                />
              </el-form-item>
            </el-col>
            <el-col :span="8" v-if="parameter.hasBond == 1">
              <el-form-item label="保证金（元）" prop="bond">
                <el-input
                  :readonly="this.breadcrumbOpt[1].breadcrumbName == '详情'"
                  v-model="parameter.bond"
                  placeholder="请输入保证金"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="报价轮数" prop="quotationRounds">
                <el-input
                  v-model="parameter.quotationRounds"
                  placeholder="请输入报价轮数"
                  :readonly="this.breadcrumbOpt[1].breadcrumbName == '详情'"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="报价模板" prop="quotationTemplateName">
                <el-input
                  :readonly="this.breadcrumbOpt[1].breadcrumbName == '详情'"
                  v-model="parameter.quotationTemplateName"
                  placeholder="请选择报价模板"
                >
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item
                label="投标文件是否必传"
                prop="isBidDocumentsUpload"
              >
                <dict-select
                  dictCode="sfsctbwj"
                  :hasDefaultOption="true"
                  readonly
                  style="width: 100%"
                  v-model="parameter.isBidDocumentsUpload"
                  placeholder="请选择投标文件是否必传"
                />
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="联系人" prop="affiliatedUserName">
                <el-input
                  v-model="parameter.affiliatedUserName"
                  placeholder="请输入联系人"
                  :readonly="this.breadcrumbOpt[1].breadcrumbName == '详情'"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="联系方式" prop="contactsPhone">
                <el-input
                  v-model="parameter.contactsPhone"
                  placeholder="请输入联系方式"
                  :readonly="this.breadcrumbOpt[1].breadcrumbName == '详情'"
                ></el-input>
              </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"
                  :readonly="this.breadcrumbOpt[1].breadcrumbName == '详情'"
                  :options="editorOption"
                  :editorOption="editorOption"
                >
                </quill-editor>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </div>
      <div v-if="activeName == 2" class="div-content">
        <el-form
          ref="formInfo2"
          :model="parameter"
          label-width="auto"
          label-position="left"
        >
          <el-table
            ref="singleTable"
            :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
              fixed
              label="物料名称"
              min-width="170"
              prop="matName"
            >
              <template slot-scope="scope">
                <el-input
                  disabled
                  readonly
                  v-model="scope.row.matName"
                  placeholder="选择物料名称"
                ></el-input>
              </template>
            </el-table-column>
            <el-table-column
              label="企业物料编号"
              min-width="150"
              prop="matCompanyCode"
            >
              <template slot-scope="scope">
                <el-input
                  disabled
                  v-model="scope.row.matCompanyCode"
                  placeholder="企业物料编号"
                ></el-input>
              </template>
            </el-table-column>

            <el-table-column
              label="物料牌号"
              min-width="130"
              prop="matMaterial"
            >
              <template slot-scope="scope">
                <el-input
                  disabled
                  v-model="scope.row.matMaterial"
                  placeholder="物料牌号"
                ></el-input>
              </template>
            </el-table-column>
            <el-table-column label="规格型号" min-width="130" prop="matSpec">
              <template slot-scope="scope">
                <el-input
                  disabled
                  v-model="scope.row.matSpec"
                  placeholder="规格型号"
                ></el-input>
              </template>
            </el-table-column>
            <el-table-column label="数量" min-width="110" prop="matNum">
              <template slot-scope="scope">
                <el-input
                  disabled
                  v-model="scope.row.matNum"
                  placeholder="请输入数量"
                ></el-input>
              </template>
            </el-table-column>
            <el-table-column label="税率" min-width="80" prop="taxRate">
              <template slot-scope="scope">
                <el-input
                  disabled
                  v-model="scope.row.taxRate"
                  placeholder="税率"
                ></el-input>
              </template>
            </el-table-column>
            <el-table-column label="计量单位" min-width="80" prop="matUnit">
              <template slot-scope="scope">
                <el-input
                  disabled
                  v-model="scope.row.matUnit"
                  placeholder="计量单位"
                ></el-input>
              </template>
            </el-table-column>
            <el-table-column label="品牌" min-width="80" prop="matBrand">
              <template slot-scope="scope">
                <el-input
                  disabled
                  v-model="scope.row.matBrand"
                  placeholder="品牌"
                ></el-input>
              </template>
            </el-table-column>
            <el-table-column label="计划编号" min-width="80" prop="planCode">
              <template slot-scope="scope">
                <el-input
                  disabled
                  v-model="scope.row.planCode"
                  placeholder="计划编号"
                ></el-input>
              </template>
            </el-table-column>
            <el-table-column label="需求日期" min-width="140" prop="demandDate">
              <template slot-scope="scope">
                <el-date-picker
                  v-model="scope.row.demandDate"
                  type="date"
                  disabled
                  value-format="yyyy-MM-dd"
                  placeholder="请选择需求日期"
                  style="width: 100%"
                />
              </template>
            </el-table-column>
            <el-table-column label="基础扩展" min-width="140" prop="matBaseExt">
              <template slot-scope="scope">
                <el-input
                  disabled
                  v-model="scope.row.matBaseExt"
                  placeholder="基础扩展"
                ></el-input>
              </template>
            </el-table-column>
            <el-table-column
              label="其他扩展"
              min-width="140"
              prop="matOtherExt"
            >
              <template slot-scope="scope">
                <el-input
                  disabled
                  v-model="scope.row.matOtherExt"
                  placeholder="其他扩展"
                ></el-input>
              </template>
            </el-table-column>
            <el-table-column
              label="送货地址"
              min-width="180"
              prop="unloadAddress"
            >
              <template slot-scope="scope">
                <el-input
                  readonly
                  disabled
                  v-model="scope.row.unloadAddress"
                  placeholder="请输入送货地址"
                ></el-input>
              </template>
            </el-table-column>
            <el-table-column
              label="企业补充说明"
              min-width="180"
              prop="remarks"
            >
              <template slot-scope="scope">
                <el-input
                  disabled
                  v-model="scope.row.remarks"
                  placeholder="请输入企业补充说明"
                ></el-input>
              </template>
            </el-table-column>
          </el-table>
        </el-form>
      </div>
      <div v-if="activeName == 3" class="div-content">
        <el-form
          ref="formInfo3"
          :model="parameter"
          label-width="auto"
          label-position="left"
        >
          <el-row :gutter="24">
            <el-col :span="8">
              <el-form-item label="投标开始时间" prop="biddingStartTime">
                <el-date-picker
                  readonly
                  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="8">
              <el-form-item label="投标结束时间" prop="biddingEndTime">
                <el-date-picker
                  readonly
                  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="8" v-if="this.parameter.procureType != 3">
              <el-form-item label="评标方式" prop="evaluationMode">
                <dict-select
                  dictCode="cglx-pbfs"
                  :hasDefaultOption="true"
                  readonly
                  style="width: 100%"
                  v-model="parameter.evaluationMode"
                  placeholder="请选择评标方式"
                />
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="评标方法" prop="evaluationMethod">
                <!-- <el-input
                readonly
                type="areatext"
                v-model="parameter.evaluationMethod"
                placeholder="请选择评标方法"
              >
              <el-button
                    slot="append"
                    @click="evaluationBid"
                    icon="el-icon-search"
                  ></el-button>
              </el-input> -->
                <dict-select
                  dictCode="cglx-pbff"
                  :hasDefaultOption="true"
                  readonly
                  :disabled="this.parameter.procureType == 3"
                  style="width: 100%"
                  v-model="parameter.evaluationMethod"
                  placeholder="请选择评标方法"
                />
              </el-form-item>
            </el-col>
            <el-col :span="8" 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: 18px" class="el-icon-question" />
                  </el-tooltip>
                </span>
                <el-input
                  readonly
                  type="areatext"
                  v-model="parameter.expertList"
                  placeholder="请选择评标人"
                >
                </el-input>
              </el-form-item>
            </el-col>

            <el-col :span="8">
              <el-form-item label="评标开始时间" prop="evaluationStartTime">
                <el-date-picker
                  readonly
                  type="datetime"
                  value-format="yyyy-MM-dd HH:mm:ss"
                  style="width: 100%"
                  v-model="parameter.evaluationStartTime"
                  placeholder="请选择评标开始时间"
                ></el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item
                label="澄清补遗截止时间"
                prop="clarificationSupplementDeadlineTime"
              >
                <el-date-picker
                  readonly
                  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="8">
              <el-form-item
                label="供货商提出问题的截止时间"
                prop="raisingQuestionsDeadlineTime"
              >
                <el-date-picker
                  readonly
                  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="8">
              <el-form-item label="响应截止时间" prop="responseTimeDeadline">
                <el-date-picker
                  readonly
                  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-col :span="8">
              <el-form-item label="中标结果有效期（天）" prop="winBidValidity">
                <el-input
                  readonly
                  v-model="parameter.winBidValidity"
                  placeholder="请输入中标结果有效期（天）"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <div class="rows-title">
            <div class="text-overflow">
              <el-tabs v-model="active" @tab-click="handleClick">
                <el-tab-pane name="1" label="招标文件">
                  <div>
                    <el-table
                      class="down"
                      :data="dataList"
                      border
                      stripe
                      style="width: 100%; margin-top: 20px"
                    >
                      <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>
                </el-tab-pane>
                <el-tab-pane name="2" label="补遗文件">
                  <div>
                    <el-table class="down" :data="supplementList" border stripe>
                      <el-table-column
                        prop="describe"
                        key="addendum"
                        label="描述"
                        show-overflow-tooltip
                      ></el-table-column>
                      <el-table-column
                        prop="name"
                        label="文件名称"
                      ></el-table-column>
                      <el-table-column label="操作">
                        <template slot-scope="scope">
                          <el-button size="small" type="text">
                            <a
                              @click="
                                downloadFile(scope.row.name, scope.row.url)
                              "
                              >下载</a
                            >
                          </el-button>
                        </template>
                      </el-table-column>
                    </el-table>
                  </div>
                </el-tab-pane>
                <el-tab-pane name="3" label="投标文件">
                  <div>
                    <el-table class="down" border stripe :data="tenderList">
                  <el-table-column
                    prop="createOrgName"
                    min-width="200px"
                    key="second"
                    label="投标企业"
                  ></el-table-column>
                  <el-table-column
                    prop="name"
                    min-width="200px"
                    key="second"
                    label="文件名称"
                  ></el-table-column>
                  <el-table-column min-width="100px" key="second" label="操作">
                    <template slot-scope="scope">
                      <el-button size="small" type="text">
                        <a @click="downloadFile(scope.row.name, scope.row.url)"
                          >下载</a
                        >
                      </el-button>
                    </template>
                  </el-table-column>
                </el-table>
                  </div>
                </el-tab-pane>
                <el-tab-pane name="4" label="澄清提问">
                  <div>
                    <el-table
                  class="down"
                  :data="clarifyList"
                  border
                  :key="activeName == 'question'"
                  stripe
                  v-loading="tendering"
                >
                  <el-table-column type="expand">
                    <template slot-scope="props">
                      <el-table
                        :key="'childTable' + props.row.id"
                        header-cell-class-name="selectAllbtnDis"
                        :ref="'childTable' + props.row.id"
                        :data="props.row.answerList"
                        style="width: 100%; margin-left: 25px"
                      >
                        <el-table-column label="澄清企业" prop="operateOrgName">
                        </el-table-column>
                        <el-table-column label="澄清描述" prop="describe">
                        </el-table-column>
                        <el-table-column label="澄清时间" prop="operateTime">
                        </el-table-column>
                        <el-table-column
                          prop="name"
                          label="附件"
                        ></el-table-column>
                        <el-table-column width="120px" label="操作">
                          <template slot-scope="scope">
                            <el-button
                              size="small"
                              v-if="scope.row.accessoryList.length != 0"
                              type="text"
                            >
                              <a
                                @click="
                                  downloadFile(scope.row.name, scope.row.url)
                                "
                                >下载</a
                              >
                            </el-button>
                          </template>
                        </el-table-column>
                      </el-table>
                    </template>
                  </el-table-column>
                  <el-table-column
                    prop="operateOrgName"
                    label="提问企业"
                    min-width="100px"
                    show-overflow-tooltip
                  ></el-table-column>
                  <el-table-column
                    prop="describe"
                    label="描述"
                    min-width="100px"
                    show-overflow-tooltip
                  ></el-table-column>

                  <el-table-column
                    prop="operateTime"
                    label="提出时间"
                    min-width="100px"
                    show-overflow-tooltip
                  ></el-table-column>
                  <el-table-column
                    prop="name"
                    show-overflow-tooltip
                    label="文件名称"
                  ></el-table-column>
                  <el-table-column min-width="80px" label="操作">
                    <template slot-scope="scope">
                      <el-button
                        size="small"
                        v-if="scope.row.accessoryList.length != 0"
                        type="text"
                      >
                        <a @click="downloadFile(scope.row.name, scope.row.url)"
                          >下载</a
                        >
                      </el-button>
                    </template>
                  </el-table-column>
                </el-table>
                  </div>
                </el-tab-pane>
              </el-tabs>
            </div>
          </div>
        </el-form>
      </div>
      <div v-if="activeName == 4" class="div-content">
        <el-form
          ref="formInfo3"
          :model="parameter"
          label-width="auto"
          label-position="left"
        >
          <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"
              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="180"
              align="center"
              prop="evaluationItemCode"
            >
              <template slot-scope="scope">
               <div v-if="!scope.row.children">{{scope.row.evaluationItemCode}}</div> 
              </template>
            </el-table-column>
            <el-table-column
              label="评分标准"
              min-width="180"
              align="center"
              prop="evaluationStandard"
            >
              <template slot-scope="scope">
                <div v-if="!scope.row.children">{{scope.row.evaluationStandard}}</div>
              </template>
            </el-table-column>
            <el-table-column
              align="center"
              label="分值"
              min-width="140"
              prop="evaluationScore"
            >
              <template slot-scope="scope">
                <div v-if="!scope.row.children">
                  {{ scope.row.evaluationScore }}
                </div>
              </template>
            </el-table-column>
          </el-table>
        </el-form>
      </div>
    </div>
    <div slot="footer" class="footer">
      <el-button @click="handleClose">{{ $t('domestic.cancel') }}</el-button>
      <el-button type="primary" v-if="activeName == 2" @click="up"
        >上一步</el-button
      >
      <el-button type="primary" v-if="activeName == 3" @click="up1"
        >上一步</el-button
      >
      <el-button type="primary" v-if="activeName == 4" @click="up2"
        >上一步</el-button
      >
      <el-button type="primary" v-if="activeName == 1" @click="next"
        >下一步</el-button
      >
      <el-button type="primary" v-if="activeName == 2" @click="next1"
        >下一步</el-button
      >
      <el-button
        type="primary"
        v-if="activeName == 3 && parameter.evaluationMethod == 2"
        @click="next2"
        >下一步</el-button
      >
    </div>
  </div>
</template>

<script>
import Breadcrumb from '@/components/Breadcrumb/index.vue'
import {quillEditor} from 'vue-quill-editor' //调用编辑器
import basicData from '@/api/basicData'
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import {mapState} from 'vuex'
import 'quill/dist/quill.bubble.css'
import procurementManagement from '@/api/procurementManagement'

const toolbarOptions = [
  ['bold', 'italic', 'underline', 'strike'], // toggled buttons
  ['blockquote', 'code-block'],

  [{header: 1}, {header: 2}], // custom button values
  [{list: 'ordered'}, {list: 'bullet'}],
  [{script: 'sub'}, {script: 'super'}], // superscript/subscript
  [{indent: '-1'}, {indent: '+1'}], // outdent/indent
  [{direction: 'rtl'}], // text direction

  [{size: ['small', false, 'large', 'huge']}], // custom dropdown
  [{header: [1, 2, 3, 4, 5, 6, false]}],

  [{color: []}, {background: []}], // dropdown with defaults from theme
  [{font: []}],
  [{align: []}],
  ['link', 'image', 'upload'],
  ['clean'], // remove formatting button
]
import {Quill} from 'vue-quill-editor'
import moment from 'moment'
// 自定义插入a链接
var Link = Quill.import('formats/link')
class FileBlot extends Link {
  // 继承Link Blot
  static create(value) {
    let node = undefined
    if (value && !value.href) {
      // 适应原本的Link Blot
      node = super.create(value)
    } else {
      // 自定义Link Blot
      node = super.create(value.href)
      // node.setAttribute('download', value.innerText);  // 左键点击即下载
      node.innerText = value.innerText
      node.download = value.innerText
    }
    return node
  }
}
FileBlot.blotName = 'link'
FileBlot.tagName = 'A'
Quill.register(FileBlot)
export default {
  name: 'domesticDialog',
  components: {
    Breadcrumb,
    quillEditor,
  },
  props: {
    editData: Object,
  },
  data() {
    return {
      activeName: '1',
      supplierList: [],
      describe: '',
      editorOption: {
        // 改变提示文字内容
        placeholder: '请输入内容......',
        modules: {
          toolbar: {
            container: toolbarOptions, // 工具栏
            handlers: {},
          },
        },
      },
      loading: false,
      supplementList: [],
      qualificationsList: [],
      active: '1',
      breadcrumbOpt: [{breadcrumbName: '采购立项'}, {breadcrumbName: '新增'}],
      clarifyList: [],
      tenderList: [],
      parameter: {},
    }
  },
  created() {
    this.selectTree()
    this.addModifyBtn()
    this.parameter.matIfPlat = this.$route.query.type
  },
  computed: {
    ...mapState({
      headers: (state) => {
        return {Authorization: `Bearer ${state.login.currentUser.token}`}
      },
      action: function () {
        return window.context.portal + '/biz/universal/v1/minioUpload'
      },
      actionBz: function () {
        return window.context.portal + '/matApproval/v1/uploadTenderDoc'
      },
    }),
  },
  mounted() {},
  methods: {
    // 切换tab
    handleClick(tab, e) {
      if (this.active == 1) {
      }
      if (this.active == 2) {
        this.supplementList = []
        let parmas = {
          pageBean: {
            pageSize: -1,
            page: -1,
          },
          querys: [],
        }
        parmas.querys.push(
          {
            group: 'main',
            operation: 'EQUAL',
            parentGroup: '',
            property: 'projectApprovalId',
            relation: 'AND',
            value: this.parameter.id,
          },
          {
            group: 'main',
            operation: 'EQUAL',
            parentGroup: '',
            property: 'releaseStatus',
            relation: 'AND',
            value: 2,
          },
          {
            group: 'main',
            operation: 'EQUAL',
            parentGroup: '',
            property: 'type',
            relation: 'AND',
            value: 2,
          }
        )
        this.$http
          .post('${portal}/tenderDocument/v1/pageAccessory', parmas)
          .then((res) => {
            let data = res.data.value.rows
            data.forEach((item) => {
              if (item.accessoryList && item.accessoryList.length != 0) {
                item.accessoryList.forEach((val) => {
                  if (item.id == val.sourceId) {
                    val.describe = item.describe
                    this.supplementList.push(val)
                  }
                })
              }
            })
          })
      }
      if (this.active == 3) {
        this.tenderList = []
        let parmas = {
          pageBean: {
            pageSize: -1,
            page: -1,
          },
          querys: [],
        }
        parmas.querys.push(
          {
            group: 'main',
            operation: 'EQUAL',
            parentGroup: '',
            property: 'projectApprovalId',
            relation: 'AND',
            value: this.parameter.id,
          },
          {
            group: 'main',
            operation: 'EQUAL',
            parentGroup: '',
            property: 'projectApprovalType',
            relation: 'AND',
            value: 1,
          }
        )
        this.tenderList = []
        this.$http
          .post('${portal}/bidDocuments/v1/page', parmas)
          .then((res) => {
            let data = res.data.value.rows
            data.forEach((item) => {
              if (item.accessoryList && item.accessoryList.length != 0) {
                item.accessoryList.forEach((val) => {
                  if (item.id == val.sourceId) {
                    this.tenderList.push(val)
                  }
                })
              }
            })
          })
      }
      if (this.active == 4) {
        let parmas = {
          pageBean: {
            pageSize: -1,
            page: -1,
          },
          querys: [],
        }
        parmas.querys.push({
          group: 'main',
          operation: 'EQUAL',
          parentGroup: '',
          property: 'projectApprovalId',
          relation: 'AND',
          value: this.parameter.id,
        })
        this.$http
          .post('${portal}/clarifyQuestions/v1/pageAndAnswer', parmas)
          .then((res) => {
            this.clarifyList = []
            if (res.data.state) {
              this.clarifyList = res.data.value.rows
              this.clarifyList.forEach((item) => {
                if (item.accessoryList && item.accessoryList.length) {
                  item.accessoryList.forEach((val) => {
                    item.name = val.name
                    item.url = val.url
                  })
                }
                if (item.answerList.length != 0) {
                  item.answerList.forEach((e) => {
                    if (e.accessoryList && e.accessoryList.length) {
                      e.accessoryList.forEach((key) => {
                        e.name = key.name
                        e.url = key.url
                      })
                    }
                  })
                }
              })
            }
          })
      }
    },
    //查询评标分类树结构
    selectTree() {
      basicData.bizEvaluationItemSelectTree().then((res) => {
        this.scoreData = res.value[0].children
        this.scoreData.forEach((item) => {
          item.evaluationItemPname = item.subjectName
        })
      })
    },
    //下载按钮回调
    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)
    },
    changeTab(val) {
      this.activeName = val
    },
    //编辑
    addModifyBtn() {
      if (this.$route.query.editRows) {
        this.breadcrumbOpt[1].breadcrumbName = '详情'
        this.modifychoData(this.$route.query.editRows)
      } else {
        this.breadcrumbOpt[1].breadcrumbName = '新增'
      }
    },
    //获取修改回显数据
    modifychoData(val) {
      this.loading = true
      procurementManagement.bizProjectApprovalSelectOne(val.id).then((res) => {
        this.loading = false
        this.parameter = res.value
        if (this.parameter.zbDocument != undefined) {
          delete this.parameter.zbDocument.id
          this.dataList = this.parameter.zbDocument.accessoryList
        }
        this.parameter.vendorName = this.parameter.approvalInviteVendorList
          .map((item) => {
            return item.vendorName
          })
          .join(',')
        this.scoreData.forEach((item) => {
          item.evaluationItemPname = item.subjectName
          this.parameter.evaTemplate.descriptionList.forEach((val) => {
            if (item.id == val.evaluationItemPid) {
              item.children.push(val)
            }
          })
        })
        if (this.parameter.projectEvaluationExpertList) {
          this.parameter.expertList = this.parameter.projectEvaluationExpertList
            .map((item) => {
              return item.fullname
            })
            .join(',')
        }
        this.supplierList = this.parameter.approvalInviteVendorList
      })
    },
    // 关闭//面包屑点击
    handleClose() {
      if (this.$route.query.type == 1) {
        this.$router.push({
          name: 'materialProjectManagement',
          params: {
            tabsActiveName: 'focusMaterialProjectManagement',
          },
        })
      }
      if (this.$route.query.type == 0) {
        this.$router.push({
          name: 'materialProjectManagement',
          params: {
            tabsActiveName: 'selfMaterialProjectManagement',
          },
        })
      }
      this.parameter = {}
    },
    next() {
      if (this.activeName == 1) {
        this.activeName = 2
      }
    },
    next1() {
      this.activeName = 3
    },
    next2() {
      this.activeName = 4
    },
    up() {
      if (this.activeName == 2) {
        this.activeName = 1
      }
    },
    up1() {
      if (this.activeName == 3) {
        this.activeName = 2
      }
    },
    up2() {
      if (this.activeName == 4) {
        this.activeName = 3
      }
    },
  },
}
</script>

<style lang="scss" scoped>
.form-content {
  overflow: hidden;
}
/deep/.el-tabs {
  height: 100%;
}
/deep/.el-tabs__content {
  height: calc(100% - 50px);
  overflow-y: auto;
}
.div-content {
  height: calc(100% - 70px);
  overflow-y: auto;
  overflow-x: hidden;
}
.rows {
  display: flex;
  align-items: center;
  border-bottom: 1px solid #ebebeb;
  margin-bottom: 16px;
  padding: 10px 0;
  .rows-left {
    margin-right: 10px;
    .rows-hr {
      width: 3px;
      height: 18px;
      background-color: #0e6eff;
      border-radius: 2px;
    }
  }
  .rows-title {
    .text-overflow {
      width: 100%;
      font-size: 16px;
    }
  }
}
/deep/.el-tabs__item {
  font-size: 16px;
}
/deep/.el-tabs__header {
  padding: 0;
}
/deep/.el-row {
  display: flex;
  flex-wrap: wrap;
}
.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;
}
/deep/.el-step.is-simple .el-step__title {
  cursor: pointer;
}
</style>
<style lang="scss">
.ql-snow.ql-toolbar .ql-upload {
  background: url('../../../../../assets/img/icon_upload.svg');
  background-size: 18px 18px;
  background-position: center center;
  background-repeat: no-repeat;
  /*background: red;*/
}
</style>
