totalExpenses.vue 1.71 KB
Newer Older
1 2 3
<template>
  <div>
      <div class="d-flex search-box jc-end">
乐宝呗666's avatar
乐宝呗666 committed
4
        <el-select v-model="selectYear" size="mini" style="width:1.4rem;" @change="getFee('')">
5 6 7 8 9 10 11 12
            <el-option
                v-for="item in yearList"
                :key="item"
                :label="item"
                :value="item">
            </el-option>
            </el-select>
        </div>
13
        <barChart @downData="downData" :message="dataList" idstr="totalExpenses" class="heightCut68"></barChart>
14 15 16 17
  </div>
</template>

<script>
18
import barChart from '@/components/echarts/barChart' // 费用统计 柱图
19
import * as API_OPERATION from '@/api/con.operation'
20 21 22 23
export default {
  components: { barChart },
  data () {
    return {
24 25 26 27
      selectYear: '',
      yearList: [],
      selectId: '',
      dataList: {}
28 29 30
    }
  },
  mounted () {
31
    this.getFeeYear()
32 33
  },
  methods: {
34 35
    async getFeeYear () {
      const _data = await API_OPERATION.getFeeYear()
乐宝呗666's avatar
乐宝呗666 committed
36
      if (!_data.data) { return false }
37 38 39 40 41 42 43
      this.yearList = _data.data
      this.selectYear = this.yearList[0]
      this.getFee()
    },
    async getFee (param, isLeaf) {
      this.selectId = param || null
      const _data = await API_OPERATION.getFee({ center: this.selectId, date: this.selectYear })
乐宝呗666's avatar
乐宝呗666 committed
44
      if (!_data.data) { return false }
45 46 47 48 49
      this.dataList = {
        parentId: param || '',
        isLeaf: isLeaf,
        xAxis: _data.data.xAxis,
        idxs: _data.data.idxs,
50 51
        data: _data.data.data,
        yAxis: '单位:万元'
52 53
      }
    },
54
    downData (item) {
乐宝呗666's avatar
乐宝呗666 committed
55
      // console.log('传来的值:', item)
56 57 58 59 60
      if (!item) {
        this.getFee('', false)
      } else {
        this.getFee(item, true)
      }
61
    }
62 63 64 65 66 67 68
  }
}
</script>

<style lang="scss" scoped>

</style>