From 4ca96ffea633a15f979276153838c8c2eba9362d Mon Sep 17 00:00:00 2001 From: cpf <1105965053@qq.com> Date: Thu, 3 Sep 2020 11:20:41 +0800 Subject: [PATCH 1/2] =?UTF-8?q?[=E5=AE=8C=E5=96=84]=20=E6=A8=AA=E5=90=91?= =?UTF-8?q?=E7=BA=B5=E5=90=91=E6=9F=A5=E8=AF=A2=E5=8A=9F=E8=83=BD=E5=9F=BA?= =?UTF-8?q?=E6=9C=AC=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../page-two-time.component.html | 82 ++++++++++++------ .../page-two-time.component.scss | 47 +++++------ .../page-two-time/page-two-time.component.ts | 83 +++++++++---------- 3 files changed, 121 insertions(+), 91 deletions(-) diff --git a/src/app/statistic-analysis/state/page-two-time/page-two-time.component.html b/src/app/statistic-analysis/state/page-two-time/page-two-time.component.html index 885bdf7..522e47e 100644 --- a/src/app/statistic-analysis/state/page-two-time/page-two-time.component.html +++ b/src/app/statistic-analysis/state/page-two-time/page-two-time.component.html @@ -1,33 +1,67 @@
-
-
- -
- - - - -
- -
- - - - -
- -
- -
-
- -
-
+ +
+ + + + +
+ +
+
+ 开始年份: + + + {{item}} + + + 开始月份: + + + {{item}} + + + 结束年份: + + + {{item}} + + + 结束月份: + + + {{item}} + + + +
+
+ +
+
+ 开始年份: + + + {{item}} + + + 结束年份: + + + {{item}} + + + +
+
+ +
+
diff --git a/src/app/statistic-analysis/state/page-two-time/page-two-time.component.scss b/src/app/statistic-analysis/state/page-two-time/page-two-time.component.scss index 5984003..5bbff55 100644 --- a/src/app/statistic-analysis/state/page-two-time/page-two-time.component.scss +++ b/src/app/statistic-analysis/state/page-two-time/page-two-time.component.scss @@ -17,35 +17,34 @@ } } +//头部搜索栏 .header { - padding: 10px; - box-sizing: border-box; border-bottom: 1px solid #999; - min-height: 70px; - .queryBox { - box-sizing: border-box; - padding: 5px 15px; - display: flex; - flex-direction: row; - flex-wrap: wrap; - align-items:center; - justify-content:center; - .queryField { - margin: 0 15px; - font-size: 14px; - input { - width: 180px; - height: 22px; - line-height: 22px; - } - } - .btnbox{ - float: right; + height: 70px; + box-sizing: border-box; + padding: 0 15px; + display: flex; + flex-direction: row; + flex-wrap: wrap; + align-items:center; + justify-content:center; + .queryField { + margin: 0 10px; + font-size: 14px; + .mat-form-field { + width: 130px; + max-height: 50px;; + margin: 0 15px 0 10px; } - - } //queryBox + } + .fixedCss{ + position: fixed; + top: 78px; + right: 32px; + } } +//echarts div公有样式 .publicCss{ height: 350px; width: 50%; diff --git a/src/app/statistic-analysis/state/page-two-time/page-two-time.component.ts b/src/app/statistic-analysis/state/page-two-time/page-two-time.component.ts index b26dd39..618c624 100644 --- a/src/app/statistic-analysis/state/page-two-time/page-two-time.component.ts +++ b/src/app/statistic-analysis/state/page-two-time/page-two-time.component.ts @@ -20,18 +20,11 @@ export class PageTwoTimeComponent implements OnInit { @ViewChild('pageTwoName')pageTwoName :PageTwoNameComponent; //父组件中获得子组件的引用 ngOnInit(): void { - this.startTime = new FormControl( (new Date()).getFullYear()-10 ) - this.endTime = new FormControl( (new Date()).getFullYear() ) - this.adapter.setLocale('CH') + this.dateInit() } isQuery:boolean = true; //横纵向查询 - //查询 - query () { - - } - //shao toggleTrue () { this.isQuery = true @@ -44,54 +37,58 @@ export class PageTwoTimeComponent implements OnInit { this.echartsData.statefulInspectionToggle = true } - startTime:any; //查询开始时间 - endTime:any; //查询结束时间 - - //选择开始时间 - startEvent (e: MatDatepickerInputEvent) { - let nowTime = new Date() - if (nowTime < e.value) { + selectType:string = 'month'; //选择当前的 查询类型 按月/年 + + //查询数据 + years:any = [] + selectMonth:any = [1,2,3,4,5,6,7,8,9,10,11,12] + + //日期初始化 + dateInit () { + let date = (new Date()).getFullYear() + for (let i=date; i>=date-10;i--) { + this.years.unshift(i) + } + } + + selectOneYear:any = (new Date()).getFullYear() //开始年份 + selectTwoYear:any = (new Date()).getFullYear() //结束年份 + selectStartMonth:any = 1 //开始月份 + selectEndMonth:any = (new Date()).getMonth()+1 //结束月份 + //按月查询 + monthSubmit (e) { + if (e.selectTwoYear >= e.selectOneYear) { + let startTime = e.selectOneYear + '-' + e.selectStartMonth + '-' + 1 + ' ' + 0 + ':' + 0 +':'+ 0 + let endTime = e.selectTwoYear + '-' + e.selectEndMonth + '-' + 31 + ' ' + 23 + ':' + 59 +':'+ 59 + console.log(startTime) + console.log(endTime) + } else { const config = new MatSnackBarConfig(); config.verticalPosition = 'top'; config.duration = 3000 - this.snackBar.open('选择时间不能大于现在时间段','确定',config); - this.startTime = new FormControl( new Date(new Date().toLocaleDateString()) ) - } else { - this.startTime = new FormControl(e.value) + this.snackBar.open('请选择正确时间区段','确定',config); } } - //选择结束时间 - endEvent (e: MatDatepickerInputEvent) { - let oneDay:number = 86399000; //一天的毫秒数 - let selectDay = (e.value).toLocaleDateString() //选择的年月日 - let newDay = (new Date()).toLocaleDateString() //现在的年月日 - let nowTime = new Date() //现在的时间 - if (nowTime < e.value && selectDay!=newDay) { //选择时间段大于现在时间段时 + + selectStartYear:any = (new Date()).getFullYear() //开始年份 + selectEndYear:any = (new Date()).getFullYear() //结束年份 + //按年查询 + yearSubmit (e) { + if (e.selectEndYear >= e.selectStartYear) { + let startTime = e.selectStartYear + '-' + 1 + '-' + 1 + ' ' + 0 + ':' + 0 +':'+ 0 + let endTime = e.selectEndYear + '-' + 12 + '-' + 31 + ' ' + 23 + ':' + 59 +':'+ 59 + console.log(startTime) + console.log(endTime) + } else { const config = new MatSnackBarConfig(); config.verticalPosition = 'top'; config.duration = 3000 - this.snackBar.open('选择时间不能大于现在时间段','确定',config); - this.endTime = new FormControl( new Date() ) - } else if (nowTime > e.value && selectDay!=newDay) { //正常情况下 时间+1天 - this.endTime = new FormControl( new Date(e.value.getTime()+oneDay) ) - } else if ( selectDay == newDay ) { //选择时间段是今天时 - this.endTime = new FormControl( new Date() ) + this.snackBar.open('请选择正确时间区段','确定',config); } } - //处理时间 传入 new Date()格式 - getTime(date){ - let year = date.getFullYear(); //年 - let month = date.getMonth() + 1; //月 - let day = date.getDate(); //日 - let hour = date.getHours() //时 - let min = date.getMinutes(); //分 - let seconds = date.getSeconds(); //秒 - return year+'-'+month+'-'+ day + " "+ hour +':'+ min +':'+ seconds; - } - } From cd5d09e25aa73395b43de5560160cb3a860e75c3 Mon Sep 17 00:00:00 2001 From: cpf <1105965053@qq.com> Date: Thu, 3 Sep 2020 11:45:46 +0800 Subject: [PATCH 2/2] =?UTF-8?q?[=E5=AE=8C=E5=96=84]=20=E6=96=B0=E5=BB=BA?= =?UTF-8?q?=E8=AE=A1=E5=88=92=E6=9B=B4=E6=96=B0=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scheduled-updates.component.html | 1 + .../scheduled-updates.component.scss | 0 .../scheduled-updates.component.spec.ts | 25 +++++++++++++++++++ .../scheduled-updates.component.ts | 15 +++++++++++ .../page-two-time/page-two-time.component.ts | 16 ++++++++++-- .../statistic-analysis-routing.module.ts | 4 ++- .../statistic-analysis.module.ts | 3 ++- 7 files changed, 60 insertions(+), 4 deletions(-) create mode 100644 src/app/statistic-analysis/scheduled-updates/scheduled-updates.component.html create mode 100644 src/app/statistic-analysis/scheduled-updates/scheduled-updates.component.scss create mode 100644 src/app/statistic-analysis/scheduled-updates/scheduled-updates.component.spec.ts create mode 100644 src/app/statistic-analysis/scheduled-updates/scheduled-updates.component.ts diff --git a/src/app/statistic-analysis/scheduled-updates/scheduled-updates.component.html b/src/app/statistic-analysis/scheduled-updates/scheduled-updates.component.html new file mode 100644 index 0000000..e5a8cee --- /dev/null +++ b/src/app/statistic-analysis/scheduled-updates/scheduled-updates.component.html @@ -0,0 +1 @@ +

