<template>
  <div class="bidding-management-view">
    <div v-if="advanceViewList.length" class="view-steps-box">
      <cy-steps :steps-data="advanceViewList"></cy-steps>
    </div>
    <div v-loading="loading">
      <el-collapse v-if="advanceViewList.length" v-model="activeNames" @change="handleChange">
        <el-collapse-item v-for="(item, index) in advanceViewList" :id="index" :key="index" :name="index">
          <template slot="title">
            <cy-view-bar
              :view-bar-data="{ ...item.businessProcessingLogVo, formBusinessName: item.formBusinessName, index: index + 1 }"
            >
            </cy-view-bar>
          </template>
          <create-bidding v-if="item.formBusinessName === '业务创建'" :deatails-info="item.obj" :disabled="true"></create-bidding>
          <template-Review-content v-if="item.formBusinessName === '模板审核'" :deatails-info="item.obj" :disabled="true"></template-Review-content>
          <guarantee-confirm-content v-if="item.formBusinessName === '保证方式确认'" :deatails-info="item.obj" :disabled="true"></guarantee-confirm-content>
          <margin-collection-confirm-content v-if="item.formBusinessName === '保证金收款确认'" :deatails-info="item.obj" :disabled="true"></margin-collection-confirm-content>
          <successful-bidder-confirm-content v-if="item.formBusinessName === '中标确认'" :deatails-info="item.obj" :disabled="true"></successful-bidder-confirm-content>
          <margin-refund-confirm-content v-if="item.formBusinessName === '保证金退款确认'" :deatails-info="item.obj" :disabled="true"></margin-refund-confirm-content>
        </el-collapse-item>
      </el-collapse>
      <!-- <el-empty v-else style="height: calc(100vh - 0.85rem - 90px)"></el-empty> -->
    </div>
  </div>
</template>

<script>
import { doBusinessHistoryView } from '@/api/dictionary'
import collapseSeeMix from '@/mixins/collapseSeeMix'

export default {
  components: {
    CreateBidding: () => import('../createBidding.vue'),
    TemplateReviewContent: () => import('./TemplateReviewContent'),
    GuaranteeConfirmContent: () => import('./GuaranteeConfirmContent'),
    MarginCollectionConfirmContent: () => import('./MarginCollectionConfirmContent'),
    SuccessfulBidderConfirmContent: () => import('./SuccessfulBidderConfirmContent'),
    MarginRefundConfirmContent: () => import('./MarginRefundConfirmContent')
  },
  mixins: [collapseSeeMix],
  data() {
    return {
      activeNames: [],
      advanceViewList: [],
      loading: true
    }
  },
  created() {
    this.featchDat()
  },
  methods: {
    featchDat() {
      this.loading = true
      const { id } = this.$route.query
      doBusinessHistoryView({ businessKey: id, businessType: 'BiddingBasicInfo' }).then(({ data }) => {
        this.loading = false
        this.advanceViewList = data
      })
    }
  }
}
</script>

<style scoped>
.bidding-management-view .tempalte-content {
  min-height: calc(100vh - 0.85rem - 120px);
}
</style>
