zhangjiaqing
8 天以前 1cef3adee31c6934c0da4b4f0b8a6f5ac03b364f
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
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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
(function (vc) {
    var DEFAULT_PAGE = 1;
    var DEFAULT_ROWS = 10;
    vc.extends({
        data: {
            listOwnerInfo: {
                owners: [],
                personRoles: [],
                total: 0,
                records: 1,
                moreCondition: false,
                _currentOwnerId: '',
                _eventName: '',
                conditions: {
                    personRole: '',
                    ownerId: '',
                    name: '',
                    link: '',
                    idCard: '',
                    roomNum: '',
                    roomId: '',
                    roomName: '',
                    personType: ''
                },
                currentPage: DEFAULT_PAGE,
                listColumns: []
            }
        },
        _initMethod: function () {
 
            $that._getColumns(function () {
                $that._listOwnerData($that.listOwnerInfo.currentPage, DEFAULT_ROWS);
            });
            let _personRoles = [{
                statusCd: '',
                name: '全部'
            }];
            vc.getDict('building_owner', "person_role", function (_data) {
                _data.forEach(_d => {
                    _personRoles.push(_d);
                });
            });
            $that.listOwnerInfo.personRoles = _personRoles;
        },
        _initEvent: function () {
            vc.on('listOwner', 'listOwnerData', function () {
                $that._listOwnerData($that.listOwnerInfo.currentPage, DEFAULT_ROWS);
            });
            vc.on('pagination', 'page_event', function (_currentPage) {
                $that.listOwnerInfo.currentPage = _currentPage;
                $that._listOwnerData(_currentPage, DEFAULT_ROWS);
            });
            vc.on('listOwner', 'chooseRoom', function (_room) {
                if ($that.listOwnerInfo._eventName == 'PayPropertyFee') {
                    vc.jumpToPage("/#/pages/property/listRoomFee?" + vc.objToGetParam(_room));
                } else {
                    vc.jumpToPage("/#/pages/property/ownerRepairManage?ownerId=" + $that.listOwnerInfo._currentOwnerId + "&roomId=" + _room.roomId);
                }
            });
            vc.on('listOwner', 'chooseParkingSpace', function (_parkingSpace) {
                vc.jumpToPage("/#/pages/property/listParkingSpaceFee?" + vc.objToGetParam(_parkingSpace));
            });
        },
        methods: {
            _listOwnerData: function (_page, _row) {
                $that.listOwnerInfo.conditions.page = _page;
                $that.listOwnerInfo.conditions.row = _row;
                $that.listOwnerInfo.conditions.communityId = vc.getCurrentCommunity().communityId;
                let param = {
                    params: $that.listOwnerInfo.conditions
                }
                //发送get请求
                vc.http.apiGet('/owner.queryOwners',
                    param,
                    function (json, res) {
                        let _json = JSON.parse(json);
                        $that.listOwnerInfo.total = _json.total;
                        $that.listOwnerInfo.records = _json.records;
                        $that.listOwnerInfo.owners = _json.data;
                        $that.dealOwnerAttr(_json.data);
                        vc.emit('pagination', 'init', {
                            total: $that.listOwnerInfo.records,
                            dataCount: $that.listOwnerInfo.total,
                            currentPage: _page
                        });
                    },
                    function (errInfo, error) {
                        console.log('请求失败处理');
                    }
                );
            },
            _openAddOwnerModal: function () { //打开添加框
                vc.emit('addOwner', 'openAddOwnerModal', -1);
            },
            _openDelOwnerModel: function (_owner) { // 打开删除对话框
                vc.emit('deleteOwner', 'openOwnerModel', _owner);
            },
            _openEditOwnerModel: function (_owner) {
                vc.emit('editOwner', 'openEditOwnerModal', _owner);
            },
            //查询
            _queryOwnerMethod: function () {
                $that._listOwnerData(DEFAULT_PAGE, DEFAULT_ROWS);
            },
            //重置
            _resetOwnerMethod: function () {
                $that.listOwnerInfo.conditions = {
                    personRole: '',
                    ownerId: '',
                    name: '',
                    link: '',
                    idCard: '',
                    roomNum: '',
                    roomId: '',
                    roomName: '',
                    personType: ''
                };
                $that._listOwnerData(DEFAULT_PAGE, DEFAULT_ROWS);
            },
            _openAddOwnerRoom: function (_owner) {
                vc.jumpToPage("/#/pages/property/addOwnerRoomBinding?ownerId=" + _owner.ownerId);
            },
            _openHireParkingSpace: function (_owner) {
                vc.jumpToPage("/#/pages/property/hireParkingSpace?ownerId=" + _owner.ownerId);
            },
            _openSellParkingSpace: function (_owner) {
                vc.jumpToPage("/#/pages/property/sellParkingSpace?ownerId=" + _owner.ownerId);
            },
            _openOwnerDetailModel: function (_owner) {
                vc.jumpToPage("/#/pages/owner/ownerDetail?ownerId=" + _owner.ownerId + "&ownerName=" + _owner.name + "&needBack=true");
            },
            _openOwnerDetailMember: function (_owner) {
                vc.jumpToPage("/#/pages/owner/ownerDetail?ownerId=" + _owner.ownerId + "&ownerName=" + _owner.name + "&needBack=true&currentTab=ownerDetailMember");
            },
            _openDeleteOwnerRoom: function (_owner) {
                vc.jumpToPage("/#/pages/property/deleteOwnerRoom?ownerId=" + _owner.ownerId);
            },
            _openPayPropertyFee: function (_owner) {
                //查看 业主是否有多套房屋,如果有多套房屋,则提示对话框选择,只有一套房屋则直接跳转至交费页面缴费
                $that.listOwnerInfo._eventName = "PayPropertyFee";
                $that.listOwnerInfo._currentOwnerId = _owner.ownerId; // 暂存如果有多个房屋是回调回来时 ownerId 会丢掉
                var param = {
                    params: {
                        communityId: vc.getCurrentCommunity().communityId,
                        ownerId: _owner.ownerId
                    }
                }
                vc.http.apiGet('/room.queryRoomsByOwner',
                    param,
                    function (json, res) {
                        var listRoomData = JSON.parse(json);
                        var rooms = listRoomData.rooms;
                        if (rooms.length == 1) {
                            vc.jumpToPage("/#/pages/property/listRoomFee?" + vc.objToGetParam(rooms[0]));
                        } else if (rooms.length == 0) {
                            //vc.toast("当前业主未查询到房屋信息");
                            vc.toast("当前业主未查询到房屋信息");
                        } else {
                            vc.emit('searchRoom', 'showOwnerRooms', rooms);
                        }
                    },
                    function (errInfo, error) {
                        console.log('请求失败处理');
                    }
                );
            },
            _moreCondition: function () {
                if ($that.listOwnerInfo.moreCondition) {
                    $that.listOwnerInfo.moreCondition = false;
                } else {
                    $that.listOwnerInfo.moreCondition = true;
                }
            },
            dealOwnerAttr: function (owners) {
                if (!owners) {
                    return;
                }
                owners.forEach(item => {
                    $that._getColumnsValue(item);
                });
            },
            _getColumnsValue: function (_owner) {
                _owner.listValues = [];
                if (!_owner.hasOwnProperty('ownerAttrDtos') || _owner.ownerAttrDtos.length < 1) {
                    $that.listOwnerInfo.listColumns.forEach(_value => {
                        _owner.listValues.push('');
                    })
                    return;
                }
                let _ownerAttrDtos = _owner.ownerAttrDtos;
                $that.listOwnerInfo.listColumns.forEach(_value => {
                    let _tmpValue = '';
                    _ownerAttrDtos.forEach(_attrItem => {
                        if (_value == _attrItem.specName) {
                            _tmpValue = _attrItem.valueName;
                        }
                    })
                    _owner.listValues.push(_tmpValue);
                })
            },
            _getColumns: function (_call) {
                $that.listOwnerInfo.listColumns = [];
                vc.getAttrSpec('building_owner_attr', function (data) {
                    $that.listOwnerInfo.listColumns = [];
                    data.forEach(item => {
                        if (item.listShow == 'Y') {
                            $that.listOwnerInfo.listColumns.push(item.specName);
                        }
                    });
                    _call();
                });
            },
            _viewOwnerRooms: function (_owner) {
                vc.emit('ownerRooms', 'openOwnerRoomModel', _owner);
            },
            _viewOwnerMembers: function (_owner) {
                vc.emit('ownerMembers', 'openOwnerMemberModel', _owner);
            },
            _viewOwnerCars: function (_owner) {
                vc.emit('ownerCars', 'openOwnerCarModel', _owner);
            },
            _viewOweFees: function (_owner) {
                vc.emit('ownerOweFees', 'openOwnerOweFeeModel', _owner);
            },
            _viewOwnerFace: function (_url) {
                vc.emit('viewImage', 'showImage', {
                    url: _url
                });
            },
            swatchPersonRole: function (item) {
                $that.listOwnerInfo.conditions.personRole = item.statusCd;
                $that._listOwnerData(DEFAULT_PAGE, DEFAULT_ROWS);
            },
        }
    })
})(window.vc);