Blame view

src/components/report/DataReportEarnedWayStatistics.vue 2.29 KB
b25b036d   wuxw   v1.9 优化日期
1
  <template>
51f9221a   wuxw   加入报表功能
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
    <div class="margin-top">
      <div class="text-right">
        <el-button type="primary" size="small" @click="_exportReportEarnedWayExcel">
          <i class="el-icon-download"></i>
          <span>{{ $t('dataReport.export') }}</span>
        </el-button>
      </div>
      <div class="margin-top">
        <el-table :data="[dataReportEarnedWayStatisticsInfo.fees]" border style="width: 100%">
          <el-table-column v-for="(item, index) in dataReportEarnedWayStatisticsInfo.fees" :key="index" :label="item.name"
            align="center">
            <template>
              {{ item.receivedAmount || 0 }}
            </template>
          </el-table-column>
        </el-table>
      </div>
    </div>
  </template>
  
  <script>
  import { queryReceivedWayStatistics, exportData } from '@/api/report/dataReportApi'
  
  export default {
    name: 'DataReportEarnedWayStatistics',
  
    data() {
      return {
        dataReportEarnedWayStatisticsInfo: {
          fees: []
        },
        startDate: '',
        endDate: '',
        communityId: ''
      }
    },
    created() {
    },
    methods: {
      open(_param) {
        this.startDate = _param.startDate
        this.endDate = _param.endDate
        this.communityId = _param.communityId
        this._loadDataReportEarnedWayStatisticsData()
      },
      async _loadDataReportEarnedWayStatisticsData() {
        try {
          const params = {
            communityId: this.communityId,
            startDate: this.startDate,
            endDate: this.endDate
          }
          const { data } = await queryReceivedWayStatistics(params)
          this.dataReportEarnedWayStatisticsInfo.fees = data
        } catch (error) {
          console.error('Failed to load data:', error)
        }
      },
      async _exportReportEarnedWayExcel() {
        try {
          const params = {
            communityId: this.communityId,
            startDate: this.startDate,
            endDate: this.endDate,
            pagePath: 'dataReportEarnedWayStatistics'
          }
          const res = await exportData(params)
          this.$message.success(res.msg)
          if (res.code === 0) {
            this.$router.push('/pages/property/downloadTempFile?tab=下载中心')
          }
        } catch (error) {
          console.error('Export failed:', error)
        }
      }
    }
  }
  </script>
  
  <style scoped>
  .margin-top {
    margin-top: 20px;
  }
  
  .text-right {
    text-align: right;
  }
  </style>