<!--
  @description: 开标数据监控
  @Modifier: yangzy
  @routerPath: /bidding/bidOpening/bidOpeningMonitor/bidingOpeningMonitorDetail/bidingOpeningMonitor-detail
  @date: 2021/02/03 14:15:26
-->
<template>
  <div>
    <section class="title p0-16 clearfix">
      <template>
        <div class="title-back pointer" @click="back">
          <i class="iconfont icon-fanhui mr10" />开标数据查看
        </div>
      </template>
    </section>
    <section class="p0-16">
      <div class="mb10">
        <el-button type="primary" @click="bidDecryptData">
          标段开启/解密/完成情况列表
        </el-button>
        <!-- isTwoBidOpening为00 一步开标展示开启和解密数据 decryptionMethod为00 客户端解密 -->
        <template v-if="this.$route.params.isTwoBidOpening === '00'">
          <el-button type="primary" @click="bidNoThreeData">
            投标人数未达到3人的标段
          </el-button>
          <template v-if="this.$route.params.decryptionMethod === '00'">
            <el-button type="primary" @click="bidSignDecryptData">
              签到解密家数情况
            </el-button>
            <el-button type="primary" @click="bidNoSignSupplier">
              标段开启未签到供应商
            </el-button>
            <el-button type="primary" @click="bidNoDecryptSupplier">
              签到但未解密供应商
            </el-button>
          </template>
          <!-- isTwoBidOpening为00 一步开标展示开启和解密数据 decryptionMethod为01 集中解密 -->
          <template v-if="this.$route.params.decryptionMethod === '01'">
            <el-button type="primary" @click="bidSignDecryptData">
              解密家数情况
            </el-button>
          </template>
          <el-button type="primary" @click="getOpenBidDecryptFailSupplier">
            解密失败投标人信息
          </el-button>
        </template>
        <!-- isTwoBidOpening为01 两步开标展示商务技术和经济标开启和解密数据 -->
        <template v-if="this.$route.params.isTwoBidOpening === '01'">
          <el-button type="primary" @click="bidNoThreeData">
            商务技术标投标人数未达到3人的标段
          </el-button>
          <el-button type="primary" @click="StageOneDecStageTwoNoBidSupplierData">
            商务技术标已解密经济标未投标的供应商
          </el-button>
          <el-button type="primary" @click="getTechnicalOpeningDecFailSupplier">
            商务技术标解密失败投标人信息
          </el-button>
          <el-button type="primary" @click="getEconomicDecFailSupplier">
            经济标解密失败投标人信息
          </el-button>
          <template v-if="this.$route.params.decryptionMethod === '00'">
            <el-button type="primary" @click="bidSignDecryptData">
              签到解密家数情况
            </el-button>
            <el-button type="primary" @click="getTechnicalOpenedNoTechSignSupplier">
              商务技术标已开标但未签到的投标人
            </el-button>
            <el-button type="primary" @click="getEconomicOpenedNoSignSupplier">
              经济标已开标但未签到的投标人
            </el-button>
            <el-button type="primary" @click="getTechnicalSignedNoDecSupplier">
              商务技术标已签到但未解密的投标人
            </el-button>
            <el-button type="primary" @click="getEconomicSignedNoDecSupplier">
              经济标已签到但未解密的投标人
            </el-button>
          </template>
          <template v-if="this.$route.params.decryptionMethod === '01'">
            <el-button type="primary" @click="bidSignDecryptData">
              解密家数情况
            </el-button>
          </template>
        </template>
      </div>
    </section>
    <section class="p0-16">
      <tenderOpenNumDataDetail v-if="tableIsShow === '01'" ref="tenderOpenNumDataDetail" :tender-open-num="openMonitorCurrentData" />
      <bidDecryptDataDetail v-if="tableIsShow === '02'" ref="bidDecryptDataDetail" :bid-decrypt="openMonitorCurrentData" />
      <bidSignDecryptDataDetail v-if="tableIsShow === '03'" ref="bidSignDecryptDataDetail" :bid-sign-decrypt="openMonitorCurrentData" />
      <bidNoThreeDataDetail v-if="tableIsShow === '04'" ref="bidNoThreeDataDetail" :bid-no-three="openMonitorCurrentData" />
      <openBidNoSignDataDetail v-if="tableIsShow === '05'" ref="openBidNoSignDataDetail" :bid-sign-decrypt="openMonitorCurrentData" />
      <openBidNoDecryptDataDetail v-if="tableIsShow === '06'" ref="openBidNoDecryptDataDetail" :bid-sign-decrypt="openMonitorCurrentData" />
      <supplierDataDetail v-if="tableIsShow === '07'" ref="supplierDataDetail" :bid-sign-decrypt="openMonitorCurrentData" />
      <decFailSupplierDataDetail v-if="tableIsShow === '08'" ref="decFailSupplierDataDetail" :bid-sign-decrypt="openMonitorCurrentData" />
      <bidderDataDetail v-if="tableIsShow === '09'" ref="bidderDataDetail" :bid-sign-decrypt="openMonitorCurrentData" />
    </section>
  </div>
