@zgfe/modules-event 0.0.2-event.30 → 0.0.2-event.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,7 +13,7 @@ import { BizChart, BizGlobalDataContext, ajax } from '@zgfe/business-lib';
13
13
  import { EventTable, MiNone } from '../../components';
14
14
  import { judgeIsCity } from '../content/utils';
15
15
  import { getValue } from '../../modules/content/utils';
16
- import { getDefaultShow, getShowColor, getUserGroupsCompareData } from '../../utils/formData';
16
+ import { getDefaultShow, getShowColor, getUserGroupsCompareData, getChartDataEventAliasName } from '../../utils/formData';
17
17
  import _ from 'lodash';
18
18
  import moment from 'moment';
19
19
  import { Apis, chartColors } from '../../constants';
@@ -52,16 +52,6 @@ var EventChart = function EventChart(props) {
52
52
  if (!dataSource) return chartColors;
53
53
  return getShowColor(dataSource, showList);
54
54
  }, [showList]);
55
- var chartData = useMemo(function () {
56
- console.log('chartData?.length', dataSource);
57
- if (dataSource) {
58
- var data = _.cloneDeep(dataSource);
59
- data.x_axis = dataSource.xAxis;
60
- return data;
61
- } else {
62
- return [];
63
- }
64
- }, [dataSource, chartType]);
65
55
  useEffect(function () {
66
56
  if (!props.dataSource) {
67
57
  console.log('看板列表访问-请求查询', params);
@@ -108,10 +98,12 @@ var EventChart = function EventChart(props) {
108
98
  if (!res) {
109
99
  return;
110
100
  }
101
+ var _data = getChartDataEventAliasName(res.data, eventGroupList, params.userGroup.length);
102
+ console.log('chartData?.length-2', _data);
111
103
  if (params.userGroup.length > 1) {
112
- setDataSource(getUserGroupsCompareData(res.data));
104
+ setDataSource(getUserGroupsCompareData(_data));
113
105
  } else {
114
- setDataSource(res.data);
106
+ setDataSource(_data);
115
107
  }
116
108
  setLoading(false);
117
109
  }).catch(function () {
@@ -148,7 +140,7 @@ var EventChart = function EventChart(props) {
148
140
  }, /*#__PURE__*/React.createElement("div", null, "\u6570\u636E\u66F4\u65B0\u65F6\u95F4\uFF1A", moment().format('YYYY-MM-DD HH:mm')));
149
141
  };
150
142
  var chartBox = function chartBox() {
151
- if (chartData.series.length <= 0) {
143
+ if (dataSource.series.length <= 0) {
152
144
  return /*#__PURE__*/React.createElement("div", {
153
145
  className: "".concat(classPrefix, "-table-empty")
154
146
  }, /*#__PURE__*/React.createElement("img", {
@@ -161,7 +153,7 @@ var EventChart = function EventChart(props) {
161
153
  }, dataUpdateTime(), /*#__PURE__*/React.createElement(BizChart, {
162
154
  key: chartType,
163
155
  type: chartType,
164
- data: chartData,
156
+ data: dataSource,
165
157
  legendPosition: "bottom",
166
158
  showList: showList,
167
159
  colors: showColors,
@@ -16,7 +16,7 @@ import './styles/index.less';
16
16
  import { Apis } from '../../constants';
17
17
  import { judgeIsCity, judgeIsArea, getValue } from './utils';
18
18
  import { ContentPanel, SearchPanel } from '../../components';
19
- import { getDefaultShow, getUserGroupsCompareData } from '../../utils/formData';
19
+ import { getDefaultShow, getUserGroupsCompareData, getChartDataEventAliasName } from '../../utils/formData';
20
20
  import TopPanel from '../topPanel';
21
21
  var timer = 0;
22
22
  var ajaxFlag = true;
@@ -68,12 +68,16 @@ var EventContent = function EventContent(props) {
68
68
  }
69
69
  }, [props.defaultValue]);
70
70
  useEffect(function () {
71
- if (searchData && searchData.dimension) {
72
- var _getValue;
73
- var _attrName = (_getValue = getValue(searchData.dimension, eventGroupList, eventEnvList, userPropList)) === null || _getValue === void 0 ? void 0 : _getValue.name;
74
- if (_attrName) {
75
- setEnableSelectChart(judgeIsArea(_attrName));
76
- setIsCity(judgeIsCity(_attrName));
71
+ if (searchData) {
72
+ if (searchData.dimension) {
73
+ var _getValue;
74
+ var _attrName = (_getValue = getValue(searchData.dimension, eventGroupList, eventEnvList, userPropList)) === null || _getValue === void 0 ? void 0 : _getValue.name;
75
+ if (_attrName) {
76
+ setEnableSelectChart(judgeIsArea(_attrName));
77
+ setIsCity(judgeIsCity(_attrName));
78
+ }
79
+ } else {
80
+ setEnableSelectChart(false);
77
81
  }
78
82
  }
79
83
  if (timer) clearTimeout(timer);
@@ -115,12 +119,9 @@ var EventContent = function EventContent(props) {
115
119
  return;
116
120
  }
117
121
  var result = res.data;
118
- setShowList(result ? getDefaultShow(result) : []);
119
- if (searchData.userGroup.length > 1) {
120
- setEventData(getUserGroupsCompareData(result));
121
- } else {
122
- setEventData(result);
123
- }
122
+ var _data = getChartDataEventAliasName(result, eventGroupList, searchData.userGroup.length);
123
+ setShowList(_data ? getDefaultShow(_data) : []);
124
+ setEventData(getUserGroupsCompareData(_data));
124
125
  setFinalSearchData(_objectSpread({}, searchData));
125
126
  setTimeout(function () {
126
127
  setLoading(false);
@@ -1,10 +1,12 @@
1
1
  import { AttrConditionTypes } from '@zgfe/business-lib';
2
2
  import type { ColumnsType } from 'antd/es/table';
3
+ import { eventChartProps } from '../modules/chart/types';
3
4
  import { EventGroup, UserProp, EnvProp } from '@zgfe/business-lib/es/attributeSelector/types';
4
5
  import { ResponseDataProps, SearchValue } from '../types';
5
6
  import { EventProps } from '../modules/home/types';
6
7
  import '../style/index.less';
7
8
  export declare function getColumns(eventGroupList: EventGroup[] | undefined, userPropList: UserProp[] | undefined, eventEnvList: EnvProp[] | undefined, columnData: string[], userGroup: number[], searchData: SearchValue, showList: string[], onShowCallback: Function, onClickToDetailCallback: Function, onSelectEvent?: (id: number, name: string) => void): ColumnsType<EventProps.ColumnsDataType>;
9
+ export declare function getChartDataEventAliasName(dataSource: eventChartProps.ChartTypesProps, eventGroupList: EventGroup[] | undefined, userGroupLength: number): eventChartProps.ChartTypesProps;
8
10
  export declare function getEventAliasName(name: string, eventGroupList: EventGroup[] | undefined): string;
9
11
  export declare function getEventAliasId(name: string, eventGroupList: EventGroup[] | undefined): number;
10
12
  export declare function getUserGroupsCompareData(data: ResponseDataProps): ResponseDataProps;
@@ -89,8 +89,8 @@ export function getColumns(eventGroupList, userPropList, eventEnvList, columnDat
89
89
  ellipsis: true,
90
90
  fixed: true,
91
91
  render: function render(val) {
92
- console.log('事件', val);
93
- var _val = getEventAliasName(val, eventGroupList);
92
+ console.log('事件', val, eventGroupList);
93
+ var _val = val;
94
94
  return /*#__PURE__*/React.createElement(Tooltip, {
95
95
  className: "tooltip-name-box",
96
96
  title: _val
@@ -160,6 +160,17 @@ export function getColumns(eventGroupList, userPropList, eventEnvList, columnDat
160
160
  }
161
161
  return data;
162
162
  }
163
+ export function getChartDataEventAliasName(dataSource, eventGroupList, userGroupLength) {
164
+ var data = _.cloneDeep(dataSource);
165
+ var series = [];
166
+ data.series.map(function (item) {
167
+ item.names = userGroupLength > 1 ? [item.names[0], getEventAliasName(item.names[1], eventGroupList)] : [getEventAliasName(item.names[0], eventGroupList)];
168
+ series.push(item);
169
+ });
170
+ data.series = series;
171
+ console.log('getChartDataEventAliasName', data, dataSource);
172
+ return data;
173
+ }
163
174
  export function getEventAliasName(name, eventGroupList) {
164
175
  var aliasName = '';
165
176
  eventGroupList && eventGroupList.map(function (item) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/modules-event",
3
- "version": "0.0.2-event.30",
3
+ "version": "0.0.2-event.32",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -49,7 +49,7 @@
49
49
  "react": "^16.12.0 || ^17.0.0",
50
50
  "yorkie": "^2.0.0"
51
51
  },
52
- "gitHead": "7c82bb6d4001a0471fb61c7b49f7b3765c4defeb",
52
+ "gitHead": "549e21ba3723b7a59bbb6cbbb55de9743411c5f9",
53
53
  "dependencies": {
54
54
  "react-copy-to-clipboard": "^5.1.0",
55
55
  "react-highlight": "^0.15.0"