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
/**
 入驻小区
 **/
(function (vc) {
    var DEFAULT_PAGE = 1;
    var DEFAULT_ROWS = 10;
    vc.extends({
        data: {
            repairDispatchManageInfo: {
                ownerRepairs: [],
                total: 0,
                records: 1,
                moreCondition: false,
                repairName: '',
                repairTypes: [],
                states: [],
                conditions: {
                    repairId: '',
                    repairName: '',
                    tel: '',
                    repairType: '',
                    roomId: '',
                    roomName: '',
                    ownerId: '',
                    userId: vc.getData('/nav/getUserInfo').userId,
                    userName: vc.getData('/nav/getUserInfo').userName,
                    state: ''
                }
            }
        },
        _initMethod: function () {
            vc.getDict('r_repair_pool', "state", function (_data) {
                $that.repairDispatchManageInfo.states = _data;
            });
            $that._listOwnerRepairs(DEFAULT_PAGE, DEFAULT_ROWS);
            $that._listRepairTypes(DEFAULT_PAGE, DEFAULT_ROWS);
            //与字典表关联
            vc.getDict('r_repair_pool', "state", function (_data) {
                $that.repairDispatchManageInfo.states = _data;
            });
        },
        _initEvent: function () {
            vc.on('repairDispatchManage', 'listOwnerRepair', function (_param) {
                $that._listOwnerRepairs(DEFAULT_PAGE, DEFAULT_ROWS);
            });
            vc.on('pagination', 'page_event', function (_currentPage) {
                $that._listOwnerRepairs(_currentPage, DEFAULT_ROWS);
            });
        },
        methods: {
            _validateParam: function () {
                var _ownerId = vc.getParam('ownerId')
                var _roomId = vc.getParam('roomId')
                if (!vc.notNull(_roomId)) {
                    vc.toast("非法操作,未找到房屋信息");
                    vc.jumpToPage('/#/pages/property/listOwner');
                    return;
                }
                $that.repairDispatchManageInfo.conditions.roomId = _roomId;
                $that.repairDispatchManageInfo.conditions.ownerId = _ownerId;
                let param = {
                    params: {
                        roomId: $that.repairDispatchManageInfo.conditions.roomId,
                        communityId: vc.getCurrentCommunity().communityId,
                        page: 1,
                        row: 1
                    }
                };
                //查询房屋信息 业主信息
                vc.http.apiGet('/room.queryRooms',
                    param,
                    function (json, res) {
                        if (res.status == 200) {
                            var _roomInfos = JSON.parse(json);
                            if (!_roomInfos.hasOwnProperty("rooms")) {
                                vc.toast("非法操作,未找到房屋信息");
                                vc.jumpToPage('/#/pages/property/listOwner');
                                return;
                            }
                            let _roomInfo = _roomInfos.rooms[0];
                            $that.repairDispatchManageInfo.conditions.roomName = _roomInfo.floorNum + "号楼 " + _roomInfo.unitNum + "单元 " + _roomInfo.roomNum + "室";
                            $that._listOwnerRepairs(DEFAULT_PAGE, DEFAULT_ROWS);
                        } else {
                            vc.toast("非法操作,未找到房屋信息");
                            vc.jumpToPage('/#/pages/property/listOwner');
                        }
                    },
                    function (errInfo, error) {
                        console.log('请求失败处理');
                        vc.toast("非法操作,未找到房屋信息");
                        vc.jumpToPage('/#/pages/property/listOwner');
                    }
                );
            },
            _listOwnerRepairs: function (_page, _rows) {
                $that.repairDispatchManageInfo.conditions.page = _page;
                $that.repairDispatchManageInfo.conditions.row = _rows;
                $that.repairDispatchManageInfo.conditions.communityId = vc.getCurrentCommunity().communityId;
                var param = {
                    params: $that.repairDispatchManageInfo.conditions
                };
                param.params.repairId = param.params.repairId.trim();
                param.params.repairName = param.params.repairName.trim();
                param.params.tel = param.params.tel.trim();
                //发送get请求
                vc.http.apiGet('/ownerRepair.listStaffRepairs',
                    param,
                    function (json, res) {
                        var _repairDispatchManageInfo = JSON.parse(json);
                        $that.repairDispatchManageInfo.total = _repairDispatchManageInfo.total;
                        $that.repairDispatchManageInfo.records = _repairDispatchManageInfo.records;
                        $that.repairDispatchManageInfo.ownerRepairs = _repairDispatchManageInfo.data;
                        vc.emit('pagination', 'init', {
                            total: $that.repairDispatchManageInfo.records,
                            dataCount: $that.repairDispatchManageInfo.total,
                            currentPage: _page
                        });
                    },
                    function (errInfo, error) {
                        console.log('请求失败处理');
                    }
                );
            },
            //查询
            _queryOwnerRepairMethod: function () {
                $that._listOwnerRepairs(DEFAULT_PAGE, DEFAULT_ROWS);
            },
            //重置
            _resetOwnerRepairMethod: function () {
                $that.repairDispatchManageInfo.conditions.repairId = "";
                $that.repairDispatchManageInfo.conditions.repairName = "";
                $that.repairDispatchManageInfo.conditions.tel = "";
                $that.repairDispatchManageInfo.conditions.repairType = "";
                $that.repairDispatchManageInfo.conditions.state = "";
                $that._listOwnerRepairs(DEFAULT_PAGE, DEFAULT_ROWS);
            },
            //办结
            _openFinishRepair: function (_ownerRepair) {
                // vc.emit('finishRepair', 'openFinishRepairModal', _ownerRepair);
                vc.jumpToPage('/#/pages/property/finishRepair?repairType=' + _ownerRepair.repairType + '&repairId=' + _ownerRepair.repairId + '&repairObjType=' + _ownerRepair.repairObjType + '&publicArea=' + _ownerRepair.publicArea + '&repairChannel=' + _ownerRepair.repairChannel);
            },
            //详情
            _openDispatchRepairDetail: function (_ownerRepair) {
                //vc.emit('ownerRepairDetail','openOwnerRepairDetailModal',_ownerRepair);
                vc.jumpToPage('/#/pages/property/ownerRepairDetail?repairId=' + _ownerRepair.repairId);
            },
            //查询报修类型
            _listRepairTypes: function (_page, _rows) {
                var param = {
                    params: {
                        page: _page,
                        row: _rows,
                        communityId: vc.getCurrentCommunity().communityId
                    }
                };
                //发送get请求
                vc.http.apiGet('repair.listRepairSettings',
                    param,
                    function (json, res) {
                        var _repairTypesInfo = JSON.parse(json);
                        $that.repairDispatchManageInfo.repairTypes = _repairTypesInfo.data;
                    },
                    function (errInfo, error) {
                        console.log('请求失败处理');
                    }
                );
            },
            _moreCondition: function () {
                if ($that.repairDispatchManageInfo.moreCondition) {
                    $that.repairDispatchManageInfo.moreCondition = false;
                } else {
                    $that.repairDispatchManageInfo.moreCondition = true;
                }
            },
            //转单
            _openDispatchRepairModel: function (_repair) {
                _repair.action = "TRANSFER";
                vc.emit('dispatchRepair', 'openDispatchRepairModal', _repair);
            },
            //退单
            _openBackRepairModel: function (_repair) {
                _repair.action = "BACK";
                vc.emit('dispatchRepair', 'openDispatchRepairModal', _repair);
            },
            //回访
            _openAppraiseRepair: function (_repair) {
                vc.emit('appraiseRepair', 'openAppraiseRepairModal', _repair);
            },
            //暂停
            _openStopRepair: function (_repair) {
                vc.emit('stopRepair', 'openStopRepairModal', _repair);
            },
            //启动
            _openStartRepair: function (_repair) {
                vc.emit('startRepair', 'openStartRepairModal', _repair);
            }
        }
    });
})(window.vc);