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

  import PosList from './PosList'
  import PosAdd from './PosAdd'

  export default {
    title: 'POS终端管理',
    components: {
      PosList, PosAdd
    },
    data () {
      return {
        isChange: false,
        row: null,

        f_filialeids: ''
      }
    },
    methods: {
      selected (obj) {
        this.isChange = true
        this.row = obj.val
      }
    },
    events: {
      'search' () {
        this.isChange = false
        this.row = null
        this.$refs.list.$refs.paged.$refs.cri.search()
      },
      'research' () {
        console.log('重新查询')
        this.isChange = false
        this.row = null
      },
      'refresh' () {
        this.isChange = false
        this.row = null
        this.$refs.list.search()
      },
      'error' (name, row, res) {
        this.isChange = false
        this.row = null
      },
      'close' () {
        this.isChange = false
        this.row = null
        this.$refs.list.search()
      },
      'add' () {
        this.row = null
        this.isChange = true
        this.$refs.list.$refs.paged.$refs.grid.selectStore.selected = null
      }
    }
  }
</script>
