<template>
  <div id="unit" class=" flex-row">
    <user-res-list @select-changed="selected" class="basic-main" style="width:auto;"
                   v-ref:list></user-res-list>
    <div class="binary-right" style="width: 40%;" v-if="isChange">
      <user-res-history :data="row"></user-res-history>
      <user-res-change v-if="row.id" :res_id="row.id"></user-res-change>
    </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: {
      'search' () {
        this.isChange = false
      },
      'refresh' () {
        this.row = null
        this.isChange = false
        this.$refs.list.$refs.paged.$refs.cri.search()
      }
    }
  }

</script>
