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
(function (vc) {
    vc.extends({
        data: {
            ownerRepairDetailInfo: {
                repairId: '',
                repairType: '',
                repairTypeName: '',
                repairName: '',
                tel: '',
                roomId: '',
                roomName: '',
                repairObjName: '',
                appointmentTime: '',
                submitHours:'',
                timeout:'',
                finishTime:'',
                context: '',
                stateName: '',
                userId: '',
                userName: '',
                repairUsers: [],
                photos: [],
                beforePhotos: [],
                afterPhotos: [],
                visitType: '',
                visitContext: '',
                maintenanceType: '',
                repairMaterials: '',
                repairFee: '',
                resourceStoreInfo: [],
                appraiseScore: 0,
                doorSpeedScore: 0,
                repairmanServiceScore: 0,
                average: 0.0
            }
        },
        _initMethod: function () {
            let repairId = vc.getParam('repairId');
            if (!vc.notNull(repairId)) {
                vc.toast('非法操作');
                vc.jumpToPage('/#/pages/property/repairPoolManage');
                return;
            }
            $that.ownerRepairDetailInfo.repairId = repairId;
            $that._listRepairPools()
        },
        _initEvent: function () {
            vc.on('ownerRepairDetail','notifyRepairUser',function(){
                $that._loadRepairUser();
            })
        },
        methods: {
            _getRoom: function () {
                var param = {
                    params: {
                        roomId: $that.ownerRepairDetailInfo.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('/#/listOwner');
                                return;
                            }
                            var _roomInfo = _roomInfos.rooms[0];
                            $that.ownerRepairDetailInfo.roomName = _roomInfo.floorNum + "号楼 " + _roomInfo.unitNum + "单元 " + _roomInfo.roomNum + "室";
                        } else {
                            vc.toast("非法操作,未找到房屋信息");
                        }
                    },
                    function (errInfo, error) {
                        console.log('请求失败处理');
                        vc.toast("非法操作,未找到房屋信息");
                    }
                );
            },
            _listRepairPools: function () {
                let param = {
                    params: {
                        page: 1,
                        row: 1,
                        communityId: vc.getCurrentCommunity().communityId,
                        repairId: $that.ownerRepairDetailInfo.repairId
                    }
                };
                //发送get请求
                vc.http.apiGet('/ownerRepair.listOwnerRepairs',
                    param,
                    function (json, res) {
                        var _repairPoolManageInfo = JSON.parse(json);
                        let _repairs = _repairPoolManageInfo.data;
                        if (_repairs.length < 1) {
                            vc.toast("数据异常");
                            vc.jumpToPage('/#/pages/property/repairPoolManage');
                            return;
                        }
                        vc.copyObject(_repairs[0], $that.ownerRepairDetailInfo);
                        //查询房屋信息
                        //$that._getRoom();
                        // 查询物品信息
                        if ($that.ownerRepairDetailInfo.maintenanceType == '1001' || $that.ownerRepairDetailInfo.maintenanceType == '1003') {
                            $that._loadResourceStoreList();
                        }
                        //查询处理轨迹
                        $that._loadRepairUser();
                    },
                    function (errInfo, error) {
                        console.log('请求失败处理');
                    }
                );
            },
            _loadResourceStoreList: function () {
                var param = {
                    params: {
                        page: 1,
                        row: 100,
                        communityId: vc.getCurrentCommunity().communityId,
                        repairId: $that.ownerRepairDetailInfo.repairId
                    }
                };
                //发送get请求
                vc.http.apiGet('/resourceStore.listResourceStoreUseRecords',
                    param,
                    function (json, res) {
                        let _json = JSON.parse(json);
                        let _resource = _json.data;
                        $that.ownerRepairDetailInfo.resourceStoreInfo = _resource;
                        $that.ownerRepairDetailInfo.resourceStoreInfo.forEach((item) => {
                            if (item.resId == '666666') {
                                item.rstName = item.specName = '自定义';
                            }
                        })
                    },
                    function (errInfo, error) {
                        console.log('请求失败处理');
                    }
                );
            },
            _loadRepairUser: function () {
                var param = {
                    params: {
                        page: 1,
                        row: 100,
                        communityId: vc.getCurrentCommunity().communityId,
                        repairId: $that.ownerRepairDetailInfo.repairId
                    }
                };
                //发送get请求
                vc.http.apiGet('/ownerRepair.listRepairStaffs',
                    param,
                    function (json, res) {
                        let _json = JSON.parse(json);
                        let _repairs = _json.data;
                        $that.ownerRepairDetailInfo.repairUsers = _repairs;
                    },
                    function (errInfo, error) {
                        console.log('请求失败处理');
                    }
                );
            },
            _goBack: function () {
                vc.goBack()
            },
            openFile: function (_photo) {
                vc.emit('viewImage', 'showImage', {
                    url: _photo.url
                });
            },
            /**
             * 新增打印功能,跳转打印页面
             */
            _printRepairDetail: function () {
                window.open("/print.html#/pages/property/printRepairDetail?repairId=" + $that.ownerRepairDetailInfo.repairId + "&repairType=" + $that.ownerRepairDetailInfo.repairType)
            },
            _openRepairAppraise:function(_repairStaff){
                vc.emit('replyRepairAppraise', 'openReplyRepairAppraiseModal',_repairStaff);
            }
        }
    });
})(window.vc);