<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
            size="mini"
            ref="multipleSelection"
            :data="tableData"
            height="100%"
            @cell-click="handleBtn"
            highlight-current-row
            @selection-change="selectionChange"
          >
            <el-table-column
              type="selection"
              min-width="50px"
              align="center"
            ></el-table-column>
            <el-table-column
              min-width="100px"
              label="企业物料编号"
              align="center"
              prop="matCode"
              show-overflow-tooltip
            >
            </el-table-column>
            <el-table-column
              min-width="100px"
              label="平台物料编号"
              align="center"
              show-overflow-tooltip
              prop="matPlatcode"
            >
            </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="planCode"
              min-width="100px"
              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="matBaseExt"
              min-width="100px"
              label="基础扩展"
              align="center"
              show-overflow-tooltip
            >
            </el-table-column>
            <el-table-column
              prop="matOtherExt"
              min-width="100px"
              label="其他扩展"
              align="center"
              show-overflow-tooltip
            >
            </el-table-column>

            <el-table-column
              prop="matCompanyName"
              min-width="120px"
              label="需求单位"
              align="center"
              show-overflow-tooltip
            >
            </el-table-column>
            <el-table-column
              prop="demandDate"
              min-width="100px"
              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-column
              prop="tenderExplain"
              show-overflow-tooltip
              min-width="100px"
              align="center"
              label="投标补充说明"
              resizable
            >
            </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="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
                  stripe
                  fit
                  v-loading="loading"
                  ref="multipleTable"
                  :row-key="getRowKeys"
                  :data="scoreData"
                  @row-click="handledbClick"
                  @select="(selection, row) => handledbClick(row)"
                  @selection-change="handleSelectionChange"
                  @select-all="changeAll"
                  style="width: 100%"
                >
                  <el-table-column
                    type="selection"
                    min-width="50px"
                    :disabled="true"
                    align="center"
                  >
                  </el-table-column>
                  <el-table-column
                    min-width="120px"
                    key="first"
                    label="供应商编号"
                    align="center"
                    prop="quotationCompanyCode"
                    show-overflow-tooltip
                  >
                  </el-table-column>
                  <el-table-column
                    min-width="120px"
                    label="供应商名称"
                    align="center"
                    prop="quotationCompanyName"
                    show-overflow-tooltip
                  >
                  </el-table-column>
                  <el-table-column
                    header-align="center"
                    align="center"
                    v-for="(item, index) in tableHeadData"
                    :key="index"
                    :prop="item.prop"
                    :min-width="item.width"
                    :label="item.label"
                  >
                    <template slot-scope="scope">
                      <div v-if="item.prop != 'amount'">
                        {{ scope.row.quotationPrice }}
                      </div>
                      <div v-else>
                        {{
                          (scope.row.quotationPrice * scope.row.matNum).toFixed(
                            2
                          )
                        }}
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column
                    prop="isLowest"
                    min-width="100px"
                    label="是否最低价"
                    align="center"
                    show-overflow-tooltip
                  >
                    <template slot-scope="scope">
                      <div>
                        {{ scope.row.isLowest == 1 ? '是' : '否' }}
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column
                    prop="isEva"
                    min-width="100px"
                    label="是否评标"
                    align="center"
                    show-overflow-tooltip
                  >
                    <template slot-scope="scope">
                      <div>
                        {{ scope.row.isEva == 1 ? '是' : '否' }}
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column
                    prop="quotationRounds"
                    min-width="100px"
                    label="是否第二次报价"
                    align="center"
                    show-overflow-tooltip
                  >
                    <template slot-scope="scope">
                      <div>
                        {{ scope.row.quotationRounds == 1 ? '否' : '是' }}
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column
                      prop="tenderExplain"
                      show-overflow-tooltip
                      min-width="100px"
                      align="center"
                      label="投标补充说明"
                      resizable
                    >
                    </el-table-column>
                  <el-table-column
                    prop="evaExplain"
                    show-overflow-tooltip
                    min-width="120px"
                    align="center"
                    label="评标说明"
                  >
                  </el-table-column>
                  <el-table-column
                    prop="evaExplainAccessory"
                    min-width="120px"
                    label="附件"
                    align="center"
                    show-overflow-tooltip
                  >
                    <template slot-scope="scope">
                      <a
                        v-if="
                          scope.row.evaExplainAccessory &&
                          scope.row.evaExplainAccessory.length != 0
                        "
                        :href="scope.row.evaExplainAccessory[0].url"
                        target="_blank"
                        >{{ scope.row.evaExplainAccessory[0].name }}</a
                      >
                    </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" border stripe :data="fileList">
                  <el-table-column
                    prop="name"
                    min-width="200px"
                    key="five"
                    label="文件名称"
                  ></el-table-column>
                  <el-table-column min-width="100px" key="five" 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 === '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" 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>
            </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 == 1"
                  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"
                    key="addendum"
                    label="描述"
                    show-overflow-tooltip
                  ></el-table-column>
                  <el-table-column
                    prop="name"
                    key="addendum"
                    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" />
    <!-- 选择最低价弹窗 -->
    <el-dialog
      title="评标"
      :visible.sync="dialogVisible"
      width="60%"
      :before-close="dialogBeforeClose"
    >
      <el-form :model="parameter">
        <el-form-item
          :rules="{required: true, message: '请输入原因说明', trigger: 'blur'}"
          label="原因说明"
          label-width="90px"
        >
          <el-input v-model="parameter.evaExplain" type="textarea"></el-input>
        </el-form-item>
        <el-form-item label="附件上传" label-width="90px">
          <el-upload
            class="upload-demo"
            ref="upload"
            :headers="headers"
            :action="action"
            :file-list="parameter.accessoryList"
            :multiple="false"
            style="text-align: left"
            accept=".png,.jpg,.jpeg,.xlsx,.xls,.pdf,.docx,.doc,.zip,.rar"
            :show-file-list="false"
            :before-upload="beforeUpload"
            :on-success="handleSuccess"
          >
            <el-button slot="trigger" size="small" type="primary"
              >上传文件</el-button
            >
          </el-upload>
        </el-form-item>
      </el-form>
      <el-table
        class="down"
        :data="parameter.accessoryList"
        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>
            <el-button
              size="small"
              type="text"
              @click="deleteHandle(scope.$index)"
              >删除</el-button
            >
          </template>
        </el-table-column>
      </el-table>
      <div slot="footer">
        <el-button @click="dialogBeforeClose">取 消</el-button>
        <el-button type="primary" :loading="saving" @click="saveOrg"
          >确 定</el-button
        >
      </div>
    </el-dialog>
  </div>
