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

<script>
module.exports = {
  components: {
    BusinessCreateContent: httpVueLoader('./BusinessCreateContent.vue'),
    TemplateExamineContent: httpVueLoader('./TemplateExamineContent.vue'),
    PledgeWayContent: httpVueLoader('./PledgeWayContent.vue'),
    BondContent: httpVueLoader('./BondContent.vue'),
    WinBiddingContent: httpVueLoader('./WinBiddingContent.vue'),
    RefundDepositContent: httpVueLoader('./RefundDepositContent.vue'),
  },
  data() {
    return {
      activeNames: [],
      advanceViewList: [],
      loading: true
    }
  },
  created() {
    this.featchData()
  },
  methods: {
    handleChange(val) {
      // console.log(val);
    },
    featchData() {
      this.loading = true
      const { businessKey, type } = this.$route.query
      this.$api.dictionary.getProcessNodeInfo({ businessKey, businessType: 'BusinessManagement' }).then(({ data }) => {
        this.loading = false
        this.advanceViewList = data
        // if(type === 'see') {
        //   this.activeNames = [0]
        // }
      })
    }
  },
}
</script>

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