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
/**
 入驻小区
 **/
(function (vc) {
    var DEFAULT_PAGE = 1;
    var DEFAULT_ROWS = 10;
    vc.extends({
        data: {
            scheduleClassesPageInfo: {
                staffs: [],
                scheduleClassess: [],
                maxDay: 30,
                curMonth: '',
                curYear: '',
                total: 0,
                records: 1,
                moreCondition: false,
                states: '',
                conditions: {
                    staffNameLike: '',
                    scheduleId: '',
                    curDate: '',
                    orgId: '',
                    orgName: ''
                }
            }
        },
        _initMethod: function () {
            $that.initStaffDate();
            $that._listStaffScheduleClassess(DEFAULT_PAGE, DEFAULT_ROWS);
            $that._listScheduleClassess(DEFAULT_PAGE, DEFAULT_ROWS);
        },
        _initEvent: function () {
            vc.on('scheduleClassesPage', 'listScheduleClasses', function (_param) {
                $that._listStaffScheduleClassess(DEFAULT_PAGE, DEFAULT_ROWS);
            });
            vc.on('pagination', 'page_event', function (_currentPage) {
                $that._listStaffScheduleClassess(_currentPage, DEFAULT_ROWS);
            });
            vc.on('scheduleClassesPage', 'switchOrg', function (_org) {
                $that.scheduleClassesPageInfo.conditions.orgId = _org.orgId;
                $that.scheduleClassesPageInfo.conditions.orgName = _org.allOrgName;
            });
        },
        methods: {
            initStaffDate: function () {
                let _date = new Date(new Date());
                $that.scheduleClassesPageInfo.curMonth = _date.getMonth() + 1
                $that.scheduleClassesPageInfo.curYear = _date.getFullYear();
                $that.scheduleClassesPageInfo.conditions.curDate = _date.getFullYear() + "-" + (_date.getMonth() + 1);
                $that.scheduleClassesPageInfo.maxDay = new Date(_date.getFullYear(), _date.getMonth() + 1, 0).getDate();
                vc.initDateMonth('queryDate', function (_value) {
                    $that.scheduleClassesPageInfo.conditions.curDate = _value;
                    let _values = _value.split('-');
                    $that.scheduleClassesPageInfo.curYear = _values[0];
                    $that.scheduleClassesPageInfo.curMonth = _values[1];
                    $that._listStaffScheduleClassess(DEFAULT_PAGE, DEFAULT_ROWS);
                })
            },
            _listStaffScheduleClassess: function (_page, _rows) {
                $that.scheduleClassesPageInfo.conditions.page = _page;
                $that.scheduleClassesPageInfo.conditions.row = _rows;
                let param = {
                    params: $that.scheduleClassesPageInfo.conditions
                };
                //发送get请求
                vc.http.apiGet('/scheduleClasses.staffMonthScheduleClasses',
                    param,
                    function (json, res) {
                        let _json = JSON.parse(json);
                        $that.scheduleClassesPageInfo.total = _json.total;
                        $that.scheduleClassesPageInfo.records = _json.records;
                        $that.scheduleClassesPageInfo.staffs = _json.data;
                        vc.emit('pagination', 'init', {
                            total: $that.scheduleClassesPageInfo.records,
                            dataCount: $that.scheduleClassesPageInfo.total,
                            currentPage: _page
                        });
                    },
                    function (errInfo, error) {
                        console.log('请求失败处理');
                    }
                );
            },
            //查询
            _queryScheduleClassesMethod: function () {
                $that._listStaffScheduleClassess(DEFAULT_PAGE, DEFAULT_ROWS);
            },
            _resetScheduleClassesMethod: function () {
                $that.scheduleClassesPageInfo.conditions = {
                    staffNameLike: '',
                    scheduleId: '',
                    curDate: '',
                    orgId: '',
                    orgName: ''
                }
                let _date = new Date(new Date());
                $that.scheduleClassesPageInfo.conditions.curDate = _date.getFullYear() + "-" + (_date.getMonth() + 1);
            },
            _moreCondition: function () {
                if ($that.scheduleClassesPageInfo.moreCondition) {
                    $that.scheduleClassesPageInfo.moreCondition = false;
                } else {
                    $that.scheduleClassesPageInfo.moreCondition = true;
                }
            },
            _listScheduleClassess: function (_page, _rows) {
                let param = {
                    params: {
                        page: 1,
                        row: 100
                    }
                };
                //发送get请求
                vc.http.apiGet('/scheduleClasses.listScheduleClasses',
                    param,
                    function (json, res) {
                        let _json = JSON.parse(json);
                        $that.scheduleClassesPageInfo.scheduleClassess = _json.data;
                    },
                    function (errInfo, error) {
                        console.log('请求失败处理');
                    }
                );
            },
            _exportScheduleClasses: function () {
                //vc.jumpToPage('/callComponent/exportReportFee/exportData?pagePath=reportPayFeeDetail&' + vc.objToGetParam($that.reportPayFeeDetailInfo.conditions));
                $that.scheduleClassesPageInfo.conditions.communityId = vc.getCurrentCommunity().communityId;
                $that.scheduleClassesPageInfo.conditions.pagePath = 'reportStaffMonthScheduleClasses';
                let param = {
                    params: $that.scheduleClassesPageInfo.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('请求失败处理');
                    });
            },
            _staffChangeOrg: function () {
                vc.emit('chooseOrgTree', 'openOrgModal', {});
            },
            _computeTableDivWidth:function(){
                let mainWidth = document.getElementsByTagName('body')[0].clientWidth - document.getElementById('menu-nav').offsetWidth;
                //let treeWidth = document.getElementsByClassName('room-floor-unit-tree')[0].offsetWidth;
                mainWidth = mainWidth - 20 -15 - 20;
                //document.getElementsByClassName('hc-table-div')[0].style.width=mainWidth+'px';
                return mainWidth+'px';
            },
        }
    });
})(window.vc);