Skip to content
warning-track-info.component.ts 1.52 KiB
Newer Older
wangqinghua's avatar
wangqinghua committed
import {Component, Input, OnInit} from '@angular/core';
import {EarlyWarningService} from '../../earlyWarning.service';
import {NzMessageService} from 'ng-zorro-antd';

@Component({
    selector: 'smart-warning-track-info',
    templateUrl: './warning-track-info.component.html',
    styles: []
})
export class WarningTrackInfoComponent implements OnInit {

    @Input() msgId;
    @Input() title;

    warnList = [];

    page = {
        pageNum: 1,
        pageCount: 10,
        totalNum: 0,
        loading: false,
    };

    constructor(public warningSer: EarlyWarningService, public message: NzMessageService,
    ) {
    }

    ngOnInit() {
wangqinghua's avatar
wangqinghua committed
        this.getList()
wangqinghua's avatar
wangqinghua committed
    }

    outGet() {
        this.page.pageNum = 1;
        this.getList();
    }

    diffResource() {
        this.getList();
    }

    //跟踪信息
    getList() {
        this.page.loading = true;
        const data = {
            pageNum: this.page.pageNum,
            pageCount: this.page.pageCount,
            msgId: this.msgId
        };
        this.warningSer.msgPageWarningMsg(data).subscribe(
            (res) => {
                if (res.errCode == 10000) {
                    if (res.data) {
                        this.warnList = res.data.data;
                        this.page.totalNum = res.data.totalNum;
                    }
                }
                this.page.loading = false;
            }
        );
    }

    //翻页
    change(e) {
        if (e > 0) {
            this.page.pageNum = e;
            this.getList();
        }
    }

}