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
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
/**
 入驻小区
 **/
(function (vc) {
    var DEFAULT_PAGE = 1;
    var DEFAULT_ROWS = 10;
    vc.extends({
        data: {
            reportRepairInfo: {
                repairs: [],
                communitys:[],
                total: 0,
                records: 1,
                moreCondition: false,
                title: '',
                states: '',
                repairUsers: '',
                conditions: {
                    staffId: '',
                    staffName: '',
                    state: '',
                    stateName: '',
                    amount: '',
                    beginStartTime: '',
                    beginEndTime: '',
                    finishStartTime: '',
                    finishEndTime: '',
                    dealNumber: '',   //处理中总数量
                    dispatchNumber: '',   //派单总数量
                    transferOrderNumber: '',   //转单总数量
                    chargebackNumber: '',    //退单总数量
                    statementNumber: '',   //结单总数量
                    returnNumber: '',   //回访总数量
                    score: '',
                    communityId: ''
                }
            }
        },
        _initMethod: function () {
            $that._initDate();
            $that.reportRepairInfo.conditions.communityId = vc.getCurrentCommunity().communityId;
            $that._loadStaffCommunitys();
            $that._listRepairs(DEFAULT_PAGE, DEFAULT_ROWS);
            //关联字典表费用类型
            vc.getDict('r_repair_user', "state", function (_data) {
                $that.reportRepairInfo.states = _data;
            });
            $(".popover-show").mouseover(() => {
                $('.popover-show').popover('show');
            })
            $(".popover-show").mouseleave(() => {
                $('.popover-show').popover('hide');
            })
        },
        _initEvent: function () {
            vc.on('pagination', 'page_event', function (_currentPage) {
                $that._listRepairs(_currentPage, DEFAULT_ROWS);
            });
        },
        methods: {
            _initDate: function () {
                $(".begin_start_time").datetimepicker({
                    minView: "month",
                    language: 'zh-CN',
                    fontAwesome: 'fa',
                    format: 'yyyy-mm-dd',
                    initTime: true,
                    initialDate: new Date(),
                    autoClose: 1,
                    todayBtn: true,
                    clearBtn: true
                });
                $(".begin_end_time").datetimepicker({
                    minView: "month",
                    language: 'zh-CN',
                    fontAwesome: 'fa',
                    format: 'yyyy-mm-dd',
                    initTime: true,
                    initialDate: new Date(),
                    autoClose: 1,
                    todayBtn: true,
                    clearBtn: true
                });
                $(".finish_start_time").datetimepicker({
                    minView: "month",
                    language: 'zh-CN',
                    fontAwesome: 'fa',
                    format: 'yyyy-mm-dd',
                    initTime: true,
                    initialDate: new Date(),
                    autoClose: 1,
                    todayBtn: true,
                    clearBtn: true
                });
                $(".finish_end_time").datetimepicker({
                    minView: "month",
                    language: 'zh-CN',
                    fontAwesome: 'fa',
                    format: 'yyyy-mm-dd',
                    initTime: true,
                    initialDate: new Date(),
                    autoClose: 1,
                    todayBtn: true,
                    clearBtn: true
                });
                $('.begin_start_time').datetimepicker()
                    .on('changeDate', function (ev) {
                        var value = $(".begin_start_time").val();
                        $that.reportRepairInfo.conditions.beginStartTime = value;
                    });
                $('.begin_end_time').datetimepicker()
                    .on('changeDate', function (ev) {
                        var value = $(".begin_end_time").val();
                        $that.reportRepairInfo.conditions.beginEndTime = value;
                        let start = Date.parse(new Date($that.reportRepairInfo.conditions.beginStartTime))
                        let end = Date.parse(new Date($that.reportRepairInfo.conditions.beginEndTime))
                        if (start - end > 0) {
                            vc.toast("结束时间必须大于开始时间")
                            $that.reportRepairInfo.conditions.beginEndTime = '';
                        }
                    });
                $('.finish_start_time').datetimepicker()
                    .on('changeDate', function (ev) {
                        var value = $(".finish_start_time").val();
                        $that.reportRepairInfo.conditions.finishStartTime = value;
                    });
                $('.finish_end_time').datetimepicker()
                    .on('changeDate', function (ev) {
                        var value = $(".finish_end_time").val();
                        $that.reportRepairInfo.conditions.finishEndTime = value;
                        let start = Date.parse(new Date($that.reportRepairInfo.conditions.finishStartTime))
                        let end = Date.parse(new Date($that.reportRepairInfo.conditions.finishEndTime))
                        if (start - end > 0) {
                            vc.toast("结束时间必须大于开始时间")
                            $that.reportRepairInfo.conditions.finishEndTime = '';
                        }
                    });
                //防止多次点击时间插件失去焦点
                document.getElementsByName('beginStartTime')[0].addEventListener('click', myfunc)
 
                function myfunc(e) {
                    e.currentTarget.blur();
                }
 
                document.getElementsByName("beginEndTime")[0].addEventListener('click', myfunc)
 
                function myfunc(e) {
                    e.currentTarget.blur();
                }
 
                document.getElementsByName('finishStartTime')[0].addEventListener('click', myfunc)
 
                function myfunc(e) {
                    e.currentTarget.blur();
                }
 
                document.getElementsByName("finishEndTime")[0].addEventListener('click', myfunc)
 
                function myfunc(e) {
                    e.currentTarget.blur();
                }
            },
            //查询
            _queryMethod: function () {
                $that._listRepairs(DEFAULT_PAGE, DEFAULT_ROWS);
            },
            //查询方法
            _listRepairs: function (_page, _rows) {
                $that.reportRepairInfo.conditions.page = _page;
                $that.reportRepairInfo.conditions.row = _rows;
                //$that.reportRepairInfo.conditions.communityId = vc.getCurrentCommunity().communityId;
                var param = {
                    params: $that.reportRepairInfo.conditions
                };
                //发送get请求
                vc.http.apiGet('/reportFeeMonthStatistics/queryRepair',
                    param,
                    function (json, res) {
                        var _reportRepairInfo = JSON.parse(json);
                        $that.reportRepairInfo.total = _reportRepairInfo.total;
                        $that.reportRepairInfo.records = _reportRepairInfo.records;
                        $that.reportRepairInfo.repairs = _reportRepairInfo.data;
                        $that.reportRepairInfo.repairUsers = _reportRepairInfo.sumTotal;
                        //处理中总数量
                        $that.reportRepairInfo.conditions.dealNumber = _reportRepairInfo.rep.dealNumber;
                        //派单总数量
                        $that.reportRepairInfo.conditions.dispatchNumber = _reportRepairInfo.rep.dispatchNumber;
                        //转单总数量
                        $that.reportRepairInfo.conditions.transferOrderNumber = _reportRepairInfo.rep.transferOrderNumber;
                        //退单总数量
                        $that.reportRepairInfo.conditions.chargebackNumber = _reportRepairInfo.rep.chargebackNumber;
                        //结单总数量
                        $that.reportRepairInfo.conditions.statementNumber = _reportRepairInfo.rep.statementNumber;
                        //回访总数量
                        $that.reportRepairInfo.conditions.returnNumber = _reportRepairInfo.rep.returnNumber;
                        vc.emit('pagination', 'init', {
                            total: $that.reportRepairInfo.records,
                            currentPage: _page,
                            dataCount: $that.reportRepairInfo.total
                        });
                    }, function (errInfo, error) {
                        console.log('请求失败处理');
                    }
                );
            },
            //重置
            _resetMethod: function (_page, _rows) {
                $that._resetListRepairs(DEFAULT_PAGE, DEFAULT_ROWS);
            },
            _resetListRepairs: function (_page, _rows) {
                vc.component.reportRepairInfo.conditions.staffId = "";
                vc.component.reportRepairInfo.conditions.staffName = "";
                vc.component.reportRepairInfo.conditions.beginStartTime = "";
                vc.component.reportRepairInfo.conditions.beginEndTime = "";
                vc.component.reportRepairInfo.conditions.finishStartTime = "";
                vc.component.reportRepairInfo.conditions.finishEndTime = "";
                vc.component.reportRepairInfo.conditions.state = "";
                vc.component.reportRepairInfo.conditions.stateName = "";
                vc.component._listRepairs(DEFAULT_PAGE, DEFAULT_ROWS);
            },
            _moreCondition: function () {
                if ($that.reportRepairInfo.moreCondition) {
                    $that.reportRepairInfo.moreCondition = false;
                } else {
                    $that.reportRepairInfo.moreCondition = true;
                }
            },
            _exportFee: function () {
               // vc.jumpToPage('/callComponent/exportReportFee/exportData?pagePath=reportRepairDetail&' + vc.objToGetParam($that.reportRepairInfo.conditions));
                $that.reportRepairInfo.conditions.pagePath = 'reportRepairDetail';
                let _param = {
                    params: $that.reportRepairInfo.conditions
                }
                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('请求失败处理');
                });
            },
            _loadStaffCommunitys: function () {
                let param = {
                    params: {
                        _uid: '123mlkdinkldldijdhuudjdjkkd',
                        page: 1,
                        row: 100,
                    }
                };
                vc.http.apiGet('/community.listMyEnteredCommunitys',
                    param,
                    function (json, res) {
                        if (res.status == 200) {
                            let _data = JSON.parse(json);
                            $that.reportRepairInfo.communitys = _data.communitys;
                        }
                    }, function () {
                        console.log('请求失败处理');
                    }
                );
            },
            _changCommunity:function(){
                $that._listRepairs(DEFAULT_PAGE, DEFAULT_ROWS);
            }
        }
    });
})(window.vc);