Commit ad296a58d7598740335245c1508f9a016c07f870
1 parent
051a7305
Road
Showing
10 changed files
with
160 additions
and
5 deletions
Show diff stats
src/app/app.module.ts
| @@ -28,6 +28,7 @@ import { CrossSectionComponent } from './data/cross-section/cross-section.compon | @@ -28,6 +28,7 @@ import { CrossSectionComponent } from './data/cross-section/cross-section.compon | ||
| 28 | import { EditorComponent } from '../helpers/editor.component'; | 28 | import { EditorComponent } from '../helpers/editor.component'; |
| 29 | import { RendererComponent } from '../helpers/renderer.component'; | 29 | import { RendererComponent } from '../helpers/renderer.component'; |
| 30 | import { FlowIntensityComponent } from './data/flow-intensity/flow-intensity.component'; | 30 | import { FlowIntensityComponent } from './data/flow-intensity/flow-intensity.component'; |
| 31 | +import { RoadComponent } from './data/road/road.component'; | ||
| 31 | 32 | ||
| 32 | // Services | 33 | // Services |
| 33 | import { BusStopCreateService } from '../services/bus-stop-create.service'; | 34 | import { BusStopCreateService } from '../services/bus-stop-create.service'; |
| @@ -43,6 +44,8 @@ import { CrossSectionCreateService } from '../services/cross-section-create.serv | @@ -43,6 +44,8 @@ import { CrossSectionCreateService } from '../services/cross-section-create.serv | ||
| 43 | import { BooleanSelectListService } from '../services/boolean-select-list.service'; | 44 | import { BooleanSelectListService } from '../services/boolean-select-list.service'; |
| 44 | import { FlowIntensityCreateService } from '../services/flow-intensity-create.service'; | 45 | import { FlowIntensityCreateService } from '../services/flow-intensity-create.service'; |
| 45 | import { FlowIntensityService } from '../services/flow-intensity.service'; | 46 | import { FlowIntensityService } from '../services/flow-intensity.service'; |
| 47 | +import { RoadCreateService } from '../services/road-create.service'; | ||
| 48 | +import { RoadService } from '../services/road.service'; | ||
| 46 | 49 | ||
| 47 | const httpInterceptorProviders: Type<any>[] = [ | 50 | const httpInterceptorProviders: Type<any>[] = [ |
| 48 | RequestInterceptor, | 51 | RequestInterceptor, |
| @@ -63,6 +66,7 @@ const httpInterceptorProviders: Type<any>[] = [ | @@ -63,6 +66,7 @@ const httpInterceptorProviders: Type<any>[] = [ | ||
| 63 | RendererComponent, | 66 | RendererComponent, |
| 64 | RoadWidthComponent, | 67 | RoadWidthComponent, |
| 65 | FlowIntensityComponent, | 68 | FlowIntensityComponent, |
| 69 | + RoadComponent, | ||
| 66 | CrossSectionComponent, | 70 | CrossSectionComponent, |
| 67 | ], // directives, components, and pipes owned by this NgModule | 71 | ], // directives, components, and pipes owned by this NgModule |
| 68 | imports: [ | 72 | imports: [ |
| @@ -75,6 +79,7 @@ const httpInterceptorProviders: Type<any>[] = [ | @@ -75,6 +79,7 @@ const httpInterceptorProviders: Type<any>[] = [ | ||
| 75 | RoadSurfaceComponent, | 79 | RoadSurfaceComponent, |
| 76 | RoadWidthComponent, | 80 | RoadWidthComponent, |
| 77 | FlowIntensityComponent, | 81 | FlowIntensityComponent, |
| 82 | + RoadComponent, | ||
| 78 | CrossSectionComponent, | 83 | CrossSectionComponent, |
| 79 | ]), | 84 | ]), |
| 80 | CovalentCoreModule.forRoot(), | 85 | CovalentCoreModule.forRoot(), |
| @@ -105,6 +110,8 @@ const httpInterceptorProviders: Type<any>[] = [ | @@ -105,6 +110,8 @@ const httpInterceptorProviders: Type<any>[] = [ | ||
| 105 | RoadWidthService, | 110 | RoadWidthService, |
| 106 | FlowIntensityCreateService, | 111 | FlowIntensityCreateService, |
| 107 | FlowIntensityService, | 112 | FlowIntensityService, |
| 113 | + RoadCreateService, | ||
| 114 | + RoadService, | ||
| 108 | CrossSectionCreateService, | 115 | CrossSectionCreateService, |
| 109 | CrossSectionService, | 116 | CrossSectionService, |
| 110 | ], // additional providers needed for this module | 117 | ], // additional providers needed for this module |
src/app/app.routes.ts
| @@ -10,6 +10,7 @@ import { RoadWidthComponent } from './data/road-width/road-width.component'; | @@ -10,6 +10,7 @@ import { RoadWidthComponent } from './data/road-width/road-width.component'; | ||
| 10 | import { CrossSectionComponent } from './data/cross-section/cross-section.component'; | 10 | import { CrossSectionComponent } from './data/cross-section/cross-section.component'; |
| 11 | import { ServiceObjectComponent } from './data/service-object/service-object.component'; | 11 | import { ServiceObjectComponent } from './data/service-object/service-object.component'; |
| 12 | import { FlowIntensityComponent } from './data/flow-intensity/flow-intensity.component'; | 12 | import { FlowIntensityComponent } from './data/flow-intensity/flow-intensity.component'; |
| 13 | +import { RoadComponent } from './data/road/road.component'; | ||
| 13 | 14 | ||
| 14 | const routes: Routes = [ | 15 | const routes: Routes = [ |
| 15 | {path: 'login', component: LoginComponent}, | 16 | {path: 'login', component: LoginComponent}, |
| @@ -22,6 +23,7 @@ const routes: Routes = [ | @@ -22,6 +23,7 @@ const routes: Routes = [ | ||
| 22 | {path: 'road-width', component: RoadWidthComponent}, | 23 | {path: 'road-width', component: RoadWidthComponent}, |
| 23 | {path: 'flow-intensity', component: FlowIntensityComponent}, | 24 | {path: 'flow-intensity', component: FlowIntensityComponent}, |
| 24 | {path: 'cross-section', component: CrossSectionComponent}, | 25 | {path: 'cross-section', component: CrossSectionComponent}, |
| 26 | + {path: 'road', component: RoadComponent}, | ||
| 25 | ]}, | 27 | ]}, |
| 26 | ]}, | 28 | ]}, |
| 27 | ]; | 29 | ]; |
src/app/data/data.component.html
| @@ -14,7 +14,7 @@ | @@ -14,7 +14,7 @@ | ||
| 14 | <span>Відомості</span> | 14 | <span>Відомості</span> |
| 15 | </md-toolbar> | 15 | </md-toolbar> |
| 16 | <md-nav-list td-sidenav-content> | 16 | <md-nav-list td-sidenav-content> |
| 17 | - <a md-list-item md-ripple class="block relative" (click)="!media.query('gt-sm') && manageList.close()" [routerLinkActive]="['active']" [routerLinkActiveOptions]="{exact:true}" [routerLink]="['/product']"> | 17 | + <a md-list-item md-ripple class="block relative" (click)="!media.query('gt-sm') && manageList.close()" [routerLinkActive]="['active']" [routerLinkActiveOptions]="{exact:true}" [routerLink]="['road']"> |
| 18 | <md-icon md-list-icon>dashboard</md-icon> | 18 | <md-icon md-list-icon>dashboard</md-icon> |
| 19 | Автомобільні дороги | 19 | Автомобільні дороги |
| 20 | </a> | 20 | </a> |
| @@ -54,10 +54,6 @@ | @@ -54,10 +54,6 @@ | ||
| 54 | <md-icon md-list-icon>dashboard</md-icon> | 54 | <md-icon md-list-icon>dashboard</md-icon> |
| 55 | Автобусні зупинки | 55 | Автобусні зупинки |
| 56 | </a> | 56 | </a> |
| 57 | - <a md-list-item md-ripple class="block relative" (click)="!media.query('gt-sm') && manageList.close()" [routerLinkActive]="['active']" [routerLinkActiveOptions]="{exact:true}" [routerLink]="['flow-intensity']"> | ||
| 58 | - <md-icon md-list-icon>dashboard</md-icon> | ||
| 59 | - Інтенсивності | ||
| 60 | - </a> | ||
| 61 | </md-nav-list> | 57 | </md-nav-list> |
| 62 | <div td-toolbar-content layout="row" layout-align="start center" flex> | 58 | <div td-toolbar-content layout="row" layout-align="start center" flex> |
| 63 | <span>{{title}}</span> | 59 | <span>{{title}}</span> |
| 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 | \ No newline at end of file | 13 | \ No newline at end of file |
| 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 { RoadService } from '../../../services/road.service'; | ||
| 8 | +import { RoadCreateService } from '../../../services/road-create.service'; | ||
| 9 | +import { Road } from '../../../models/road'; | ||
| 10 | +import { EditorComponent } from '../../../helpers/editor.component'; | ||
| 11 | +import { RendererComponent } from '../../../helpers/renderer.component'; | ||
| 12 | +import { RoadTypeSelectList } from '../../../models/road-type-select-list'; | ||
| 13 | + | ||
| 14 | +import { routerTransition } from '../../../animations/router.animation'; | ||
| 15 | + | ||
| 16 | +@Component({ | ||
| 17 | + // tslint:disable-next-line:component-selector | ||
| 18 | + selector: 'road-grid', | ||
| 19 | + templateUrl: 'road.component.html', | ||
| 20 | + styleUrls: ['road.scss'], | ||
| 21 | + encapsulation: ViewEncapsulation.None, | ||
| 22 | +}) | ||
| 23 | +export class RoadComponent extends StatementBase { | ||
| 24 | + | ||
| 25 | + public roadTypes: RoadTypeSelectList[]; | ||
| 26 | + | ||
| 27 | + constructor( | ||
| 28 | + protected service: RoadService, | ||
| 29 | + protected dataService: RoadCreateService, | ||
| 30 | + protected loadingService: TdLoadingService, | ||
| 31 | + ) { | ||
| 32 | + super(); | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + protected createColumnDefs(): any[] { | ||
| 36 | + return [ | ||
| 37 | + { | ||
| 38 | + headerName: '#', | ||
| 39 | + width: 30, | ||
| 40 | + checkboxSelection: true, | ||
| 41 | + suppressSorting: true, | ||
| 42 | + suppressMenu: true, | ||
| 43 | + pinned: true, | ||
| 44 | + }, | ||
| 45 | + { | ||
| 46 | + headerName: 'ID', | ||
| 47 | + field: 'id', | ||
| 48 | + }, | ||
| 49 | + { | ||
| 50 | + headerName: 'Назва дороги', | ||
| 51 | + field: 'name', | ||
| 52 | + editable: true, | ||
| 53 | + }, | ||
| 54 | + { | ||
| 55 | + headerName: 'Індекс дороги', | ||
| 56 | + field: 'index', | ||
| 57 | + editable: true, | ||
| 58 | + }, | ||
| 59 | + { | ||
| 60 | + headerName: 'Тип дороги', | ||
| 61 | + field: 'roadTypeId', | ||
| 62 | + editable: true, | ||
| 63 | + cellEditorFramework: EditorComponent, | ||
| 64 | + cellRendererFramework: RendererComponent, | ||
| 65 | + cellEditorParams: { | ||
| 66 | + data: this.roadTypes, | ||
| 67 | + valueCol: 'roadTypeId', | ||
| 68 | + labelCol: 'name', | ||
| 69 | + }, | ||
| 70 | + }, | ||
| 71 | + ]; | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + protected initFunction(): void { | ||
| 75 | + this.dataService.getModels().then((models: any) => { | ||
| 76 | + this.roadTypes = models.roadTypeSelectListDsM as RoadTypeSelectList[]; | ||
| 77 | + }).then(() => { | ||
| 78 | + this.bootstrapGrid(); | ||
| 79 | + }); | ||
| 80 | + } | ||
| 81 | +} |
| 1 | +export class Road { | ||
| 2 | + id: number; | ||
| 3 | + name: string; | ||
| 4 | + value: string; | ||
| 5 | + length: number; | ||
| 6 | + historicalBackground: string; | ||
| 7 | + economicValue: string; | ||
| 8 | + lawDoc: string; | ||
| 9 | + acceptTransferDoc: string; | ||
| 10 | + acceptanceDoc: string; | ||
| 11 | + authorityAct: string; | ||
| 12 | + roadTypeId: number; | ||
| 13 | + index: number; | ||
| 14 | +} |
| 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 RoadCreateService extends CreateBaseService { | ||
| 8 | + protected apiUrl: string = 'http://localhost:5000/road/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 { Road } from '../models/road'; | ||
| 7 | + | ||
| 8 | +@Injectable() | ||
| 9 | +export class RoadService extends StatementBaseService { | ||
| 10 | + protected url: string = 'http://localhost:5000/road'; | ||
| 11 | + constructor(protected http: Http) { | ||
| 12 | + super(http); | ||
| 13 | + } | ||
| 14 | + public createModel(): Object { | ||
| 15 | + return new Road(); | ||
| 16 | + } | ||
| 17 | + protected parseModels(json: any): any[] { | ||
| 18 | + return json.busStopEditDsM as Road[]; | ||
| 19 | + }; | ||
| 20 | + protected parseModel(json: any): any { | ||
| 21 | + return json as Road; | ||
| 22 | + }; | ||
| 23 | +} |