Blame view

src/components/owner/ownerDetailHis.vue 6.29 KB
b25b036d   wuxw   v1.9 优化日期
1
  <template>
c85e0853   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
    <div class="owner-detail-his">
      <el-row class="margin-top">
        <el-table :data="ownerDetailHisInfo.owners" border style="width: 100%" class="footable">
          <el-table-column prop="operate" :label="$t('ownerDetailHis.action')" align="center" >
            <template slot-scope="scope">
              {{ _getHisOwnerOperate(scope.row) }}
            </template>
          </el-table-column>
          <el-table-column prop="userName" :label="$t('ownerDetailHis.operator')" align="center" >
            <template slot-scope="scope">
              {{ scope.row.userName || '-' }}
            </template>
          </el-table-column>
          <el-table-column prop="createTime" :label="$t('ownerDetailHis.operateTime')" align="center"
            width="180"></el-table-column>
          <el-table-column prop="name" :label="$t('ownerDetailHis.name')" align="center" >
            <template slot-scope="scope">
              {{ scope.row.name }}({{ scope.row.link }})
            </template>
          </el-table-column>
          <el-table-column prop="sex" :label="$t('ownerDetailHis.gender')" align="center" >
            <template slot-scope="scope">
              {{ scope.row.sex == 0 ? $t('ownerDetailHis.male') : $t('ownerDetailHis.female') }}
            </template>
          </el-table-column>
          <el-table-column prop="idCard" :label="$t('ownerDetailHis.idCard')" align="center" >
            <template slot-scope="scope">
              {{ scope.row.idCard || '-' }}
            </template>
          </el-table-column>
          <el-table-column prop="address" :label="$t('ownerDetailHis.address')" align="center" >
            <template slot-scope="scope">
              {{ scope.row.address || '-' }}
            </template>
          </el-table-column>
          <el-table-column v-for="(item, index) in ownerDetailHisInfo.listColumns" :key="index" :label="item"
            align="center" width="150">
            <template slot-scope="scope">
              {{ scope.row.listValues[index] || '-' }}
            </template>
          </el-table-column>
        </el-table>
  
        <el-row class="margin-top">
          <el-col :span="24" class="text-right">
            <el-pagination @current-change="handleCurrentChange" :current-page="pagination.currentPage"
              :page-size="pagination.pageSize" layout="total, prev, pager, next, jumper"
              :total="pagination.total"></el-pagination>
          </el-col>
        </el-row>
      </el-row>
    </div>
  </template>
  
  <script>
  import { queryHisOwner } from '@/api/owner/ownerDetailHisApi'
  import { getCommunityId } from '@/api/community/communityApi'
27dcfde5   wuxw   系统全面测试完成
59
  import {getAttrSpecList} from '@/api/dev/attrSpecApi'
c85e0853   wuxw   业主详情开发完成
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
  export default {
    name: 'OwnerDetailHis',
    data() {
      return {
        ownerDetailHisInfo: {
          owners: [],
          ownerId: '',
          ownerName: '',
          carNum: '',
          listColumns: [],
          logStartTime: '',
          logEndTime: '',
          ownerNameLike: '',
          staffNameLike: ''
        },
        pagination: {
          currentPage: 1,
          pageSize: 10,
          total: 0
        }
      }
    },
    methods: {
      open(ownerId, ownerName, ownerNameLike, logStartTime, logEndTime, staffNameLike) {
        this.ownerDetailHisInfo.ownerId = ownerId
        this.ownerDetailHisInfo.ownerName = ownerName
c85e0853   wuxw   业主详情开发完成
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
        this.ownerDetailHisInfo.logStartTime = logStartTime
        this.ownerDetailHisInfo.logEndTime = logEndTime
        this.ownerDetailHisInfo.staffNameLike = staffNameLike
        this._getColumns(() => {
          this._loadOwnerDetailHisData(1, this.pagination.pageSize)
        })
      },
      _loadOwnerDetailHisData(page, row) {
        const params = {
          communityId: getCommunityId(),
          memberId: this.ownerDetailHisInfo.ownerId,
          ownerNameLike: this.ownerDetailHisInfo.ownerNameLike,
          logStartTime: this.ownerDetailHisInfo.logStartTime,
          logEndTime: this.ownerDetailHisInfo.logEndTime,
          staffNameLike: this.ownerDetailHisInfo.staffNameLike,
          page: page,
          row: row
        }
  
        queryHisOwner(params)
          .then(response => {
            const data = response.data
887fa33a   wuxw   v1.9 优化业主详情房屋费用不显...
108
109
110
            this.ownerDetailHisInfo.owners = data
            this.dealOwnerAttr(data)
            this.pagination.total = response.records
c85e0853   wuxw   业主详情开发完成
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
            this.pagination.currentPage = page
          })
          .catch(error => {
            console.error('请求失败:', error)
          })
      },
      handleCurrentChange(currentPage) {
        this._loadOwnerDetailHisData(currentPage, this.pagination.pageSize)
      },
      dealOwnerAttr(owners) {
        if (!owners) {
          return
        }
        owners.forEach(item => {
          this._getColumnsValue(item)
        })
      },
      _getColumnsValue(owner) {
        owner.listValues = []
        if (!Object.prototype.hasOwnProperty.call(owner, 'ownerAttrDtos') || owner.ownerAttrDtos.length < 1) {
          this.ownerDetailHisInfo.listColumns.forEach(() => {
            owner.listValues.push('')
          })
          return
        }
        const ownerAttrDtos = owner.ownerAttrDtos
        this.ownerDetailHisInfo.listColumns.forEach(value => {
          let tmpValue = ''
          ownerAttrDtos.forEach(attrItem => {
            if (value === attrItem.specName) {
              tmpValue = attrItem.valueName
            }
          })
          owner.listValues.push(tmpValue)
        })
      },
      _getColumns(callback) {
        this.ownerDetailHisInfo.listColumns = []
27dcfde5   wuxw   系统全面测试完成
149
        getAttrSpecList({specCd:'building_owner_attr',page:1,row:10}).then(data => {
c85e0853   wuxw   业主详情开发完成
150
          this.ownerDetailHisInfo.listColumns = []
887fa33a   wuxw   v1.9 优化业主详情房屋费用不显...
151
          data.data.forEach(item => {
c85e0853   wuxw   业主详情开发完成
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
            if (item.listShow === 'Y') {
              this.ownerDetailHisInfo.listColumns.push(item.specName)
            }
          })
          callback()
        })
      },
      _getHisOwnerOperate(owner) {
        let ownerCount = 0
        this.ownerDetailHisInfo.owners.forEach(item => {
          if (owner.bId === item.bId) {
            ownerCount += 1
          }
        })
        if (ownerCount <= 1) {
          if (owner.operate === 'ADD') {
            return this.$t('ownerDetailHis.add')
          }
          if (owner.operate === 'DEL') {
            return this.$t('ownerDetailHis.delete')
          }
          return '-'
        }
        if (owner.operate === 'ADD') {
          return this.$t('ownerDetailHis.modifyNew')
        }
        if (owner.operate === 'DEL') {
          return this.$t('ownerDetailHis.modifyOld')
        }
        return '-'
      }
    }
  }
  </script>
  
  <style scoped>
  .margin-top {
    margin-top: 20px;
  }
  
  .text-right {
    text-align: right;
  }
  </style>