解决数据同步保存按钮异常问题

This commit is contained in:
zhouyuejun
2019-03-18 16:04:03 +08:00
parent 1305c8f615
commit d7bb19635a
2 changed files with 14 additions and 10 deletions
@@ -28,7 +28,7 @@
</div>
</div>
<div class="user-footer">
<button (click)='save()' nz-button nzType="primary" class="mr10" [disabled]='!dateRange'>确定</button>
<button (click)='save()' nz-button nzType="primary" class="mr10" [disabled]='!search.startDate||!search.endDate'>确定</button>
<!-- <button (click)='cancel()' nz-button nzType="default">取消</button> -->
</div>
</div>
@@ -12,7 +12,7 @@ export class DataSynchronizeComponent implements OnInit {
selectedValue: any = '1';
dateRange: any = '';
search: any = {
startDate: '',
startDate: '',
endDate: ''
}
constructor(
@@ -63,14 +63,18 @@ export class DataSynchronizeComponent implements OnInit {
//日期时间处理
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 ;
if(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 ;
}else{
return '';
}
}
//保存