Skip to content
pause.component.ts 1.27 KiB
Newer Older
wangqinghua's avatar
wangqinghua committed
import {Component, OnInit} from '@angular/core';
import {OverAllService} from '../../overAll/overAll.service';
import { DatePipe } from '@angular/common';
wangqinghua's avatar
wangqinghua committed
import {NzMessageService} from 'ng-zorro-antd';
wangqinghua's avatar
wangqinghua committed

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

    modalTitle = '临时暂停(服务器时间)';
    isShow = false;
    data = {
        startTime: null,
        time: ''
    };
    hostId;  //主机id
wangqinghua's avatar
wangqinghua committed
    constructor(public overAllSer: OverAllService,public datePipe:DatePipe,
                public message:NzMessageService) {
wangqinghua's avatar
wangqinghua committed
    }

    ngOnInit() {
    }

    showModal(id) {
        this.hostId = id;
        this.isShow = true;
    }

    handleCancel() {
        this.isShow = false;
    }

    handleOk() {
        const data = {
wangqinghua's avatar
wangqinghua committed
            hostId: Number(this.hostId),
wangqinghua's avatar
wangqinghua committed
            startTime: this.datePipe.transform(this.data.startTime,'yyyy-MM-dd HH:MM:ss'),
            time: Number(this.data.time)
        };
wangqinghua's avatar
wangqinghua committed
        this.overAllSer.tempStop(data).subscribe(
wangqinghua's avatar
wangqinghua committed
            (res) => {
wangqinghua's avatar
wangqinghua committed
                    if(res.errCode == 10000){
                        this.isShow = false;
                    }
                this.message.info(res.errMsg);