<template>
  <div class="materialInformation">
    <div class="crumbs">
      <Breadcrumb
        :breadcrumbOpt="breadcrumbOpt"
        svg-name="#icon-audit"
        @breadcrumb-click="handleClose"
      />
    </div>
    <div class="content">
      <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="six"></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="table">
                <el-table
                  border
                  stripe
                  key="first"
                  fit
                  v-loading="tableLoading"
                  :data="tableData"
                  style="width: 100%"
                >
                  <el-table-column
                    type="index"
                    width="55"
                    align="center"
                    label="序号"
                  >
                  </el-table-column>
                  <el-table-column
                    align="center"
                    prop="noticeCode"
                    min-width="100"
                    show-overflow-tooltip
                    label="项目编号"
                  ></el-table-column>
                  <el-table-column
                    align="center"
                    prop="noticeName"
                    min-width="100"
                    show-overflow-tooltip
                    label="项目名称"
                  ></el-table-column>
                  <el-table-column
                    align="center"
                    prop="noticeType"
                    show-overflow-tooltip
                    min-width="100"
                    label="项目类型"
                  >
                    <template slot-scope="scope">
                      <span v-if="scope.row.noticeType == 1">物资</span>
                      <span v-if="scope.row.noticeType == 2">项目</span>
                    </template>
                  </el-table-column>
                  <el-table-column
                    align="center"
                    prop="procureOrgCode"
                    show-overflow-tooltip
                    min-width="100"
                    label="需求企业编号"
                  >
                  </el-table-column
                  ><el-table-column
                    align="center"
                    prop="procureOrgName"
                    show-overflow-tooltip
                    min-width="120"
                    label="需求企业名称"
                  >
                  </el-table-column>
                  <el-table-column
                    align="center"
                    prop="operateTime"
                    show-overflow-tooltip
                    min-width="120"
                    label="评标日期"
                  ></el-table-column>
                  <el-table-column
                    align="center"
                    prop="quotationOrgCode"
                    min-width="100"
                    show-overflow-tooltip
                    label="中标供应商编号"
                  ></el-table-column>
                  <el-table-column
                    align="center"
                    prop="quotationOrgName"
                    show-overflow-tooltip
                    min-width="100"
                    label="中标供应商名称"
                  ></el-table-column>
                  <el-table-column
                    align="center"
                    prop="score"
                    min-width="100"
                    show-overflow-tooltip
                    label="得分汇总"
                  ></el-table-column>
                  <el-table-column
                    align="center"
                    prop="quotationMethod"
                    show-overflow-tooltip
                    min-width="100"
                    label="付款方式"
                  >
                    <template v-slot="{row}">
                      {{ getDictName('cglx-fkfs', row.quotationMethod) }}
                    </template>
                  </el-table-column>
                  <el-table-column
                    align="center"
                    prop="isTax"
                    show-overflow-tooltip
                    min-width="100"
                    label="是否含税"
                  >
                    <template v-slot="{row}">
                      {{ getDictName('cgsq-bjfs', row.isTax) }}
                    </template>
                  </el-table-column>
                  <el-table-column
                    align="center"
                    prop="quotationAmount"
                    min-width="100"
                    show-overflow-tooltip
                    label="中标金额(元)"
                  ></el-table-column>
                  <el-table-column
                    align="center"
                    min-width="100"
                    fixed="right"
                    show-overflow-tooltip
                    label="操作"
                  >
                    <template slot-scope="scope">
                      <el-button
                        size="small"
                        type="primary"
                        @click="handleDetais(scope.row)"
                        >查看明细</el-button
                      >
                    </template>
                  </el-table-column>
                </el-table>
              </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"
                  v-loading="tableLoading"
                  :data="bidFileList"
                  border
                  stripe
                >
                  <el-table-column
                    prop="createOrgName"
                    key="second"
                    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 === '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"
                  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>
            </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"
                  v-loading="tableLoading"
                  :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>
            </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"
                  v-loading="tableLoading"
                  :data="TenderList"
                  border
                  stripe
                >
                  <el-table-column
                    prop="name"
                    key="five"
                    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 === 'six'">
              <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"
                  v-loading="tableLoading"
                  :data="scoreData"
                  height="100%"
                  :key="activeName == 'six'"
                  :tree-props="{
                    children: 'children',
                    hasChildren: 'hasChildren',
                  }"
                  border
                >
                  <el-table-column
                    :prop="item.prop"
                    :label="item.label"
                    :min-width="item.width"
                    show-overflow-tooltip
                    v-for="(item, index) in scoreColumn"
                    :key="index"
                  ></el-table-column>
                  <el-table-column
                    prop="score"
                    label="总得分"
                    min-width="70"
                  ></el-table-column>
                  <el-table-column prop="score" label="操作" min-width="100">
                    <template slot-scope="scope">
                      <div>
                        <el-button
                          size="small"
                          @click="clickView(scope.row)"
                          type="primary"
                          >查看评分详情</el-button
                        >
                      </div>
                    </template>
                  </el-table-column>
                </el-table>
              </div>
            </div>
          </el-col>
        </el-row>
      </div>
    </div>
    <!-- 明细详情 -->
    <el-dialog
      :close-on-click-modal="false"
      title="明细详情"
      :visible.sync="visible"
      width="80%"
      :close-on-press-escape="false"
      :before-close="close"
    >
      <template>
        <el-table
          ref="multipleSelection"
          v-loading="loading"
          border
          :data="detailsList"
          :style="{width: '100%'}"
          :max-height="tableMaxHeight"
          :cell-style="{'text-align': 'center'}"
          :header-cell-style="{'text-align': 'center'}"
        >
          <el-table-column
            prop="matCode"
            min-width="100px"
            label="企业物料编号"
            show-overflow-tooltip
            align="center"
            resizable
          >
          </el-table-column>
          <el-table-column
            prop="matPlatcode"
            min-width="100px"
            label="平台物料编号"
            show-overflow-tooltip
            align="center"
            resizable
          >
          </el-table-column>
          <el-table-column
            prop="matName"
            min-width="100px"
            label="物料名称"
            show-overflow-tooltip
            align="center"
            resizable
          >
          </el-table-column>
          <el-table-column
            prop="matMaterial"
            min-width="100px"
            label="物料牌号"
            show-overflow-tooltip
            align="center"
            resizable
          >
          </el-table-column>
          <el-table-column
            prop="matSpec"
            min-width="100px"
            label="规格型号"
            show-overflow-tooltip
            align="center"
            resizable
          >
          </el-table-column>
          <el-table-column
            prop="matNum"
            show-overflow-tooltip
            min-width="90px"
            align="center"
            label="数量"
            resizable
          >
          </el-table-column>
          <el-table-column
            prop="matUnit"
            show-overflow-tooltip
            min-width="90px"
            align="center"
            label="计量单位"
            resizable
          >
          </el-table-column>
          <el-table-column
            align="center"
            prop="planCode"
            show-overflow-tooltip
            min-width="120"
            label="计划编号"
          ></el-table-column>
          <el-table-column
            align="center"
            prop="matBrand"
            show-overflow-tooltip
            min-width="100"
            label="品牌"
          ></el-table-column>
          <el-table-column
            align="center"
            prop="matBaseExt"
            min-width="100"
            show-overflow-tooltip
            label="基础扩展"
          ></el-table-column>
          <el-table-column
            align="center"
            prop="matOtherExt"
            show-overflow-tooltip
            min-width="100"
            label="其他扩展"
          ></el-table-column>
          <el-table-column
            prop="quotationRounds"
            show-overflow-tooltip
            min-width="90px"
            align="center"
            label="报价轮次"
            resizable
          >
          </el-table-column>
          <el-table-column
            align="center"
            prop="quotationMethod"
            show-overflow-tooltip
            min-width="100"
            label="付款方式"
          >
            <template v-slot="{row}">
              {{ getDictName('cglx-fkfs', row.quotationMethod) }}
            </template>
          </el-table-column>
          <el-table-column
            align="center"
            prop="isTax"
            show-overflow-tooltip
            min-width="100"
            label="是否含税"
          >
            <template v-slot="{row}">
              {{ getDictName('cgsq-bjfs', row.isTax) }}
            </template>
          </el-table-column>
          <el-table-column
            prop="quotationPrice"
            show-overflow-tooltip
            min-width="100"
            align="center"
            label="报价单价(元)"
            resizable
          >
          </el-table-column>
          <el-table-column
            prop="quotationAmount"
            show-overflow-tooltip
            min-width="100"
            align="center"
            label="报价金额(元)"
            resizable
          >
            <template slot-scope="scope">
              <div>
                {{ (scope.row.quotationPrice * scope.row.matNum).toFixed(2) }}
              </div>
            </template>
          </el-table-column>
        </el-table>
        <div class="common-pagenation">
          <el-pagination
            ref="paginationPanel"
            background
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page="queryParam.pageBean.page"
            :page-sizes="[20, 30, 40, 50]"
            :page-size="queryParam.pageBean.pageSize"
            layout="total, sizes, prev, pager, next, jumper"
            :total="queryParam.pageBean.total"
          >
          </el-pagination>
        </div>
      </template>
      <span slot="footer" class="dialog-footer">
        <el-button @click="close">取 消</el-button>
      </span>
    </el-dialog>
    <el-dialog
      title="评分详情"
      :visible.sync="dialogVisible"
      width="70%"
      top="6vh"
      :before-close="dialogBeforeClose"
    >
      <el-table
        row-key="id"
        ref="multipleSelection"
        default-expand-all
        :data="scoreChildren"
        :summary-method="getSummaries"
        show-summary
        v-loading="loading"
        border
        :tree-props="{
          children: 'children',
          hasChildren: 'hasChildren',
        }"
        style="width: 100%"
      >
        <el-table-column
          prop="evaluationItemPname"
          min-width="100px"
          label="评分大项"
          class-name="el-table-lable-box"
          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="130px"
          align="center"
          prop="evaluationItemCode"
        >
          <template slot-scope="scope">
            <div>
              {{ scope.row.evaluationItemCode }}
            </div>
          </template>
        </el-table-column>
        <el-table-column
          label="评分标准"
          min-width="130px"
          align="center"
          prop="evaluationStandard"
        >
          <template slot-scope="scope">
            <div>
              {{ scope.row.evaluationStandard }}
            </div>
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          label="分值"
          min-width="100px"
          prop="evaluationScore"
        >
        </el-table-column>
        <el-table-column
          align="center"
          label="得分"
          min-width="100px"
          prop="score"
        >
        </el-table-column>
      </el-table>
      <div slot="footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>
  
  <script>
