<template>
  <div class="materialInformation">
    <div class="crumbs">
      <Breadcrumb
        :breadcrumbOpt="breadcrumbOpt"
        svg-name="#icon-fileprotect"
        @breadcrumb-click="handleClose"
      />
    </div>
    <div class="content" v-loading="tableLoading">
      <div class="left-tree">
        <div class="common-table-content btn-pagenation">
          <el-table
            :border="true"
            stripe
            fit
            class="top-table-content"
            size="mini"
            ref="multiple"
            height="100%"
            :data="tableData"
            :row-key="getRowKeys"
            @row-click="handleBtn"
            @select="(selection, row) => handleBtn(row)"
            @selection-change="handleSelectionChange"
            @select-all="selectAll"
            highlight-current-row
          >
            <el-table-column
              type="selection"
              min-width="50px"
              align="center"
              fixed="left"
            ></el-table-column>
            <el-table-column
              min-width="90px"
              label="评标状态"
              align="center"
              show-overflow-tooltip
              prop="isEva"
            >
              <template slot-scope="scope">
                <span v-if="scope.row.isEva == 0">未评标</span>
                <span v-if="scope.row.isEva == 1">已评标</span>
              </template>
            </el-table-column>
            <el-table-column
              min-width="120px"
              label="平台物料编号"
              align="center"
              show-overflow-tooltip
              prop="matPlatcode"
            >
            </el-table-column>
            <el-table-column
              min-width="120px"
              label="企业物料编号"
              align="center"
              prop="matCode"
              show-overflow-tooltip
            >
            </el-table-column>
            <el-table-column
              min-width="100px"
              label="物料名称"
              align="center"
              prop="matName"
              show-overflow-tooltip
            >
            </el-table-column>
            <el-table-column
              prop="matMaterial"
              show-overflow-tooltip
              min-width="100px"
              align="center"
              label="物料牌号"
            >
            </el-table-column>
            <el-table-column
              prop="matSpec"
              min-width="100px"
              label="规格型号"
              align="center"
              show-overflow-tooltip
            >
            </el-table-column>
            <el-table-column
              prop="matNum"
              min-width="90px"
              label="数量"
              align="center"
              show-overflow-tooltip
            >
            </el-table-column>
            <el-table-column
              prop="matUnit"
              min-width="90px"
              label="计量单位"
              align="center"
              show-overflow-tooltip
            >
            </el-table-column>
            <el-table-column
              prop="maximumPriceLimit"
              min-width="90px"
              label="最高限价"
              align="center"
              show-overflow-tooltip
            >
            </el-table-column>

            <el-table-column
              prop="taxRate"
              min-width="90px"
              label="税率(%)"
              align="center"
              show-overflow-tooltip
            >
            </el-table-column>
            <el-table-column
              prop="matBaseExt"
              min-width="120px"
              label="基础扩展"
              align="center"
              show-overflow-tooltip
            >
            </el-table-column>
            <el-table-column
              prop="matOtherExt"
              min-width="120px"
              label="其他扩展"
              align="center"
              show-overflow-tooltip
            >
            </el-table-column>

            <el-table-column
              prop="matCompanyName"
              min-width="130px"
              label="需求单位"
              align="center"
              show-overflow-tooltip
            >
            </el-table-column>
            <el-table-column
              prop="demandDate"
              min-width="130px"
              label="需求时间"
              align="center"
              show-overflow-tooltip
            >
            </el-table-column>
            <el-table-column
              prop="unloadAddress"
              min-width="100px"
              label="交货地点"
              align="center"
              show-overflow-tooltip
            >
            </el-table-column>
            <el-table-column
              prop="remarks"
              min-width="100px"
              label="企业补充说明"
              align="center"
              show-overflow-tooltip
            >
            </el-table-column>
          </el-table>
        </div>
        <div class="left-bottom">
          <el-table
            :border="true"
            stripe
            fit
            height="100%"
            size="small"
            ref="multipleSelection"
            v-loading="loading"
            :data="quotationCompanyList"
          >
            <el-table-column
              type="index"
              min-width="50px"
              label="序号"
            ></el-table-column>
            <el-table-column
              min-width="150px"
              label="投标单位"
              align="center"
              prop="quotationCompanyName"
              show-overflow-tooltip
            >
            </el-table-column>
            <el-table-column
              min-width="100px"
              label="投标单价(元)"
              align="center"
              prop="quotationPrice"
              show-overflow-tooltip
            >
            </el-table-column>
            <el-table-column
              prop="quotationAmount"
              show-overflow-tooltip
              min-width="100px"
              align="center"
              label="投标总额(元)"
            >
              <template slot-scope="scope">
                <div>
                  {{ scope.row.quotationPrice * scope.row.matNum }}
                </div>
              </template>
            </el-table-column>
          </el-table>
        </div>
      </div>
      <div class="common-page-shadow">
        <div class="material-management">
          <el-tabs v-model="activeName" @tab-click="handleClick">
            <el-tab-pane label="评分管理" name="first"> </el-tab-pane>
            <el-tab-pane label="招标文件" name="five"></el-tab-pane>
            <el-tab-pane label="投标文件" name="second"></el-tab-pane>
            <el-tab-pane label="澄清提问" name="question"></el-tab-pane>
            <el-tab-pane label="补遗文件" name="addendum"></el-tab-pane>
          </el-tabs>
        </div>
        <el-row
          class="common-table-container flex searchPanel"
          :style="SearchPanel"
        >
          <el-col :span="24" class="common-table-wrapper">
            <div class="score-table" v-if="activeName === 'first'">
              <div class="common-search-container" ref="contentPanel">
                <el-form
                  ref="form"
                  :model="searchForm"
                  label-width="auto"
                  label-position="right "
                  :inline="true"
                  type="flex"
                  justify="left"
                >
                  <el-form-item label="投标单位:">
                    <el-select
                      v-model="searchForm.venderName"
                      clearable
                      filterable
                      placeholder="请选择投标单位"
                    >
                      <el-option
                        v-for="item in venderList"
                        :key="item.quotationCompanyId"
                        :label="item.quotationCompanyName"
                        :value="item.quotationCompanyId"
                        @click.native="selectVender(item)"
                      >
                      </el-option>
                    </el-select>
                  </el-form-item>
                  <!-- <el-form-item label="投标价格(元):">
                    <span style="color: red; font-size: 16px">{{
                      objData.quotationPrice
                    }}</span>
                  </el-form-item>
                  <el-form-item label="投标金额(元):">
                    <span style="color: red; font-size: 16px">{{
                      objData.quotationAmount
                    }}</span>
                  </el-form-item> -->
                  <el-form-item label="总得分:">
                    {{ searchForm.score }}
                  </el-form-item>
                </el-form>
                <div style="margin-left: 60px">
                  <el-button
                    type="primary"
                    size="small"
                    icon="el-icon-thumb"
                    :loading="saving"
                    @click="handleSave"
                    >保存评标</el-button
                  >
                </div>
              </div>
              <div class="rows">
                <div class="rows-left">
                  <div class="rows-hr"></div>
                </div>
                <div class="rows-title">
                  <div class="text-overflow">评分表</div>
                </div>
              </div>
              <div class="table">
                <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="subjectName"
                    min-width="100px"
                    label="评分大项"
                    align="center"
                    resizable
                  >
                  </el-table-column>
                  <el-table-column
                    label="评分细项"
                    min-width="140"
                    prop="evaluationItemCode"
                  >
                    <template slot-scope="scope">
                      <div>
                        {{ scope.row.evaluationItemCode }}
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="评分标准"
                    min-width="140"
                    prop="evaluationStandard"
                  >
                    <template slot-scope="scope">
                      <div>
                        {{ scope.row.evaluationStandard }}
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="分值"
                    min-width="80"
                    prop="evaluationScore"
                  >
                    <template slot-scope="scope">
                      <div v-if="!scope.row.children">
                        {{ scope.row.evaluationScore }}
                      </div>
                      <div v-else>
                        {{ scope.row.evaluationScore }}
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column label="得分" min-width="140" prop="score">
                    <template slot-scope="scope">
                      <el-input-number
                        v-model="scope.row.score"
                        controls-position="right"
                        :min="0"
                        :precision="2"
                        :disabled="form.isEva==1"
                        v-if="!scope.row.children"
                        @change="handleInput(scope.row)"
                        :max="scope.row.evaluationScore"
                      ></el-input-number>
                      <div v-else>
                        {{ scope.row.score }}
                      </div>
                    </template>
                  </el-table-column>
                </el-table>
              </div>
              <div slot="footer" class="footer">
                <el-button
                  type="primary"
                  size="small"
                  icon="el-icon-thumb"
                  :loading="loadingBtn"
                  @click="saveAll"
                  >提交所有评标</el-button
                ><span style="color: red"
                  >（注：对该物料所有供应商保存评标后进行点击提交）</span
                >
              </div>
            </div>
            <div class="quote-content" v-if="activeName === 'second'">
              <div class="rows">
                <div class="rows-left">
                  <div class="rows-hr"></div>
                </div>
                <div class="rows-title">
                  <div class="text-overflow">投标文件</div>
                </div>
              </div>
              <div class="content">
                <el-table class="down" :data="bidFileList" border stripe>
                  <el-table-column
                    prop="createOrgName"
                    label="投标供应商"
                  ></el-table-column>
                  <el-table-column
                    prop="name"
                    key="second"
                    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>
            </div>
            <div class="quote-content" v-if="activeName === 'question'">
              <div class="rows">
                <div class="rows-left">
                  <div class="rows-hr"></div>
                </div>
                <div class="rows-title">
                  <div class="text-overflow">澄清提问</div>
                </div>
              </div>
              <div class="content">
                <el-table
                  class="down"
                  :data="clarifyList"
                  size="mini"
                  border
                  :key="activeName == 'question'"
                  stripe
                >
                  <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="提问企业"
                    show-overflow-tooltip
                  ></el-table-column>
                  <el-table-column
                    prop="describe"
                    label="描述"
                    show-overflow-tooltip
                  ></el-table-column>

                  <el-table-column
                    prop="operateTime"
                    label="提出时间"
                    show-overflow-tooltip
                  ></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>
              </div>
            </div>
            <div class="quote-content" v-if="activeName === 'addendum'">
              <div class="rows">
                <div class="rows-left">
                  <div class="rows-hr"></div>
                </div>
                <div class="rows-title">
                  <div class="text-overflow">补遗文件</div>
                </div>
              </div>
              <div class="content">
                <el-table class="down" :data="SupplementList" border stripe>
                  <el-table-column
                    prop="describe"
                    label="描述"
                  ></el-table-column>
                  <el-table-column
                    prop="name"
                    label="文件名称"
                  ></el-table-column>
                  <el-table-column width="150px" 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>
            </div>
            <div class="quote-content" v-if="activeName === 'five'">
              <div class="rows">
                <div class="rows-left">
                  <div class="rows-hr"></div>
                </div>
                <div class="rows-title">
                  <div class="text-overflow">招标文件</div>
                </div>
              </div>
              <div class="content">
                <el-table class="down" :data="TenderList" border stripe>
                  <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>
            </div>
          </el-col>
        </el-row>
      </div>
    </div>
    <procurementUnits ref="troubleshooting" />
  </div>
