perbaikan routing see more
This commit is contained in:
parent
21b75ca610
commit
379bdb24da
|
@ -115,8 +115,6 @@ export class BuildingComponent {
|
|||
}
|
||||
|
||||
viewDetail(row) {
|
||||
console.log(row.floor_id);
|
||||
console.log(row.building_id);
|
||||
if (row.building_id !== undefined && row.floor_id === undefined) {
|
||||
this.router.navigate(["/monitoring/view-detail-floor", row.building_id, row.id]);
|
||||
} else if (row.building_id !== undefined && row.floor_id !== undefined) {
|
||||
|
@ -124,9 +122,6 @@ export class BuildingComponent {
|
|||
} else {
|
||||
this.router.navigate(["/monitoring/view-detail-building", row.id]);
|
||||
}
|
||||
|
||||
|
||||
// this.router.navigate(["/monitoring/view-detail", row.id]);
|
||||
}
|
||||
|
||||
editRow(row) {
|
||||
|
|
|
@ -23,7 +23,10 @@ export class ControlDeviceSeemoreComponent {
|
|||
dataMasterStatus: any;
|
||||
spinnerFilterActive = false;
|
||||
switchState: boolean;
|
||||
paramsId: any;
|
||||
buildingId: any;
|
||||
floorId: any;
|
||||
roomId: any;
|
||||
modeRoute: any;
|
||||
|
||||
public breadcrumb: any;
|
||||
spinnerActive: boolean = false;
|
||||
|
@ -40,14 +43,15 @@ export class ControlDeviceSeemoreComponent {
|
|||
this.authService.startTokenCheck();
|
||||
this.authService.startTrackingActivity();
|
||||
this.route.params.subscribe((params) => {
|
||||
const buildingId = params["id"];
|
||||
this.paramsId = buildingId ? buildingId: 0;
|
||||
this.buildingSelected = parseInt(this.paramsId);
|
||||
|
||||
this.modeRoute = params["mode"];
|
||||
this.buildingId = params["buildingId"] ? params["buildingId"] : 0;
|
||||
this.floorId = params["floorId"] ? params["floorId"] : 0;
|
||||
this.roomId = params["roomId"] ? params["roomId"] : 0;
|
||||
this.buildingSelected = parseInt(this.buildingId);
|
||||
});
|
||||
this.breadcrumb = {
|
||||
mainlabel: "Control Device",
|
||||
linkBack: `/monitoring/view-new-building/${this.buildingSelected}`,
|
||||
linkBack: this.routeBack(''),
|
||||
isLinkBack: true,
|
||||
links: [
|
||||
{
|
||||
|
@ -77,6 +81,17 @@ export class ControlDeviceSeemoreComponent {
|
|||
this.dataListBuilding();
|
||||
}
|
||||
|
||||
routeBack(route){
|
||||
if (this.modeRoute === 'building') {
|
||||
route = `/monitoring/view-detail-building/${this.buildingId}`;
|
||||
} else if (this.modeRoute === 'floor') {
|
||||
route = `/monitoring/view-detail-floor/${this.buildingId}/${this.floorId}`;
|
||||
} else if (this.modeRoute === 'room') {
|
||||
route = `/monitoring/view-detail-room/${this.buildingId}/${this.floorId}/${this.roomId}`;
|
||||
}
|
||||
return route
|
||||
}
|
||||
|
||||
fetchData(buildingSelected, categorySelected, statusSelected) {
|
||||
this.deviceService
|
||||
.getDeviceData(buildingSelected, categorySelected, statusSelected)
|
||||
|
@ -112,11 +127,7 @@ export class ControlDeviceSeemoreComponent {
|
|||
|
||||
dataListBuilding() {
|
||||
this.monitoringApiService.getBuildingList().subscribe((data) => {
|
||||
console.log(data);
|
||||
|
||||
this.dataBuildingList = data.data.filter((item) => item.statusName.toLowerCase() === "aktif" || item.status_id === 71);
|
||||
console.log(this.dataBuildingList);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -141,7 +152,7 @@ export class ControlDeviceSeemoreComponent {
|
|||
}
|
||||
|
||||
doFilterCancel(){
|
||||
this.buildingSelected = parseInt(this.paramsId);
|
||||
this.buildingSelected = parseInt(this.buildingId);
|
||||
this.categorySelected = undefined;
|
||||
this.statusSelected = undefined;
|
||||
this.fetchData(this.buildingSelected, 0, 0);
|
||||
|
@ -173,7 +184,7 @@ export class ControlDeviceSeemoreComponent {
|
|||
command_type: "on_off",
|
||||
};
|
||||
this.deviceService.deviceSwitch(requestData).subscribe((res) => {
|
||||
console.log(res);
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -242,7 +242,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-6" *ngFor="let item of deviceCategory?.usesd">
|
||||
<div class="col-6" *ngFor="let item of deviceCategory?.used">
|
||||
<div
|
||||
class="card"
|
||||
style="
|
||||
|
@ -299,7 +299,7 @@
|
|||
font-family: 'Open Sans', sans-serif;
|
||||
font-weight: 700;
|
||||
"
|
||||
(click)="seeMore(paramsId)"
|
||||
(click)="seeMore(buildingId, floorId, roomId)"
|
||||
>
|
||||
See More
|
||||
</button>
|
||||
|
|
|
@ -55,7 +55,9 @@ export class DetailComponent {
|
|||
temperature: any;
|
||||
deviceCategory: any;
|
||||
chartKwhWater: any;
|
||||
paramsId: any;
|
||||
buildingId: any;
|
||||
floorId: any;
|
||||
roomId: any;
|
||||
//......
|
||||
|
||||
constructor(
|
||||
|
@ -85,40 +87,29 @@ export class DetailComponent {
|
|||
this.breadcrumbLink();
|
||||
this.route.params.subscribe((params) => {
|
||||
|
||||
const buildingId = params["buildingId"];
|
||||
const floorId = params["floorId"];
|
||||
const roomId = params["roomId"];
|
||||
console.log(buildingId, 'buildingId');
|
||||
console.log(floorId, 'floorId');
|
||||
console.log(roomId, 'roomId');
|
||||
this.buildingId = params["buildingId"] ? params["buildingId"] : 0;
|
||||
this.floorId = params["floorId"] ? params["floorId"] : 0;
|
||||
this.roomId = params["roomId"] ? params["roomId"] : 0;
|
||||
|
||||
if (buildingId !== undefined && floorId === undefined && roomId === undefined) {
|
||||
this.dataEnergyMonitoringTopCard(buildingId, 0, 0);
|
||||
this.dataEnergyMonitoringSummary(buildingId, 0, 0);
|
||||
this.dataEnergyDeviceCategory(buildingId, 0, 0);
|
||||
this.dataEnergyChartKwhWater(buildingId, 0, 0);
|
||||
} else if (buildingId !== undefined && floorId !== undefined && roomId === undefined) {
|
||||
this.dataEnergyMonitoringTopCard(buildingId, floorId, 0);
|
||||
this.dataEnergyMonitoringSummary(buildingId, floorId, 0);
|
||||
this.dataEnergyDeviceCategory(buildingId, floorId, 0);
|
||||
this.dataEnergyChartKwhWater(buildingId, floorId, 0);
|
||||
} else if (buildingId !== undefined && floorId !== undefined && roomId !== undefined) {
|
||||
this.dataEnergyMonitoringTopCard(buildingId, floorId, roomId);
|
||||
this.dataEnergyMonitoringSummary(buildingId, floorId, roomId);
|
||||
this.dataEnergyDeviceCategory(buildingId, floorId, roomId);
|
||||
this.dataEnergyChartKwhWater(buildingId, floorId, roomId);
|
||||
if (this.buildingId !== undefined && this.floorId === undefined && this.roomId === undefined) {
|
||||
this.dataEnergyMonitoringTopCard(this.buildingId, 0, 0);
|
||||
this.dataEnergyMonitoringSummary(this.buildingId, 0, 0);
|
||||
this.dataEnergyDeviceCategory(this.buildingId, 0, 0);
|
||||
this.dataEnergyChartKwhWater(this.buildingId, 0, 0);
|
||||
} else if (this.buildingId !== undefined && this.floorId !== undefined && this.roomId === undefined) {
|
||||
this.dataEnergyMonitoringTopCard(this.buildingId, this.floorId, 0);
|
||||
this.dataEnergyMonitoringSummary(this.buildingId, this.floorId, 0);
|
||||
this.dataEnergyDeviceCategory(this.buildingId, this.floorId, 0);
|
||||
this.dataEnergyChartKwhWater(this.buildingId, this.floorId, 0);
|
||||
} else if (this.buildingId !== undefined && this.floorId !== undefined && this.roomId !== undefined) {
|
||||
this.dataEnergyMonitoringTopCard(this.buildingId, this.floorId, this.roomId);
|
||||
this.dataEnergyMonitoringSummary(this.buildingId, this.floorId, this.roomId);
|
||||
this.dataEnergyDeviceCategory(this.buildingId, this.floorId, this.roomId);
|
||||
this.dataEnergyChartKwhWater(this.buildingId, this.floorId, this.roomId);
|
||||
}
|
||||
|
||||
this.paramsId = params["buildingId"];
|
||||
this.dataDeviceIr();
|
||||
this.getAirQualityData();
|
||||
// if (buildingId) {
|
||||
// this.dataEnergyMonitoringTopCard(buildingId);
|
||||
// this.dataEnergyMonitoringSummary(buildingId);
|
||||
// this.dataEnergyMonitoringSAir(buildingId);
|
||||
// this.dataEnergyDeviceCategory(buildingId);
|
||||
// this.dataEnergyChartKwhWater(buildingId);
|
||||
// }
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -282,7 +273,6 @@ export class DetailComponent {
|
|||
.getDashboardChartKwhWater(buildingId, floorId, roomId)
|
||||
.subscribe((res) => {
|
||||
this.chartKwhWater = res.data;
|
||||
console.log(this.chartKwhWater);
|
||||
this.chartKwhWater.forEach((entry) => {
|
||||
this.barChartData.push(entry.kwh.toFixed(1));
|
||||
this.barChartData2.push(entry.cost);
|
||||
|
@ -361,7 +351,7 @@ export class DetailComponent {
|
|||
// alert(`Day: ${params.name}\nKWH Consumption: ${params.value}`);
|
||||
}
|
||||
|
||||
seeMore(paramsId) {
|
||||
this.router.navigate(["/monitoring/control-device-see-more/", paramsId]);
|
||||
seeMore(buildingId, floorId, roomId) {
|
||||
this.router.navigate(["/monitoring/control-device-see-more/", buildingId, floorId, roomId, this.mode]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ import { ClipboardModule } from 'ngx-clipboard';
|
|||
component: WaterComponent,
|
||||
},
|
||||
{
|
||||
path: 'control-device-see-more/:id',
|
||||
path: 'control-device-see-more/:buildingId/:floorId/:roomId/:mode',
|
||||
component: ControlDeviceSeemoreComponent,
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue