<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>
          <create-sales-contract-content v-if="item.formBusinessName === '销售合同创建'" :sales-contract="item.obj" :disabled="true"></create-sales-contract-content>
          <prequalification-content v-if="item.formBusinessName === '模板初审' || item.formBusinessName === '模板复审' || item.formBusinessName === '变更初审' || item.formBusinessName === '变更复审'" :business-name="item.formBusinessName" :deatails-info="item.obj" :disabled="true"></prequalification-content>
          <sales-contract-add-content v-if="item.formBusinessName === '销售合同录入'" :details-info="item.obj" :disabled="true" :business-name="item.formBusinessName" />
          <sales-contract-review-content v-if="item.formBusinessName === '信息审核'" :details-info="item.obj" :disabled="true"></sales-contract-review-content>
          <change-create-sales-contract-content v-if="item.formBusinessName === '变更合同创建'" :change-create="item.obj" :disabled="true" :business-name="item.formBusinessName"></change-create-sales-contract-content>
          <change-sales-contract-add-content v-if="item.formBusinessName === '变更信息录入'" :deatails-info="item.obj" :disabled="true" />
          <change-contract-review-content v-if="item.formBusinessName === '变更审核'" :deatails-info="item.obj" :disabled="true"></change-contract-review-content>
          <sign-confirmation-content-c v-if="item.formBusinessName === '签署确认' || item.formBusinessName === '变更签署确认'" :deatils-info="item.obj" :disabled="true"></sign-confirmation-content-c>
          <sign-review-content v-if="item.formBusinessName === '签署审核' || item.formBusinessName === '变更签署审核'" :deatails-info="item.obj" :disabled="true"></sign-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 collapseSeeMix from '@/mixins/collapseSeeMix'

export default {
  components: {
    CreateSalesContractContent: () => import('./CreateSalesContractContent.vue'),
    PrequalificationContent: () => import('./PrequalificationContent.vue'),
    SalesContractAddContent: () => import('./SalesContractAddContent.vue'),
    SalesContractReviewContent: () => import('./SalesContractReviewContent.vue'),
    ChangeCreateSalesContractContent: () => import('./ChangeCreateSalesContractContent.vue'),
    ChangeSalesContractAddContent: () => import('./ChangeSalesContractAddContent.vue'),
    ChangeContractReviewContent: () => import('./ChangeContractReviewContent.vue'),
    SignConfirmationContentC: () => import('./SignConfirmationContentC.vue'),
    SignReviewContent: () => import('./SignReviewContent.vue')
  },
  mixins: [collapseSeeMix],
  data() {
    return {
      activeNames: [],
      advanceViewList: [],
      loading: true
    }
  },
  created() {
    this.featchDat()
  },
  methods: {
    featchDat() {
      this.loading = true
      const { id } = this.$route.query
      doBusinessHistoryView({ businessKey: id, businessType: 'SalesContract' }).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>