</template>

<script>
import procurementUnits from './procurementUnits.vue'
import {getMergeCells} from '@/utils/mergingTable.js'
import Breadcrumb from '@/components/Breadcrumb/index.vue'
import pagination from '@/components/pagination'
import basicData from '@/api/basicData'
import {TableMixin} from '@/mixins/tableMixin'
import routerManagement from '@/api/BasicDataManagement/routerManagement.js'
export default {
  name: 'evaluationManagement',
  components: {
    pagination,
    Breadcrumb,
    procurementUnits,
  },
  mixins: [TableMixin],
  data() {
    return {
      breadcrumbOpt: [
        {breadcrumbName: '物资采购'},
        {breadcrumbName: '综合评标法'},
      ],
      loading: false,
      tableLoading: false,
      activeName: 'first',
      isRadioMode: false,
      handleSaveActive: '',
      loadingBtn: false,
      dataList: [],
      selectArr: [],
      saving: false,
      tableData: [],
      parmas: {},
      bidFileList: [], //投标文件
      TenderList: [], //招标文件
      SupplementList: [], //补遗文件
      clarifyList: [],
      objData: {},
      form: {},
      venderList: [], //供应商列表
      quotationCompanyList: [],
      objScore: {},
      mannerList: [
        {label: '综合评标法', value: 1},
        {label: '最低评标法', value: 0},
      ],
      searchForm: {manner: 1, venderName: '', score: ''}, // 顶部搜索对象
      scoreData: [],
    }
  },
  mounted() {},
  created() {
    this.params = this.$route.query.data
    this.selectTree()
    this.loadData()
  },
  methods: {
    // 切换tab栏选项
    handleClick() {
      if (this.activeName == 'first') {
      }
      if (this.activeName == 'second') {
        this.bidFileList = []
        let parmas = {
          pageBean: {
            pageSize: -1,
            page: -1,
          },
          querys: [],
        }
        parmas.querys.push(
          {
            group: 'main',
            operation: 'EQUAL',
            parentGroup: '',
            property: 'projectApprovalId',
            relation: 'AND',
            value: this.params.id,
          },
          {
            group: 'main',
            operation: 'EQUAL',
            parentGroup: '',
            property: 'projectApprovalType',
            relation: 'AND',
            value: 1,
          }
        )
        this.bidFileList = []
        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.bidFileList.push(val)
                  }
                })
              }
            })
          })
      }
      if (this.activeName == 'question') {
        let parmas = {
          pageBean: {
            pageSize: -1,
            page: -1,
          },
          querys: [],
        }
        parmas.querys.push({
          group: 'main',
          operation: 'EQUAL',
          parentGroup: '',
          property: 'projectApprovalId',
          relation: 'AND',
          value: this.params.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
                      })
                    }
                  })
                }
              })
            }
          })
      }
      if (this.activeName == 'addendum') {
        this.SupplementList = []
        let parmas = {
          pageBean: {
            pageSize: -1,
            page: -1,
          },
          querys: [],
        }
        parmas.querys.push(
          {
            group: 'main',
            operation: 'EQUAL',
            parentGroup: '',
            property: 'projectApprovalId',
            relation: 'AND',
            value: this.params.id,
          },
          {
            group: 'main',
            operation: 'EQUAL',
            parentGroup: '',
            property: 'projectApprovalType',
            relation: 'AND',
            value: 1,
          },
          {
            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.activeName == 'five') {
        this.TenderList = []
        let parmas = {
          pageBean: {
            pageSize: -1,
            page: -1,
          },
          querys: [],
        }
        parmas.querys.push(
          {
            group: 'main',
            operation: 'EQUAL',
            parentGroup: '',
            property: 'projectApprovalId',
            relation: 'AND',
            value: this.params.id,
          },
          {
            group: 'main',
            operation: 'EQUAL',
            parentGroup: '',
            property: 'projectApprovalType',
            relation: 'AND',
            value: 1,
          },
          {
            group: 'main',
            operation: 'EQUAL',
            parentGroup: '',
            property: 'type',
            relation: 'AND',
            value: 1,
          }
        )
        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) {
                    this.TenderList.push(val)
                  }
                })
              }
            })
          })
      }
    },
    //查询评分分类树结构
    selectTree() {
      basicData.bizEvaluationItemSelectTree().then((res) => {
        this.treeData = res.value[0].children
        this.treeData.forEach((item) => {
          this.$set(item, 'evaluationScore', 0)
          // this.$set(item, 'score', 0)
        })
      })
    },
    getVender(id) {
      let parmas = {
        pageBean: {
          pageSize: -1,
          page: -1,
        },
        querys: [],
        sorter: [
          {
            direction: 'ASC',
            property: 'quotationPrice',
          },
        ],
      }
      parmas.querys.push({
        group: 'main',
        operation: 'EQUAL',
        parentGroup: '',
        property: 'quo.NOTICE_DETAILED_ID_',
        relation: 'AND',
        value: id,
      })
      this.$http
        .post('${portal}/bizBiddingQuotation/v1/pageMatDetail', parmas)
        .then((res) => {
          if (res.data.state) {
            this.quotationCompanyList = []
            res.data.value.rows.forEach((item) => {
              this.quotationCompanyList.push(item)
            })
          }
        })
    },
    getCompany(row) {
      this.venderList = []
      let parmas = {
        pageBean: {
          pageSize: -1,
          page: -1,
        },
        querys: [],
      }
      parmas.querys.push(
        {
          group: 'main',
          operation: 'EQUAL',
          parentGroup: '',
          property: 'noticeId',
          relation: 'AND',
          value: this.params.id,
        },
        {
          group: 'main',
          operation: 'EQUAL',
          parentGroup: '',
          property: 'noticeDetailedId',
          relation: 'AND',
          value: row.id,
        }
      )
      this.$http
        .post('${portal}/bizBiddingQuotation/v1/pageQuoOrg', parmas)
        .then((res) => {
          if (res.data.state) {
            this.venderList = res.data.value.rows
          }
        })
    },
    selectVender(val) {
      this.objData = val
      this.getScoreData()
    },
    //保存
    handleSave() {
      if (this.searchForm.venderName == '') {
        this.$message.warning('请选择投标单位！')
        return
      }
      let form = {...this.objScore, ...this.form, ...this.objData}
      form.evaluationDetailList = []
      form.noticeTitle = this.params.noticeTitle
      form.projectNumber = this.params.projectNumber
      form.quotationOrgId = form.quotationCompanyId
      form.quotationOrgCode = form.quotationCompanyCode
      form.quotationOrgName = form.quotationCompanyName
      form.quotationPrice = this.objData.quotationPrice
      form.quotationId = this.form.id
      form.quotationAmount = this.objData.quotationPrice * this.form.matNum
      form.evaluationMethods = 2
      form.evaluationMode = 1
      form.noticeDetaiedId = this.objData.noticeDetaiedId
      delete form.descriptionList
      let sum = 0
      this.scoreData.forEach((item) => {
        if (item.bidEvaId == undefined) {
          delete form.id
        }
        item.evaluationId = item.evaluationItemId
        item.children.forEach((val) => {
          if (item.id == val.evaluationItemPid) {
            val.evaluationSystemDetailId = val.id
            val.evaluationSystemId = item.id
            val.evaluationItemPname = item.subjectName
          }
          if (val.id) {
            delete val.id
          }
          form.evaluationDetailList.push(val)
        })
      })
      form.score = this.searchForm.score
      console.log(form)
      this.saving = true
      this.$http
        .post('${portal}/bidEvaluationRecord/v1/bidEvaComprehensiveMat', form)
        .then((res) => {
          if (res.data.state) {
            this.$message.success(res.data.message)
          }
          this.objData = {}
          this.searchForm = {
            venderName: '',
            score: '',
          }
          this.saving = false
        })
    },
    //查看文件
    downloadFile(name, url) {
      console.log(name, 'name')
      const link = document.createElement('a')
      link.style.display = 'none'
      link.target = '_blank'
      // 设置下载地址
      link.setAttribute('href', url)
      // 设置文件名
      link.setAttribute('download', name)
      link.download = name
      document.body.appendChild(link)
      link.click()
      document.body.removeChild(link)
    },
    //获取数据
    loadData() {
      this.tableLoading = true
      let params = {
        querys: [],
        pageBean: {
          pageSize: -1,
          page: -1,
        },
      }
      params.querys.push({
        group: 'main',
        operation: 'EQUAL',
        property: 'noticeId',
        relation: 'AND',
        value: this.params.id,
      })
      this.$http
        .post('${portal}/projectApprovalDetails/v1/pageEvaDetail', params)
        .then((res) => {
          this.tableLoading = false
          const data = (res && res.data) || {}
          this.tableData = data.value.rows || []
        })
    },
    // 关闭//面包屑点击
    handleClose() {
      this.$router.push({
        name: 'evaluationReview',
        params: {
          tabsActiveName: 'projectView',
          pageBean: this.$route.query.pageBean,
        },
      })
    },
    //详情
    detailBtn(row) {
      let form = row
      form.quotationRounds = this.params.quotationRoundsNum
      this.$refs.troubleshooting.add(form)
    },
    // 表格行点击
    handleBtn(rows) {
      console.log(rows, '点击行数据')
      this.objData = {}
      this.form = rows
      this.searchForm.venderName = ''
      this.searchForm.score = ''
      this.getVender(rows.id)
      this.getCompany(rows)
      this.getScoreData()
      this.searchForm.name = rows.quotationCompanyName
      this.selectArr = []
      this.$refs.multiple.clearSelection()
      this.selectArr.push(rows)
      this.$refs.multiple.toggleRowSelection(rows)
    },
    selectAll(selection, row) {
      this.$refs.multiple.clearSelection()
      this.selectAll = []
    },
    handleSelectionChange(val) {
      this.selectArr = val
    },
    getScoreData() {
      let params = {
        noticeId: this.form.noticeId,
        orgId: this.objData.quotationCompanyId,
        noticeDetailId: this.objData.noticeDetailedId,
        noticeType: 1,
      }
      console.log(params, 'paramsparamsparams')
      this.loading = true
      this.$http
        .post('${portal}/bizEvaluationSystemDescription/v1/getEvaScore', params)
        .then((res) => {
          this.loading = false
          let sum = 0
          this.selectTree()
          this.scoreData = []
          if (res.data.state) {
            this.objScore = res.data.value
            res.data.value.descriptionList.forEach((item) => {
              if (item.score != undefined && item.score != 0) {
                sum += item.score
              }
            })
            let data = res.data.value.descriptionList || []
            this.treeData.forEach((val) => {
              data.forEach((i) => {
                if (i.evaluationItemPid == val.id) {
                  val.evaluationItemName = i.scoringContent
                  val.evaluationItemPid = val.evaluationItemPid
                  val.evaluationScore += i.evaluationScore
                  val.children.push(i)
                }
              })
              val.children.forEach((e) => {
                // if (e.evaluationItemPname) {
                //   delete e.evaluationItemPname
                // }
                if (e.score == undefined) {
                  this.$set(e, 'score', 0)
                }
              })
            })
            this.searchForm.score = sum
            this.scoreData = this.treeData || []
            this.scoreData.sort((a, b) => {
              if (a['evaluationItemPid'] != b['evaluationItemPid']) {
                return a['evaluationItemPid'].localeCompare(
                  b['evaluationItemPid']
                )
              }
            })
            this.$forceUpdate()
          }
        })
    },
    handleInput(row) {
      let sum = 0
      this.scoreData.forEach((item) => {
        item.score = 0
        item.children.forEach((e) => {
          item.score += e.score
        })
        sum += item.score
      })
      this.searchForm.score = sum
    },
    getRowKeys(row) {
      return row.id
    },
    saveAll() {
      this.$confirm('提交所有评标数据后不可修改评分，是否继续提交？', '提示', {
        confirmButtonText: '确 定',
        cancelButtonText: '取 消',
        type: 'warning',
      }).then(() => {
        this.loadingBtn = true
        let form = {
          noticeId: this.params.id,
          noticeType: 1,
          noticeDetailedId: this.form.id,
        }
        this.$http
          .post('${portal}/bidEvaluationRecord/v1/submitBidEvaluation', form)
          .then((res) => {
            if (res.data.state) {
              this.loadData()
              this.$message.success(res.data.message)
            }
            this.loadingBtn = false
          })
      })
    },
  },
  computed: {
    SearchPanel() {
      return {
        '--searchPanel': this.searchPanel + 'px',
      }
    },
  },
}
</script>