</template>

<script>
import procurementUnits from './procurementUnits.vue'
import {mapState} from 'vuex'
import Breadcrumb from '@/components/Breadcrumb/index.vue'
import pagination from '@/components/pagination'
import {TableMixin} from '@/mixins/tableMixin'

export default {
  name: 'evaluationManagement',
  components: {
    pagination,
    Breadcrumb,
    procurementUnits,
  },
  mixins: [TableMixin],
  data() {
    return {
      breadcrumbOpt: [
        {breadcrumbName: '物资采购'},
        {breadcrumbName: '最低评标法'},
      ],
      loading: false,
      tableLoading: false,
      parameter: {
        accessoryList: [],
        evaExplain: '',
      },
      activeName: 'first',
      dataList: [],
      dialogVisible: false,
      params: {},
      saving: false,
      tableData: [],
      multipleSelection: [],
      form: {},
      objData: {},
      selectArr: [],
      fileList: [], //招标文件
      supplementList: [], //补遗文件
      scoreData: [],
      tableHeadData: [], // 自定义报价表头
      currentUser: {},
      tenderList: [], //投标文件
      clarifyList: [],
    }
  },
  mounted() {},
  created() {
    this.tableHeadData = [
      {label: '报价金额', width: 100, prop: 'quoArrange'},
      {label: '合计金额', width: 100, prop: 'amount'},
    ]
    this.params = this.$route.params
    this.loadData()
    this.getZbfile()
    this.currentUser = JSON.parse(sessionStorage.getItem('currentUserDetail'))
  },
  methods: {
    // 切换tab选项
    handleClick() {
      if (this.activeName == 'five') {
        this.getZbfile()
      }
      if (this.activeName == 'second') {
        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.ids,
          },
          {
            group: 'main',
            operation: 'EQUAL',
            parentGroup: '',
            property: 'projectApprovalType',
            relation: 'AND',
            value: 1,
          }
          // {
          //   group: 'main',
          //   operation: 'EQUAL',
          //   parentGroup: '',
          //   property: 'supplierId',
          //   relation: 'AND',
          //   value: this.currentUser.org[0].orgId,
          // }
        )
        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.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.ids,
        })
        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.ids,
          },
          {
            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)
                  }
                })
              }
            })
          })
      }
    },
    // 获取招标文件
    getZbfile() {
      let parmas = {
        pageBean: {
          pageSize: -1,
          page: -1,
        },
        querys: [],
      }
      parmas.querys.push(
        {
          group: 'main',
          operation: 'EQUAL',
          parentGroup: '',
          property: 'projectApprovalId',
          relation: 'AND',
          value: this.$route.params.ids,
        },
        {
          group: 'main',
          operation: 'EQUAL',
          parentGroup: '',
          property: 'type',
          relation: 'AND',
          value: 1,
        }
      )
      this.dataing = true
      this.$http
        .post('${portal}/tenderDocument/v1/pageAccessory', parmas)
        .then((res) => {
          this.dataing = false
          this.fileList = []
          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.fileList.push(val)
                  this.$forceUpdate()
                }
              })
            }
          })
        })
    },
    saveOrg() {
      this.saving = true
      let form = {
        quotationList: [],
        noticeDetailedId: '',
        noticeType: 1,
        noticeId: '',
      }
      this.selectList.forEach((item) => {
        item.evaExplain = this.parameter.evaExplain
        item.evaExplainAccessory = this.parameter.accessoryList
        form.quotationList.push(item)
      })
      form.noticeDetailedId = this.form.id
      form.noticeId = this.params.ids
      this.$http
        .post('${portal}/bidEvaluation/v1/choiceBidEvaLowest', form)
        .then((res) => {
          this.saving = false
          if (res.data.state) {
            this.$message.success(res.data.message)
            this.getSupplier(this.form)
            this.dialogBeforeClose()
          }

          this.loadData()
        })
    },
    //查看文件
    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() {
      let params = {
        pageBean: {
          page: -1,
          pageSize: -1,
        },
        querys: [
          {
            group: 'main',
            operation: 'EQUAL',
            parentGroup: '',
            property: 'detail.NOTICE_ID_',
            relation: 'AND',
            value: this.params.ids,
          },
        ],
      }
      this.tableLoading = true
      this.$http
        .post('${portal}/matApproval/v1/getDataById?id=' + this.params.ids)
        .then((res) => {
          this.tableLoading = false
          const data = (res && res.data) || {}
          this.tableData = data.value.detailsList || []
        })
    },
    getSupplier(row) {
      let params = {
        pageBean: {
          page: -1,
          pageSize: -1,
        },
        querys: [],
        sorter: [
          {
            direction: 'DESC',
            property: 'create_time_',
          },
        ],
      }
      params.querys.push(
        {
          group: 'main',
          operation: 'EQUAL',
          parentGroup: '',
          property: 'noticeId',
          relation: 'AND',
          value: this.params.ids,
        },
        {
          group: 'main',
          operation: 'EQUAL',
          parentGroup: '',
          property: 'noticeType',
          relation: 'AND',
          value: 1,
        },
        {
          group: 'main',
          operation: 'EQUAL',
          parentGroup: '',
          property: 'quotationRounds',
          relation: 'AND',
          value: this.$route.query.rows.quotationRoundsNum,
        },
        {
          group: 'main',
          operation: 'EQUAL',
          parentGroup: '',
          property: 'noticeDetailedId',
          relation: 'AND',
          value: row.id,
        },
        {
          group: 'main',
          operation: 'GREAT',
          parentGroup: '',
          property: 'quotationPrice',
          relation: 'AND',
          value: 0,
        }
      )
      this.loading = true
      this.$http
        .post('${portal}/bizBiddingQuotation/v1/pageLowestEva', params)
        .then((res) => {
          this.loading = false
          if (res.data.state) {
            let data = res.data.value.rows
            this.scoreData = res.data.value.rows
            this.$nextTick(() => {
              this.scoreData.forEach((item) => {
                if (item.isEva == 1) {
                  this.$refs.multipleTable.toggleRowSelection(item, true)
                }
              })
            })
            this.scoreData.forEach((item, index) => {
              if (item.quotationTemplateDetailDataList.length != 0) {
                item.quoArrange = item.quotationTemplateDetailDataList[0].value
                item.quotationTemplateDetailDataList.forEach((object) => {
                  let arr = []
                  arr = Object.keys(item.quotationTemplateDetailDataList[0])
                  this.tableHeadData.forEach((val) => {
                    arr.forEach((e) => {
                      if (e == val.prop && object.quoArrange != '') {
                        val.label =
                          item.quotationTemplateDetailDataList[0].quoArrange
                      }
                    })
                  })
                })
              }

              if (item.quotationPrice == 0) {
                this.scoreData.splice(index, 1)
              }
            })
          }
          this.loading = false
        })
    },
    // 关闭//面包屑点击
    handleClose() {
      this.$router.push({
        name: 'evaluationReview',
        params: {
          tabsActiveName: 'materialInspection',
          pageBean: this.$route.query.pageBean,
        },
      })
    },
    dialogBeforeClose() {
      this.dialogVisible = false
    },
    handleSelectionChange(value) {
      this.selectList = value
      this.multipleSelection = value.map((item) => {
        return item.id
      })
    },
    selectionChange(val) {
      this.selectArr = val
      if (this.selectArr.length > 1) {
        this.$refs.multipleSelection.toggleRowSelection(
          this.selectArr[0],
          false
        )
      }
      this.getSupplier(this.selectArr[0])
    },
    // 表格行点击
    handleBtn(rows) {
      this.form = rows
      this.selectArr = []
      this.selectArr.push(rows)
      this.$refs.multipleSelection.toggleRowSelection(rows, true)
      this.getSupplier(rows)
    },
    getRowKeys(row) {
      return row.id
    },
    // 表格行点击
    handledbClick(rows) {
      this.selectList = []
      this.objData = rows
      this.$refs.multipleTable.clearSelection()
      this.selectList.push(rows)
      this.$refs.multipleTable.toggleRowSelection(rows)
    },
    changeAll(selection, row) {
      this.$refs.multipleTable.clearSelection()
      this.selectList = []
    },
    // 文件状态改变时的钩子，添加文件、上传成功和上传失败时都会被调用,function(file, fileList)
    handleSuccess(res, file, fileList) {
      console.log(res, fileList)
      this.parameter.accessoryList.push(res.value)
    },
    beforeUpload(file) {
      let acceptList = ['xlsx', 'xls','png','jpg','jpeg','xlsx','xls','pdf','docx','doc','zip','rar']
      // 根据文件名获取文件的后缀名
      let fileType = file.name.split('.').pop().toLowerCase()
      // 判断文件格式是否符合要求
      if (acceptList.indexOf(fileType) === -1) {
        this.$message.error('请上传 .png,.jpg,.jpeg,.xlsx,.xls,pdf,.docx,.doc,.zip,.rar 格式的文件 !')
        return false
      }
    },
    //下载按钮回调
    downloadFile(name, url) {
      console.log(name, 'name')
      var a = document.createElement('a')
      var event = new MouseEvent('click')
      a.download = name
      a.target = '_blank'
      a.href = url
      a.dispatchEvent(event)
    },
    // 删除
    deleteHandle(id, index) {
      this.$confirm('是否确认删除该附件', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      }).then(() => {
        if (id) {
          this.$http
            .post('${portal}/biz/universal/v1/delete?ids=' + id)
            .then((res) => {
              if (res.data.state) {
                this.$message.success('删除成功')
              }
            })
        } else {
          this.parameter.accessoryList.splice(index, 1)
        }
        this.$forceUpdate()
      })
    },
  },
  computed: {
    SearchPanel() {
      return {
        '--searchPanel': this.searchPanel + 'px',
      }
    },
    ...mapState({
      headers: (state) => {
        return {Authorization: `Bearer ${state.login.currentUser.token}`}
      },
      action: function () {
        return window.context.portal + '/biz/universal/v1/minioUpload'
      },
    }),
  },
}
</script>

<style lang="scss" scoped>
.materialInformation {
  width: 100%;
  height: 100%;
  .content {
    display: flex;
    width: 100%;
    height: calc(100% - 65px);
    margin-top: 10px;
    .common-page-shadow {
      width: 60%;
      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% - 70px);
              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: 40%;
      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);
    }
  }
}
/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>
