<template>
  <div class="sales-contract-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>
          <apply-invoicing-content v-if="item.formBusinessName === '提交申请'" :deatils-info="item.obj" :disabled="true"></apply-invoicing-content>
          <business-review-content v-if="item.formBusinessName === '业务审核'" :deatails-info="item.obj" :disabled="true"></business-review-content>
          <financial-review-content v-if="item.formBusinessName === '财务审核'" :deatails-info="item.obj" :disabled="true"></financial-review-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 collapseMix from '@/mixins/collapseSeeMix'

export default {
  components: {
    ApplyInvoicingContent: () => import('./ApplyInvoicingContent.vue'),
    BusinessReviewContent: () => import('./BusinessReviewContent.vue'),
    FinancialReviewContent: () => import('./FinancialReviewContent.vue')
  },
  mixins: [collapseMix],
  data() {
    return {
      activeNames: [],
      advanceViewList: [],
      loading: true
    }
  },
  created() {
    this.doBusinessHistoryView()
  },
  methods: {
    doBusinessHistoryView() {
      this.loading = true
      const { id } = this.$route.query
      doBusinessHistoryView({ businessKey: id, businessType: 'invoiceManager' }).then(({ data }) => {
        this.loading = false
        this.advanceViewList = data
      })
    }
  }
}
</script>

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