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.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 ce92b6e..474d168 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..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 @@ -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,70 @@ 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 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 - 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; - } - } diff --git a/src/app/statistic-analysis/statistic-analysis-routing.module.ts b/src/app/statistic-analysis/statistic-analysis-routing.module.ts index acd3c20..3a53d39 100644 --- a/src/app/statistic-analysis/statistic-analysis-routing.module.ts +++ b/src/app/statistic-analysis/statistic-analysis-routing.module.ts @@ -16,6 +16,7 @@ import { AddUnitOneComponent } from './addUnit/add-unit-one/add-unit-one.compone import { AddUnitTwoTypeStatisticsComponent } from './addUnit/add-unit-two-type-statistics/add-unit-two-type-statistics.component'; import { AddUnitTwoTypeDetailsComponent } from './addUnit/add-unit-two-type-details/add-unit-two-type-details.component'; import { AddUnitTwoTimeComponent } from './addUnit/add-unit-two-time/add-unit-two-time.component'; +import {ScheduledUpdatesComponent} from './scheduled-updates/scheduled-updates.component' const routes: Routes = [ { path: 'statePageOne', component: PageOneComponent}, @@ -32,6 +33,7 @@ const routes: Routes = [ { path: 'addUnit_one/addUnit_two_type', component: AddUnitTwoTypeStatisticsComponent}, { path: 'addUnit_one/addUnit_two_typeDetails', component: AddUnitTwoTypeDetailsComponent}, { path: 'addUnit_one/addUnit_two_time', component: AddUnitTwoTimeComponent}, + { 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 74eded9..aaa1b65 100644 --- a/src/app/statistic-analysis/statistic-analysis.module.ts +++ b/src/app/statistic-analysis/statistic-analysis.module.ts @@ -59,10 +59,12 @@ import { AddUnitOneComponent } from './addUnit/add-unit-one/add-unit-one.compone import { AddUnitTwoTypeStatisticsComponent } from './addUnit/add-unit-two-type-statistics/add-unit-two-type-statistics.component'; import { AddUnitTwoTypeDetailsComponent } from './addUnit/add-unit-two-type-details/add-unit-two-type-details.component'; import { AddUnitTwoTimeComponent } from './addUnit/add-unit-two-time/add-unit-two-time.component'; +import { ScheduledUpdatesComponent } from './scheduled-updates/scheduled-updates.component'; + @NgModule({ - declarations: [PageOneComponent, PageTwoTimeComponent, PageTwoNameComponent, PageZhongDuiDetailsComponent,echartsComponent, DeleteOneComponent, DeleteTwoComponent, DeleteThereComponent, DeleteFourComponent, BuildingTypeOneComponent, BuildingTypeTwoForwardComponent, BuildingTypeTwoReverseComponent, BuildingTypeThreeDetailsComponent, AddUnitOneComponent, AddUnitTwoTypeStatisticsComponent, AddUnitTwoTypeDetailsComponent, AddUnitTwoTimeComponent], + declarations: [PageOneComponent, PageTwoTimeComponent, PageTwoNameComponent, PageZhongDuiDetailsComponent,echartsComponent, DeleteOneComponent, DeleteTwoComponent, DeleteThereComponent, DeleteFourComponent, BuildingTypeOneComponent, BuildingTypeTwoForwardComponent, BuildingTypeTwoReverseComponent, BuildingTypeThreeDetailsComponent, AddUnitOneComponent, AddUnitTwoTypeStatisticsComponent, AddUnitTwoTypeDetailsComponent, AddUnitTwoTimeComponent,ScheduledUpdatesComponent], imports: [ CommonModule, StatisticAnalysisRoutingModule,