Files
airport-chengdu-web/src/app/pages/system-management/data-synchronize/data-synchronize.component.ts
T

55 lines
1.6 KiB
TypeScript
Raw Normal View History

2018-10-29 16:27:34 +08:00
import { Component, OnInit } from '@angular/core';
2018-12-21 18:28:32 +08:00
import { HttpClientService } from '../../../services/http-client.service';
import { Router } from '@angular/router';
2018-12-24 18:10:01 +08:00
import { NzMessageService,NzModalRef, NzModalService } from 'ng-zorro-antd';
2018-10-29 16:27:34 +08:00
@Component({
selector: 'app-data-synchronize',
templateUrl: './data-synchronize.component.html',
styleUrls: ['./data-synchronize.component.scss']
})
export class DataSynchronizeComponent implements OnInit {
2018-12-21 18:28:32 +08:00
selectedValue:any='1';
dateRange:any='';
search:any={
2018-12-24 18:10:01 +08:00
startDate:'',
endDate:''
2018-12-21 18:28:32 +08:00
}
2018-12-24 18:10:01 +08:00
constructor(
private http:HttpClientService,
private message: NzMessageService,
private modal: NzModalService,
) { }
2018-10-29 16:27:34 +08:00
2018-12-21 18:28:32 +08:00
ngOnInit() {
}
onChange(result: Date): void {
2018-12-24 18:10:01 +08:00
this.search.startDate=this.changeDate(result[0]);
this.search.endDate=this.changeDate(result[1]);
2018-12-21 18:28:32 +08:00
}
//日期时间处理
changeDate(time){
var date = new Date(time);
var Y = date.getFullYear()+'';
var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1)+'';
var D = (date.getDate()<10?'0'+date.getDate():date.getDate())+'';
var h = (date.getHours()<10?'0'+date.getHours():date.getHours())+'' ;
var m = (date.getMinutes()<10?'0'+date.getMinutes():date.getMinutes())+'';
var s = date.getSeconds()<10?'0'+date.getSeconds():date.getSeconds()+'';
return Y+'-'+M+'-'+D+' '+h+':'+m+':'+s;
}
2018-12-24 18:10:01 +08:00
//保存
save(){
this.http.post('/msgexchangeapi/schd/sync',this.search).subscribe((json)=>{
if(json.is_success){
this.message.success(`提交成功!`);
}else{
this.message.error(`提交失败!`);
}
})
}
2018-10-29 16:27:34 +08:00
}