Blame view

src/components/system/feeDetailHis.vue 4.06 KB
ce5e1a2a   wuxw   系统模块开发中
1
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
  <template>
    <div class="fee-detail-his">
      <el-table
        :data="feeDetailHisInfo.fees"
        border
        style="width: 100%"
        v-loading="loading">
        <el-table-column
          :label="$t('feeDetailHis.feeName')"
          align="center">
          <template slot-scope="scope">
            {{ scope.row.feeName }}
            <span v-if="scope.row.payerObjName">({{ scope.row.payerObjName }})</span>
          </template>
        </el-table-column>
        <el-table-column
          :label="$t('feeDetailHis.startTime')"
          align="center">
          <template slot-scope="scope">
            {{ scope.row.startTime || '-' }}
          </template>
        </el-table-column>
        <el-table-column
          :label="$t('feeDetailHis.endTime')"
          align="center">
          <template slot-scope="scope">
            {{ scope.row.endTime || '-' }}
          </template>
        </el-table-column>
        <el-table-column
          :label="$t('feeDetailHis.operate')"
          align="center">
          <template slot-scope="scope">
            {{ _getFeeHisOperate(scope.row) }}
          </template>
        </el-table-column>
        <el-table-column
          :label="$t('feeDetailHis.userName')"
          align="center">
          <template slot-scope="scope">
            {{ scope.row.userName || '-' }}
          </template>
        </el-table-column>
        <el-table-column
          :label="$t('feeDetailHis.createTime')"
          align="center">
          <template slot-scope="scope">
            {{ scope.row.createTime }}
          </template>
        </el-table-column>
      </el-table>
  
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="page.current"
        :page-sizes="[10, 20, 30, 50]"
        :page-size="page.size"
        layout="total, sizes, prev, pager, next, jumper"
        :total="page.total">
      </el-pagination>
    </div>
  </template>
  
  <script>
  import { queryHisFee } from '@/api/system/operateDataLogApi'
  
  export default {
    name: 'FeeDetailHis',
    data() {
      return {
        loading: false,
        feeDetailHisInfo: {
          fees: [],
          feeId: '',
          staffNameLike: '',
          feeNameLike: '',
          payerObjName: '',
          logStartTime: '',
          logEndTime: ''
        },
        page: {
          current: 1,
          size: 10,
          total: 0
        }
      }
    },
    methods: {
      open(conditions) {
        this.feeDetailHisInfo = {
          ...this.feeDetailHisInfo,
          ...conditions
        }
        this._loadFeeDetailHisData()
      },
      async _loadFeeDetailHisData() {
        try {
          this.loading = true
          const params = {
            page: this.page.current,
            row: this.page.size,
            feeId: this.feeDetailHisInfo.feeId,
            staffNameLike: this.feeDetailHisInfo.staffNameLike,
            feeNameLike: this.feeDetailHisInfo.feeNameLike,
            payerObjName: this.feeDetailHisInfo.payerObjName,
            logStartTime: this.feeDetailHisInfo.logStartTime,
            logEndTime: this.feeDetailHisInfo.logEndTime
          }
          
          const { data, total } = await queryHisFee(params)
          this.feeDetailHisInfo.fees = data
          this.page.total = total
        } catch (error) {
          console.error('Failed to load fee history:', error)
        } finally {
          this.loading = false
        }
      },
      _getFeeHisOperate(fee) {
        const feeCount = this.feeDetailHisInfo.fees.filter(item => item.bId === fee.bId).length
        
        if (feeCount <= 1) {
          if (fee.operate === 'ADD') return this.$t('feeDetailHis.add')
          if (fee.operate === 'DEL') return this.$t('feeDetailHis.delete')
          return '-'
        }
        
        if (fee.operate === 'ADD') return this.$t('feeDetailHis.modifyNew')
        if (fee.operate === 'DEL') return this.$t('feeDetailHis.modifyOld')
        return '-'
      },
      handleSizeChange(size) {
        this.page.size = size
        this._loadFeeDetailHisData()
      },
      handleCurrentChange(current) {
        this.page.current = current
        this._loadFeeDetailHisData()
      }
    }
  }
  </script>
  
  <style scoped>
  .fee-detail-his {
    padding: 20px;
  }
  
  .el-pagination {
    margin-top: 20px;
    text-align: right;
  }
  </style>