<template>
  <div class="app-container">
    <transition name="el-zoom-in-center">
      <dept-list v-if="options.showList" @showCard="showCard"></dept-list>
    </transition>
    <transition name="el-zoom-in-top">
      <dept-add v-if="options.showAdd" :parentId="options.parentId" @showCard="showCard"></dept-add>
    </transition>
    <transition name="el-zoom-in-top">
      <dept-edit v-if="options.showEdit" :id="options.id" @showCard="showCard"></dept-edit>
    </transition>
    <transition name="el-zoom-in-bottom">
      <dept-detail v-if="options.showDetail" :id="options.id" @showCard="showCard"></dept-detail>
    </transition>
  </div>
</template>

<script>
import DeptList from './DeptList'
import DeptAdd from './DeptAdd'
import DeptEdit from './DeptEdit'
import DeptDetail from './DeptDetail'

export default {
  name: 'Dept',
  components: { DeptList, DeptAdd, DeptEdit, DeptDetail },
  data () {
    return {
      options: {
        id: undefined,
        showList: true,
        showAdd: false,
        showEdit: false,
        showDetail: false
      }
    }
  },
  methods: {
    showCard (data) {
      Object.assign(this.options, data);
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
