<template>
  <div id="unit" class="flex-row">
    <staff-list @select-changed="selected" class="basic-main" style="width:auto;" v-ref:list></staff-list>
    <div class="binary-right" style="width: 40%;" v-if="isChange">
      <staff-compile-list :data="row"></staff-compile-list>
    </div>
  </div>
</template>

<script>

  export default {
    title: '人员管理',
    props: ['data'],
    data () {
      return {
        row: null,
        isChange: false
      }
    },
    methods: {
      selected (obj) {
        this.row = obj.val
        this.isChange = true
      }
    },
    events: {
      'adduser' () {
        this.row = null
        this.isChange = true
      },
      'search' () {
        this.isChange = false
      },
      'refresh' () {
        this.row = null
        this.isChange = false
        this.$refs.list.$refs.paged.$refs.cri.search()
      }
    }
  }

</script>
