<template>
  <div id="unit" class="flex-row">
    <meter-list-s v-ref:list :row="row" @select-changed="selected" style="width:60%;"></meter-list-s>
    <div style="width:40%; margin-left: 20px;" class="flex" v-if="isdetail">
      <meter-trace :data="row" @close="refresh" v-ref:met></meter-trace>
    </div>
  </div>
</template>
<script>
  /**
   *表具追溯管理组件
   */

  let readyGen = async function (self) {
    await self.$LoadParams.loadParam()
  }

  export default {
    title: '表具追溯',
    data() {
      return {
        row: null,
        meter: [],
        parentData: '',
        isdetail: false
      }
    },
    ready() {
      readyGen(this)
    },
    methods: {
      selected(obj) {
        this.row = obj.val
        this.isdetail = true
        console.log("row", this.row)
      },
      refresh() {
        this.row = null
        this.isdetail = false
        this.$refs.list.search()
      }
    },
    events: {
      'add'() {
        this.isdetail = true
        this.$refs.list.$refs.paged.$refs.grid.selectStore.selected = null
        this.row = null
      },
      'close'() {
        this.isdetail = false
      }
    }
  }
</script>