import {getMergeCells} from '@/utils/mergingTable.js'
import Breadcrumb from '@/components/Breadcrumb/index.vue'
import pagination from '@/components/pagination'
import {TableMixin} from '@/mixins/tableMixin'
import basicData from '@/api/basicData'
export default {
  name: 'evaluationManagement',
  components: {
    pagination,
    Breadcrumb,
  },
  mixins: [TableMixin],
  data() {
    return {
      breadcrumbOpt: [
        {breadcrumbName: '定标管理'},
        {breadcrumbName: '定标详情'},
      ],
      loading: false,
      tableLoading: false,
      activeName: 'first',
      form: {},
      dialogVisible: false,
      scoreData: [],
      scoreChildren: [],
      queryParam: {
        pageBean: {
          page: 1,
          pageSize: 20,
          total: 0,
        },
        querys: [],
      },
      bidFileList: [], //投标文件
      TenderList: [], //招标文件
      supplementList: [], //补遗文件
      clarifyList: [],
      detailsList: [],
      searchForm: {manner: 1, name: '招标采购'}, // 顶部搜索对象
      tableData: [],
      scoreColumn: [
        {prop: 'operateUserName', label: '评分人', width: 50},
        {prop: 'operateTime', label: '评分时间', width: 100},
        {prop: 'quotationOrgName', label: '供应商名称', width: 100},
      ],
      visible: false,
      form: {},
      treeData: [],
    }
  },
  mounted() {
    // this.$refs.multipleSelection.setCurrentRow(this.tableData[0])
  },
  created() {
    this.form = this.$route.query.rows
    this.gettableData()
  },
  methods: {
    // tab栏切换
    handleClick() {
      if (this.activeName == 'first') {
        this.gettableData()
      }
      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.$route.params.id,
          },
          {
            group: 'main',
            operation: 'EQUAL',
            parentGroup: '',
            property: 'projectApprovalType',
            relation: 'AND',
            value: 1,
          }
        )
        this.tableLoading = true
        this.$http
          .post('${portal}/bidDocuments/v1/page', parmas)
          .then((res) => {
            this.tableLoading = false
            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.$route.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.$route.params.id,
          },
          {
            group: 'main',
            operation: 'EQUAL',
            parentGroup: '',
            property: 'releaseStatus',
            relation: 'AND',
            value: 2,
          },
          {
            group: 'main',
            operation: 'EQUAL',
            parentGroup: '',
            property: 'type',
            relation: 'AND',
            value: 2,
          }
        )
        this.tableLoading = true
        this.$http
          .post('${portal}/tenderDocument/v1/pageAccessory', parmas)
          .then((res) => {
            this.tableLoading = false
            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.$route.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.tableLoading = true
        this.$http
          .post('${portal}/tenderDocument/v1/pageAccessory', parmas)
          .then((res) => {
            this.tableLoading = false
            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.activeName == 'six') {
        this.scoreData = []
        let parmas = {
          pageBean: {
            pageSize: -1,
            page: -1,
          },
          querys: [],
        }
        parmas.querys.push(
          {
            group: 'main',
            operation: 'EQUAL',
            parentGroup: '',
            property: 'noticeId',
            relation: 'AND',
            value: this.$route.params.id,
          },
          {
            group: 'main',
            operation: 'EQUAL',
            parentGroup: '',
            property: 'status',
            relation: 'AND',
            value: 2,
          }
        )
        this.tableLoading = true
        this.$http
          .post('${portal}/bidEvaluationRecord/v1/pageAndDetail', parmas)
          .then((res) => {
            this.tableLoading = false
            if (res.data.state) {
              this.scoreData = res.data.value.rows
              this.scoreData.forEach((item) => {
                item.children = []
                item.evaluationDetailList.forEach((val) => {
                  item.children.push(val)
                })
              })
            }
          })
      }
    },
    clickView(row) {
      this.loading = true
      basicData.bizEvaluationItemSelectTree().then((res) => {
        this.loading = false
        this.treeData = []
        this.scoreChildren = []
        this.treeData = res.value[0].children
        this.treeData.forEach((item) => {
          item.score = 0
          item.evaluationScore = 0
          row.evaluationDetailList.forEach((val) => {
            if (item.id == val.evaluationItemPid) {
              item.evaluationItemPname = item.subjectName
              item.children.push(val)
              item.score += val.score
              item.evaluationScore += val.evaluationScore
            }
          })
        })
        this.scoreChildren = this.treeData
        this.dialogVisible = true
      })
    },
    // 表数据合并
    objectSpanMethod({row, column, rowIndex, columnIndex}) {
      return this.spanArr[rowIndex][columnIndex]
    },
    //查看文件
    downloadFile(name, url) {
      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)
    },
    //获取数据
    gettableData() {
      this.tableLoading = true
      this.$http
        .post(
          '${portal}/bidEvaluation/v1/getCalibraDetailMaxScoreById?noticeId=' +
            this.$route.params.id
        )
        .then((res) => {
          this.tableLoading = false
          if (res.data.state) {
            this.tableData = res.data.value
            this.tableData.forEach((item) => {
              this.$set(item, 'quotationMethod', this.form.quotationMethod)
              this.$set(item, 'isTax', this.form.isTax)
            })
          }
        })
    },
    // 关闭//面包屑点击
    handleClose() {
      this.$router.push({
        name: 'calibration',
        params: {
          tabsActiveName: 'materialProcurement',
        },
      })
    },
    getSummaries(param) {
      const {columns, data} = param
      const sums = []
      columns.forEach((column, index) => {
        if (index === 0) {
          sums[index] = '合计'
          return
        }
        const values = data.map((item) => Number(item[column.property]))
        if (!values.every((value) => isNaN(value))) {
          sums[index] = values.reduce((prev, curr) => {
            const value = Number(curr)
            if (!isNaN(value)) {
              return prev + curr
            } else {
              return prev
            }
          }, 0)
          sums[index] += ''
        } else {
          sums[index] = ''
        }
      })
      return sums
    },
    dialogBeforeClose() {
      this.dialogVisible = false
    },
    handleDetais(row) {
      this.form = row
      this.queryParam.querys = []
      this.queryParam.querys.push(
        {
          group: 'main',
          operation: 'EQUAL',
          parentGroup: '',
          property: 'quo.QUOTATION_COMPANY_ID_',
          relation: 'AND',
          value: row.quotationOrgId,
        },
        {
          group: 'main',
          operation: 'EQUAL',
          parentGroup: '',
          property: 'quo.NOTICE_ID_',
          relation: 'AND',
          value: row.noticeId,
        }
      )
      this.$http
        .post('${portal}/bizBiddingQuotation/v1/pageMatDetail', this.queryParam)
        .then((res) => {
          this.detailsList = res.data.value.rows
          this.queryParam.pageBean.page = res.data.value.page
          this.queryParam.pageBean.pageSize = res.data.value.pageSize
          this.queryParam.pageBean.total = res.data.value.total
          this.visible = true
        })
    },
    close() {
      this.visible = false
    },
    handleCurrentChange(page) {
      this.queryParam.pageBean = {...this.queryParam.pageBean, page}
      this.handleDetais(this.form)
    },
    handleSizeChange(pageSize) {
      this.queryParam.pageBean = {...this.queryParam.pageBean, pageSize}
      this.handleDetais(this.form)
    },
  },
  computed: {
    SearchPanel() {
      return {
        '--searchPanel': this.searchPanel + 'px',
      }
    },
    // 获取所有单元格合并数据
    spanArr() {
      if (!this.scoreColumn.length) return []
      const mergeCols = ['operateUserName'] // 需要合并的列（字段）
      return getMergeCells(this.scoreData, this.scoreColumn, mergeCols)
    },
  },
}
</script>
  
  <style lang="scss" scoped>
.materialInformation {
  width: 100%;
  height: 100%;
  .content {
    width: 100%;
    height: calc(100% - 70px);
    margin-top: 10px;
    .common-page-shadow {
      width: 100%;
      height: calc(100%);
      box-sizing: border-box;
      .common-table-container {
        margin: 0;
        height: calc(100% - 80px);
        .common-table-wrapper {
          height: 100%;
          .score-table {
            height: 100%;
            .table {
              height: calc(100% - 50px);
            }
          }
          .quote-content {
            height: 100%;
            position: relative;
            .content {
              height: calc(100% - 70px);
            }
            .btn {
              width: 100%;
              position: absolute;
              bottom: 16px;
              display: flex;
              justify-content: center;
            }
          }
        }
      }
    }
  }
}
/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-lable-box .cell {
  display: flex;
  justify-content: center;
}
/deep/ .el-table thead tr th {
  background-color: #eee !important;
  border-right: 1px solid #dfe2e8 !important;
}
/deep/ .el-table {
  border-collapse: collapse !important;
}
</style>
  