<template>
  <div id="unit" class="flex-row">
    <div :class="{'basic-main':!showDetail,'binary-left':showDetail}">
      <manage-summary-report v-ref:gas
                             @user-detail="selected"
                             :style="style">
      </manage-summary-report>
    </div>
    <div v-if="showDetail" class="binary-right">
      <div class="flex">
        <manage-summary-report-detail v-if="showDetail" :data="row">
        </manage-summary-report-detail>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  title: '营收汇总报表',
  components: {},
  data () {
    return {
      row: {},
      showDetail: false,
      companyId: null,
      style: 'col-sm-2 form-group'
    }
  },
  methods: {
    selected (obj) {
      console.log('看看选中的数据', obj)
      if (obj) {
        this.style = 'col-sm-3 form-group'
        this.showDetail = true
        this.row = obj
        this.row.startDate = this.$refs.gas.$refs.paged.$refs.cri.model.startDate
        this.row.endDate = this.$refs.gas.$refs.paged.$refs.cri.model.endDate
        this.row.f_user_type = this.$refs.gas.$refs.paged.$refs.cri.model.f_user_type
        this.row.f_user_usetype = this.$refs.gas.$refs.paged.$refs.cri.model.f_user_usetype
        this.row.f_user_usenature = this.$refs.gas.$refs.paged.$refs.cri.model.f_user_usenature
        this.row.f_use_institution = this.$refs.gas.$refs.paged.$refs.cri.model.f_use_institution
      }
    },
    refresh () {
    }
  },
  events: {
    'cancel' () {
      this.style = 'col-sm-2 form-group'
      this.row = null
      this.showDetail = false
    }
  }
}
</script>
<style>
</style>
