|
|
@@ -21,15 +21,12 @@ import { formatDate } from '@angular/common';
|
|
|
|
|
|
import {AngularMyDatePickerDirective,IAngularMyDpOptions, IMyDateModel} from 'angular-mydatepicker';
|
|
|
|
|
|
-
|
|
|
-
|
|
|
@Component({
|
|
|
selector: 'app-assets',
|
|
|
templateUrl: './assets.component.html',
|
|
|
styleUrls: ['./assets.component.scss']
|
|
|
})
|
|
|
|
|
|
-
|
|
|
export class AssetsComponent implements OnInit {
|
|
|
|
|
|
title = "Plantas";
|
|
|
@@ -92,10 +89,7 @@ export class AssetsComponent implements OnInit {
|
|
|
|
|
|
this.route.queryParams.subscribe(params => {
|
|
|
this.organizationId = params['id'];
|
|
|
- console.log("organization");
|
|
|
- console.log(this.organizationId);
|
|
|
});
|
|
|
-
|
|
|
|
|
|
Swal.fire({
|
|
|
allowOutsideClick: false,
|
|
|
@@ -136,13 +130,11 @@ export class AssetsComponent implements OnInit {
|
|
|
this.onMeasureClickRange(this.view, this.initialDate);
|
|
|
|
|
|
let energy_produced = this.logsService.getEnergySummaryByAsset(this.organizationId).subscribe(resp => {
|
|
|
- console.log(resp);
|
|
|
this.eProduced = resp["data"]["energy"];//results[1];
|
|
|
this.energyDay = this.eProduced.today.total_energy_kWh;
|
|
|
- this.energyWeek = this.eProduced.thisWeek.total_energy_kWh > 0 ? this.eProduced.thisWeek.total_energy_kWh/1000 : this.eProduced.thisWeek.total_energy_kWh
|
|
|
- this.energyMonth = this.eProduced.thisMonth.total_energy_kWh > 0 ? this.eProduced.thisMonth.total_energy_kWh/1000 : this.eProduced.thisMonth.total_energy_kWh
|
|
|
- this.energyYear = this.eProduced.lifeTime.total_energy_kWh > 0 ? this.eProduced.lifeTime.total_energy_kWh/1000 : this.eProduced.lifeTime.total_energy_kWh
|
|
|
- console.log(this.energyYear);
|
|
|
+ this.energyWeek = this.eProduced.thisWeek.total_energy_kWh > 0 ? (this.eProduced.thisWeek.total_energy_kWh/1000).toFixed(2) : this.eProduced.thisWeek.total_energy_kWh
|
|
|
+ this.energyMonth = this.eProduced.thisMonth.total_energy_kWh > 0 ? (this.eProduced.thisMonth.total_energy_kWh/1000).toFixed(2) : this.eProduced.thisMonth.total_energy_kWh
|
|
|
+ this.energyYear = this.eProduced.lifeTime.total_energy_kWh > 0 ? (this.eProduced.lifeTime.total_energy_kWh/1000).toFixed(2) : this.eProduced.lifeTime.total_energy_kWh
|
|
|
});
|
|
|
|
|
|
}, (err) => {
|
|
|
@@ -153,8 +145,6 @@ export class AssetsComponent implements OnInit {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
-
|
|
|
-
|
|
|
//this.chartjs = true;
|
|
|
setTimeout(()=>{
|
|
|
Swal.close();
|
|
|
@@ -263,8 +253,6 @@ export class AssetsComponent implements OnInit {
|
|
|
|
|
|
this.logsService.getEnergyProducedByParams(assetId,interval,dateRange).toPromise()
|
|
|
.then((data: any) => {
|
|
|
- console.log("meters");
|
|
|
- console.log(data);
|
|
|
this.metersData = [];
|
|
|
this.metersKeys = Object.keys(data["data"]["dataset"]);
|
|
|
|