55 lines
1.6 KiB
TypeScript
55 lines
1.6 KiB
TypeScript
import { Component, OnInit } from '@angular/core';
|
|
import { HttpClientService } from '../../../services/http-client.service';
|
|
import { Router } from '@angular/router';
|
|
import { NzMessageService,NzModalRef, NzModalService } from 'ng-zorro-antd';
|
|
|
|
@Component({
|
|
selector: 'app-data-synchronize',
|
|
templateUrl: './data-synchronize.component.html',
|
|
styleUrls: ['./data-synchronize.component.scss']
|
|
})
|
|
export class DataSynchronizeComponent implements OnInit {
|
|
selectedValue:any='1';
|
|
dateRange:any='';
|
|
search:any={
|
|
startDate:'',
|
|
endDate:''
|
|
}
|
|
constructor(
|
|
private http:HttpClientService,
|
|
private message: NzMessageService,
|
|
private modal: NzModalService,
|
|
) { }
|
|
|
|
ngOnInit() {
|
|
}
|
|
onChange(result: Date): void {
|
|
this.search.startDate=this.changeDate(result[0]);
|
|
this.search.endDate=this.changeDate(result[1]);
|
|
|
|
}
|
|
//日期时间处理
|
|
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;
|
|
}
|
|
|
|
//保存
|
|
save(){
|
|
this.http.post('/msgexchangeapi/schd/sync',this.search).subscribe((json)=>{
|
|
if(json.is_success){
|
|
this.message.success(`提交成功!`);
|
|
}else{
|
|
this.message.error(`提交失败!`);
|
|
}
|
|
})
|
|
}
|
|
|
|
}
|