<template>
  <div>
    <div style="text-align: center">
      <el-button :type="isShowSz?'success':''" v-if="authenticName !== '侯吉光'" @click="oi()">每日收支总结表</el-button>
      <el-button :type="isShowMx?'success':''" @click="o()">每日支出表</el-button>
    </div>
    <businessOutlayIncome v-if="outLayIncome" ref="outInLayWeb"></businessOutlayIncome>
    <businessOutLay v-if="outLay" ref="outLayWeb"></businessOutLay>
  </div>
</template>

<script>
import businessOutLay from './businessoutlay'
import businessOutlayIncome from './businessoutlayincome'
export default {
  components: {
    businessOutLay,
    businessOutlayIncome
  },
  data () {
    return {
      isShowSz: false,
      isShowMx: false,
      outLay: false,
      outLayIncome: false,
      userId: '',
      authenticName: ''
    }
  },
  methods: {
    // 收支总结
    oi () {
      this.isShowSz = true
      this.isShowMx = false
      this.outLayIncome = true
      this.outLay = false
      this.$nextTick(() => {
        this.$refs.outInLayWeb.getDataList()
      })
    },
    // 支出明细
    o () {
      this.isShowSz = false
      this.isShowMx = true
      this.outLay = true
      this.outLayIncome = false
      this.$nextTick(() => {
        this.$refs.outLayWeb.getDataList()
      })
    }
  },
  mounted () {
    if (this.authenticName !== '侯吉光') {
      this.o()
    } else {
      this.oi()
    }
    // 获取登录人信息
    this.$http.request({
      url: this.$http.adornUrl('/sys/user/info'),
      method: 'get'
    }).then(({data}) => {
      if (data && data.code === 0) {
        this.userId = data.user.userId
        this.authenticName = data.user.authenticName
      }
    })
  }
}
</script>

<style scoped>



</style>
