@zgfe/modules-event 0.0.2-alpha.4 → 0.0.2-alpha.9

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.
@@ -1,3 +1,6 @@
1
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
3
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1
4
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
5
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
6
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
@@ -8,6 +11,7 @@ import { Tooltip } from 'antd';
8
11
  import React, { useEffect, useRef, useState } from 'react';
9
12
  import { BizEventSelector, BizAttributeSelector, IconFont, BizAttrConditionGroup } from '@zgfe/business-lib';
10
13
  import './styles/index.less';
14
+ import _ from 'lodash';
11
15
  var classPrefix = 'eventfilter-box';
12
16
  var EventFilter = function EventFilter(props) {
13
17
  var _useState = useState(0),
@@ -39,14 +43,16 @@ var EventFilter = function EventFilter(props) {
39
43
  bizAttributeSelectorValue = _useState12[0],
40
44
  setBizAttributeSelectorValue = _useState12[1];
41
45
  useEffect(function () {
42
- if (props.value !== null) {
43
- var _data = props.value[0];
46
+ if (props.value) {
47
+ var _data = props.value;
44
48
  setEvent({
45
49
  id: _data.id,
46
50
  name: _data.name
47
51
  });
48
52
  setFilter(_data.filters);
49
- setBizAttributeSelectorValue(_data.eventAttr);
53
+ setBizAttributeSelectorValue(_objectSpread(_objectSpread({}, _data.dimension), {}, {
54
+ key: _data.dimension.propCategory === 'eventProp' ? _data.dimension.value : _data.dimension.propCategory + '-' + _data.dimension.value
55
+ }));
50
56
  setEventOverview(false);
51
57
  }
52
58
  }, []);
@@ -89,13 +95,12 @@ var EventFilter = function EventFilter(props) {
89
95
  if (attr === undefined) {
90
96
  setBizAttributeSelectorValue(undefined);
91
97
  } else {
98
+ var _value = attr.propCategory === 'eventProp' ? attr.id : attr.name;
92
99
  setBizAttributeSelectorValue({
93
- id: attr.id,
94
100
  propCategory: attr.propCategory,
95
- name: attr.name,
96
101
  category: attr.category,
97
- label: attr.label,
98
- dimensionSub: attr.dimensionSub
102
+ value: _value,
103
+ key: attr.propCategory === 'eventProp' ? attr.id : attr.propCategory + '-' + _value
99
104
  });
100
105
  }
101
106
  };
@@ -108,10 +113,15 @@ var EventFilter = function EventFilter(props) {
108
113
  _event.filters = filter;
109
114
  }
110
115
  if (bizAttributeSelectorValue) {
111
- _event.eventAttr = bizAttributeSelectorValue;
116
+ var _dimension = _.cloneDeep(bizAttributeSelectorValue);
117
+ delete _dimension.key;
118
+ _event.dimension = _dimension;
112
119
  }
113
120
  props.onChange && props.onChange(_event);
114
121
  }, [bizAttributeSelectorValue, filter, event]);
122
+ useEffect(function () {
123
+ console.log(666, bizAttributeSelectorValue);
124
+ }, [bizAttributeSelectorValue]);
115
125
  return /*#__PURE__*/React.createElement("div", {
116
126
  className: classPrefix
117
127
  }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(BizEventSelector, {
@@ -9,6 +9,7 @@
9
9
  }
10
10
  .shaixuan {
11
11
  margin-top: 2px;
12
+ margin-left: 20px;
12
13
  color: #9aa1a9;
13
14
  font-size: 20px !important;
14
15
  cursor: pointer;
@@ -17,6 +17,7 @@ import { Apis } from '../../constants';
17
17
  import { Modal, message } from 'antd';
18
18
  import { formTableData, getColumns } from '../../utils/formData';
19
19
  import './styles/index.less';
20
+ import { getValue } from '../../modules/content/utils';
20
21
  import { EventContext } from '../../types';
21
22
  var classPrefix = 'mi-table';
22
23
  var EventTable = function EventTable(props) {
@@ -53,7 +54,7 @@ var EventTable = function EventTable(props) {
53
54
  sqlText = _useState10[0],
54
55
  setSqlText = _useState10[1];
55
56
  useEffect(function () {
56
- var gLen = (searchData === null || searchData === void 0 ? void 0 : searchData.filterConditions) && (searchData === null || searchData === void 0 ? void 0 : searchData.filterConditions[0].eventAttr) ? 1 : 0;
57
+ var gLen = (searchData === null || searchData === void 0 ? void 0 : searchData.dimension) ? 1 : 0;
57
58
  var sortData = formTableData(dataSource, searchData.userGroup || [0], gLen, eventGroupList);
58
59
  setSearchTable(sortData);
59
60
  setSortTable(sortData);
@@ -66,40 +67,24 @@ var EventTable = function EventTable(props) {
66
67
  props.changeShowByName(nameGroup);
67
68
  };
68
69
  var onClickToDetail = function onClickToDetail(item, time, count) {
69
- var _searchData$time;
70
- console.log('666', searchData);
71
- var group_value = '';
72
- if (searchData.filterConditions && searchData.filterConditions[0].eventAttr) {
73
- group_value = item.eventAttr;
74
- } else {
75
- eventGroupList === null || eventGroupList === void 0 ? void 0 : eventGroupList.forEach(function (group) {
76
- group.eventList.forEach(function (event) {
77
- if (event.name === item.name) {
78
- group_value = event.id.toString();
79
- }
80
- });
81
- });
82
- }
83
- var group_by = [['bar', 'map', 'pie'].includes(searchData.chartType) ? 'total' : (_searchData$time = searchData.time) === null || _searchData$time === void 0 ? void 0 : _searchData$time.unit];
84
- if (searchData.filterConditions && searchData.filterConditions[0].eventAttr) {
85
- var _searchData$filterCon;
86
- group_by.push((_searchData$filterCon = searchData.filterConditions[0].eventAttr) === null || _searchData$filterCon === void 0 ? void 0 : _searchData$filterCon.dimensionSub);
87
- } else {
88
- group_by.push('');
70
+ var _searchData$filters;
71
+ var group_value = {};
72
+ if (searchData.dimension) {
73
+ group_value = {
74
+ group_value: item.dimension
75
+ };
89
76
  }
90
77
  onUserDrill && onUserDrill({
91
78
  appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
92
79
  platform: (currentApp === null || currentApp === void 0 ? void 0 : currentApp.platform) || 0,
93
80
  count: count,
94
- params: _objectSpread(_objectSpread({
95
- appid: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
96
- plat: (currentApp === null || currentApp === void 0 ? void 0 : currentApp.platform) || 0,
97
- user_type: 0,
98
- isTotal: false,
99
- group_value: group_value,
100
- group_by: group_by.join(','),
101
- module: 'event'
102
- }, searchData), {}, {
81
+ module: 'event',
82
+ params: _objectSpread(_objectSpread({}, group_value), {}, {
83
+ id: searchData.id,
84
+ userGroup: searchData.userGroup,
85
+ chartType: searchData.chartType,
86
+ conditions: (_searchData$filters = searchData.filters) === null || _searchData$filters === void 0 ? void 0 : _searchData$filters.conditions,
87
+ dimension: searchData.dimension,
103
88
  time: _objectSpread(_objectSpread({}, searchData.time), {}, {
104
89
  begin: time[0],
105
90
  end: time.length > 1 ? time[1] : time[0]
@@ -128,7 +113,7 @@ var EventTable = function EventTable(props) {
128
113
  data: _objectSpread({
129
114
  appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
130
115
  platform: (currentApp === null || currentApp === void 0 ? void 0 : currentApp.platform) || 0,
131
- service: !searchData.filterConditions ? 'event/overview_sql' : 'event_sql'
116
+ service: !searchData.dimension ? 'event/overview_sql' : 'event_sql'
132
117
  }, searchData)
133
118
  }).then(function (res) {
134
119
  setSqlText(res.data.sql);
@@ -140,10 +125,10 @@ var EventTable = function EventTable(props) {
140
125
  if (searchData.userGroup && searchData.userGroup.length > 1) {
141
126
  seriesNames.push(base64.encode('用户群'));
142
127
  }
143
- if (searchData.filterConditions && searchData.filterConditions[0].eventAttr) {
144
- seriesNames.push(base64.encode(searchData.filterConditions[0].eventAttr.label));
128
+ if (searchData.dimension) {
129
+ seriesNames.push(base64.encode(getValue(searchData.dimension).label));
145
130
  }
146
- if (searchData.filterConditions && !searchData.filterConditions[0].eventAttr || !searchData.filterConditions) {
131
+ if (searchData.id && !searchData.dimension || !searchData.id) {
147
132
  seriesNames.push(base64.encode('事件'));
148
133
  }
149
134
  var params = _objectSpread(_objectSpread({
@@ -17,7 +17,8 @@ var classPrefix = 'modules-event-topbar';
17
17
  var TopBar = function TopBar(props) {
18
18
  var _useContext = useContext(EventContext),
19
19
  panelId = _useContext.panelId,
20
- afterEditTarget = _useContext.afterEditTarget;
20
+ afterEditTarget = _useContext.afterEditTarget,
21
+ enableAddScene = _useContext.enableAddScene;
21
22
  var _useState = useState(false),
22
23
  _useState2 = _slicedToArray(_useState, 2),
23
24
  showPanel = _useState2[0],
@@ -30,11 +31,14 @@ var TopBar = function TopBar(props) {
30
31
  currentApp = _useContext2.currentApp;
31
32
  var searchData = props.searchData,
32
33
  platformChange = props.platformChange;
33
- console.log(123123, searchData);
34
- var _useState5 = useState(),
34
+ var _useState5 = useState(searchData.platform === undefined ? 0 : searchData.platform),
35
35
  _useState6 = _slicedToArray(_useState5, 2),
36
- panelType = _useState6[0],
37
- setPanelType = _useState6[1];
36
+ selectPlatform = _useState6[0],
37
+ setselectPlatform = _useState6[1];
38
+ var _useState7 = useState(),
39
+ _useState8 = _slicedToArray(_useState7, 2),
40
+ panelType = _useState8[0],
41
+ setPanelType = _useState8[1];
38
42
  var closeHandle = function closeHandle(type) {
39
43
  if (type === 'panel') {
40
44
  setPanelType(undefined);
@@ -68,7 +72,7 @@ var TopBar = function TopBar(props) {
68
72
  onOk: function onOk(data) {
69
73
  return _onOk('panel', data);
70
74
  }
71
- })), !panelId && /*#__PURE__*/React.createElement("div", {
75
+ })), enableAddScene && /*#__PURE__*/React.createElement("div", {
72
76
  className: "".concat(classPrefix, "-scene")
73
77
  }, /*#__PURE__*/React.createElement(Button, {
74
78
  onClick: function onClick() {
@@ -95,9 +99,11 @@ var TopBar = function TopBar(props) {
95
99
  className: "".concat(classPrefix, "-platform")
96
100
  }, platformOption.map(function (item) {
97
101
  return /*#__PURE__*/React.createElement("div", {
102
+ className: "".concat(selectPlatform === item.key ? 'active' : ''),
98
103
  key: item.key,
99
104
  onClick: function onClick() {
100
- return platformChange(item.key);
105
+ setselectPlatform(item.key);
106
+ platformChange(item.key);
101
107
  }
102
108
  }, item.value);
103
109
  })));
@@ -25,7 +25,8 @@
25
25
  border: 1px solid #ecedf0;
26
26
  cursor: pointer;
27
27
  }
28
- > div:hover {
28
+ > div:hover,
29
+ .active {
29
30
  z-index: 1;
30
31
  color: #165dff;
31
32
  background: #e8efff;
@@ -11,6 +11,7 @@ import React, { useContext, useEffect, useMemo, useState } from 'react';
11
11
  import { BizChart, BizGlobalDataContext, ajax } from '@zgfe/business-lib';
12
12
  import { EventTable, MiNone } from '../../components';
13
13
  import { judgeIsCity } from '../content/utils';
14
+ import { getValue } from '../../modules/content/utils';
14
15
  import { getDefaultShow, getShowColor } from '../../utils/formData';
15
16
  import _ from 'lodash';
16
17
  import { Apis, chartColors } from '../../constants';
@@ -70,10 +71,10 @@ var EventChart = /*#__PURE__*/React.forwardRef(function (props, ref) {
70
71
  var chartData = ((_params$chartType = params.chartType) === null || _params$chartType === void 0 ? void 0 : _params$chartType.split(',')) || ['line'];
71
72
  var type = (chartData === null || chartData === void 0 ? void 0 : chartData.length) > 1 ? chartData[chartData.length - 1] : chartData[0];
72
73
  setChartType(props.type || type);
73
- if (params.filterConditions && params.filterConditions[0]) {
74
- var dimensions = params.filterConditions[0].eventAttr;
75
- if (type === 'map' && dimensions && dimensions.name) {
76
- setIsCity(judgeIsCity(dimensions.name));
74
+ if (params.id) {
75
+ var dimensions = params.dimension;
76
+ if (type === 'map' && dimensions) {
77
+ setIsCity(judgeIsCity(getValue(dimensions).name));
77
78
  }
78
79
  }
79
80
  }, [params, props.type]);
@@ -25,6 +25,7 @@ var CancelToken = Request.CancelToken;
25
25
  var cancel;
26
26
  var classPrefix = 'event-content';
27
27
  var EventContent = function EventContent(props) {
28
+ console.log('EventContent', props);
28
29
  var _Form$useForm = Form.useForm(),
29
30
  _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
30
31
  form = _Form$useForm2[0];
@@ -52,10 +53,13 @@ var EventContent = function EventContent(props) {
52
53
  _useState12 = _slicedToArray(_useState11, 2),
53
54
  isCity = _useState12[0],
54
55
  setIsCity = _useState12[1];
56
+ var _useState13 = useState(-1),
57
+ _useState14 = _slicedToArray(_useState13, 2),
58
+ eventId = _useState14[0],
59
+ setEventId = _useState14[1];
55
60
  var _useContext = useContext(BizGlobalDataContext),
56
61
  currentApp = _useContext.currentApp;
57
62
  var _useContext2 = useContext(EventContext),
58
- panelId = _useContext2.panelId,
59
63
  searchData = _useContext2.searchData,
60
64
  setSearchData = _useContext2.setSearchData;
61
65
  var _useContext3 = useContext(BizTargetFromPanelContext),
@@ -63,13 +67,41 @@ var EventContent = function EventContent(props) {
63
67
  var chartRef = useRef();
64
68
  var collapseRef = useRef();
65
69
  useEffect(function () {
66
- if (props.value && props.value.filterConditions && props.value.filterConditions[0].id !== -1) {
67
- setEventId(props.value.filterConditions[0].id);
70
+ form.resetFields();
71
+ if (props.defaultValue) {
72
+ setEventId(props.defaultValue.id);
73
+ var _props$defaultValue = props.defaultValue,
74
+ id = _props$defaultValue.id,
75
+ name = _props$defaultValue.name,
76
+ dimension = _props$defaultValue.dimension,
77
+ filters = _props$defaultValue.filters,
78
+ userGroup = _props$defaultValue.userGroup;
79
+ form.setFieldsValue({
80
+ userGroup: userGroup ? userGroup.map(function (item) {
81
+ return {
82
+ id: item
83
+ };
84
+ }) : [{
85
+ id: 0
86
+ }],
87
+ filterConditions: {
88
+ id: id,
89
+ name: name,
90
+ dimension: dimension,
91
+ filters: filters
92
+ }
93
+ });
94
+ } else {
95
+ form.setFieldsValue({
96
+ userGroup: [{
97
+ id: 0
98
+ }]
99
+ });
68
100
  }
69
- }, []);
101
+ }, [props.defaultValue]);
70
102
  useEffect(function () {
71
- if (searchData && searchData.filterConditions && searchData.filterConditions[0].eventAttr) {
72
- var _attrName = searchData.filterConditions[0].eventAttr.name;
103
+ if (searchData && searchData.filterConditions && searchData.filterConditions[0].dimension) {
104
+ var _attrName = searchData.filterConditions[0].dimension.name;
73
105
  setEnableSelectChart(judgeIsArea(_attrName));
74
106
  setIsCity(judgeIsCity(_attrName));
75
107
  }
@@ -130,23 +162,14 @@ var EventContent = function EventContent(props) {
130
162
  var onChangeShow = function onChangeShow(data) {
131
163
  setShowList(data);
132
164
  };
133
- var onFinish = function onFinish(values) {
134
- console.log('onFinish', values);
135
- };
136
- var _useState13 = useState(-1),
137
- _useState14 = _slicedToArray(_useState13, 2),
138
- eventId = _useState14[0],
139
- setEventId = _useState14[1];
140
165
  var onValuesChange = function onValuesChange(data) {
141
- console.log('onValuesChange', data);
142
166
  var _data = {};
143
167
  if (data.filterConditions) {
144
168
  if (data.filterConditions.id !== -100) {
145
- _data.filterConditions = [data.filterConditions];
146
- } else {
147
- _data.filterConditions = undefined;
169
+ _data = data.filterConditions;
170
+ setEventId(data.filterConditions.id);
148
171
  }
149
- if (finalSearchData && finalSearchData.filterConditions && data.filterConditions.id === finalSearchData.filterConditions[0].id) {
172
+ if (finalSearchData && finalSearchData.id && data.filterConditions.id === finalSearchData.id) {
150
173
  ajaxFlag = false;
151
174
  }
152
175
  } else if (data.userGroup) {
@@ -161,14 +184,13 @@ var EventContent = function EventContent(props) {
161
184
  setSearchData(function (_searchData) {
162
185
  return _objectSpread(_objectSpread({}, _searchData), _data);
163
186
  });
164
- if (data.event && data.event.id !== -1) {
165
- setEventId(data.event.id);
166
- }
167
187
  };
168
188
  var platformChange = function platformChange(data) {
169
189
  ajaxFlag = true;
170
190
  setSearchData(function (_searchData) {
171
- return _objectSpread(_objectSpread({}, _searchData), data);
191
+ return _objectSpread(_objectSpread({}, _searchData), {}, {
192
+ platform: data
193
+ });
172
194
  });
173
195
  };
174
196
  var resetting = function resetting() {
@@ -186,18 +208,7 @@ var EventContent = function EventContent(props) {
186
208
  component: "div",
187
209
  colon: false,
188
210
  layout: "vertical",
189
- onFinish: onFinish,
190
211
  scrollToFirstError: true,
191
- initialValues: {
192
- userGroup: searchData && searchData.userGroup ? searchData.userGroup.map(function (item) {
193
- return {
194
- id: item
195
- };
196
- }) : [{
197
- id: 0
198
- }],
199
- filterConditions: panelId ? searchData === null || searchData === void 0 ? void 0 : searchData.filterConditions : null
200
- },
201
212
  onValuesChange: onValuesChange
202
213
  }, /*#__PURE__*/React.createElement(Form.Item, {
203
214
  label: "",
@@ -1,6 +1,7 @@
1
1
  import { SearchValue } from '../../types';
2
2
  export declare namespace EventContentProps {
3
3
  interface Props {
4
+ defaultValue?: SearchValue;
4
5
  value: SearchValue;
5
6
  show?: string[];
6
7
  onSearching?: (flag: boolean) => void;
@@ -1,2 +1,5 @@
1
+ import { AttributeSelect } from '@zgfe/business-lib';
2
+ import { bizAttributeSelectorValueProp } from '../../types';
1
3
  export declare const judgeIsCity: (name: string | undefined) => boolean;
2
4
  export declare const judgeIsArea: (name: string | undefined) => boolean;
5
+ export declare const getValue: (param: bizAttributeSelectorValueProp) => AttributeSelect.Value | undefined;
@@ -1,3 +1,5 @@
1
+ import { BizGlobalDataContext } from '@zgfe/business-lib';
2
+ import { useContext } from 'react';
1
3
  export var judgeIsCity = function judgeIsCity(name) {
2
4
  var areaData = ['current_city', 'city'];
3
5
  return name && areaData.indexOf(name) !== -1 ? true : false;
@@ -5,4 +7,30 @@ export var judgeIsCity = function judgeIsCity(name) {
5
7
  export var judgeIsArea = function judgeIsArea(name) {
6
8
  var areaData = ['current_area', 'current_city', 'area', 'city'];
7
9
  return name && areaData.indexOf(name) !== -1 ? true : false;
10
+ };
11
+ export var getValue = function getValue(param) {
12
+ var _useContext = useContext(BizGlobalDataContext),
13
+ eventGroupList = _useContext.eventGroupList,
14
+ eventEnvList = _useContext.eventEnvList,
15
+ userPropList = _useContext.userPropList;
16
+ var res = undefined;
17
+ var key = param.propCategory === 'eventProp' ? param.value : param.propCategory + '-' + param.value;
18
+ if ((param === null || param === void 0 ? void 0 : param.propCategory) === 'envProp') {
19
+ eventEnvList === null || eventEnvList === void 0 ? void 0 : eventEnvList.forEach(function (attr) {
20
+ if (attr.key === key) res = attr;
21
+ });
22
+ } else if ((param === null || param === void 0 ? void 0 : param.propCategory) === 'eventProp') {
23
+ eventGroupList === null || eventGroupList === void 0 ? void 0 : eventGroupList.forEach(function (group) {
24
+ group.eventList.forEach(function (event) {
25
+ event.attrList.forEach(function (attr) {
26
+ if (attr.key === key) res = attr;
27
+ });
28
+ });
29
+ });
30
+ } else if ((param === null || param === void 0 ? void 0 : param.propCategory) === 'userProp') {
31
+ userPropList === null || userPropList === void 0 ? void 0 : userPropList.forEach(function (attr) {
32
+ if (attr.key === key) res = attr;
33
+ });
34
+ }
35
+ return res;
8
36
  };
@@ -9,7 +9,7 @@ import { DemoWrapper, setGlobalConfig } from '@zgfe/business-lib';
9
9
  import { ModuleEvent } from '../../../index';
10
10
  import { requestConfig } from '../../../utils/ajaxConfig';
11
11
  import { Button } from 'antd';
12
- var defaultValue = {};
12
+ var defaultValue = null;
13
13
  export default (function () {
14
14
  var _useState = useState(false),
15
15
  _useState2 = _slicedToArray(_useState, 2),
@@ -10,54 +10,43 @@ import { ModuleEvent } from '../../../index';
10
10
  import { requestConfig } from '../../../utils/ajaxConfig';
11
11
  import { Button } from 'antd';
12
12
  var defaultValue = {
13
- id: 243217,
14
- name: '事件分析1',
13
+ id: 7565,
14
+ name: '测试6666',
15
15
  type: 0,
16
16
  enlarged: 0,
17
17
  panelId: 400900,
18
18
  panelType: 'edit',
19
19
  data: {
20
- appId: 204,
21
20
  chartType: 'line',
22
- platform: 0,
23
- userGroup: [959, 962],
24
- analysisIndex: 'number',
25
- userAttr: '',
21
+ analysisIndex: 'per',
22
+ id: 7565,
23
+ name: '测试6666',
24
+ appId: 266,
25
+ platform: 1,
26
+ userGroup: [933, 935],
26
27
  time: {
27
28
  unit: 'day',
28
- relative: [7, 0],
29
- begin: '2023-08-03',
30
- end: '2023-08-10'
29
+ relative: [14, 0],
30
+ begin: '2023-08-04',
31
+ end: '2023-08-18'
31
32
  },
32
- filterConditions: [{
33
- type: 'event',
34
- alias: '崩溃',
35
- id: 6606,
36
- name: '崩溃',
37
- eventGroupId: -1,
38
- marked: false,
39
- filters: {
40
- relation: 'and',
41
- conditions: [{
42
- attrId: 142787,
43
- propCategory: 'eventProp',
44
- type: 1,
45
- operator: 'equal',
46
- values: ['com.zhuge.demo:main'],
47
- dimensionSub: 'event_attr',
48
- label: '异常进程名称',
49
- attrName: '异常进程名称'
50
- }]
51
- },
52
- eventAttr: {
53
- id: 142787,
33
+ dimension: {
34
+ propCategory: 'eventProp',
35
+ value: 151045
36
+ },
37
+ filters: {
38
+ relation: 'and',
39
+ conditions: [{
40
+ attrId: 151045,
54
41
  propCategory: 'eventProp',
55
- type: 2,
42
+ type: 1,
43
+ operator: 'equal',
44
+ values: ['55'],
56
45
  dimensionSub: 'event_attr',
57
- label: '异常进程名称',
58
- name: '异常进程名称'
59
- }
60
- }]
46
+ label: '应用名称',
47
+ attrName: '应用名称'
48
+ }]
49
+ }
61
50
  }
62
51
  };
63
52
  export default (function () {
@@ -87,7 +76,7 @@ export default (function () {
87
76
  };
88
77
  return /*#__PURE__*/React.createElement(DemoWrapper, {
89
78
  needMeta: true,
90
- defaultApp: 204
79
+ defaultApp: 266
91
80
  }, isDetail ? /*#__PURE__*/React.createElement("div", null, JSON.stringify(detailParams), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Button, {
92
81
  onClick: function onClick() {
93
82
  return setIsDetail(false);
@@ -10,29 +10,26 @@ import { ModuleEvent } from '../../../index';
10
10
  import { requestConfig } from '../../../utils/ajaxConfig';
11
11
  import { Button } from 'antd';
12
12
  var defaultValue = {
13
- source: 'SCENE',
14
13
  data: {
15
- app_id: 177,
16
- targets: [{
17
- type: 'event',
18
- alias: '事件概览',
19
- eventId: -100,
20
- eventName: '事件概览',
21
- eventGroupId: 0,
22
- analysisDimension: {
23
- analysisIndex: 'number'
24
- }
14
+ filterConditions: [{
15
+ name: '123123',
16
+ id: 7567
25
17
  }],
26
- userGroup: [0],
18
+ module: 'event',
19
+ analysisIndex: 'number',
20
+ chartType: 'line',
27
21
  time: {
28
- unit: 'month',
29
- relative: [3, 1],
30
- begin: '2022-09-27',
31
- end: '2022-12-27'
22
+ unit: 'day',
23
+ end: '2023-08-17',
24
+ begin: '2023-08-03',
25
+ relative: [14, 0]
32
26
  },
33
- chartType: 'line'
27
+ appId: 266,
28
+ userGroup: [0, 1039]
34
29
  },
35
- chosen_data: []
30
+ chosen_data: [],
31
+ source: 'EVENT',
32
+ enableAddScene: false
36
33
  };
37
34
  export default (function () {
38
35
  var _useState = useState(false),
@@ -61,7 +58,7 @@ export default (function () {
61
58
  };
62
59
  return /*#__PURE__*/React.createElement(DemoWrapper, {
63
60
  needMeta: true,
64
- defaultApp: 254
61
+ defaultApp: 266
65
62
  }, isDetail ? /*#__PURE__*/React.createElement("div", null, JSON.stringify(detailParams), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Button, {
66
63
  onClick: function onClick() {
67
64
  return setIsDetail(false);
@@ -17,6 +17,7 @@ import EventContent from '../content';
17
17
  import { chartTypes } from '../../constants';
18
18
  var classPrefix = 'event-container';
19
19
  var ModuleEvent = function ModuleEvent(props) {
20
+ console.log('ModuleEvent-props', props);
20
21
  var _useContext = useContext(BizGlobalDataContext),
21
22
  userGroupList = _useContext.userGroupList,
22
23
  currentApp = _useContext.currentApp;
@@ -104,12 +105,13 @@ var ModuleEvent = function ModuleEvent(props) {
104
105
  setSearchData: setSearchData,
105
106
  panelName: title,
106
107
  includeToday: props.includeToday,
107
- enableAddScene: props.enableAddScene && (!props.defaultValue || props.defaultValue.source === 'EVENT'),
108
+ enableAddScene: props.defaultValue && props.defaultValue.enableAddScene || !props.defaultValue,
108
109
  changeLoading: changeLoading,
109
110
  afterEditTarget: props.afterEditTarget,
110
111
  onUserDrill: props.onUserDrill
111
112
  }
112
113
  }, /*#__PURE__*/React.createElement(EventContent, {
114
+ defaultValue: props.defaultValue ? props.defaultValue.data : null,
113
115
  value: searchData,
114
116
  show: showList,
115
117
  onChange: setSearchData,
@@ -3,7 +3,6 @@ export declare namespace EventProps {
3
3
  interface Props {
4
4
  defaultValue?: Value;
5
5
  includeToday?: boolean;
6
- enableAddScene?: boolean;
7
6
  afterEditTarget?: (type: string, value?: any) => void;
8
7
  onUserDrill: (data: any, searchData: SearchValue) => void;
9
8
  }
package/es/types.d.ts CHANGED
@@ -2,26 +2,27 @@ import { TargetConditionTypes, AttrConditionTypes, BizSelectTypes, AttributeSele
2
2
  import { DatePickerTypes } from '@zgfe/business-lib/es/datePicker/types';
3
3
  import { ReactNode } from 'react';
4
4
  export interface bizAttributeSelectorValueProp {
5
- id?: number;
6
5
  propCategory?: string;
7
- name?: string;
8
6
  category?: string;
9
- label?: string;
10
- dimensionSub?: string;
7
+ value?: number | string;
8
+ key?: number | string;
11
9
  }
12
10
  export interface eventProps {
13
11
  id?: number;
14
12
  name?: string;
15
13
  filters?: AttrConditionTypes.GroupValue;
16
- eventAttr?: bizAttributeSelectorValueProp;
14
+ dimension?: bizAttributeSelectorValueProp;
17
15
  }
18
16
  export interface SearchValue {
17
+ id?: number;
18
+ name?: string;
19
19
  chartType?: EventChartTypes;
20
20
  userGroup?: number[];
21
21
  analysisIndex?: string;
22
22
  analysisAttr?: string;
23
23
  time?: DatePickerTypes.Value;
24
- filterConditions?: eventProps[];
24
+ dimension?: bizAttributeSelectorValueProp;
25
+ filters?: AttrConditionTypes.GroupValue;
25
26
  }
26
27
  export interface SearchData {
27
28
  userGroup?: Array<BizSelectTypes.Option>;
@@ -4,6 +4,7 @@ import { chartColors } from '../constants/color';
4
4
  import { PropCategory } from '@zgfe/business-lib/es/attributeSelector/types';
5
5
  import { Tooltip } from 'antd';
6
6
  import '../style/index.less';
7
+ import { getValue } from '../modules/content/utils';
7
8
  var classPrefix = 'event-form-data';
8
9
  export function getColumns(columnData, userGroup, searchData, showList, onShowCallback, onClickToDetailCallback) {
9
10
  var data = [{
@@ -44,13 +45,12 @@ export function getColumns(columnData, userGroup, searchData, showList, onShowCa
44
45
  }
45
46
  });
46
47
  }
47
- if (searchData.filterConditions && searchData.filterConditions[0].eventAttr) {
48
- var eventAttr = searchData.filterConditions[0].eventAttr;
48
+ if (searchData.dimension) {
49
49
  data.push({
50
- title: eventAttr.label,
50
+ title: getValue(searchData.dimension).label,
51
51
  width: 150,
52
- dataIndex: 'eventAttr',
53
- key: 'eventAttr',
52
+ dataIndex: 'dimension',
53
+ key: 'dimension',
54
54
  ellipsis: true,
55
55
  render: function render(val) {
56
56
  return /*#__PURE__*/React.createElement(Tooltip, {
@@ -64,7 +64,7 @@ export function getColumns(columnData, userGroup, searchData, showList, onShowCa
64
64
  }
65
65
  });
66
66
  }
67
- if (searchData.filterConditions && !searchData.filterConditions[0].eventAttr || !searchData.filterConditions) {
67
+ if (searchData.id && !searchData.dimension || !searchData.id) {
68
68
  data.push({
69
69
  title: '事件',
70
70
  width: 150,
@@ -184,7 +184,7 @@ export function formTableData(originalData, userGroups, attrNum, eventGroupList,
184
184
  };
185
185
  data.marked = markList[names[len - 1]];
186
186
  if (attrNum) {
187
- data["eventAttr"] = haveUserGroup ? names[1] : names[0];
187
+ data["dimension"] = haveUserGroup ? names[1] : names[0];
188
188
  } else {
189
189
  data["eventName"] = names[0];
190
190
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/modules-event",
3
- "version": "0.0.2-alpha.4",
3
+ "version": "0.0.2-alpha.9",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -36,7 +36,7 @@
36
36
  "@types/lodash": "^4.14.191",
37
37
  "@umijs/fabric": "^2.8.1",
38
38
  "@umijs/test": "^3.0.5",
39
- "@zgfe/business-lib": "1.1.72-event.3",
39
+ "@zgfe/business-lib": "1.1.76-event.0",
40
40
  "antd": "^4.22.6",
41
41
  "dumi": "^1.1.0",
42
42
  "echarts": "^5.3.2",
@@ -49,7 +49,7 @@
49
49
  "react": "^16.12.0 || ^17.0.0",
50
50
  "yorkie": "^2.0.0"
51
51
  },
52
- "gitHead": "a10ec53ac2302e81df1bbc1fab795dc065008019",
52
+ "gitHead": "b06071e8686d8bf5d8677633a58f4d8239151ba3",
53
53
  "dependencies": {
54
54
  "react-copy-to-clipboard": "^5.1.0",
55
55
  "react-highlight": "^0.15.0"