dcim-topology2d 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -282,7 +282,7 @@ var Common = /** @class */ (function () {
282
282
  try {
283
283
  const _this = this;
284
284
  const now = performance.now();
285
- if (now - _this.lastRender < _this.store.options.interval) {
285
+ if (now - _this.lastRender < _this.store.options.interval && !noFocus) {
286
286
  if (_this.renderTimer) {
287
287
  cancelAnimationFrame(_this.renderTimer);
288
288
  }
@@ -954,7 +954,7 @@ var Common = /** @class */ (function () {
954
954
  // console.log('收到消息', syncData)
955
955
  Store.set('mqtt:responseData', syncData);
956
956
  data.pens.map((item) => {
957
- if (item.children != undefined) {
957
+ if (item.children && item.children.length) {
958
958
  item.children.map((_item) => {
959
959
  item.defaultFillStyle = item.fillStyle;
960
960
  item.defaultFontColor = item.font.color;
@@ -5,4 +5,4 @@ export declare function setNodeEvents(item: any[], pen: Pen): void;
5
5
  export declare function setControlData(pen: Pen, syncData: Node): void;
6
6
  export declare function getControlNode(item: any, data: any): Node;
7
7
  export declare function getDetailData(data: Node): void;
8
- export declare function setStatisticalData(pen: Pen, data: any): Node;
8
+ export declare function setStatisticalData(pen: Pen, staticForType: string, chartData: any): Node;
@@ -96,22 +96,26 @@ export function setConfItemNode(pen, syn_synata) {
96
96
  const { echartDataValue } = syn_synata;
97
97
  //const seriesData = pen.data.echarts.option.series.length > 1 ? echartDataValue : echartData
98
98
  const seriesData = echartDataValue;
99
- if(seriesData) pen.data.echarts = setStatisticalData(pen, seriesData)
99
+ const chartData = seriesData && Object.keys(seriesData).length && seriesData[pen.data.params.id];
100
+ const staticForType = pen.data.params.staticForType ? pen.data.params.staticForType : '';//统计类型:日,周,月,年
101
+ if(staticForType && (!chartData || !chartData[`${staticForType}_Data`]) || !chartData) {
102
+ // 无效配置
103
+ }else {
104
+ pen.data.echarts = setStatisticalData(pen, staticForType, chartData);
105
+ }
100
106
  }
101
107
  }
102
108
  return pen
103
109
  }
104
- export function setStatisticalData(pen, echartData) {
110
+ export function setStatisticalData(pen, staticForType, chartData) {
105
111
  const node = Object.assign({}, pen);
106
112
  const displayMode = parseInt(node.data.echarts.option.displayMode);
107
- const chartData = echartData[node.data.params.id];
108
- if ((displayMode === 1 || displayMode === 2) && chartData){ // 折线图,柱状图
113
+ const chartOptions = staticForType ? chartData[`${staticForType}_Data`] : chartData;
114
+ if (displayMode === 1 || displayMode === 2){ // 折线图,柱状图
109
115
  //const xData = [], seriesData = [];
110
- const staticForType = node.data.params.staticForType ? node.data.params.staticForType : '';//统计类型:日,周,月,年
111
116
  const seriesNodes = node.data.echarts.option.series;
112
117
  // 双轴曲线
113
118
  if(seriesNodes.length > 1 || node.data.params.curveNum > 1){
114
- const chartOptions = staticForType ? chartData[`${staticForType}_Data`] : chartData;
115
119
  const legendData = [];
116
120
  if(!chartOptions) return;
117
121
  node.data.echarts.option.xAxis[0].data = chartOptions.XData;
@@ -130,16 +134,13 @@ export function setStatisticalData(pen, echartData) {
130
134
  node.data.echarts.option.series = []
131
135
  }
132
136
  }else {
133
- const chartOptions = staticForType ? chartData[`${staticForType}_Data`] : chartData;
134
137
  if(chartOptions) {
135
138
  node.data.echarts.option.xAxis[0].data = chartOptions.XData;
136
139
  node.data.echarts.option.series[0].data = chartOptions.seriesData;
137
140
  }
138
141
  }
139
142
  }
140
- if(displayMode === 4 && chartData) { // 电量图
141
- const staticForType = node.data.params.staticForType ? node.data.params.staticForType : '';//统计类型:日,周,月,年
142
- const chartOptions = staticForType ? chartData[`${staticForType}_Data`] : chartData;
143
+ if(displayMode === 4) { // 电量图
143
144
  node.data.echarts.option.yAxis[0].data = chartOptions.XData;
144
145
  node.data.echarts.option.yAxis[1].data = chartOptions.seriesData;
145
146
  node.data.echarts.option.series[0].data = chartOptions.seriesData;
@@ -153,10 +154,12 @@ export function setStatisticalData(pen, echartData) {
153
154
  node.data.echarts.option.series[1].data = barData;
154
155
  }
155
156
  }
156
- if (displayMode === 5 && chartData && Array.isArray(chartData)){ // 饼图
157
+ if (displayMode === 5){ // 饼图
157
158
  const colors = node.data.echarts.option.color;
159
+ const pieData = staticForType ? chartData : chartData.data;
158
160
  const seriesData = [];
159
- chartData.map((chd, index) => {
161
+ if(!pieData) return;
162
+ pieData.map((chd, index) => {
160
163
  seriesData.push({
161
164
  itemStyle: { color: colors[index] },
162
165
  name: chd.name,
@@ -1,7 +1,9 @@
1
1
  import { Store } from 'le5le-store';
2
2
  import { Lock } from '../models'
3
+ import {commonStore} from '../store';
3
4
  export let DomElements = {};
4
5
  export function createChildrenDivByElementId(node, data) {
6
+ if(!data) data = commonStore[node.TID].data;
5
7
  if (!DomElements[node.id]) {
6
8
  DomElements[node.id] = document.getElementById(node.id);
7
9
  if (DomElements[node.id]) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dcim-topology2d",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "",
5
5
  "main": "-",
6
6
  "scripts": {