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
/**
 入驻小区
 **/
(function (vc) {
    var DEFAULT_PAGE = 1;
    var DEFAULT_ROWS = 10;
    vc.extends({
        data: {
            maintainanceTaskManageInfo: {
                maintainanceTasks: [],
                total: 0,
                records: 1,
                moreCondition: false,
                taskId: '',
                stateTypes: [],
                conditions: {
                    planUserName: '',
                    planId: '',
                    planName: '',
                    actInsTime: '',
                    startTime: '',
                    endTime: '',
                    state: ''
                }
            }
        },
        _initMethod: function () {
            //与字典表关联
            vc.getDict('maintainance_task', "state", function (_data) {
                vc.component.maintainanceTaskManageInfo.stateTypes = _data;
            });
            vc.component._initMaintainanceTaskDateInfo();
            vc.component._listMaintainanceTasks(DEFAULT_PAGE, DEFAULT_ROWS);
        },
        _initEvent: function () {
            vc.on('maintainanceTaskManage', 'listMaintainanceTask', function (_param) {
                vc.component._listMaintainanceTasks(DEFAULT_PAGE, DEFAULT_ROWS);
            });
            vc.on('maintainanceTaskManage', 'pageReload', function (_param) {
                location.reload();
            });
            vc.on('pagination', 'page_event', function (_currentPage) {
                vc.component._listMaintainanceTasks(_currentPage, DEFAULT_ROWS);
            });
        },
        methods: {
            _initMaintainanceTaskDateInfo: function () {
                $('.startTime').datetimepicker({
                    language: 'zh-CN',
                    fontAwesome: 'fa',
                    format: 'yyyy-mm-dd hh:ii:ss',
                    initTime: true,
                    initialDate: new Date(),
                    autoClose: 1,
                    todayBtn: true
                });
                $('.startTime').datetimepicker()
                    .on('changeDate', function (ev) {
                        var value = $(".startTime").val();
                        vc.component.maintainanceTaskManageInfo.conditions.startTime = value;
                    });
                $('.endTime').datetimepicker({
                    language: 'zh-CN',
                    fontAwesome: 'fa',
                    format: 'yyyy-mm-dd hh:ii:ss',
                    initTime: true,
                    initialDate: new Date(),
                    autoClose: 1,
                    todayBtn: true
                });
                $('.endTime').datetimepicker()
                    .on('changeDate', function (ev) {
                        var value = $(".endTime").val();
                        vc.component.maintainanceTaskManageInfo.conditions.endTime = value;
                    });
                //防止多次点击时间插件失去焦点
                document.getElementsByClassName(' form-control startTime')[0].addEventListener('click', myfunc)
 
                function myfunc(e) {
                    e.currentTarget.blur();
                }
 
                document.getElementsByClassName(" form-control endTime")[0].addEventListener('click', myfunc)
 
                function myfunc(e) {
                    e.currentTarget.blur();
                }
            },
            _listMaintainanceTasks: function (_page, _rows) {
                vc.component.maintainanceTaskManageInfo.conditions.page = _page;
                vc.component.maintainanceTaskManageInfo.conditions.row = _rows;
                $that.maintainanceTaskManageInfo.conditions.communityId = vc.getCurrentCommunity().communityId;
                var param = {
                    params: vc.component.maintainanceTaskManageInfo.conditions
                };
                param.params.planUserName = param.params.planUserName.trim();
                param.params.planId = param.params.planId.trim();
                param.params.planName = param.params.planName.trim();
                //发送get请求
                vc.http.apiGet('/maintainanceTask.listMaintainanceTask',
                    param,
                    function (json, res) {
                        var _maintainanceTaskManageInfo = JSON.parse(json);
                        vc.component.maintainanceTaskManageInfo.total = _maintainanceTaskManageInfo.total;
                        vc.component.maintainanceTaskManageInfo.records = _maintainanceTaskManageInfo.records;
                        vc.component.maintainanceTaskManageInfo.maintainanceTasks = _maintainanceTaskManageInfo.data;
                        vc.emit('pagination', 'init', {
                            total: vc.component.maintainanceTaskManageInfo.records,
                            dataCount: vc.component.maintainanceTaskManageInfo.total,
                            currentPage: _page
                        });
                    },
                    function (errInfo, error) {
                        console.log('请求失败处理');
                    }
                );
            },
            _openMaintainanceTaskDetail: function (_maintainanceTask) {
                vc.emit('maintainanceTaskDetail', 'openMaintainanceTaskDetail', _maintainanceTask);
            },
            _openMaintainanceTaskTransfer: function (_maintainanceTask) {
                vc.emit('maintainanceTaskTransfer', 'openMaintainanceTaskTransferModal', _maintainanceTask);
            },
            _openDeleteMaintainanceTask: function (_maintainanceTask) {
                vc.emit('deleteMaintainanceTask', 'openDeleteMaintainanceTaskModal', _maintainanceTask);
            },
            //查询
            _queryMaintainanceTaskMethod: function () {
                vc.component._listMaintainanceTasks(DEFAULT_PAGE, DEFAULT_ROWS);
            },
            //重置
            _resetMaintainanceTaskMethod: function () {
                vc.component.maintainanceTaskManageInfo.conditions.planUserName = "";
                vc.component.maintainanceTaskManageInfo.conditions.planId = "";
                vc.component.maintainanceTaskManageInfo.conditions.planName = "";
                vc.component.maintainanceTaskManageInfo.conditions.startTime = "";
                vc.component.maintainanceTaskManageInfo.conditions.endTime = "";
                vc.component.maintainanceTaskManageInfo.conditions.state = "";
                vc.component._listMaintainanceTasks(DEFAULT_PAGE, DEFAULT_ROWS);
            },
            _moreCondition: function () {
                if (vc.component.maintainanceTaskManageInfo.moreCondition) {
                    vc.component.maintainanceTaskManageInfo.moreCondition = false;
                } else {
                    vc.component.maintainanceTaskManageInfo.moreCondition = true;
                }
            }
        }
    });
})(window.vc);