zhangjq
2026-01-28 e7fff4b19129140e8af61ff7c243ec7bbad4190f
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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
(function (vc) {
    var DEFAULT_PAGE = 1;
    var DEFAULT_ROWS = 10;
    vc.extends({
        data: {
            listOwnerCarInfo: {
                ownerCars: [],
                total: 0,
                records: 1,
                num: '',
                moreCondition: false,
                carTypeCds: [],
                leaseTypes: [],
                conditions: {
                    carNum: '',
                    carNumLike: '',
                    num: '',
                    valid: '',
                    carTypeCd: '1001',
                    leaseType: '',
                    ownerName: '',
                    link: '',
                    memberCarNumLike: '',
                    // 新增字段
                //   communityCode: '',
    floorNum: '',
    unitNum: '',
    roomNum: '',
    carTypeCdName: '',
    endTime: '',
    firstPaymentDate: '',
    paymentDeadlineDate: '',
    unitPricePerMonth: ''
 
 
 
 
                },
                listColumns: [],
                currentPage: DEFAULT_PAGE,
                listColumns: [],
                currentPage: DEFAULT_PAGE
            }
        },
        _initMethod: function () {
            $that._listOwnerCar(DEFAULT_PAGE, DEFAULT_ROWS);
        },
        _initEvent: function () {
            vc.on('listOwnerCar', 'listOwnerCarData', function () {
                $that._listOwnerCar($that.listOwnerCarInfo.currentPage, DEFAULT_ROWS);
            });
            vc.on('pagination', 'page_event', function (_currentPage) {
                $that.listOwnerCarInfo.currentPage = _currentPage;
 
                $that._listOwnerCar(_currentPage, DEFAULT_ROWS);
            });
            //与字典表关联
            vc.getDict('owner_car', "car_type_cd", function (_data) {
                $that.listOwnerCarInfo.carTypeCds = _data;
            });
            //与字典表关联
            vc.getDict('owner_car', "lease_type", function (_data) {
                $that.listOwnerCarInfo.leaseTypes = [{
                    statusCd: '',
                    name: '全部车辆'
                }];
                _data.forEach(item => {
                    $that.listOwnerCarInfo.leaseTypes.push(item);
                });
                $that.listOwnerCarInfo.leaseTypes.push({
                    statusCd: 'expireCar',
                    name: '到期车辆'
                })
            });
        },
        methods: {
            swatchLeaseType: function (_item) {
                $that.listOwnerCarInfo.conditions.leaseType = _item.statusCd;
                $that.listOwnerCarInfo.currentPage = DEFAULT_PAGE;
                $that._listOwnerCar(DEFAULT_PAGE, DEFAULT_ROWS);
            },
            _listOwnerCar: function (_page, _row) {
                let _params = vc.deepClone($that.listOwnerCarInfo.conditions);
                _params.page = _page;
                _params.row = _row;
                _params.communityId = vc.getCurrentCommunity().communityId;
                let param = {
                    params: _params
                }
                param.params.carNumLike = param.params.carNumLike.trim();
                param.params.num = param.params.num.trim();
                param.params.ownerName = param.params.ownerName.trim();
                param.params.link = param.params.link.trim();
                if (_params.leaseType == 'expireCar') {
                    _params.leaseType = '';
                    _params.valid = 3;
                }
                //发送get请求
                vc.http.apiGet('/owner.queryOwnerCars',
                    param,
                    function (json, res) {
                        let _json = JSON.parse(json);
                        $that.listOwnerCarInfo.total = _json.total;
                        $that.listOwnerCarInfo.records = _json.records;
                        $that.listOwnerCarInfo.ownerCars = _json.data;
                        $that.dealCarAttr(_json.data);
                        vc.emit('pagination', 'init', {
                            total: $that.listOwnerCarInfo.records,
                            dataCount: $that.listOwnerCarInfo.total,
                            currentPage: _page
                        });
                    },
                    function (errInfo, error) {
                        console.log('请求失败处理');
                    }
                );
            },
            _addOwnerCar: function () { //出租
                vc.jumpToPage('/#/pages/property/hireParkingSpace');
            },
            _openEditOwnerCar: function (_car) {
                vc.emit('editCar', 'openEditCar', _car);
            },
            //查询
            _queryMethod: function () {
                $that._listOwnerCar(DEFAULT_PAGE, DEFAULT_ROWS);
            },
            //重置
            _resetMethod: function () {
                $that.listOwnerCarInfo.conditions.carNumLike = "";
                $that.listOwnerCarInfo.conditions.num = "";
                $that.listOwnerCarInfo.conditions.valid = "";
                $that.listOwnerCarInfo.conditions.leaseType = "H";
                $that.listOwnerCarInfo.conditions.ownerName = "";
                $that.listOwnerCarInfo.conditions.link = "";
                $that.listOwnerCarInfo.currentPage = DEFAULT_PAGE;
                $that._listOwnerCar(DEFAULT_PAGE, DEFAULT_ROWS);
            },
            _moreCondition: function () {
                if ($that.listOwnerCarInfo.moreCondition) {
                    $that.listOwnerCarInfo.moreCondition = false;
                } else {
                    $that.listOwnerCarInfo.moreCondition = true;
                }
            },
            _openDelOwnerCarModel: function (_car) {
                vc.emit('deleteOwnerCar', 'openOwnerCarModel', _car);
            },
            _deleteCarParkingSpace: function (_car) {
                vc.http.apiPost(
                    '/owner.deleteCarParkingSpace',
                    JSON.stringify(_car), {
                        emulateJSON: true
                    },
                    function (json, res) {
                        let _json = JSON.parse(json);
                        if (_json.code == 0) {
                            $that._listOwnerCar(DEFAULT_PAGE, DEFAULT_ROWS);
                            vc.toast('释放成功');
                            return;
                        } else {
                            vc.toast(_json.msg);
                        }
                    },
                    function (errInfo, error) {
                        console.log('请求失败处理');
                        vc.toast(errInfo);
                    });
            },
            _addCarParkingSpace: function (_car) {
                vc.jumpToPage('/#/pages/property/carAddParkingSpace?carId=' + _car.carId);
            },
            _toBuyCarMonthCard: function (_car) {
                vc.jumpToPage('/#/pages/fee/buyCarMonthCard?carNum=' + _car.carNum );
            },
            _toCarMember: function (car) {
                vc.jumpToPage('/#/pages/property/listOwnerCarMember?carId=' + car.carId + "&carNum=" + car.carNum)
            },
            _getCarState: function (car) {
                if (car.state != null && car.state != '' && car.state != 'undefined' && car.state == '3003') {
                    return "到期";
                }
                let _carEndTime = new Date(car.endTime);
                if (_carEndTime.getTime() > new Date().getTime()) {
                    return "正常";
                }
                return "到期";
            },
            _openOwnerCarImport: function () {
                vc.emit('importOwnerCar', 'openImportOwnerCarModal', {});
            },
            dealCarAttr: function (cars) {
                $that._getColumns(cars, function () {
                    cars.forEach(item => {
                        $that._getColumnsValue(item);
                    });
                });
            },
            _getColumnsValue: function (_car) {
                _car.listValues = [];
                if (!_car.hasOwnProperty('ownerCarAttrDto') || _car.ownerCarAttrDto.length < 1) {
                    $that.listOwnerCarInfo.listColumns.forEach(_value => {
                        _car.listValues.push('');
                    })
                    return;
                }
                let _carAttrDtos = _car.ownerCarAttrDto;
                $that.listOwnerCarInfo.listColumns.forEach(_value => {
                    let _tmpValue = '';
                    _carAttrDtos.forEach(_attrItem => {
                        if (_value == _attrItem.specName) {
                            _tmpValue = _attrItem.valueName;
                        }
                    })
                    _car.listValues.push(_tmpValue);
                })
            },
            _getColumns: function (_cars, _call) {
                $that.listOwnerCarInfo.listColumns = [];
                vc.getAttrSpec('owner_car_attr', function (data) {
                    $that.listOwnerCarInfo.listColumns = [];
                    data.forEach(item => {
                        if (item.listShow == 'Y') {
                            $that.listOwnerCarInfo.listColumns.push(item.specName);
                        }
                    });
                    _call();
                });
            },
            _viewOwner: function (_car) {
                let param = {
                    params: {
                        page: 1,
                        row: 1,
                        memberId: _car.ownerId,
                        communityId: vc.getCurrentCommunity().communityId,
                        ownerTypeCd: '1001'
                    }
                }
                vc.http.apiGet('/owner.queryOwners',
                    param,
                    function (json, res) {
                        let _owner = JSON.parse(json).data[0];
                        let _data = {
                            "业主编号": _owner.ownerId,
                            "业主名称": _owner.name,
                            "性别": _owner.sex == 0 ? '男' : '女',
                            "身份证": _owner.idCard,
                            "联系方式": _owner.link,
                            "家庭住址": _owner.address,
                            "备注": _owner.remark,
                        };
                        if (_owner.ownerAttrDtos && _owner.ownerAttrDtos.length > 0) {
                            _owner.ownerAttrDtos.forEach(attr => {
                                _data[attr.specCdName] = attr.value;
                            })
                        }
                        vc.emit('viewData', 'openViewDataModal', {
                            title: _owner.name + " 详情",
                            data: _data
                        });
                    },
                    function (errInfo, error) {
                        console.log('请求失败处理');
                    }
                );
            },
            _viewIotStateRemark: function (_car) {
                let _data = {
                    "同步说明": _car.iotRemark
                };
                vc.emit('viewData', 'openViewDataModal', {
                    title: _car.carNum + " 同步物联网详情",
                    data: _data
                });
            },
            _exportExcel: function () {
                //vc.jumpToPage('/callComponent/exportReportFee/exportData?pagePath=reportFeeSummary&' + vc.objToGetParam($that.reportFeeSummaryInfo.conditions));
                $that.listOwnerCarInfo.conditions.communityId = vc.getCurrentCommunity().communityId;
                $that.listOwnerCarInfo.conditions.pagePath = 'exportOwnerCar';
                let param = {
                    params: $that.listOwnerCarInfo.conditions
                };
                //发送get请求
                vc.http.apiGet('/export.exportData', param,
                    function (json, res) {
                        let _json = JSON.parse(json);
                        vc.toast(_json.msg);
                        if (_json.code == 0) {
                            vc.jumpToPage('/#/pages/property/downloadTempFile?tab=下载中心')
                        }
                    },
                    function (errInfo, error) {
                        console.log('请求失败处理');
                    });
            },
        }
    })
})(window.vc);