fengxiang
2018-07-30 af9fa5a094ca652293a890f06634b59c955e1067
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
import { Component, OnInit, OnDestroy } from '@angular/core';
import { NzMessageService } from 'ng-zorro-antd';
import { _HttpClient } from '@delon/theme';
import { HttpClient } from '@angular/common/http';
import * as moment from 'moment';
import { DeviceService } from '@business/services/http/device.service';
 
@Component({
    selector: 'statistics-calender',
    templateUrl: './calendar.component.html',
    styleUrls: ['./calendar.component.less'],
    providers: [DeviceService]
})
export class CalendarComponent implements OnInit, OnDestroy {
 
    data: any = {};
    public calendarDayCells:{
       [key : string] : {
         'status': string,
         'statusName': string,
         'data': {}
       }
    } = {};
    constructor(
        private deviceService: DeviceService,
        private http: _HttpClient,
        public msg: NzMessageService,
        private http2: HttpClient) {
    }
 
    ngOnInit() {
        const day = Number(moment().format('DD'));
        for(let index = 1;index <= day; index++) {
            this.calendarDayCells[('0'+index).slice(-2)] = {
                status: 'processing',
                statusName: '加载中',
                data: {}
            }
        }
        // console.log(this.calendarDayCells);
    }
 
    ngOnDestroy(): void {
    }
    // 日历单元格 被点击
    calendarClick(mo: moment.Moment) {
        console.log(mo.format('DD'));
    }
    public isExpire(mo: moment.Moment):boolean {
        //  console.log(moment().valueOf());
        //  console.log(mo.valueOf());
        //  console.log(moment().valueOf() < mo.valueOf());
         return moment().valueOf() < mo.valueOf();
    }
    loadCalendar(event) {
        console.log(event);
    }
}