<template>
  <div class="xx-view">
    <cy-steps v-if="advanceViewList.length" :steps-data="advanceViewList"></cy-steps>
    <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>
          <edit-content v-if="item.formBusinessName === '支用资料提交'" :details-info="item.obj" :disabled="true"></edit-content>
          <approval-content v-if="item.formBusinessName === '支用资料审核'" :details-info="item.obj" :disabled="true"></approval-content>
          <contract-content v-if="item.formBusinessName === '合同清单上传'" :details-info="item.obj" :disabled="true"></contract-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: {
    EditContent: () => import('./EditContent.vue'),
    ApprovalContent: () => import('./ApprovalContent.vue'),
    ContractContent: () => import('./ContractContent.vue')
  },
  mixins: [collapseSeeMix],
  data() {
    return {
      activeNames: [],
      advanceViewList: [],
      loading: true
    }
  },
  created() {
    this.featchData()
  },
  methods: {
    featchData() {
      this.loading = true
      const { businessKey } = this.$route.query
      doBusinessHistoryView({ businessKey, businessType: 'FinancialCustomerExpenditure' }).then(({ data }) => {
        this.loading = false
        this.advanceViewList = data
      })
    }
  }
}
</script>
<style scoped lang="scss"></style>
