<template>
  <div class="project-credit-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>
          <supplement v-if="item.formBusinessName === '项目录入'" :details-info="item.obj"></supplement>
          <project-review v-if="item.formBusinessName === '尽调审核'" :details-info="item.obj"></project-review>
        </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'
import Supplement from './components/historyView/ProjectSupplement.vue'
import ProjectReview from './components/historyView/ProjectReview.vue'
export default {
  name: 'ProjectCreditView',
  components: {
    Supplement,
    ProjectReview
  },
  mixins: [collapseSeeMix],
  data() {
    return {
      activeNames: [],
      advanceViewList: [],
      loading: true
    }
  },
  created() {
    this.fetchData()
  },
  methods: {
    fetchData() {
      this.loading = true
      const { id } = this.$route.query
      doBusinessHistoryView({ businessKey: id, businessType: 'ProjectInformation' }).then(({ data }) => {
        this.loading = false
        this.advanceViewList = data
      }).catch(res => {
        this.loading = false
      })
    }
  }
}
</script>

<style scoped>

</style>
