<template>
  <div id="unit" class="flex-row">
    <div :class="{'basic-main':!isChange,' binary-left':isChange}">
    <box-list v-ref:list :row="row" @select-changed="selected" :f_filialeids.sync="f_filialeid" ></box-list>
    </div>
    <div class="flex  binary-right" style="margin-left: 10px; width: 50%" v-if="isChange">
        <add-box v-if="isChange" :data="boxmodel" :f_filialeid.sync="f_filialeid" v-ref:addbox></add-box>
        <box-user-list v-if="userlist" :data="boxmodel"></box-user-list>
    </div>
 </div>
</template>
<script>
import co from 'co'

export default {
  title: '加气枪管理',
  data () {
    return {
      isChange: false,
      userlist: false,
      row: null,
      boxmodel: null,
      f_filialeid: null
    }
  },
  methods: {
    selected (obj) {
      this.isChange = true
      this.userlist = true
      this.row = obj.val
      this.boxmodel = obj.val
    },
    getChange () {
      this.isChange = true
    }
  },
  events: {
    'search' () {
      this.isChange = false
      this.userlist = false
      this.row = null
      this.boxmodel = {}
      this.$refs.list.$refs.paged.$refs.cri.search()
    },
    'success' (name, row, res) {
      this.isChange = false
      this.userlist = false
      this.row = null
      this.boxmodel = {}

      this.$refs.list.search()
    },
    'error' (name, row, res) {
      this.isChange = false
      this.userlist = false
      this.row = null
      this.boxmodel = {}
    },
    'close' () {
      this.isChange = false
      this.userlist = false
      this.row = null
      this.boxmodel = {}
      this.$refs.list.search()
    },
    'add' () {
      this.isChange = true
      this.userlist = false
      this.row = null
      this.boxmodel = {}
      this.$refs.list.$refs.paged.$refs.grid.selectStore.selected = null
    }
  }
}
</script>
