From 6efb2a0076a544b5714bccba214d81904264540d Mon Sep 17 00:00:00 2001
From: xufenglei <xufenglei>
Date: Tue, 12 Jun 2018 08:49:31 +0800
Subject: [PATCH] 报表展示 增加镇村选项
---
src/app/routes/report/report.component.ts | 42 ++++++++++++++++++++++++++----------------
1 files changed, 26 insertions(+), 16 deletions(-)
diff --git a/src/app/routes/report/report.component.ts b/src/app/routes/report/report.component.ts
index 85f429f..85643f5 100644
--- a/src/app/routes/report/report.component.ts
+++ b/src/app/routes/report/report.component.ts
@@ -123,27 +123,34 @@
for (let i = 0; i < items.length; i++) {
this.title = items[i].formatTime;
items[i].deviceCount = deviceCounts[i];
- if (!(items[i].monitorPointId)) {
+ /* if (!(items[i].monitorPointId)) {
items[i].monitorPointName = items[i].areaName;
- }
- const legendName = items[i].formatTime + label +
- (items[i].mac ? '������:' + items[i].deviceName : (items[i].monitorPointId ? '���������:' + items[i].monitorPointName : items[i].areaName));
+ } */
+ const showName = this.items[i].showName =
+ items[i].mac ? ('������:' + items[i].deviceName) :
+ ((items[i].monitorPointId ? '���������:' + items[i].monitorPointName : items[i].areaName) + (items[i].professionName ? items[i].professionName : ''));
+ const legendName = items[i].formatTime + label + showName;
items[i].legendName = option.legend.data[i] = legendName;
- option.series.push({
- name: legendName,
- data: res.data.datas[i][sensorKey],
- type: params.reportType,
- smooth: true,
- itemStyle: {
- normal: {
- barBorderRadius: [10, 10, 10, 10]
+ if (res.data.datas[i][sensorKey]) {
+ option.series.push({
+ name: legendName,
+ data: res.data.datas[i][sensorKey],
+ type: params.reportType,
+ smooth: true,
+ itemStyle: {
+ normal: {
+ barBorderRadius: [10, 10, 10, 10]
+ }
}
- }
- });
+ });
+ }
}
const myChart = echarts.init(document.getElementById('mydiv' + index));
myChart.setOption(option, true);
window.onresize = myChart.resize;
+ if (option.series.length < 1) {
+ $('#mydiv' + index).remove();
+ }
}
this.sensorArr.forEach(i => {
if (i >= sensors.length) {
@@ -151,6 +158,9 @@
}
});
this.spinning = false;
+ if (!this.title) {
+ this.title = items[0].formatTime;
+ }
const title: any[] = this.title.replace(' ', '-').split('-');
this.title = '';
for (let i = 0; i < title.length; i++) {
@@ -224,10 +234,10 @@
for (const key in res.data.sortList[i]) {
const split = key.split('-');
this.sensorKeys.forEach(sensor => {
- if (sensor.key === split[0]) {
+ if (sensor.key === split[0] && res.data.sortList[i][key] != 0) {
this.resultArr.push({
sensorName: sensor.name,
- monitorPointName: this.items[split[1]].mac ? this.items[split[1]].deviceName : this.items[split[1]].monitorPointName,
+ monitorPointName: this.items[split[1]].showName,
result: res.data.sortList[i][key] + '%',
effect: sensor.effect,
measures: sensor.measures
--
Gitblit v1.8.0