Blame view

src/components/system/roomDetailHis.vue 4.59 KB
b25b036d   wuxw   v1.9 优化日期
1
  <template>
ce5e1a2a   wuxw   系统模块开发中
2
    <div class="room-detail-his">
27dcfde5   wuxw   系统全面测试完成
3
4
      <el-table :data="roomDetailHisInfo.rooms" border style="width: 100%" v-loading="loading">
        <el-table-column :label="$t('roomDetailHis.operate')" align="center">
ce5e1a2a   wuxw   系统模块开发中
5
6
7
8
          <template slot-scope="scope">
            {{ _getRoomHisOperate(scope.row) }}
          </template>
        </el-table-column>
27dcfde5   wuxw   系统全面测试完成
9
        <el-table-column :label="$t('roomDetailHis.userName')" align="center">
ce5e1a2a   wuxw   系统模块开发中
10
11
12
13
          <template slot-scope="scope">
            {{ scope.row.userName || '-' }}
          </template>
        </el-table-column>
27dcfde5   wuxw   系统全面测试完成
14
        <el-table-column :label="$t('roomDetailHis.createTime')" align="center">
ce5e1a2a   wuxw   系统模块开发中
15
16
17
18
          <template slot-scope="scope">
            {{ scope.row.createTime }}
          </template>
        </el-table-column>
27dcfde5   wuxw   系统全面测试完成
19
        <el-table-column :label="$t('roomDetailHis.roomNum')" align="center">
ce5e1a2a   wuxw   系统模块开发中
20
21
22
23
          <template slot-scope="scope">
            {{ scope.row.floorNum }}-{{ scope.row.unitNum }}-{{ scope.row.roomNum }}
          </template>
        </el-table-column>
27dcfde5   wuxw   系统全面测试完成
24
        <el-table-column :label="$t('roomDetailHis.layer')" align="center">
ce5e1a2a   wuxw   系统模块开发中
25
26
27
28
          <template slot-scope="scope">
            {{ scope.row.layer }}
          </template>
        </el-table-column>
27dcfde5   wuxw   系统全面测试完成
29
        <el-table-column :label="$t('roomDetailHis.roomSubTypeName')" align="center">
ce5e1a2a   wuxw   系统模块开发中
30
31
32
33
          <template slot-scope="scope">
            {{ scope.row.roomSubTypeName }}
          </template>
        </el-table-column>
27dcfde5   wuxw   系统全面测试完成
34
        <el-table-column :label="$t('roomDetailHis.area')" align="center">
ce5e1a2a   wuxw   系统模块开发中
35
36
37
38
          <template slot-scope="scope">
            {{ scope.row.builtUpArea }}/{{ scope.row.roomArea }}
          </template>
        </el-table-column>
27dcfde5   wuxw   系统全面测试完成
39
        <el-table-column :label="$t('roomDetailHis.roomRent')" align="center">
ce5e1a2a   wuxw   系统模块开发中
40
41
42
43
          <template slot-scope="scope">
            {{ scope.row.roomRent }}
          </template>
        </el-table-column>
27dcfde5   wuxw   系统全面测试完成
44
        <el-table-column :label="$t('roomDetailHis.stateName')" align="center">
ce5e1a2a   wuxw   系统模块开发中
45
46
47
48
49
50
          <template slot-scope="scope">
            {{ scope.row.stateName }}
          </template>
        </el-table-column>
      </el-table>
  
27dcfde5   wuxw   系统全面测试完成
51
52
      <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"
ce5e1a2a   wuxw   系统模块开发中
53
54
55
56
57
58
59
        :total="page.total">
      </el-pagination>
    </div>
  </template>
  
  <script>
  import { queryHisRoom } from '@/api/system/operateDataLogApi'
27dcfde5   wuxw   系统全面测试完成
60
  import { getCommunityId } from '@/api/community/communityApi'
ce5e1a2a   wuxw   系统模块开发中
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
  
  export default {
    name: 'RoomDetailHis',
    data() {
      return {
        loading: false,
        roomDetailHisInfo: {
          rooms: [],
          roomId: '',
          roomName: '',
          logStartTime: '',
          logEndTime: '',
          staffNameLike: '',
          payerObjName: ''
        },
        page: {
          current: 1,
          size: 10,
          total: 0
        }
      }
    },
    methods: {
      open(conditions) {
        this.roomDetailHisInfo = {
          ...this.roomDetailHisInfo,
          ...conditions
        }
        this._loadRoomDetailHisData()
      },
      async _loadRoomDetailHisData() {
        try {
          this.loading = true
          const params = {
            page: this.page.current,
            row: this.page.size,
            roomId: this.roomDetailHisInfo.roomId,
            roomName: this.roomDetailHisInfo.roomName,
            logStartTime: this.roomDetailHisInfo.logStartTime,
            logEndTime: this.roomDetailHisInfo.logEndTime,
            staffNameLike: this.roomDetailHisInfo.staffNameLike,
27dcfde5   wuxw   系统全面测试完成
102
103
            payerObjName: this.roomDetailHisInfo.payerObjName,
            communityId: getCommunityId() 
ce5e1a2a   wuxw   系统模块开发中
104
          }
27dcfde5   wuxw   系统全面测试完成
105
  
ce5e1a2a   wuxw   系统模块开发中
106
107
108
109
110
111
112
113
114
115
116
          const { data, total } = await queryHisRoom(params)
          this.roomDetailHisInfo.rooms = data
          this.page.total = total
        } catch (error) {
          console.error('Failed to load room history:', error)
        } finally {
          this.loading = false
        }
      },
      _getRoomHisOperate(room) {
        const roomCount = this.roomDetailHisInfo.rooms.filter(item => item.bId === room.bId).length
27dcfde5   wuxw   系统全面测试完成
117
  
ce5e1a2a   wuxw   系统模块开发中
118
119
120
121
122
        if (roomCount <= 1) {
          if (room.operate === 'ADD') return this.$t('roomDetailHis.add')
          if (room.operate === 'DEL') return this.$t('roomDetailHis.delete')
          return '-'
        }
27dcfde5   wuxw   系统全面测试完成
123
  
ce5e1a2a   wuxw   系统模块开发中
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
        if (room.operate === 'ADD') return this.$t('roomDetailHis.modifyNew')
        if (room.operate === 'DEL') return this.$t('roomDetailHis.modifyOld')
        return '-'
      },
      handleSizeChange(size) {
        this.page.size = size
        this._loadRoomDetailHisData()
      },
      handleCurrentChange(current) {
        this.page.current = current
        this._loadRoomDetailHisData()
      }
    }
  }
  </script>
  
  <style scoped>
  .room-detail-his {
    padding: 20px;
  }
  
  .el-pagination {
    margin-top: 20px;
    text-align: right;
  }
  </style>