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
273
274
275
276
/**
 入驻小区
 **/
(function (vc) {
    var DEFAULT_PAGE = 1;
    var DEFAULT_ROWS = 10;
    vc.extends({
        data: {
            reportFeeSummaryInfo: {
                fees: [],
                feeConfigs: [],
                floors: [],
                configIds: [],
                feeTypeCds: [],
                communitys: [],
                total: 0,
                records: 1,
                moreCondition: false,
                conditions: {
                    floorId: '',
                    objName: '',
                    startDate: '',
                    endDate: '',
                    configId: '',
                    feeTypeCd: '',
                    ownerName: '',
                    link: '',
                    communityId: ''
                }
            }
        },
        _initMethod: function () {
            $that.reportFeeSummaryInfo.conditions.communityId = vc.getCurrentCommunity().communityId
            $that._initDate();
            $that._loadStaffCommunitys();
            $that._listFeeConfigs();
            vc.getDict('pay_fee_config', "fee_type_cd", function (_data) {
                $that.reportFeeSummaryInfo.feeTypeCds = _data
            });
            vc.emit('selectCommunityFloor', 'initCommunityFloor', {
                callBack: function (_floor) {
                    $that.reportFeeSummaryInfo.conditions.floorId = _floor.floorId;
                    $that._listFees(DEFAULT_PAGE, DEFAULT_ROWS);
                }
            })
            $that._listFees(DEFAULT_PAGE, DEFAULT_ROWS);
        },
        _initEvent: function () {
        },
        methods: {
            _initDate: function () {
                /*vc.initDate('startDate', function (_value) {
                    $that.reportFeeSummaryInfo.conditions.startDate = _value;
                });
                vc.initDate('endDate', function (_value) {
                    $that.reportFeeSummaryInfo.conditions.endDate = _value;
                });*/
                $('.startDate').datetimepicker({
                    language: 'zh-CN',
                    fontAwesome: 'fa',
                    format: 'yyyy-mm-dd',
                    minView: "month",
                    initTime: true,
                    initialDate: new Date(),
                    autoClose: 1,
                    todayBtn: true
                });
                $('.startDate').datetimepicker()
                    .on('changeDate', function (ev) {
                        var value = $(".startDate").val();
                        var start = Date.parse(new Date(value));
                        var end = Date.parse(new Date($that.reportFeeSummaryInfo.conditions.endDate));
                        if (start - end >= 0) {
                            vc.toast("计费起始时间必须小于计费终止时间");
                            $(".startDate").val('');
                            $that.reportFeeSummaryInfo.conditions.startDate = "";
                        } else {
                            $that.reportFeeSummaryInfo.conditions.startDate = value;
                        }
                    });
                $('.endDate').datetimepicker({
                    language: 'zh-CN',
                    fontAwesome: 'fa',
                    format: 'yyyy-mm-dd',
                    minView: "month",
                    initTime: true,
                    initialDate: new Date(),
                    autoClose: 1,
                    todayBtn: true
                });
                $('.endDate').datetimepicker()
                    .on('changeDate', function (ev) {
                        var value = $(".endDate").val();
                        var start = Date.parse(new Date($that.reportFeeSummaryInfo.conditions.startDate));
                        var end = Date.parse(new Date(value));
                        if (start - end >= 0) {
                            vc.toast("计费终止时间必须大于计费起始时间");
                            $(".endDate").val('');
                            $that.reportFeeSummaryInfo.conditions.endDate = "";
                        } else {
                            $that.reportFeeSummaryInfo.conditions.endDate = value;
                        }
                    });
                //防止多次点击时间插件失去焦点
                document.getElementsByClassName(' form-control startDate')[0].addEventListener('click', myfunc)
 
                function myfunc(e) {
                    e.currentTarget.blur();
                }
 
                document.getElementsByClassName(" form-control endDate")[0].addEventListener('click', myfunc)
 
                function myfunc(e) {
                    e.currentTarget.blur();
                }
 
                let _data = new Date();
                let _month = _data.getMonth() + 1;
                let _newDate = "";
                if (_month < 10) {
                    _newDate = _data.getFullYear() + "-0" + _month + "-01";
                } else {
                    _newDate = _data.getFullYear() + "-" + _month + "-01";
                }
                $that.reportFeeSummaryInfo.conditions.startDate = _newDate;
                _data.setMonth(_data.getMonth() + 1);
                _data.setDate(0);
                _month = _data.getMonth() + 1;
                if (_month < 10) {
                    _newDate = _data.getFullYear() + "-0" + _month + '-' + _data.getDate();
                } else {
                    _newDate = _data.getFullYear() + "-" + _month + '-' + _data.getDate();
                }
                $that.reportFeeSummaryInfo.conditions.endDate = _newDate;
            },
            //查询
            _queryMethod: function () {
                $that._listFees(DEFAULT_PAGE, DEFAULT_ROWS);
            },
            //查询方法
            _listFees: function (_page, _rows) {
                $that.reportFeeSummaryInfo.conditions.page = _page;
                $that.reportFeeSummaryInfo.conditions.row = _rows;
                //$that.reportFeeSummaryInfo.conditions.communityId = vc.getCurrentCommunity().communityId;
                let param = {
                    params: $that.reportFeeSummaryInfo.conditions
                };
                if ($that.reportFeeSummaryInfo.configIds.length > 0) {
                    param.params.configIds = $that.reportFeeSummaryInfo.configIds.join(',');
                } else {
                    param.params.configIds = $that.reportFeeSummaryInfo.configIds;
                }
                //发送get请求
                vc.http.apiGet('/reportFeeMonthStatistics.queryReportFeeSummary',
                    param,
                    function (json, res) {
                        let _json = JSON.parse(json)
                        if (_json.code == 0) {
                            let _json = JSON.parse(json);
                            $that.reportFeeSummaryInfo.fees = _json.data;
                        } else {
                            vc.toast(_json.msg);
                        }
                    },
                    function (errInfo, error) {
                        console.log('请求失败处理');
                    }
                );
                //楼栋收费率
                vc.emit('floorFeeSummary', 'notify', param.params);
                vc.emit('configFeeSummary', 'notify', param.params);
            },
            //重置
            _resetMethod: function (_page, _rows) {
                /*$that.reportFeeSummaryInfo.conditions.startDate = "";
                $that.reportFeeSummaryInfo.conditions.endDate = "";*/
                $that.reportFeeSummaryInfo.conditions.roomNum = "";
                $that.reportFeeSummaryInfo.conditions.ownerName = "";
                $that.reportFeeSummaryInfo.conditions.link = "";
                $that.reportFeeSummaryInfo.conditions.feeTypeCd = "";
                $that.reportFeeSummaryInfo.conditions.floorName = "";
                $that.reportFeeSummaryInfo.conditions.floorId = "";
                $that.reportFeeSummaryInfo.conditions.unitId = "";
                $that.reportFeeSummaryInfo.configIds = [];
                $that.reportFeeSummaryInfo.conditions.configId = "";
                $that._listFees(DEFAULT_PAGE, DEFAULT_ROWS);
            },
            _listFeeConfigs: function () {
                let param = {
                    params: {
                        page: 1,
                        row: 100,
                        communityId: $that.reportFeeSummaryInfo.conditions.communityId,
                        isDefault: 'F'
                    }
                };
                //发送get请求
                vc.http.apiGet('/feeConfig.listFeeConfigs', param,
                    function (json, res) {
                        let _json = JSON.parse(json);
                        $that.reportFeeSummaryInfo.feeConfigs = _json.feeConfigs;
                    },
                    function (errInfo, error) {
                        console.log('请求失败处理');
                    });
            },
            _moreCondition: function () {
                if ($that.reportFeeSummaryInfo.moreCondition) {
                    $that.reportFeeSummaryInfo.moreCondition = false;
                } else {
                    $that.reportFeeSummaryInfo.moreCondition = true;
                }
            },
 
            _exportExcel: function () {
                //vc.jumpToPage('/callComponent/exportReportFee/exportData?pagePath=reportFeeSummary&' + vc.objToGetParam($that.reportFeeSummaryInfo.conditions));
                //$that.reportFeeSummaryInfo.conditions.communityId = vc.getCurrentCommunity().communityId;
                $that.reportFeeSummaryInfo.conditions.pagePath = 'reportFeeSummary';
                let param = {
                    params: $that.reportFeeSummaryInfo.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('请求失败处理');
                    });
            },
            _toDetail: function (_fee) {
                let _configIds = "";
                $that.reportFeeSummaryInfo.feeConfigNames.forEach(item => {
                    _configIds += (item.configId + ',')
                })
                if (_configIds.endsWith(',')) {
                    _configIds = _configIds.substring(0, _configIds.length - 1);
                }
                vc.jumpToPage('/#/pages/property/reportFeeSummaryDetail?feeYear=' + _fee.feeYear + "&feeMonth=" + _fee.feeMonth +
                    "&configIds=" + _configIds + "&" + vc.objToGetParam($that.reportFeeSummaryInfo.conditions))
            },
            _printFeeSummary: function () {
                let _param = vc.objToGetParam($that.reportFeeSummaryInfo.conditions);
                window.open('/print.html#/pages/property/reportFeeSummaryPrint?' + _param);
            },
            _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.reportFeeSummaryInfo.communitys = _data.communitys;
                        }
                    }, function () {
                        console.log('请求失败处理');
                    }
                );
            },
            _changCommunity: function () {
                $that._listFeeConfigs();
                $that._listFees(DEFAULT_PAGE, DEFAULT_ROWS);
            }
        }
    });
})(window.vc);