<template>
  <div id="unit" class="flex-row">
    <stopair-list class="binary-left" v-ref:list :row="row"   :style="style"
                     style="width:auto;"></stopair-list>
    <div class="binary-right" style="overflow-y: auto;" v-if="isdetail || showrecordflag" :style="{width: isdetail||showrecordflag?'40%':'auto'}">
      <stopair-add style="height: 40%; margin-bottom: 30px;"  :data="row" v-if="isdetail"  v-ref:gas></stopair-add>
      <div v-if="showrecordflag"  class="auto">
        <ul class="nav nav-tabs" >
          <li class="active"><a href="#">停气通知记录</a></li>
        </ul>
        <stopair-list-record  v-ref:update :data="row"></stopair-list-record>
      </div>
    </div>
  </div>
</template>
<script>
  export default {
    title: '停气通知管理',
    data () {
      return {
        style: 'col-sm-2 form-group',
        row: null,
        blodid: '',
        parentData: '',
        isdetail: false,
        showrecordflag:false
      }
    },
    methods: {
    },
    ready () {
    },
    events: {
      'success' (name, row, res) {
        this.showrecordflag=false;
        // this.style='col-sm-2'
        this.row = null
        this.blodid = ''
        this.isdetail = false
        this.$refs.list.search()
      },
      'error' (name, row, res) {
        this.showrecordflag=false;
        this.row = null
        this.blodid = ''
        this.isdetail = false
        this.$refs.list.search()
      },
      'close' (res) {
        this.showrecordflag=false;
        this.style = 'col-sm-2 form-group'
        this.row = null
        this.blodid = ''
        this.isdetail = false
      },
      'search' () {
        this.showrecordflag=false;
        this.style = 'col-sm-2 form-group'
        this.row = null
        this.blodid = ''
        this.isdetail = false
        // this.$refs.list.search()
      },
      'add' () {
        this.style = 'col-sm-3 form-group'
        this.isdetail = true
        this.blodid = ''
        this.$refs.list.$refs.paged.$refs.grid.selectStore.selected = null
        this.row = null
      },
      'showrecord'(val){
        this.row = val
        this.style = 'col-sm-3 form-group';
        this.showrecordflag = true;
        this.isdetail = false
      },
      'selectchange'(val){
        if (val) {
          this.showrecordflag=false;
          this.style = 'col-sm-3 form-group'
          this.row = val
          this.isdetail = true
        }
      }
    }
  }
</script>
<style>
  .datapanel {
    color: #333;
    background-color: white;
    box-shadow: darkgrey 0.5px 0.5px 0.5px 0.5px ;
    padding: 10px 10px 5px 10px;
    border-radius:10px;
  }
</style>
