Commit 907e8b4e2c9746d0e4c3dc0d90295581309a7f63
1 parent
fb475cb7
Flow intensity
Showing
8 changed files
with
310 additions
and
0 deletions
Show diff stats
src/app/app.module.ts
... | ... | @@ -26,6 +26,7 @@ import { RoadSurfaceComponent } from './data/road-surface/road-surface.component |
26 | 26 | import { RoadWidthComponent } from './data/road-width/road-width.component'; |
27 | 27 | import { EditorComponent } from '../helpers/editor.component'; |
28 | 28 | import { RendererComponent } from '../helpers/renderer.component'; |
29 | +import { FlowIntensityComponent } from './data/flow-intensity/flow-intensity.component'; | |
29 | 30 | |
30 | 31 | // Services |
31 | 32 | import { BusStopCreateService } from '../services/bus-stop-create.service'; |
... | ... | @@ -37,6 +38,8 @@ import { RoadSurfaceCreateService } from '../services/road-surface-create.servic |
37 | 38 | import { RoadWidthService } from '../services/road-width.service'; |
38 | 39 | import { RoadWidthCreateService } from '../services/road-width-create.service'; |
39 | 40 | import { BooleanSelectListService } from '../services/boolean-select-list.service'; |
41 | +import { FlowIntensityCreateService } from '../services/flow-intensity-create.service'; | |
42 | +import { FlowIntensityService } from '../services/flow-intensity.service'; | |
40 | 43 | |
41 | 44 | const httpInterceptorProviders: Type<any>[] = [ |
42 | 45 | RequestInterceptor, |
... | ... | @@ -56,6 +59,7 @@ const httpInterceptorProviders: Type<any>[] = [ |
56 | 59 | EditorComponent, |
57 | 60 | RendererComponent, |
58 | 61 | RoadWidthComponent, |
62 | + FlowIntensityComponent, | |
59 | 63 | ], // directives, components, and pipes owned by this NgModule |
60 | 64 | imports: [ |
61 | 65 | BrowserModule, |
... | ... | @@ -66,6 +70,7 @@ const httpInterceptorProviders: Type<any>[] = [ |
66 | 70 | RendererComponent, |
67 | 71 | RoadSurfaceComponent, |
68 | 72 | RoadWidthComponent, |
73 | + FlowIntensityComponent, | |
69 | 74 | ]), |
70 | 75 | CovalentCoreModule.forRoot(), |
71 | 76 | CovalentChartsModule.forRoot(), |
... | ... | @@ -93,6 +98,8 @@ const httpInterceptorProviders: Type<any>[] = [ |
93 | 98 | RoadSurfaceService, |
94 | 99 | RoadWidthCreateService, |
95 | 100 | RoadWidthService, |
101 | + FlowIntensityCreateService, | |
102 | + FlowIntensityService, | |
96 | 103 | ], // additional providers needed for this module |
97 | 104 | entryComponents: [ ], |
98 | 105 | bootstrap: [ AppComponent ], | ... | ... |
src/app/app.routes.ts
... | ... | @@ -8,6 +8,7 @@ import { BusStopComponent } from './data/bus-stop/bus-stop.component'; |
8 | 8 | import { RoadSurfaceComponent } from './data/road-surface/road-surface.component'; |
9 | 9 | import { RoadWidthComponent } from './data/road-width/road-width.component'; |
10 | 10 | import { ServiceObjectComponent } from './data/service-object/service-object.component'; |
11 | +import { FlowIntensityComponent } from './data/flow-intensity/flow-intensity.component'; | |
11 | 12 | |
12 | 13 | const routes: Routes = [ |
13 | 14 | {path: 'login', component: LoginComponent}, |
... | ... | @@ -18,6 +19,7 @@ const routes: Routes = [ |
18 | 19 | {path: 'service-object', component: ServiceObjectComponent}, |
19 | 20 | {path: 'road-surface', component: RoadSurfaceComponent}, |
20 | 21 | {path: 'road-width', component: RoadWidthComponent}, |
22 | + {path: 'flow-intensity', component: FlowIntensityComponent}, | |
21 | 23 | ]}, |
22 | 24 | ]}, |
23 | 25 | ]; | ... | ... |
src/app/data/flow-intensity/flow-intensity.component.html
0 → 100644
1 | +<div class="grid_containert" *ngIf="showGrid"> | |
2 | + <ag-grid-ng2 #agGrid style="width: 100%; height: 100%;" class="ag-blue" [gridOptions]="gridOptions" [columnDefs]="columnDefs" [rowData]="rowData" enableColResize enableSorting enableFilter groupHeaders suppressRowClickSelection toolPanelSuppressGroups | |
3 | + toolPanelSuppressValues debug rowHeight="22" rowSelection="multiple" (cellClicked)="onCellClicked($event)" (cellDoubleClicked)="onCellDoubleClicked($event)" (cellContextMenu)="onCellContextMenu($event)" (cellValueChanged)="onCellValueChanged($event)" | |
4 | + (cellFocused)="onCellFocused($event)" (rowSelected)="onRowSelected($event)" (selectionChanged)="onSelectionChanged()" (beforeFilterChanged)="onBeforeFilterChanged()" (afterFilterChanged)="onAfterFilterChanged()" (filterModified)="onFilterModified()" | |
5 | + (beforeSortChanged)="onBeforeSortChanged()" (afterSortChanged)="onAfterSortChanged($event)" (virtualRowRemoved)="onVirtualRowRemoved($event)" (rowClicked)="onRowClicked($event)"> | |
6 | + </ag-grid-ng2> | |
7 | + <div class="control_button"> | |
8 | + <div *tdLoading="'loading'; mode:'indeterminate'; type:'circle'; strategy:'replace'; color:'accent'"></div> | |
9 | + <button md-fab color="accent" [disabled]="isNew || isSelected" (click)="addNewRow()" type="button"><md-icon>add</md-icon></button> | |
10 | + <button md-fab color="warn" [disabled]="!isSelected" (click)="deleteRows()" type="button"><md-icon>delete</md-icon></button> | |
11 | + </div> | |
12 | +</div> | |
0 | 13 | \ No newline at end of file | ... | ... |
src/app/data/flow-intensity/flow-intensity.component.ts
0 → 100644
1 | +import { Component, ViewEncapsulation, AfterViewInit } from '@angular/core'; | |
2 | +import { TdLoadingService } from '@covalent/core'; | |
3 | +import { GridOptions, IGetRowsParams, IRowModel } from 'ag-grid/main'; | |
4 | + | |
5 | +import { StatementBase } from '../../../models/statement.base'; | |
6 | + | |
7 | +import { FlowIntensityService } from '../../../services/flow-intensity.service'; | |
8 | +import { FlowIntensity } from '../../../models/flow-intensity'; | |
9 | +import { EditorComponent } from '../../../helpers/editor.component'; | |
10 | +import { RendererComponent } from '../../../helpers/renderer.component'; | |
11 | +import { FlowIntensityCreateService } from '../../../services/flow-intensity-create.service'; | |
12 | +import { RegionSelectList } from '../../../models/region-select-list'; | |
13 | +import { RoadDirectionSelectList } from '../../../models/road-direction-select-list'; | |
14 | +import { RoadSelectList } from '../../../models/road-select-list'; | |
15 | +import { SettlementSelectList } from '../../../models/settlement-select-list'; | |
16 | + | |
17 | +import { routerTransition } from '../../../animations/router.animation'; | |
18 | + | |
19 | +@Component({ | |
20 | + // tslint:disable-next-line:component-selector | |
21 | + selector: 'flow-grid', | |
22 | + templateUrl: 'flow-intensity.component.html', | |
23 | + styleUrls: ['flow-intensity.scss'], | |
24 | + encapsulation: ViewEncapsulation.None, | |
25 | +}) | |
26 | +export class FlowIntensityComponent extends StatementBase { | |
27 | + | |
28 | + public regions: RegionSelectList[]; | |
29 | + public settlements: SettlementSelectList[]; | |
30 | + public roads: RoadSelectList[]; | |
31 | + public roadDirections: RoadDirectionSelectList[]; | |
32 | + | |
33 | + constructor( | |
34 | + protected service: FlowIntensityService, | |
35 | + protected dataService: FlowIntensityCreateService, | |
36 | + protected loadingService: TdLoadingService, | |
37 | + ) { | |
38 | + super(); | |
39 | + } | |
40 | + | |
41 | + protected createColumnDefs(): any[] { | |
42 | + return [ | |
43 | + { | |
44 | + headerName: '#', | |
45 | + width: 30, | |
46 | + checkboxSelection: true, | |
47 | + suppressSorting: true, | |
48 | + suppressMenu: true, | |
49 | + pinned: true, | |
50 | + }, | |
51 | + { | |
52 | + headerName: 'ID', | |
53 | + field: 'id', | |
54 | + }, | |
55 | + { | |
56 | + headerName: 'Назва дороги', | |
57 | + field: 'roadId', | |
58 | + editable: true, | |
59 | + cellEditorFramework: EditorComponent, | |
60 | + cellRendererFramework: RendererComponent, | |
61 | + cellEditorParams: { | |
62 | + data: this.roads, | |
63 | + valueCol: 'roadId', | |
64 | + labelCol: 'name', | |
65 | + }, | |
66 | + }, | |
67 | + { | |
68 | + headerName: 'Область', | |
69 | + field: 'regionId', | |
70 | + editable: true, | |
71 | + cellEditorFramework: EditorComponent, | |
72 | + cellRendererFramework: RendererComponent, | |
73 | + cellEditorParams: { | |
74 | + data: this.regions, | |
75 | + valueCol: 'regionId', | |
76 | + labelCol: 'name', | |
77 | + }, | |
78 | + }, | |
79 | + { | |
80 | + headerName: 'Місцезнаходження, км+', | |
81 | + field: 'location', | |
82 | + editable: true, | |
83 | + }, | |
84 | + { | |
85 | + headerName: 'Місцезнаходження ділянки з однорідною інтенсивністю руху, км+, початок', | |
86 | + field: 'begin', | |
87 | + editable: true, | |
88 | + }, | |
89 | + { | |
90 | + headerName: 'Місцезнаходження ділянки з однорідною інтенсивністю руху, км+, кінець', | |
91 | + field: 'end', | |
92 | + editable: true, | |
93 | + }, | |
94 | + { | |
95 | + headerName: 'Напрямок смуги руху', | |
96 | + field: 'roadDirectionId', | |
97 | + editable: true, | |
98 | + cellEditorFramework: EditorComponent, | |
99 | + cellRendererFramework: RendererComponent, | |
100 | + cellEditorParams: { | |
101 | + data: this.roadDirections, | |
102 | + valueCol: 'roadDirectionId', | |
103 | + labelCol: 'name', | |
104 | + }, | |
105 | + }, | |
106 | + { | |
107 | + headerName: 'Найближчий населений пункт', | |
108 | + field: 'settlementId', | |
109 | + editable: true, | |
110 | + cellEditorFramework: EditorComponent, | |
111 | + cellRendererFramework: RendererComponent, | |
112 | + cellEditorParams: { | |
113 | + data: this.settlements, | |
114 | + valueCol: 'settlementId', | |
115 | + labelCol: 'name', | |
116 | + }, | |
117 | + }, | |
118 | + { | |
119 | + headerName: 'Інтенсивність руху, авт/добу, всього', | |
120 | + field: 'intensityTotal', | |
121 | + editable: true, | |
122 | + }, | |
123 | + { | |
124 | + headerName: 'Інтенсивність руху, авт/добу, приріст', | |
125 | + field: 'intensityIncrease', | |
126 | + editable: true, | |
127 | + }, | |
128 | + { | |
129 | + headerName: 'Інтенсивність руху, авт/добу, мотоцикл без коляски та мопед', | |
130 | + field: 'intensityMoto', | |
131 | + editable: true, | |
132 | + }, | |
133 | + { | |
134 | + headerName: 'Інтенсивність руху, авт/добу, мотоцикл з коляскою', | |
135 | + field: 'intensityMotoSidecar', | |
136 | + editable: true, | |
137 | + }, | |
138 | + { | |
139 | + headerName: 'Інтенсивність руху, авт/добу, легковий автомобіль', | |
140 | + field: 'intensityCar', | |
141 | + editable: true, | |
142 | + }, | |
143 | + { | |
144 | + headerName: 'Інтенсивність руху, авт/добу, вантажний автомобіль вантажопідйомністю: до 2 т.', | |
145 | + field: 'intensityTruckTwo', | |
146 | + editable: true, | |
147 | + }, | |
148 | + { | |
149 | + headerName: 'Інтенсивність руху, авт/добу, вантажний автомобіль вантажопідйомністю: від 2 т. до 6 т.', | |
150 | + field: 'intensityTruckTwoSix', | |
151 | + editable: true, | |
152 | + }, | |
153 | + { | |
154 | + headerName: 'Інтенсивність руху, авт/добу, вантажний автомобіль вантажопідйомністю: від 6 т. до 8 т.', | |
155 | + field: 'intensityTruckSixEight', | |
156 | + editable: true, | |
157 | + }, | |
158 | + { | |
159 | + headerName: 'Інтенсивність руху, авт/добу, вантажний автомобіль вантажопідйомністю: від 8 т. до 14 т.', | |
160 | + field: 'intensityTruckEightFourteen', | |
161 | + editable: true, | |
162 | + }, | |
163 | + { | |
164 | + headerName: 'Інтенсивність руху, авт/добу, вантажний автомобіль вантажопідйомністю: понад 14 т.', | |
165 | + field: 'intensityTruckFourteen', | |
166 | + editable: true, | |
167 | + }, | |
168 | + { | |
169 | + headerName: 'Інтенсивність руху, авт/добу, автопоїзд вантажопідйомністю: до 12 т.', | |
170 | + field: 'intensityLorryTwelve', | |
171 | + editable: true, | |
172 | + }, | |
173 | + { | |
174 | + headerName: 'Інтенсивність руху, авт/добу, автопоїзд вантажопідйомністю: від 12 т. до 20 т.', | |
175 | + field: 'intensityLorryTwelveTwenty', | |
176 | + editable: true, | |
177 | + }, | |
178 | + { | |
179 | + headerName: 'Інтенсивність руху, авт/добу, автопоїзд вантажопідйомністю: від 20 т. до 30 т.', | |
180 | + field: 'intensityLorryTwentyThirty', | |
181 | + editable: true, | |
182 | + }, | |
183 | + { | |
184 | + headerName: 'Інтенсивність руху, авт/добу, автопоїзд вантажопідйомністю: понад 30 т.', | |
185 | + field: 'intensityLorryThirty', | |
186 | + editable: true, | |
187 | + }, | |
188 | + { | |
189 | + headerName: 'Інтенсивність руху, авт/добу, колісний трактор з причепами до 10 т.', | |
190 | + field: 'intensityTractorUnderTen', | |
191 | + editable: true, | |
192 | + }, | |
193 | + { | |
194 | + headerName: 'Інтенсивність руху, авт/добу, колісний трактор з причепами понад 10 т.', | |
195 | + field: 'intensityTractorOverTen', | |
196 | + editable: true, | |
197 | + }, | |
198 | + { | |
199 | + headerName: 'Інтенсивність руху, авт/добу, автобус, тролейбус', | |
200 | + field: 'intensityBus', | |
201 | + editable: true, | |
202 | + }, | |
203 | + { | |
204 | + headerName: 'Інтенсивність руху, авт/добу, автобус зчеплений (здвоєний)', | |
205 | + field: 'intensityBusCoupled', | |
206 | + editable: true, | |
207 | + }, | |
208 | + ]; | |
209 | + } | |
210 | + | |
211 | + protected initFunction(): void { | |
212 | + this.dataService.getModels().then((models: any) => { | |
213 | + this.regions = models.regionSelectListDsM as RegionSelectList[]; | |
214 | + this.settlements = models.settlementSelectListDsM as SettlementSelectList[]; | |
215 | + this.roads = models.roadSelectListDsM as RoadSelectList[]; | |
216 | + this.roadDirections = models.roadDirectionSelectListDsM as RoadDirectionSelectList[]; | |
217 | + }).then(() => { | |
218 | + this.bootstrapGrid(); | |
219 | + }); | |
220 | + } | |
221 | +} | ... | ... |
1 | +export class FlowIntensity { | |
2 | + id: number; | |
3 | + roadId: number; | |
4 | + regionId: number; | |
5 | + location: number; | |
6 | + begin: number; | |
7 | + end: number; | |
8 | + roadDirectionId: number; | |
9 | + settlementId: number; | |
10 | + intensityTotal: number; | |
11 | + intensityIncrease: number; | |
12 | + intensityMoto: number; | |
13 | + intensityMotoSidecar: number; | |
14 | + intensityCar: number; | |
15 | + intensityTruckTwo: number; | |
16 | + intensityTruckTwoSix: number; | |
17 | + intensityTruckSixEight: number; | |
18 | + intensityTruckEightFourteen: number; | |
19 | + intensityTruckFourteen: number; | |
20 | + intensityLorryTwelve: number; | |
21 | + intensityLorryTwelveTwenty: number; | |
22 | + intensityLorryTwentyThirty: number; | |
23 | + intensityLorryThirty: number; | |
24 | + intensityTractorUnderTen: number; | |
25 | + intensityTractorOverTen: number; | |
26 | + intensityBus: number; | |
27 | + intensityBusCoupled: number; | |
28 | + dateAdd: number; | |
29 | +} | ... | ... |
1 | +import { Injectable } from '@angular/core'; | |
2 | +import { Http } from '@angular/http'; | |
3 | + | |
4 | +import { CreateBaseService } from './create.base.service'; | |
5 | + | |
6 | +@Injectable() | |
7 | +export class FlowIntensityCreateService extends CreateBaseService { | |
8 | + protected apiUrl: string = 'http://localhost:5000/flowintensity/directory'; | |
9 | + constructor(protected http: Http) { | |
10 | + super(http); | |
11 | + } | |
12 | +} | ... | ... |
1 | +import { Injectable } from '@angular/core'; | |
2 | +import { Http } from '@angular/http'; | |
3 | + | |
4 | +import { StatementBaseService } from './statement.base.service'; | |
5 | + | |
6 | +import { FlowIntensity } from '../models/flow-intensity'; | |
7 | + | |
8 | +@Injectable() | |
9 | +export class FlowIntensityService extends StatementBaseService { | |
10 | + protected url: string = 'http://localhost:5000/flowintensity'; | |
11 | + constructor(protected http: Http) { | |
12 | + super(http); | |
13 | + } | |
14 | + public createModel(): Object { | |
15 | + return new FlowIntensity(); | |
16 | + } | |
17 | + protected parseModels(json: any): any[] { | |
18 | + return json.flowIntensityEditDsM as FlowIntensity[]; | |
19 | + }; | |
20 | + protected parseModel(json: any): any { | |
21 | + return json as FlowIntensity; | |
22 | + }; | |
23 | +} | ... | ... |