dcim-topology2d 1.1.0 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,6 +14,7 @@ var Calling = (function () {
14
14
  if (!options) {
15
15
  options = {};
16
16
  }
17
+ options.type = this.store.options.isFitview ? 'titLogo' : 'bottLogo';
17
18
  Object.assign(this.store.options, options);
18
19
  if (typeof parent === 'string') {
19
20
  this.store.parentElem = document.getElementById(parent);
@@ -137,6 +138,7 @@ var Calling = (function () {
137
138
  }
138
139
  this.store.data.scale *= scale;
139
140
  !center && (center = this.getRect().center);
141
+ center.type = this.store.options.type;
140
142
  for (var _i = 0, _a = this.store.data.pens; _i < _a.length; _i++) {
141
143
  var item = _a[_i];
142
144
  item.scale(scale, center, w, h);
@@ -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,
@@ -238,12 +238,12 @@ var Node = /** @class */ (function (_super) {
238
238
  this.iframe ||
239
239
  this.elementId ||
240
240
  this.hasGif()) {
241
- if(type) {
242
- // 复合Echarts初始化
243
- createChildrenDivByElementId(this);
244
- }else {
245
- Store.set(this.generateStoreKey('LT:addDiv'), this);
246
- }
241
+ if(type) {
242
+ // 复合Echarts初始化
243
+ createChildrenDivByElementId(this);
244
+ }else {
245
+ Store.set(this.generateStoreKey('LT:addDiv'), this);
246
+ }
247
247
  }
248
248
  };
249
249
  Node.prototype.hasGif = function () {
@@ -749,11 +749,13 @@ var Node = /** @class */ (function (_super) {
749
749
  this.rect.height *= h;
750
750
  this.rect.ex = this.rect.x + this.rect.width;
751
751
  this.rect.ey = this.rect.y + this.rect.height;
752
- if (this.imageWidth) {
753
- this.imageWidth *= w;
754
- }
755
- if (this.imageHeight) {
756
- this.imageHeight *= h;
752
+ if(!(center.type && center.type === 'bottLogo')) {
753
+ if (this.imageWidth) {
754
+ this.imageWidth *= w;
755
+ }
756
+ if (this.imageHeight) {
757
+ this.imageHeight *= h;
758
+ }
757
759
  }
758
760
  this.lastImage = null;
759
761
  this.font.fontSize *= scale;
@@ -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.2",
4
4
  "description": "",
5
5
  "main": "-",
6
6
  "scripts": {