<style lang="scss" scoped>
.materialInformation {
  width: 100%;
  height: 100%;
  .content {
    display: flex;
    width: 100%;
    height: calc(100% - 60px);
    margin-top: 10px;
    .common-page-shadow {
      width: 50%;
      height: calc(100%);
      box-sizing: border-box;
      .common-table-container {
        margin: 0;
        height: calc(100% - 80px);
        .common-table-wrapper {
          height: 100%;
          .score-table {
            height: calc(100% - 88px);
            .table {
              height: calc(100% - 120px);
              overflow-y: scroll;
            }
          }
          .quote-content {
            height: 100%;
            position: relative;
            .content {
              height: calc(100% - 70px);
              overflow-y: scroll;
            }
            .btn {
              width: 100%;
              position: absolute;
              bottom: 16px;
              display: flex;
              justify-content: center;
            }
          }
        }
      }
      .footer {
        width: 100%;
        height: 70px;
        background-color: white;
        border-radius: 10px;
        margin-top: 10px;
        display: flex;
        justify-content: center;
        align-items: center;
      }
    }
    .left-tree {
      width: 50%;
      margin-right: 10px;
      padding: 10px;
      box-sizing: border-box;
      height: calc(100%);
      background-color: white;
      border-radius: 10px;
      box-shadow: 0 0.10417vw 0.625vw 0 rgba(0, 0, 0, 0.1);
      .common-table-content {
        height: 50%;
        margin-top: 0px;
        .top-table-content {
          height: 100%;
          /deep/.el-table__body-wrapper .is-scrolling-left {
            height: calc(100% - 50px) !important;
            overflow: scroll !important;
          }
        }
      }
      .left-bottom {
        height: 48%;
      }
    }
  }
}
/deep/.el-tabs__header {
  margin-bottom: 10px;
}
/deep/.el-table .cell {
  font-size: 14px;
}
.cloumn-btn {
  border: 1px solid #2761ff;
  padding: 3px 10px;
  border-radius: 5px;
  &:nth-child(1) {
    margin-right: 5px;
  }
  &:nth-child(2) {
    margin-right: 5px;
  }
  &:nth-child(1):hover {
    background-color: #2761ff;
    color: #fff;
  }
  &:nth-child(2):hover {
    background-color: #2761ff;
    color: #fff;
  }
  // &:nth-child(2):hover {
  //   background-color: #f56c6c;
  //   color: #fff;
  //   border-color: #f56c6c;
  // }
  /deep/ i,
  span {
    font-size: 16px;
  }
}
/deep/.el-tree-node.is-current > .el-tree-node__content {
  background-color: #ebf3fa;
  color: #409eff;
  font-weight: bold;
}

/deep/ .el-tree-node__content {
  padding: 5px 0;
}

/deep/ .el-table thead tr th {
  background-color: #eee !important;
  border-right: 1px solid #dfe2e8 !important;
}
/deep/ .el-table {
  border-collapse: collapse !important;
}
</style>
