<template>
  <div class="supplier-manage-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>
          <divide-accounts-edit v-if="item.formBusinessName === '分账提交'" :details-info="item.obj" disabled></divide-accounts-edit>
          <approval-content v-if="item.formBusinessName === '分账审核'" :details-info="item.obj" disabled></approval-content>
        </el-collapse-item>
      </el-collapse>
      <el-empty v-else style="height: calc(100vh - 408px)"></el-empty>
    </div>
  </div>
</template>

<script>
import { doBusinessHistoryView } from '@/api/dictionary'
import collapseSeeMix from '@/mixins/collapseSeeMix'
export default {
  components: {
    DivideAccountsEdit: () => import('../edit.vue'),
    ApprovalContent: () => import('./ApprovalContent.vue')
  },
  mixins: [collapseSeeMix],
  provide() {
    return {
      disabled: true
    }
  },
  data() {
    return {
      activeNames: [],
      advanceViewList: [],
      loading: true,
      disabled: true
    }
  },
  created() {
    this.featchData()
  },
  methods: {
    featchData() {
      const { id } = this.$route.params
      doBusinessHistoryView({ businessKey: id, businessType: 'LedgerInfoManage' }).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>
