<template>
  <div id="unit" class="flex-row">
    <div class="flex" style="flex: 1; width:60%">
      <dep-list @select-changed="selected" v-ref:todolist></dep-list>
    </div>
    <div style="width:40%;margin-left:5px;" v-if="isChange">
      <dep-compile-list :data="row"></dep-compile-list>
    </div>
  </div>
</template>

<script>
  export default {
    title: '部门管理',
    data () {
      return {
        row: null,
        isChange: false
      }
    },
    methods: {
      selected (obj) {
        this.row = obj.val
        this.isChange = true
      }
    },
    events: {
      'add' () {
        this.isChange = false
        this.row = null
        this.isChange = true
      },
      'search' () {
        this.isChange = false
      },
      'refresh' () {
        this.row = null
        this.isChange = false
        this.$refs.todolist.$refs.paged.$refs.cri.search()
      }
    }
  }
</script>
<style>
</style>
