Commit 14db241c691353c30ce074266ae31fe52e6a4927
1 parent
fb475cb7
add cross section
Showing
9 changed files
with
191 additions
and
3 deletions
Show diff stats
src/app/app.module.ts
| ... | ... | @@ -24,6 +24,7 @@ import { BusStopComponent } from './data/bus-stop/bus-stop.component'; |
| 24 | 24 | import { ServiceObjectComponent } from './data/service-object/service-object.component'; |
| 25 | 25 | import { RoadSurfaceComponent } from './data/road-surface/road-surface.component'; |
| 26 | 26 | import { RoadWidthComponent } from './data/road-width/road-width.component'; |
| 27 | +import { CrossSectionComponent } from './data/cross-section/cross-section.component'; | |
| 27 | 28 | import { EditorComponent } from '../helpers/editor.component'; |
| 28 | 29 | import { RendererComponent } from '../helpers/renderer.component'; |
| 29 | 30 | |
| ... | ... | @@ -36,6 +37,8 @@ import { RoadSurfaceService } from '../services/road-surface.service'; |
| 36 | 37 | import { RoadSurfaceCreateService } from '../services/road-surface-create.service'; |
| 37 | 38 | import { RoadWidthService } from '../services/road-width.service'; |
| 38 | 39 | import { RoadWidthCreateService } from '../services/road-width-create.service'; |
| 40 | +import { CrossSectionService } from '../services/cross-section.service'; | |
| 41 | +import { CrossSectionCreateService } from '../services/cross-section-create.service'; | |
| 39 | 42 | import { BooleanSelectListService } from '../services/boolean-select-list.service'; |
| 40 | 43 | |
| 41 | 44 | const httpInterceptorProviders: Type<any>[] = [ |
| ... | ... | @@ -56,6 +59,7 @@ const httpInterceptorProviders: Type<any>[] = [ |
| 56 | 59 | EditorComponent, |
| 57 | 60 | RendererComponent, |
| 58 | 61 | RoadWidthComponent, |
| 62 | + CrossSectionComponent, | |
| 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 | + CrossSectionComponent, | |
| 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 | + CrossSectionCreateService, | |
| 102 | + CrossSectionService, | |
| 96 | 103 | ], // additional providers needed for this module |
| 97 | 104 | entryComponents: [ ], |
| 98 | 105 | bootstrap: [ AppComponent ], | ... | ... |
src/app/app.routes.ts
| ... | ... | @@ -7,6 +7,7 @@ import { TemplatesComponent } from './templates/templates.component'; |
| 7 | 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 | +import { CrossSectionComponent } from './data/cross-section/cross-section.component'; | |
| 10 | 11 | import { ServiceObjectComponent } from './data/service-object/service-object.component'; |
| 11 | 12 | |
| 12 | 13 | const routes: Routes = [ |
| ... | ... | @@ -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: 'cross-section', component: CrossSectionComponent} | |
| 21 | 23 | ]}, |
| 22 | 24 | ]}, |
| 23 | 25 | ]; | ... | ... |
src/app/data/cross-section/cross-section.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()" (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" (click)="addNewRow()" type="button"><md-icon>add</md-icon></button> | |
| 10 | + <button md-fab color="warn" (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/cross-section/cross-section.component.ts
0 → 100644
| 1 | +import {Component, ViewEncapsulation} from '@angular/core'; | |
| 2 | +import {GridOptions} from 'ag-grid/main'; | |
| 3 | +import { TdLoadingService } from '@covalent/core'; | |
| 4 | + | |
| 5 | +import { StatementBase } from '../../../models/statement.base'; | |
| 6 | + | |
| 7 | +import { CrossSectionService } from '../../../services/cross-section.service'; | |
| 8 | +import { CrossSection } from '../../../models/cross-section'; | |
| 9 | +import { EditorComponent } from '../../../helpers/editor.component'; | |
| 10 | +import { RendererComponent } from '../../../helpers/renderer.component'; | |
| 11 | +import { CrossSectionCreateService } from '../../../services/cross-section-create.service'; | |
| 12 | +import { RegionSelectList } from '../../../models/region-select-list'; | |
| 13 | +import { RoadSelectList } from '../../../models/road-select-list'; | |
| 14 | +import { StateCommonSelectList } from '../../../models/state-common-select-list'; | |
| 15 | +import { SurfaceTypeSelectList } from '../../../models/surface-type-select-list'; | |
| 16 | + | |
| 17 | +import { routerTransition } from '../../../animations/router.animation'; | |
| 18 | + | |
| 19 | +@Component({ | |
| 20 | + selector: 'cross-section', | |
| 21 | + templateUrl: 'cross-section.component.html', | |
| 22 | + styleUrls: ['cross-section.scss'], | |
| 23 | + encapsulation: ViewEncapsulation.None, | |
| 24 | +}) | |
| 25 | +export class CrossSectionComponent extends StatementBase { | |
| 26 | + | |
| 27 | + public regions: RegionSelectList[]; | |
| 28 | + public roads: RoadSelectList[]; | |
| 29 | + public surfaceTypes: SurfaceTypeSelectList[]; | |
| 30 | + public states: StateCommonSelectList[]; | |
| 31 | + | |
| 32 | + constructor( | |
| 33 | + protected service: CrossSectionService, | |
| 34 | + protected dataService: CrossSectionCreateService, | |
| 35 | + protected loadingService: TdLoadingService, | |
| 36 | + ) { | |
| 37 | + super(); | |
| 38 | + } | |
| 39 | + | |
| 40 | + protected createColumnDefs(): any[] { | |
| 41 | + return [ | |
| 42 | + { | |
| 43 | + headerName: '#', | |
| 44 | + width: 30, | |
| 45 | + checkboxSelection: true, | |
| 46 | + suppressSorting: true, | |
| 47 | + suppressMenu: true, | |
| 48 | + pinned: true, | |
| 49 | + }, | |
| 50 | + { | |
| 51 | + headerName: 'ID', | |
| 52 | + field: 'id', | |
| 53 | + }, | |
| 54 | + { | |
| 55 | + headerName: 'Назва дороги', | |
| 56 | + field: 'roadId', | |
| 57 | + editable: true, | |
| 58 | + cellEditorFramework: EditorComponent, | |
| 59 | + cellRendererFramework: RendererComponent, | |
| 60 | + cellEditorParams: { | |
| 61 | + data: this.roads, | |
| 62 | + valueCol: 'roadId', | |
| 63 | + labelCol: 'name', | |
| 64 | + }, | |
| 65 | + }, | |
| 66 | + { | |
| 67 | + headerName: 'Область', | |
| 68 | + field: 'regionId', | |
| 69 | + editable: true, | |
| 70 | + cellEditorFramework: EditorComponent, | |
| 71 | + cellRendererFramework: RendererComponent, | |
| 72 | + cellEditorParams: { | |
| 73 | + data: this.regions, | |
| 74 | + valueCol: 'regionId', | |
| 75 | + labelCol: 'name', | |
| 76 | + }, | |
| 77 | + }, | |
| 78 | + { | |
| 79 | + headerName: 'Стан покриття', | |
| 80 | + field: 'stateCommonId', | |
| 81 | + editable: true, | |
| 82 | + cellEditorFramework: EditorComponent, | |
| 83 | + cellRendererFramework: RendererComponent, | |
| 84 | + cellEditorParams: { | |
| 85 | + data: this.states, | |
| 86 | + valueCol: 'stateCommonId', | |
| 87 | + labelCol: 'value', | |
| 88 | + }, | |
| 89 | + }, | |
| 90 | + ]; | |
| 91 | + } | |
| 92 | + | |
| 93 | + protected initFunction(): void { | |
| 94 | + this.dataService.getModels().then((models: any) => { | |
| 95 | + this.regions = models.regionSelectListDsM as RegionSelectList[]; | |
| 96 | + this.roads = models.roadSelectListDsM as RoadSelectList[]; | |
| 97 | + this.surfaceTypes = models.surfaceTypeSelectListDsM as SurfaceTypeSelectList[]; | |
| 98 | + this.states = models.stateCommonSelectListDsM as StateCommonSelectList[]; | |
| 99 | + }).then(() => { | |
| 100 | + this.bootstrapGrid(); | |
| 101 | + }); | |
| 102 | + } | |
| 103 | + | |
| 104 | + // tslint:disable-next-line:member-ordering | |
| 105 | + public CreateModel(): Object { | |
| 106 | + return new CrossSection(); | |
| 107 | + } | |
| 108 | +} | ... | ... |
src/app/data/data.component.html
| ... | ... | @@ -26,15 +26,15 @@ |
| 26 | 26 | <md-icon md-list-icon>star</md-icon> |
| 27 | 27 | Прив'язки населених пунктів |
| 28 | 28 | </a> |
| 29 | - <a md-list-item (click)="!media.query('gt-sm') && manageList.close()" md-ripple class="block relative"> | |
| 30 | - <md-icon md-list-icon>people</md-icon> | |
| 29 | + <a md-list-item md-ripple class="block relative" (click)="!media.query('gt-sm') && manageList.close()" [routerLinkActive]="['active']" [routerLinkActiveOptions]="{exact:true}" [routerLink]="['/product']"> | |
| 30 | + <md-icon md-list-icon>dashboard</md-icon> | |
| 31 | 31 | Інтенсивності |
| 32 | 32 | </a> |
| 33 | 33 | <a md-list-item md-ripple class="block relative" (click)="!media.query('gt-sm') && manageList.close()" [routerLinkActive]="['active']" [routerLinkActiveOptions]="{exact:true}" [routerLink]="['/product']"> |
| 34 | 34 | <md-icon md-list-icon>dashboard</md-icon> |
| 35 | 35 | Категорія доріг |
| 36 | 36 | </a> |
| 37 | - <a md-list-item md-ripple class="block relative" (click)="!media.query('gt-sm') && manageList.close()" [routerLinkActive]="['active']" [routerLinkActiveOptions]="{exact:true}" [routerLink]="['/product']"> | |
| 37 | + <a md-list-item md-ripple class="block relative" (click)="!media.query('gt-sm') && manageList.close()" [routerLinkActive]="['active']" [routerLinkActiveOptions]="{exact:true}" [routerLink]="['cross-section']"> | |
| 38 | 38 | <md-icon md-list-icon>dashboard</md-icon> |
| 39 | 39 | З'їзди |
| 40 | 40 | </a> | ... | ... |
| 1 | +export class CrossSection { | |
| 2 | + id: number; | |
| 3 | + roadId: number; | |
| 4 | + regionId: number; | |
| 5 | + stateCommonid: number; | |
| 6 | + locationLeft: number; | |
| 7 | + locationRight: number; | |
| 8 | + direction: string; | |
| 9 | + surfaceTypeId: number; | |
| 10 | + lengthSection: number; | |
| 11 | + lengthSurface: number; | |
| 12 | + distanceEdge: number; | |
| 13 | + width: number; | |
| 14 | + angle: number; | |
| 15 | + tubeAvailability: number; | |
| 16 | + safetyAvailability: number; | |
| 17 | + yearBuild: number; | |
| 18 | + yearRepair: number; | |
| 19 | + | |
| 20 | +} | ... | ... |
| 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 CrossSectionCreateService extends CreateBaseService { | |
| 8 | + protected apiUrl: string = 'http://localhost:5000/crosssection/directory'; | |
| 9 | + constructor(protected http: Http) { | |
| 10 | + super(http); | |
| 11 | + } | |
| 12 | +} | ... | ... |
| 1 | +import { Injectable } from '@angular/core'; | |
| 2 | +import { Headers, Http } from '@angular/http'; | |
| 3 | + | |
| 4 | +import { StatementBaseService } from './statement.base.service'; | |
| 5 | + | |
| 6 | +import { CrossSection } from '../models/cross-section'; | |
| 7 | + | |
| 8 | +@Injectable() | |
| 9 | +export class CrossSectionService extends StatementBaseService { | |
| 10 | + protected url: string = 'http://localhost:5000/crosssection'; | |
| 11 | + constructor(protected http: Http) { | |
| 12 | + super(http); | |
| 13 | + } | |
| 14 | + public createModel(): Object { | |
| 15 | + return new CrossSection(); | |
| 16 | + } | |
| 17 | + protected parseModels(json: any): any { | |
| 18 | + return json.crossSectionEditDsM as CrossSection[]; | |
| 19 | + } | |
| 20 | + protected parseModel(json: any): any { | |
| 21 | + return json as CrossSection; | |
| 22 | + } | |
| 23 | +} | ... | ... |