wuxw
2020-01-12 91f80f9969a2ce3a7138a6a58ca21d6bab33d7ca
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
(function (vc) {
    var DEFAULT_PAGE = 1;
    var DEFAULT_ROWS = 10;
    vc.extends({
        data: {
            indexOpenDoorAnalysisInfo: {
                analysis: [],
                openTypeCd: '1000',
                total: 0,
                records: 1,
                startTime: '',
                endTime: ''
            }
        },
        _initMethod: function () {
            //vc.component._listAnalysisData(DEFAULT_PAGE,DEFAULT_ROWS);
            vc.component._initMachineRecordData();
            vc.component._initOpenDoorAnalysisDateInfo();
        },
        _initEvent: function () {
            vc.on("indexOpenDoorAnalysis", "_listAnalysisData", function () {
                vc.component._listAnalysisData(DEFAULT_PAGE, DEFAULT_ROWS);
            });
        },
        methods: {
            _initMachineRecordData: function () {
                var dom = document.getElementById("machine-record");
                dom.style.width = (window.innerWidth * 0.9) + 'px';
                var myChart = echarts.init(dom);
 
                var app = {};
                option = null;
                app.title = '坐标轴刻度与标签对齐';
 
                option = {
                    color: ['#3398DB'],
                    tooltip: {
                        trigger: 'axis',
                        axisPointer: {            // 坐标轴指示器,坐标轴触发有效
                            type: 'shadow'        // 默认为直线,可选为:'line' | 'shadow'
                        }
                    },
                    grid: {
                        left: '3%',
                        right: '4%',
                        bottom: '3%',
                        containLabel: true
                    },
                    xAxis: [
                        {
                            type: 'category',
                            data: ['12月9日', '12月10日', '12月11日', '12月12日', '12月13日', '12月14日', '12月15日'],
                            axisTick: {
                                alignWithLabel: true
                            }
                        }
                    ],
                    yAxis: [
                        {
                            type: 'value'
                        }
                    ],
                    series: [
                        {
                            name: '开门次数',
                            type: 'bar',
                            barWidth: '60%',
                            data: [10, 52, 200, 334, 390, 330, 220]
                        }
                    ]
                };
                if (option && typeof option === "object") {
                    myChart.setOption(option, true);
                }
            },
            _initOpenDoorAnalysisDateInfo: function () {
                vc.component.indexOpenDoorAnalysisInfo.startTime = vc.dateFormat(new Date().getTime());
                $('.start_time').datetimepicker({
                    language: 'zh-CN',
                    format: 'yyyy-mm-dd hh:ii:ss',
                    initTime: true,
                    initialDate: new Date(),
                    autoClose: 1,
                    todayBtn: true
 
                });
                $('.start_time').datetimepicker()
                    .on('changeDate', function (ev) {
                        var value = $(".start_time").val();
                        vc.component.indexOpenDoorAnalysisInfo.startTime = value;
                    });
                $('.end_time').datetimepicker({
                    language: 'zh-CN',
                    format: 'yyyy-mm-dd hh:ii:ss',
                    initTime: true,
                    initialDate: new Date(),
                    autoClose: 1,
                    todayBtn: true
                });
                $('.end_time').datetimepicker()
                    .on('changeDate', function (ev) {
                        var value = $(".end_time").val();
                        vc.component.indexOpenDoorAnalysisInfo.endTime = value;
                    });
            },
            _listOpenDoorData: function (_page, _row) {
                if (vc.getCurrentCommunity() == null || vc.getCurrentCommunity == undefined) {
                    return;
                }
                var param = {
                    params: {
                        page: _page,
                        row: _row,
                        communityId: vc.getCurrentCommunity().communityId,
                        openTypeCd: vc.component.indexOpenDoorAnalysisInfo.openTypeCd
                    }
                }
 
                //发送get请求
                vc.http.get('listAnalysis',
                    'list',
                    param,
                    function (json, res) {
                        var listAnalysisData = JSON.parse(json);
 
                        vc.component.indexOpenDoorAnalysisInfo.total = listAnalysisData.total;
                        vc.component.indexOpenDoorAnalysisInfo.records = listAnalysisData.records;
                        vc.component.indexOpenDoorAnalysisInfo.arrears = listAnalysisData.arrears;
 
                        vc.emit('pagination', 'init', {
                            total: vc.component.indexOpenDoorAnalysisInfo.records,
                            currentPage: _page
                        });
                    }, function (errInfo, error) {
                        console.log('请求失败处理');
                    }
                );
 
            },
            _switchOpenType: function (_openTypeCd) {
                console.log('_openTypeCd')
                vc.component.indexOpenDoorAnalysisInfo.openTypeCd = _openTypeCd;
                vc.component._listOpenDoorData(DEFAULT_PAGE, DEFAULT_ROWS);
            }
        }
    })
})(window.vc);