</template>
<script>
/* 接口*/
import { getStageIdsByTenderId } from '@/api/bidding/bidOpening' // 根据项目相关数据查询关联的stageIds
/* 组件 */
// import tenderOpenNumDataDetail from '../bidOpeningMonitorDetail/tenderOpenNumData-detail' // 项目启动数量情况列表
import bidDecryptDataDetail from '../bidOpeningMonitorDetail/bidDecryptData-detail'
import bidSignDecryptDataDetail from '../bidOpeningMonitorDetail/bidSignDecryptData-detail'
import bidNoThreeDataDetail from '../bidOpeningMonitorDetail/bidNoThreeData-detail'
import openBidNoSignDataDetail from '../bidOpeningMonitorDetail/openBidNoSignData-detail'
import openBidNoDecryptDataDetail from '../bidOpeningMonitorDetail/openBidNoDecryptData-detail'
import supplierDataDetail from '../bidOpeningMonitorDetail/supplierData-detail'
import decFailSupplierDataDetail from '../bidOpeningMonitorDetail/decFailSupplierData-detail'
import bidderDataDetail from '../bidOpeningMonitorDetail/bidderData-detail'
// 查看归档详情
export default {
  name: 'OpeningMonitorDetail',
  components: {
    // tenderOpenNumDataDetail, // 项目启动数量情况列表
    bidDecryptDataDetail, // 标段开启及启动解密及完成情况列表
    bidSignDecryptDataDetail, // 签到解密家数情况
    openBidNoSignDataDetail, // 标段开启未签到供应商
    openBidNoDecryptDataDetail, // 签到但未解密供应商
    supplierDataDetail, // 商务技术标已解密经济标未投标的供应商
    decFailSupplierDataDetail, // 商务技术标解密失败投标人信息\经济标解密失败投标人信息
    bidderDataDetail, // 商务技术标已开标但未签到的投标人\经济标已开标但未签到的投标人\商务技术标已签到但未解密的投标人\经济标已签到但未解密的投标人
    bidNoThreeDataDetail // 投标人数未达到3家的标段
  },
  data() {
    return {
      stageIdList: [], // 阶段id集合
      tableIsShow: '02', // 表格默认显示
      openMonitorCurrentData: {} // 向子页面传值
    }
  },
  created() {
    // 字典信息
    this.initStageIds()
  },
  methods: {
    // 获取stageId集合
    initStageIds() {
      const data = {
        tenderId: this.$route.params.tenderId, // 项目id
        openBidStartTime: this.$route.params.openBidStartTime, // 开标时间/技术标开标时间
        economicOpenBidStartTime: this.$route.params.economicOpenBidStartTime // 经济标开标时间
      }
      getStageIdsByTenderId(data).then(response => {
        this.stageIdList = response.data
        this.openMonitorCurrentData = {
          stageIds: this.stageIdList, // 开标的stageIds
          isTwoBidOpening: this.$route.params.isTwoBidOpening, // 是否两步开标
          decryptionMethod: this.$route.params.decryptionMethod // 00客户端解密 01集中解密
        }
        if (this.tableIsShow === '02') {
          this.bidDecryptData()
        }
      })
    },
    // 项目启动数量情况列表
    tenderOpenNumData() {
      this.tableIsShow = '01'
      this.$nextTick(() => {
        this.$refs.tenderOpenNumDataDetail.tenderOpenNumData()
      })
    },
    // 标段开启及启动解密及完成情况列表
    bidDecryptData() {
      this.tableIsShow = '02'
      this.$nextTick(() => {
        this.$refs.bidDecryptDataDetail.bidDecryptData()
      })
    },
    // 签到解密数情况
    bidSignDecryptData() {
      this.tableIsShow = '03'
      this.$nextTick(() => {
        this.$refs.bidSignDecryptDataDetail.bidSignDecryptData()
      })
    },
    // 投标人数未达到3人的标段
    bidNoThreeData() {
      this.tableIsShow = '04'
      const data = {
        tenderId: this.$route.params.tenderId, // 项目id
        openBidStartTime: this.$route.params.openBidStartTime, // 开标时间/技术标开标时间
        economicOpenBidStartTime: this.$route.params.economicOpenBidStartTime // 经济标开标时间
      }
      getStageIdsByTenderId(data).then(response => {
        this.stageIdList = response.data
        this.openMonitorCurrentData = {
          stageIds: this.stageIdList, // 开标的stageIds
          // stageIds: [], // 开标的stageIds
          isTwoBidOpening: this.$route.params.isTwoBidOpening, // 是否两步开标
          decryptionMethod: this.$route.params.decryptionMethod // 00客户端解密 01集中解密
        }
      })
      this.$nextTick(() => {
        this.$refs.bidNoThreeDataDetail.bidNoThreeData()
      })
    },
    // 一步开标-相应标段已开启，但未签到供应商
    bidNoSignSupplier() {
      this.tableIsShow = '05'
      this.$nextTick(() => {
        this.$refs.openBidNoSignDataDetail.getOpenBidNoSignData()
      })
    },
    // 一步开标-已签到，但未解密供应商
    bidNoDecryptSupplier() {
      this.tableIsShow = '06'
      this.$nextTick(() => {
        this.$refs.openBidNoDecryptDataDetail.getOpenBidNoDecryptData()
      })
    },
    // 商务技术标已解密经济标未投标的供应商
    StageOneDecStageTwoNoBidSupplierData() {
      this.tableIsShow = '07'
      this.$nextTick(() => {
        this.$refs.supplierDataDetail.getStageOneDecStageTwoNoBidSupplier()
      })
    },
    // 商务技术标解密失败投标人信息
    getTechnicalOpeningDecFailSupplier() {
      this.tableIsShow = '08'
      this.$nextTick(() => {
        this.$refs.decFailSupplierDataDetail.getTechnicalOpeningDecFailSupplier()
      })
    },
    // 经济标解密失败投标人信息
    getEconomicDecFailSupplier() {
      this.tableIsShow = '08'
      this.$nextTick(() => {
        this.$refs.decFailSupplierDataDetail.getEconomicDecFailSupplier()
      })
    },
    // 一步开标项目解密失败投标人信息
    getOpenBidDecryptFailSupplier() {
      this.tableIsShow = '08'
      this.$nextTick(() => {
        this.$refs.decFailSupplierDataDetail.getOpenBidDecryptFailSupplier()
      })
    },
    // 商务技术标已开标但未签到的投标人
    getTechnicalOpenedNoTechSignSupplier() {
      this.tableIsShow = '09'
      this.$nextTick(() => {
        this.$refs.bidderDataDetail.getTechnicalOpenedNoTechSignSupplier()
      })
    },
    // 经济标已开标但未签到的投标人
    getEconomicOpenedNoSignSupplier() {
      this.tableIsShow = '09'
      this.$nextTick(() => {
        this.$refs.bidderDataDetail.getEconomicOpenedNoSignSupplier()
      })
    },
    // 商务技术标已签到但未解密的投标人
    getTechnicalSignedNoDecSupplier() {
      this.tableIsShow = '09'
      this.$nextTick(() => {
        this.$refs.bidderDataDetail.getTechnicalSignedNoDecSupplier()
      })
    },
    // 经济标已签到但未解密的投标人
    getEconomicSignedNoDecSupplier() {
      this.tableIsShow = '09'
      this.$nextTick(() => {
        this.$refs.bidderDataDetail.getEconomicSignedNoDecSupplier()
      })
    },
    // 返回
    back() {
      this.$router.push({
        path: 'bidingOpeningMonitor-list'
      })
    }
  }
}
</script>
<style lang="less" scoped>
/deep/.el-button{
  margin-bottom: 10px;
}
</style>
