<template>
  <div class="acceptance-management-view">
    <div v-if="advanceViewList.length" class="view-steps-box">
      <cy-steps :steps-data="advanceViewList" />
    </div>
    <div v-loading="loading" class="tempalte-content">
      <el-collapse v-if="advanceViewList.length" v-model="activeNames">
        <el-collapse-item v-for="(item, index) in advanceViewList" :key="index" :name="index">
          <template slot="title">
            <cy-view-bar
              :view-bar-data="{ ...item.businessProcessingLogVo, formBusinessName: item.formBusinessName, index: index + 1 }"
            />
          </template>
          <add v-if="item.formBusinessName === '录入验收单'" :details-info="item.obj" />
          <price-adjust v-if="item.formBusinessName.includes( '单价调整')" :details-info="item.obj" />
          <sign-confirm v-if="item.formBusinessName === '签署确认'" :details-info="item.obj" />
        </el-collapse-item>
      </el-collapse>
      <!-- <el-empty v-else style="height: calc(100vh - 0.85rem - 90px)"></el-empty> -->
    </div>
  </div>
</template>

<script>
import { getHisDetails } from '@/api/myTrade/acceptanceManagement/index'
import collapseSeeMix from '@/mixins/collapseSeeMix'
import Add from './historyViewContent/add'
import PriceAdjust from './historyViewContent/priceAdjust'
import SignConfirm from './historyViewContent/signConfirm.vue'

export default {
  components: {
    Add,
    PriceAdjust,
    SignConfirm
  },
  mixins: [collapseSeeMix],
  data() {
    return {
      activeNames: [],
      advanceViewList: [],
      loading: true
    }
  },
  created() {
    this.fetchData()
  },
  methods: {
    handleChange(val) {
      // console.log(val);
    },
    fetchData() {
      this.loading = true
      const { id } = this.$route.query
      getHisDetails({ businessKey: id, businessType: 'AcceptanceSheet' }).then(({ data }) => {
        this.loading = false
        this.advanceViewList = data
      }).catch(res => {
        this.loading = false
      })
    }
  }
}
</script>

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