@zgfe/modules-event 0.0.2-alpha.2 → 0.0.2-alpha.23

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.
Files changed (36) hide show
  1. package/es/components/eventFilter/index.d.ts +2 -1
  2. package/es/components/eventFilter/index.js +31 -19
  3. package/es/components/eventFilter/styles/index.less +1 -0
  4. package/es/components/eventFilter/types.d.ts +5 -0
  5. package/es/components/renderContent/index.d.ts +1 -1
  6. package/es/components/renderContent/index.js +2 -3
  7. package/es/components/renderContent/types.d.ts +2 -4
  8. package/es/components/searchPanel/index.js +6 -6
  9. package/es/components/searchPanel/types.d.ts +2 -5
  10. package/es/components/table/index.js +35 -38
  11. package/es/components/topBar/index.d.ts +2 -1
  12. package/es/components/topBar/index.js +13 -7
  13. package/es/components/topBar/styles/index.less +2 -1
  14. package/es/components/topBar/types.d.ts +3 -5
  15. package/es/modules/chart/index.d.ts +1 -1
  16. package/es/modules/chart/index.js +12 -8
  17. package/es/modules/content/index.js +41 -108
  18. package/es/modules/content/styles/index.less +0 -11
  19. package/es/modules/content/types.d.ts +1 -0
  20. package/es/modules/content/utils.d.ts +4 -0
  21. package/es/modules/content/utils.js +23 -0
  22. package/es/modules/home/demo/create.js +1 -1
  23. package/es/modules/home/demo/edit.js +27 -38
  24. package/es/modules/home/demo/scene.js +32 -20
  25. package/es/modules/home/index.js +12 -3
  26. package/es/modules/home/styles/index.less +6 -2
  27. package/es/modules/home/types.d.ts +13 -4
  28. package/es/modules/topPanel/index.d.ts +5 -0
  29. package/es/modules/topPanel/index.js +110 -0
  30. package/es/modules/topPanel/styles/index.less +14 -0
  31. package/es/modules/topPanel/types.d.ts +25 -0
  32. package/es/modules/topPanel/types.js +1 -0
  33. package/es/types.d.ts +17 -14
  34. package/es/utils/formData.d.ts +3 -2
  35. package/es/utils/formData.js +11 -24
  36. package/package.json +3 -3
@@ -7,31 +7,29 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
7
7
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
8
8
  function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
9
9
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
10
- import { ajax, BizGlobalDataContext, BizLayout, BizTargetFromPanelContext, BizUserGroupHeader } from '@zgfe/business-lib';
10
+ import { ajax, BizGlobalDataContext, BizLayout, BizTargetFromPanelContext } from '@zgfe/business-lib';
11
11
  import React, { useContext, useEffect, useRef, useState } from 'react';
12
12
  import Request from 'umi-request';
13
13
  import TopBar from '../../components/topBar';
14
14
  import { EventContext } from '../../types';
15
15
  import './styles/index.less';
16
16
  import { Apis } from '../../constants';
17
- import { judgeIsCity, judgeIsArea } from './utils';
17
+ import { judgeIsCity, judgeIsArea, getValue } from './utils';
18
18
  import { ContentPanel, SearchPanel } from '../../components';
19
19
  import { getDefaultShow } from '../../utils/formData';
20
- import { Form, Button } from 'antd';
21
- import EventFilter from '../../components/eventFilter';
20
+ import TopPanel from '../topPanel';
22
21
  var timer = 0;
23
22
  var ajaxFlag = true;
24
23
  var CancelToken = Request.CancelToken;
25
24
  var cancel;
26
25
  var classPrefix = 'event-content';
