<template>
  <el-dialog class="detail-dialog" :visible.sync="detailVisible" :close-on-click-modal="false" :modal-append-to-body="false" append-to-body title="流程详情">
    <div class="setting-dialog">
      <div class="detail-info">
        <p><span>流程名称：</span>01-归档审批流程</p>
        <p><span>启动时间：</span>2016-09-21 08:50:08</p>
        <p><span>实例ID：</span>9af7f46a-ea52- 4aa3-b8c3-9fd484c2af12</p>
        <p><span>发起人：</span>admin</p>
      </div>
      <!--  -->
      <div class="detail-arrow" @click="isExpend = !isExpend"><i :class="[ isExpend ? 'arrow-up':'']" /></div>
      <el-collapse-transition>
        <div v-show="isExpend" class="service-detail">
          <h4>业务详情</h4>
          <div class="detail-list">
            <p><span>业务类型：</span>归档审批</p>
            <p><span>原始位置：</span>全宗A-整理库-门类A</p>
            <p><span>目标位置：</span>全宗A-整理库-门类A</p>
            <p><span>赋权类型：</span>-</p>
            <p><span>起始时间：</span>-</p>
            <p><span>终止时间：</span>-</p>
            <p><span>利用目的：</span>-</p>
            <p><span>业务状态：</span>已完成</p>
            <p><span>审批状态：</span>通过</p>
          </div>
        </div>
      </el-collapse-transition>
      <div class="detail-tab tab-content">
        <ul class="tab-nav">
          <li :class="{'active-tab-nav': activeIndex == 0 }" @click="changeActiveTab(0)">档案列表</li>
          <li :class="{'active-tab-nav': activeIndex == 1 }" @click="changeActiveTab(1)">任务列表</li>
          <li :class="{'active-tab-nav': activeIndex == 2 }" @click="changeActiveTab(2)">流程图</li>
        </ul>
        <div v-if="activeIndex == 0" class="double-click-btn"><i class="iconfont icon-zhuyi-lan" /><span>双击列表数据查看详情</span></div>
        <component :is="comName" class="component-cont" />
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="detailVisible=false">确定</el-button>
      </div>
    </div>
  </el-dialog>
</template>

<script>
import processImg from './processImg/index'
import businessDetails from './businessDetails/index'
import taskList from './taskList/index'
import approvalList from './approvalList/index'
export default {
  name: 'Detail',
  components: {
    processImg,
    businessDetails,
    taskList,
    approvalList
  },
  data() {
    return {
      detailVisible: false,
      isExpend: false,
      activeIndex: 0
    }
  },
  computed: {
    comName: function() {
      if (this.activeIndex === 0) {
        return 'businessDetails'
      } else if (this.activeIndex === 1) {
        return 'taskList'
      } else if (this.activeIndex === 2) {
        return 'processImg'
      }
      return 'businessDetails'
    }
  },
  methods: {
    changeActiveTab(data) {
      this.activeIndex = data
    }
  }
}
</script>

<style lang='scss' scoped>
.detail-tab{
  position: relative;
}
.detail-dialog{
  .detail-info,
  .detail-list{
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    padding-top: 10px;
    font-size: 14px;
    line-height: 30px;
    color: #545B65;
    p{
      width: 50%;
      span{
        display: inline-block;
        width: 75px;
        text-align: right;
        color: #0C0E1E;
      }
    }
  }
  .detail-arrow{
    position: relative;
    width: 64px;
    height: 16px;
    margin: 10px auto;
    background-color:#E8F2FF;
    border-radius: 3px;
    cursor: pointer;
    i{
      position: absolute;
      left: 50%;
      top: 50%;
      display: block;
      width: 9px;
      height: 5px;
      margin-top: -2px;
      margin-left: -4px;
      background: url('~@/assets/images/icon/arrow.png') no-repeat center center;
      transition: all ease-in 0.5s;
      &.arrow-up {
        transform: rotate(180deg);
      }
    }

  }
  .service-detail{
    padding: 8px 12px;
    background-color: #F6F8FC;
    font-size: 14px;
    h4{
      position: relative;
      padding-left: 10px;
      color: #0C0E1E;
      &::before {
        content: "";
        position: absolute;
        left: 0;
        top: 50%;
        width: 3px;
        height: 14px;
        background-color: #0348F3;
        transform: translateY(-50%);
      }
    }
    .detail-list{
      p{
        width: 33%;
      }
    }
  }
  .double-click-btn{
    position: absolute;
    right: 0;
    top: 0;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    line-height: 26px;
    span{
      display: inline-block;
      font-size: 12px;
      color: #545B65;
    }
    i{
      display: inline-block;
      color: #0348F3;
    }
  }
}
</style>