计划更新

diff --git a/src/app/statistic-analysis/scheduled-updates/scheduled-updates.component.scss b/src/app/statistic-analysis/scheduled-updates/scheduled-updates.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/statistic-analysis/scheduled-updates/scheduled-updates.component.spec.ts b/src/app/statistic-analysis/scheduled-updates/scheduled-updates.component.spec.ts new file mode 100644 index 0000000..76cc9b8 --- /dev/null +++ b/src/app/statistic-analysis/scheduled-updates/scheduled-updates.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ScheduledUpdatesComponent } from './scheduled-updates.component'; + +describe('ScheduledUpdatesComponent', () => { + let component: ScheduledUpdatesComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ScheduledUpdatesComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ScheduledUpdatesComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/statistic-analysis/scheduled-updates/scheduled-updates.component.ts b/src/app/statistic-analysis/scheduled-updates/scheduled-updates.component.ts new file mode 100644 index 0000000..fb946f6 --- /dev/null +++ b/src/app/statistic-analysis/scheduled-updates/scheduled-updates.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-scheduled-updates', + templateUrl: './scheduled-updates.component.html', + styleUrls: ['./scheduled-updates.component.scss'] +}) +export class ScheduledUpdatesComponent implements OnInit { + + constructor() { } + + ngOnInit(): void { + } + +} diff --git a/src/app/statistic-analysis/state/page-two-time/page-two-time.component.ts b/src/app/statistic-analysis/state/page-two-time/page-two-time.component.ts index 618c624..886627a 100644 --- a/src/app/statistic-analysis/state/page-two-time/page-two-time.component.ts +++ b/src/app/statistic-analysis/state/page-two-time/page-two-time.component.ts @@ -57,12 +57,24 @@ export class PageTwoTimeComponent implements OnInit { selectEndMonth:any = (new Date()).getMonth()+1 //结束月份 //按月查询 monthSubmit (e) { - if (e.selectTwoYear >= e.selectOneYear) { + if (e.selectTwoYear > e.selectOneYear) { let startTime = e.selectOneYear + '-' + e.selectStartMonth + '-' + 1 + ' ' + 0 + ':' + 0 +':'+ 0 let endTime = e.selectTwoYear + '-' + e.selectEndMonth + '-' + 31 + ' ' + 23 + ':' + 59 +':'+ 59 console.log(startTime) console.log(endTime) - } else { + } else if (e.selectTwoYear === e.selectOneYear) { + if(e.selectEndMonth >= e.selectStartMonth) { + let startTime = e.selectOneYear + '-' + e.selectStartMonth + '-' + 1 + ' ' + 0 + ':' + 0 +':'+ 0 + let endTime = e.selectTwoYear + '-' + e.selectEndMonth + '-' + 31 + ' ' + 23 + ':' + 59 +':'+ 59 + console.log(startTime) + console.log(endTime) + } else { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('请选择正确时间区段','确定',config); + } + }else { const config = new MatSnackBarConfig(); config.verticalPosition = 'top'; config.duration = 3000 diff --git a/src/app/statistic-analysis/statistic-analysis-routing.module.ts b/src/app/statistic-analysis/statistic-analysis-routing.module.ts index 1bbcbfb..4ac378c 100644 --- a/src/app/statistic-analysis/statistic-analysis-routing.module.ts +++ b/src/app/statistic-analysis/statistic-analysis-routing.module.ts @@ -9,6 +9,7 @@ import { DeleteTwoComponent } from './deleteUnit/delete-two/delete-two.component import { DeleteThereComponent } from './deleteUnit/delete-there/delete-there.component'; import { DeleteFourComponent } from './deleteUnit/delete-four/delete-four.component'; import { BuildingTypeOneComponent } from './buildingType/building-type-one/building-type-one.component'; +import {ScheduledUpdatesComponent} from './scheduled-updates/scheduled-updates.component' const routes: Routes = [ { path: 'statePageOne', component: PageOneComponent}, @@ -17,7 +18,8 @@ const routes: Routes = [ { path: 'delete_two', component: DeleteTwoComponent}, { path: 'delete_there', component: DeleteThereComponent}, { path: 'delete_four', component: DeleteFourComponent}, - { path: 'buildingType_one', component: BuildingTypeOneComponent} + { path: 'buildingType_one', component: BuildingTypeOneComponent}, + { path: 'scheduledUpdates', component: ScheduledUpdatesComponent} ]; @NgModule({ diff --git a/src/app/statistic-analysis/statistic-analysis.module.ts b/src/app/statistic-analysis/statistic-analysis.module.ts index 1b226ed..fbfec50 100644 --- a/src/app/statistic-analysis/statistic-analysis.module.ts +++ b/src/app/statistic-analysis/statistic-analysis.module.ts @@ -52,10 +52,11 @@ import { DeleteTwoComponent } from './deleteUnit/delete-two/delete-two.component import { DeleteThereComponent } from './deleteUnit/delete-there/delete-there.component'; import { DeleteFourComponent } from './deleteUnit/delete-four/delete-four.component'; import { BuildingTypeOneComponent } from './buildingType/building-type-one/building-type-one.component'; +import { ScheduledUpdatesComponent } from './scheduled-updates/scheduled-updates.component'; @NgModule({ - declarations: [PageOneComponent, PageTwoTimeComponent, PageTwoNameComponent, PageZhongDuiDetailsComponent,echartsComponent, DeleteOneComponent, DeleteTwoComponent, DeleteThereComponent, DeleteFourComponent, BuildingTypeOneComponent], + declarations: [PageOneComponent, PageTwoTimeComponent, PageTwoNameComponent, PageZhongDuiDetailsComponent,echartsComponent, DeleteOneComponent, DeleteTwoComponent, DeleteThereComponent, DeleteFourComponent, BuildingTypeOneComponent, ScheduledUpdatesComponent], imports: [ CommonModule, StatisticAnalysisRoutingModule,