27
26
  var EventContent = function EventContent(props) {
28
- var _Form$useForm = Form.useForm(),
29
- _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
30
- form = _Form$useForm2[0];
31
27
  var _useState = useState(props.value),
32
28
  _useState2 = _slicedToArray(_useState, 2),
33
29
  finalSearchData = _useState2[0],
34
30
  setFinalSearchData = _useState2[1];
31
+ var _useContext = useContext(BizGlobalDataContext),
32
+ currentApp = _useContext.currentApp;
35
33
  var _useState3 = useState(),
36
34
  _useState4 = _slicedToArray(_useState3, 2),
37
35
  eventData = _useState4[0],
@@ -52,26 +50,32 @@ var EventContent = function EventContent(props) {
52
50
  _useState12 = _slicedToArray(_useState11, 2),
53
51
  isCity = _useState12[0],
54
52
  setIsCity = _useState12[1];
55
- var _useContext = useContext(BizGlobalDataContext),
56
- currentApp = _useContext.currentApp;
53
+ var _useState13 = useState(-1),
54
+ _useState14 = _slicedToArray(_useState13, 2),
55
+ eventId = _useState14[0],
56
+ setEventId = _useState14[1];
57
57
  var _useContext2 = useContext(EventContext),
58
- panelId = _useContext2.panelId,
59
58
  searchData = _useContext2.searchData,
60
- setSearchData = _useContext2.setSearchData;
59
+ setSearchData = _useContext2.setSearchData,
60
+ eventGroupList = _useContext2.eventGroupList,
61
+ eventEnvList = _useContext2.eventEnvList,
62
+ userPropList = _useContext2.userPropList;
61
63
  var _useContext3 = useContext(BizTargetFromPanelContext),
62
64
  handleSearch = _useContext3.handleSearch;
63
- var chartRef = useRef();
64
65
  var collapseRef = useRef();
65
66
  useEffect(function () {
66
- if (props.value && props.value.filterConditions && props.value.filterConditions[0].id !== -1) {
67
- setEventId(props.value.filterConditions[0].id);
67
+ if (props.defaultValue) {
68
+ setEventId(props.defaultValue.id);
68
69
  }
69
- }, []);
70
+ }, [props.defaultValue]);
70
71
  useEffect(function () {
71
- if (searchData && searchData.filterConditions && searchData.filterConditions[0].eventAttr) {
72
- var _attrName = searchData.filterConditions[0].eventAttr.name;
73
- setEnableSelectChart(judgeIsArea(_attrName));
74
- setIsCity(judgeIsCity(_attrName));
72
+ if (searchData && 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
+ }
75
79
  }
76
80
  if (timer) clearTimeout(timer);
77
81
  var flag = true;
@@ -88,7 +92,8 @@ var EventContent = function EventContent(props) {
88
92
  useEffect(function () {
89
93
  handleSearch && handleSearch(loading);
90
94
  }, [loading]);
91
- var fetchRequest = function fetchRequest() {
95
+ var fetchRequest = function fetchRequest(flag) {
96
+ if (flag !== undefined) ajaxFlag = flag;
92
97
  if (!ajaxFlag) return;
93
98
  setLoading(true);
94
99
  setEventData(undefined);
@@ -130,98 +135,21 @@ var EventContent = function EventContent(props) {
130
135
  var onChangeShow = function onChangeShow(data) {
131
136
  setShowList(data);
132
137
  };
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
- var onValuesChange = function onValuesChange(data) {
141
- console.log('onValuesChange', data);
142
- var _data = {};
143
- if (data.filterConditions) {
144
- if (data.filterConditions.id !== -100) {
145
- _data.filterConditions = [data.filterConditions];
146
- } else {
147
- _data.filterConditions = undefined;
148
- }
149
- if (finalSearchData && finalSearchData.filterConditions && data.filterConditions.id === finalSearchData.filterConditions[0].id) {
150
- ajaxFlag = false;
151
- }
152
- } else if (data.userGroup) {
153
- _data.userGroup = [];
154
- data.userGroup.map(function (item) {
155
- _data.userGroup.push(item.id);
156
- });
157
- if (_data.userGroup.length <= 0) _data.userGroup = [0];
158
- } else {
159
- _data = _objectSpread({}, data);
160
- }
161
- setSearchData(function (_searchData) {
162
- return _objectSpread(_objectSpread({}, _searchData), _data);
163
- });
164
- if (data.event && data.event.id !== -1) {
165
- setEventId(data.event.id);
166
- }
167
- };
168
138
  var platformChange = function platformChange(data) {
169
139
  ajaxFlag = true;
170
140
  setSearchData(function (_searchData) {
171
- return _objectSpread(_objectSpread({}, _searchData), data);
141
+ return _objectSpread(_objectSpread({}, _searchData), {}, {
142
+ platform: data
143
+ });
172
144
  });
173
145
  };
174
- var resetting = function resetting() {
175
- form.resetFields();
176
- form.setFieldsValue({
177
- userGroup: [{
178
- id: 0
179
- }],
180
- filterConditions: null
146
+ var onChangeSearch = function onChangeSearch(data, flag) {
147
+ ajaxFlag = flag;
148
+ data.id ? setEventId(data.id) : setEventId(-1);
149
+ setSearchData(function (_searchData) {
150
+ return _objectSpread(_objectSpread({}, _searchData), data);
181
151
  });
182
- props.initSearch && props.initSearch();
183
152
  };
184
- var topPanel = /*#__PURE__*/React.createElement(Form, {
185
- form: form,
186
- component: "div",
187
- colon: false,
188
- layout: "vertical",
189
- onFinish: onFinish,
190
- 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
- onValuesChange: onValuesChange
202
- }, /*#__PURE__*/React.createElement(Form.Item, {
203
- label: "",
204
- name: "userGroup"
205
- }, /*#__PURE__*/React.createElement(BizUserGroupHeader, {
206
- max: 3
207
- })), /*#__PURE__*/React.createElement(Form.Item, {
208
- label: "\u4E8B\u4EF6",
209
- name: "filterConditions",
210
- style: {
211
- paddingLeft: '24px'
212
- }
213
- }, /*#__PURE__*/React.createElement(EventFilter, null)), /*#__PURE__*/React.createElement("div", {
214
- className: "".concat(classPrefix, "-form-botton-box")
215
- }, /*#__PURE__*/React.createElement(Button, {
216
- onClick: resetting
217
- }, "\u91CD\u7F6E"), /*#__PURE__*/React.createElement(Button, {
218
- disabled: ajaxFlag,
219
- type: "primary",
220
- onClick: function onClick() {
221
- ajaxFlag = true;
222
- fetchRequest();
223
- }
224
- }, "\u67E5\u8BE2")));
225
153
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TopBar, {
226
154
  searchData: searchData,
227
155
  platformChange: platformChange
@@ -231,11 +159,17 @@ var EventContent = function EventContent(props) {
231
159
  collapseRef: collapseRef,
232
160
  topPanel: /*#__PURE__*/React.createElement("div", {
233
161
  ref: collapseRef
234
- }, topPanel)
162
+ }, /*#__PURE__*/React.createElement(TopPanel, {
163
+ onChange: onChangeSearch,
164
+ defaultValue: searchData,
165
+ ajaxFlag: ajaxFlag,
166
+ finalSearchData: finalSearchData,
167
+ fetchRequest: fetchRequest
168
+ }))
235
169
  }, /*#__PURE__*/React.createElement("div", {
236
170
  className: classPrefix
237
171
  }, /*#__PURE__*/React.createElement(SearchPanel, {
238
- chart: searchData === null || searchData === void 0 ? void 0 : searchData.chartType,
172
+ chartType: searchData === null || searchData === void 0 ? void 0 : searchData.chartType,
239
173
  time: searchData === null || searchData === void 0 ? void 0 : searchData.time,
240
174
  analysisAttr: searchData === null || searchData === void 0 ? void 0 : searchData.analysisAttr,
241
175
  analysisIndex: searchData === null || searchData === void 0 ? void 0 : searchData.analysisIndex,
@@ -243,7 +177,6 @@ var EventContent = function EventContent(props) {
243
177
  enableSelectChart: enableSelectChart,
244
178
  onChange: onChangeContent
245
179
  }), /*#__PURE__*/React.createElement(ContentPanel, {
246
- ref: chartRef,
247
180
  loading: loading,
248
181
  isCity: isCity,
249
182
  eventData: eventData,
@@ -4,15 +4,4 @@
4
4
  justify-content: flex-end;
5
5
  margin-bottom: 16px;
6
6
  }
7
- &-form-botton-box {
8
- display: flex;
9
- justify-content: flex-end;
10
- margin-top: 24px;
11
- > :nth-child(1) {
12
- margin-right: 16px;
13
- color: #fff;
14
- background-color: #29bd52;
15
- border-color: #29bd52;
16
- }
17
- }
18
7
  }
@@ -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,6 @@
1
+ import { AttributeSelect } from '@zgfe/business-lib';
2
+ import { bizAttributeSelectorValueProp } from '../../types';
3
+ import { EventGroup, UserProp, EnvProp } from '@zgfe/business-lib/es/attributeSelector/types';
1
4
  export declare const judgeIsCity: (name: string | undefined) => boolean;
2
5
  export declare const judgeIsArea: (name: string | undefined) => boolean;
6
+ export declare const getValue: (param: bizAttributeSelectorValueProp, eventGroupList: EventGroup[] | undefined, eventEnvList: EnvProp[] | undefined, userPropList: UserProp[] | undefined) => AttributeSelect.Value | undefined;
@@ -5,4 +5,27 @@ export var judgeIsCity = function judgeIsCity(name) {
5
5
  export var judgeIsArea = function judgeIsArea(name) {
6
6
  var areaData = ['current_area', 'current_city', 'area', 'city'];
7
7
  return name && areaData.indexOf(name) !== -1 ? true : false;
8
+ };
9
+ export var getValue = function getValue(param, eventGroupList, eventEnvList, userPropList) {
10
+ var res = undefined;
11
+ var key = param.propCategory === 'eventProp' ? param.value : param.propCategory + '-' + param.value;
12
+ if ((param === null || param === void 0 ? void 0 : param.propCategory) === 'envProp') {
13
+ eventEnvList === null || eventEnvList === void 0 ? void 0 : eventEnvList.forEach(function (attr) {
14
+ if (attr.key === key) res = attr;
15
+ });
16
+ } else if ((param === null || param === void 0 ? void 0 : param.propCategory) === 'eventProp') {
17
+ eventGroupList === null || eventGroupList === void 0 ? void 0 : eventGroupList.forEach(function (group) {
18
+ group.eventList.forEach(function (event) {
19
+ event.attrList.forEach(function (attr) {
20
+ if (attr.key === key) res = attr;
21
+ });
22
+ });
23
+ });
24
+ } else if ((param === null || param === void 0 ? void 0 : param.propCategory) === 'userProp') {
25
+ userPropList === null || userPropList === void 0 ? void 0 : userPropList.forEach(function (attr) {
26
+ if (attr.key === key) res = attr;
27
+ });
28
+ }
29
+ console.log('获取当前属性的全部数据', res);
30
+ return res;
8
31
  };
@@ -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,41 @@ 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
- }
25
- }],
26
- userGroup: [0],
14
+ module: 'event',
15
+ analysisIndex: 'times',
16
+ chartType: 'line',
17
+ name: 'wqeqwe',
27
18
  time: {
28
- unit: 'month',
29
- relative: [3, 1],
30
- begin: '2022-09-27',
31
- end: '2022-12-27'
19
+ unit: 'day',
20
+ end: '2023-08-19',
21
+ begin: '2023-08-05',
22
+ relative: [14, 0]
23
+ },
24
+ id: 7569,
25
+ filters: {
26
+ conditions: [{
27
+ attrId: 151053,
28
+ propCategory: 'eventProp',
29
+ values: ['111'],
30
+ dimensionSub: 'event_attr',
31
+ label: '应用名称',
32
+ type: 1,
33
+ operator: 'equal',
34
+ attrName: '应用名称'
35
+ }],
36
+ relation: 'and'
32
37
  },
33
- chartType: 'line'
38
+ appId: 266,
39
+ userGroup: [0],
40
+ dimension: {
41
+ propCategory: 'eventProp',
42
+ value: 151053
43
+ }
34
44
  },
35
- chosen_data: []
45
+ chosen_data: [],
46
+ source: 'EVENT',
47
+ enableAddScene: false
36
48
  };
37
49
  export default (function () {
38
50
  var _useState = useState(false),
@@ -61,7 +73,7 @@ export default (function () {
61
73
  };
62
74
  return /*#__PURE__*/React.createElement(DemoWrapper, {
63
75
  needMeta: true,
64
- defaultApp: 254
76
+ defaultApp: 266
65
77
  }, isDetail ? /*#__PURE__*/React.createElement("div", null, JSON.stringify(detailParams), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Button, {
66
78
  onClick: function onClick() {
67
79
  return setIsDetail(false);
@@ -17,9 +17,14 @@ 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
- userGroupList = _useContext.userGroupList,
22
- currentApp = _useContext.currentApp;
22
+ currentApp = _useContext.currentApp,
23
+ eventGroupList = _useContext.eventGroupList,
24
+ eventEnvList = _useContext.eventEnvList,
25
+ userPropList = _useContext.userPropList,
26
+ userGroupList = _useContext.userGroupList;
27
+ console.log('BizGlobalDataContext', eventGroupList, eventEnvList, userPropList);
23
28
  var _useState = useState(),
24
29
  _useState2 = _slicedToArray(_useState, 2),
25
30
  searchData = _useState2[0],
@@ -100,16 +105,20 @@ var ModuleEvent = function ModuleEvent(props) {
100
105
  value: {
101
106
  panelId: panelId,
102
107
  elementId: elementId,
108
+ eventGroupList: eventGroupList,
109
+ eventEnvList: eventEnvList,
110
+ userPropList: userPropList,
103
111
  searchData: searchData,
104
112
  setSearchData: setSearchData,
105
113
  panelName: title,
106
114
  includeToday: props.includeToday,
107
- enableAddScene: props.enableAddScene && (!props.defaultValue || props.defaultValue.source === 'EVENT'),
115
+ enableAddScene: props.defaultValue && props.defaultValue.enableAddScene === false ? false : true,
108
116
  changeLoading: changeLoading,
109
117
  afterEditTarget: props.afterEditTarget,
110
118
  onUserDrill: props.onUserDrill
111
119
  }
112
120
  }, /*#__PURE__*/React.createElement(EventContent, {
121
+ defaultValue: props.defaultValue ? props.defaultValue.data : undefined,
113
122
  value: searchData,
114
123
  show: showList,
115
124
  onChange: setSearchData,
@@ -2,7 +2,7 @@
2
2
  width: 100%;
3
3
  min-width: 1000px;
4
4
  height: 100%;
5
- overflow: hidden;
5
+ background: #fafafb;
6
6
  &-header-title {
7
7
  height: 48px;
8
8
  padding: 0px 24px;
@@ -14,7 +14,7 @@
14
14
  }
15
15
  .biz-layout-top {
16
16
  margin-top: 2px;
17
- padding: 24px 24px 24px 0;
17
+ padding-top: 0;
18
18
  .biz-user-group-header {
19
19
  .ant-space-item {
20
20
  color: #5f6085;
@@ -37,4 +37,8 @@
37
37
  .biz-select-overlay {
38
38
  max-height: 300px;
39
39
  }
40
+
41
+ .biz-layout-panel-content {
42
+ height: auto;
43
+ }
40
44
  }
@@ -1,11 +1,10 @@
1
- import { SearchValue } from '../../types';
1
+ import { SearchValue, UserDrillParamsProp } from '../../types';
2
2
  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
- onUserDrill: (data: any, searchData: SearchValue) => void;
7
+ onUserDrill: (data: UserDrillParamsProp, searchData: SearchValue) => void;
9
8
  }
10
9
  interface Value {
11
10
  panelId?: number;
@@ -13,8 +12,18 @@ export declare namespace EventProps {
13
12
  source?: string;
14
13
  name?: string;
15
14
  id?: number;
16
- data?: any;
15
+ data?: SearchValue;
17
16
  chosen_data?: string[];
18
17
  [props: string]: any;
19
18
  }
19
+ interface ColumnsDataType {
20
+ color: string;
21
+ eventName?: string;
22
+ id: number;
23
+ dimension?: string;
24
+ name: string;
25
+ nameGroup: string;
26
+ userGroup: string;
27
+ [x: string]: string | number | undefined;
28
+ }
20
29
  }
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import './styles/index.less';
3
+ import { TopPanelProps } from './types';
4
+ declare const TopPanel: React.FC<TopPanelProps>;
5
+ export default TopPanel;
@@ -0,0 +1,110 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ 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
+ 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); }
4
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
5
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import React from 'react';
8
+ import { Form, Button } from 'antd';
9
+ import { BizUserGroupHeader } from '@zgfe/business-lib';
10
+ import EventFilter from '../../components/eventFilter';
11
+ import './styles/index.less';
12
+ var classPrefix = 'top-panel';
13
+ var TopPanel = function TopPanel(props) {
14
+ var defaultValue = props.defaultValue,
15
+ ajaxFlag = props.ajaxFlag,
16
+ finalSearchData = props.finalSearchData,
17
+ fetchRequest = props.fetchRequest;
18
+ var _Form$useForm = Form.useForm(),
19
+ _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
20
+ form = _Form$useForm2[0];
21
+ var id = defaultValue.id,
22
+ name = defaultValue.name,
23
+ dimension = defaultValue.dimension,
24
+ filters = defaultValue.filters,
25
+ userGroup = defaultValue.userGroup;
26
+ var onValuesChange = function onValuesChange(data, allData) {
27
+ var _data = {};
28
+ if (allData.filterConditions) {
29
+ if (allData.filterConditions.id !== -100) {
30
+ _data = allData.filterConditions;
31
+ }
32
+ }
33
+ if (allData.userGroup) {
34
+ _data.userGroup = [];
35
+ allData.userGroup.map(function (item) {
36
+ _data.userGroup && _data.userGroup.push(item.id);
37
+ });
38
+ if (_data.userGroup.length <= 0) _data.userGroup = [0];
39
+ }
40
+ if (data.filterConditions) {
41
+ if (finalSearchData && finalSearchData.id && data.filterConditions.id === finalSearchData.id) {
42
+ ajaxFlag = false;
43
+ } else {
44
+ ajaxFlag = true;
45
+ }
46
+ }
47
+ props.onChange(_data, ajaxFlag);
48
+ };
49
+ var resetting = function resetting() {
50
+ form.resetFields();
51
+ form.setFieldsValue({
52
+ userGroup: [{
53
+ id: 0
54
+ }],
55
+ filterConditions: null
56
+ });
57
+ props.onChange({
58
+ userGroup: [0],
59
+ id: undefined,
60
+ name: undefined,
61
+ filters: undefined,
62
+ dimension: undefined
63
+ }, true);
64
+ };
65
+ return /*#__PURE__*/React.createElement(Form, {
66
+ form: form,
67
+ component: "div",
68
+ colon: false,
69
+ layout: "vertical",
70
+ initialValues: {
71
+ userGroup: userGroup ? userGroup.map(function (item) {
72
+ return {
73
+ id: item
74
+ };
75
+ }) : [{
76
+ id: 0
77
+ }],
78
+ filterConditions: {
79
+ id: id,
80
+ name: name,
81
+ dimension: dimension,
82
+ filters: filters
83
+ }
84
+ },
85
+ scrollToFirstError: true,
86
+ onValuesChange: onValuesChange
87
+ }, /*#__PURE__*/React.createElement(Form.Item, {
88
+ label: "",
89
+ name: "userGroup"
90
+ }, /*#__PURE__*/React.createElement(BizUserGroupHeader, {
91
+ max: 3
92
+ })), /*#__PURE__*/React.createElement(Form.Item, {
93
+ label: "\u4E8B\u4EF6",
94
+ name: "filterConditions",
95
+ style: {
96
+ paddingLeft: '24px'
97
+ }
98
+ }, /*#__PURE__*/React.createElement(EventFilter, null)), /*#__PURE__*/React.createElement("div", {
99
+ className: "".concat(classPrefix, "-form-botton-box")
100
+ }, /*#__PURE__*/React.createElement(Button, {
101
+ onClick: resetting
102
+ }, "\u91CD\u7F6E"), /*#__PURE__*/React.createElement(Button, {
103
+ disabled: ajaxFlag,
104
+ type: "primary",
105
+ onClick: function onClick() {
106
+ fetchRequest(true);
107
+ }
108
+ }, "\u67E5\u8BE2")));
109
+ };
110
+ export default TopPanel;