<template>
  <div id="unit" class="flex-row" >
    <div :class="{'basic-main':!(!isEmpty(val) || isChange),'binary-left':!isEmpty(val) || isChange}">
    <gas-brand-list :visiable="visiable" v-ref:list :row="row" @select-changed="selected" :f_filialeid.sync="f_filialeid"></gas-brand-list>
    </div>
    <div class="binary-right" v-el:gasbrand style="margin-left: 10px;overflow-y: auto" v-if="!isEmpty(val) || isChange">
      <span v-show='row'>
        <ul v-if="showParameValue" class="nav nav-tabs">
          <li role="presentation" class="active"><a href="#">气表型号参数</a></li>
        </ul>
        <div v-if="showParameValue" style="height:150px; overflow: auto;">
          <parames :id="row.id" :type="0"></parames>
        </div>
     </span>
      <add-gas-brand v-if="isChange" :data="gasmodel" :f_filialeid.sync="f_filialeid" v-on:toggle="getChange"></add-gas-brand>
    </div>
  </div>
</template>
<script>


  export default {
    title: '气表品牌管理',
    data() {
      return {
        f_filialeid: this.$login.f.orgid,
        isChange: false,
        row: null,
        gasmodel: null,
        showParameValue: false,
        parame:undefined,
        dataType:0,
        visiable:true
      }
    },
    methods: {
      selected(obj) {
        this.visiable = false
        this.showParameValue=false
        this.row = obj.val
        this.gasmodel = obj.val
        this.isChange = true
      },
      getChange() {
        this.isChange = true
      },
      isEmpty(value) {
        for (let id in value) {
          return false
        }
        return true
      },
      showParame() {
        this.showParameValue = this.showParameValue ? false : true
      }
    },
    events: {
      'search'() {
        this.isChange = false
        this.row = null
        this.gasmodel = {}
        this.$refs.list.$refs.paged.$refs.cri.search()
      },
      'success'(name, row, res) {
        this.isChange = false
        this.row = null
        this.gasmodel = {}
        this.$refs.list.search()
      },
      'error'(name, row, res) {
        this.isChange = false
        this.row = null
        this.gasmodel = {}
      },
      'close'() {
        this.isChange = false
        this.row = null
        this.gasmodel = {}
        this.visiable = true
        this.$refs.list.search()
      },
      'add'() {
        this.isChange = true
        this.row = null
        this.$refs.list.$refs.paged.$refs.grid.selectStore.selected = null
        this.gasmodel = null
      }
    }
  }
</script>
<style>

</style>
