road-width.component.ts
3.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
import {Component, ViewEncapsulation} from '@angular/core';
import {GridOptions} from 'ag-grid/main';
import { TdLoadingService } from '@covalent/core';
import { StatementBase } from '../../../models/statement.base';
import { RoadWidth } from '../../../models/road-width';
import { EditorComponent } from '../../../helpers/editor.component';
import { RendererComponent } from '../../../helpers/renderer.component';
import { RoadWidthService } from '../../../services/road-width.service';
import { RoadWidthCreateService } from '../../../services/road-width-create.service';
import { RegionSelectList } from '../../../models/region-select-list';
import { RoadSelectList } from '../../../models/road-select-list';
import { routerTransition } from '../../../animations/router.animation';
@Component({
selector: 'road-width',
templateUrl: 'road-width.component.html',
styleUrls: ['road-width.scss'],
encapsulation: ViewEncapsulation.None,
})
export class RoadWidthComponent extends StatementBase {
public regions: RegionSelectList[];
public roads: RoadSelectList[];
constructor(
protected service: RoadWidthService,
protected dataService: RoadWidthCreateService,
protected loadingService: TdLoadingService,
) {
super();
}
protected createColumnDefs(): any[] {
return [
{
headerName: '#',
width: 30,
checkboxSelection: true,
suppressSorting: true,
suppressMenu: true,
pinned: true,
},
{
headerName: 'ID',
field: 'id',
},
{
headerName: 'Назва дороги',
field: 'roadId',
editable: true,
cellEditorFramework: EditorComponent,
cellRendererFramework: RendererComponent,
cellEditorParams: {
data: this.roads,
valueCol: 'roadId',
labelCol: 'name',
},
},
{
headerName: 'Область',
field: 'regionId',
editable: true,
cellEditorFramework: EditorComponent,
cellRendererFramework: RendererComponent,
cellEditorParams: {
data: this.regions,
valueCol: 'regionId',
labelCol: 'name',
},
},
{
headerName: 'Місцезнаходження, км+ початок',
field: 'begin',
editable: true,
},
{
headerName: 'Місцезнаходженя, км+ кінець',
field: 'end',
editable: true,
},
{
headerName: 'Ширина, узбіччя зліва',
field: 'widthRoadsideLeft',
editable: true,
},
{
headerName: 'Ширина, проїзна зворотнього напрямку',
field: 'widthReverseRoad',
editable: true,
},
{
headerName: 'Ширина, розподільча смуга',
field: 'widthStrip',
editable: true,
},
{
headerName: 'Ширина, проїзна прямого напрямку',
field: 'widthRoadwayForward',
editable: true,
},
{
headerName: 'Ширина, узбіччя справа',
field: 'widthRoadsideRight',
editable: true,
},
{
headerName: 'Кількість смуг руху зліва',
field: 'countLaneLeft',
editable: true,
},
{
headerName: 'Кількість смуг руху справа',
field: 'countLaneRight',
editable: true,
},
];
}
protected initFunction(): void {
this.dataService.getModels().then((models: any) => {
this.regions = models.regionSelectListDsM as RegionSelectList[];
this.roads = models.roadSelectListDsM as RoadSelectList[];
}).then(() => {
this.bootstrapGrid();
});
}
// tslint:disable-next-line:member-ordering
public CreateModel(): Object {
return new RoadWidth();
}
}