@zgfe/modules-event 1.0.29-zhongyuanE.17 → 1.0.29-zhongyuanE.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.
- package/es/components/eventFilter/index.d.ts +5 -0
- package/es/components/eventFilter/index.js +315 -0
- package/es/components/eventFilter/setCascade.d.ts +3 -0
- package/es/components/eventFilter/setCascade.js +286 -0
- package/es/components/eventFilter/types.d.ts +21 -0
- package/es/components/eventFilter/types.js +1 -0
- package/es/components/index.d.ts +4 -0
- package/es/components/index.js +4 -0
- package/es/components/renderContent/index.d.ts +5 -0
- package/es/components/renderContent/index.js +46 -0
- package/es/components/renderContent/styles/index.less +19 -0
- package/es/components/renderContent/types.d.ts +8 -0
- package/es/components/renderContent/types.js +1 -0
- package/es/components/searchPanel/index.d.ts +5 -0
- package/es/components/searchPanel/index.js +134 -0
- package/es/components/searchPanel/styles/index.less +22 -0
- package/es/components/searchPanel/types.d.ts +28 -0
- package/es/components/searchPanel/types.js +1 -0
- package/es/components/table/index.d.ts +6 -0
- package/es/components/table/index.js +319 -0
- package/es/components/table/styles/index.css +236 -0
- package/es/components/table/styles/index.less +249 -0
- package/es/components/table/types.d.ts +10 -0
- package/es/components/table/types.js +1 -0
- package/es/components/topBar/index.d.ts +10 -0
- package/es/components/topBar/index.js +174 -0
- package/es/components/topBar/styles/index.less +58 -0
- package/es/components/topBar/types.d.ts +8 -0
- package/es/components/topBar/types.js +1 -0
- package/es/constants/apis.d.ts +10 -0
- package/es/constants/apis.js +10 -0
- package/es/constants/chart.d.ts +2 -0
- package/es/constants/chart.js +31 -0
- package/es/constants/color.d.ts +1 -0
- package/es/constants/color.js +1 -0
- package/es/constants/fields.d.ts +251 -0
- package/es/constants/fields.js +177 -0
- package/es/constants/index.d.ts +6 -0
- package/es/constants/index.js +6 -0
- package/es/constants/initData.d.ts +2 -0
- package/es/constants/initData.js +9 -0
- package/es/index.d.ts +6 -0
- package/es/index.js +5 -0
- package/es/modules/chart/demo/data.d.ts +73 -0
- package/es/modules/chart/demo/data.js +484 -0
- package/es/modules/chart/demo/index.d.ts +3 -0
- package/es/modules/chart/demo/index.js +51 -0
- package/es/modules/chart/demo/panel.d.ts +3 -0
- package/es/modules/chart/demo/panel.js +16 -0
- package/es/modules/chart/index.d.ts +4 -0
- package/es/modules/chart/index.js +253 -0
- package/es/modules/chart/types.d.ts +19 -0
- package/es/modules/chart/types.js +1 -0
- package/es/modules/content/index.d.ts +5 -0
- package/es/modules/content/index.js +302 -0
- package/es/modules/content/styles/index.less +19 -0
- package/es/modules/content/types.d.ts +11 -0
- package/es/modules/content/types.js +1 -0
- package/es/modules/content/utils.d.ts +18 -0
- package/es/modules/content/utils.js +134 -0
- package/es/modules/home/demo/create.d.ts +3 -0
- package/es/modules/home/demo/create.js +58 -0
- package/es/modules/home/demo/edit.d.ts +3 -0
- package/es/modules/home/demo/edit.js +73 -0
- package/es/modules/home/demo/index.d.ts +4 -0
- package/es/modules/home/demo/index.js +55 -0
- package/es/modules/home/demo/scene.d.ts +3 -0
- package/es/modules/home/demo/scene.js +89 -0
- package/es/modules/home/demo/styles/index.less +33 -0
- package/es/modules/home/index.d.ts +5 -0
- package/es/modules/home/index.js +184 -0
- package/es/modules/home/styles/index.less +49 -0
- package/es/modules/home/types.d.ts +34 -0
- package/es/modules/home/types.js +1 -0
- package/es/modules/topPanel/index.d.ts +5 -0
- package/es/modules/topPanel/index.js +246 -0
- package/es/modules/topPanel/styles/index.less +50 -0
- package/es/modules/topPanel/types.d.ts +46 -0
- package/es/modules/topPanel/types.js +1 -0
- package/es/style/theme.d.ts +15 -0
- package/es/style/theme.js +14 -0
- package/es/types.d.ts +86 -0
- package/es/types.js +6 -0
- package/es/utils/ajaxConfig.d.ts +8 -0
- package/es/utils/ajaxConfig.js +40 -0
- package/es/utils/base64.d.ts +23 -0
- package/es/utils/base64.js +125 -0
- package/es/utils/formData.d.ts +20 -0
- package/es/utils/formData.js +406 -0
- package/es/utils/util.d.ts +32 -0
- package/es/utils/util.js +139 -0
- package/package.json +2 -2
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
8
|
+
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."); }
|
|
9
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
10
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
11
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
12
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
13
|
+
import React, { useContext, useEffect, useState, useRef } from 'react';
|
|
14
|
+
import { Spin } from 'antd';
|
|
15
|
+
import { BizGlobalDataContext, BizTargetFromPanel } from '@zgfe/business-lib';
|
|
16
|
+
import './styles/index.less';
|
|
17
|
+
import { EventContext } from '../../types';
|
|
18
|
+
import { getInitDate } from '../../constants/initData';
|
|
19
|
+
import EventContent from '../content';
|
|
20
|
+
import { chartTypes } from '../../constants';
|
|
21
|
+
var classPrefix = 'event-module-container';
|
|
22
|
+
var onChangeTimer = -1;
|
|
23
|
+
var ModuleEvent = function ModuleEvent(props) {
|
|
24
|
+
var _useContext = useContext(BizGlobalDataContext),
|
|
25
|
+
currentApp = _useContext.currentApp,
|
|
26
|
+
eventGroupList = _useContext.eventGroupList,
|
|
27
|
+
eventEnvList = _useContext.eventEnvList,
|
|
28
|
+
userPropList = _useContext.userPropList,
|
|
29
|
+
userGroupList = _useContext.userGroupList,
|
|
30
|
+
useBizStoreLoading = _useContext.useBizStoreLoading;
|
|
31
|
+
var _useState = useState(),
|
|
32
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
33
|
+
searchData = _useState2[0],
|
|
34
|
+
setSearchData = _useState2[1];
|
|
35
|
+
var _useState3 = useState(),
|
|
36
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
37
|
+
completedSearchData = _useState4[0],
|
|
38
|
+
setCompletedSearchData = _useState4[1];
|
|
39
|
+
var onChangeUrlParam = function onChangeUrlParam(data) {
|
|
40
|
+
clearTimeout(onChangeTimer);
|
|
41
|
+
onChangeTimer = setTimeout(function () {
|
|
42
|
+
props.onChange({
|
|
43
|
+
data: data
|
|
44
|
+
});
|
|
45
|
+
}, 500);
|
|
46
|
+
};
|
|
47
|
+
var _useState5 = useState(true),
|
|
48
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
49
|
+
loading = _useState6[0],
|
|
50
|
+
setLoading = _useState6[1];
|
|
51
|
+
var _useState7 = useState(false),
|
|
52
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
53
|
+
refreshLoading = _useState8[0],
|
|
54
|
+
setRefreshLoading = _useState8[1];
|
|
55
|
+
var _useState9 = useState(true),
|
|
56
|
+
_useState0 = _slicedToArray(_useState9, 2),
|
|
57
|
+
pageLoading = _useState0[0],
|
|
58
|
+
setPageLoading = _useState0[1];
|
|
59
|
+
var _useState1 = useState(),
|
|
60
|
+
_useState10 = _slicedToArray(_useState1, 2),
|
|
61
|
+
title = _useState10[0],
|
|
62
|
+
setTitle = _useState10[1];
|
|
63
|
+
var _useState11 = useState(),
|
|
64
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
65
|
+
panelId = _useState12[0],
|
|
66
|
+
setPanelId = _useState12[1];
|
|
67
|
+
var _useState13 = useState(),
|
|
68
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
69
|
+
elementId = _useState14[0],
|
|
70
|
+
setElementId = _useState14[1];
|
|
71
|
+
var _useState15 = useState(),
|
|
72
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
73
|
+
showListHome = _useState16[0],
|
|
74
|
+
setShowListHome = _useState16[1];
|
|
75
|
+
useEffect(function () {
|
|
76
|
+
setPageLoading(true);
|
|
77
|
+
if (props.defaultValue) {
|
|
78
|
+
var _props$defaultValue;
|
|
79
|
+
setShowListHome(props.defaultValue.chosen_data);
|
|
80
|
+
setPanelId(props.defaultValue.panelId);
|
|
81
|
+
setTitle(props.defaultValue.name);
|
|
82
|
+
if ((_props$defaultValue = props.defaultValue) === null || _props$defaultValue === void 0 ? void 0 : _props$defaultValue.id) {
|
|
83
|
+
var _props$defaultValue2;
|
|
84
|
+
setElementId((_props$defaultValue2 = props.defaultValue) === null || _props$defaultValue2 === void 0 ? void 0 : _props$defaultValue2.id);
|
|
85
|
+
}
|
|
86
|
+
if (props.defaultValue.data) {
|
|
87
|
+
setSearchData(props.defaultValue.data);
|
|
88
|
+
} else {
|
|
89
|
+
initSearch(props.defaultValue.userGroup);
|
|
90
|
+
}
|
|
91
|
+
} else {
|
|
92
|
+
initSearch();
|
|
93
|
+
}
|
|
94
|
+
setPageLoading(false);
|
|
95
|
+
}, []);
|
|
96
|
+
var initSearch = function initSearch(userGroup) {
|
|
97
|
+
setSearchData({
|
|
98
|
+
userGroup: userGroup ? userGroup : (userGroupList === null || userGroupList === void 0 ? void 0 : userGroupList.length) > 0 ? [userGroupList[0].id] : [0],
|
|
99
|
+
time: getInitDate(props.includeToday),
|
|
100
|
+
chartType: 'line'
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
var eventContentRef = useRef();
|
|
104
|
+
var onSelectEvent = function onSelectEvent(id, name) {
|
|
105
|
+
if ((searchData === null || searchData === void 0 ? void 0 : searchData.id) === undefined) {
|
|
106
|
+
var _eventContentRef$curr;
|
|
107
|
+
setSearchData({
|
|
108
|
+
id: id,
|
|
109
|
+
name: name,
|
|
110
|
+
analysisIndex: searchData === null || searchData === void 0 ? void 0 : searchData.analysisIndex,
|
|
111
|
+
chartType: searchData === null || searchData === void 0 ? void 0 : searchData.chartType,
|
|
112
|
+
time: searchData === null || searchData === void 0 ? void 0 : searchData.time,
|
|
113
|
+
userGroup: searchData === null || searchData === void 0 ? void 0 : searchData.userGroup
|
|
114
|
+
});
|
|
115
|
+
eventContentRef === null || eventContentRef === void 0 ? void 0 : (_eventContentRef$curr = eventContentRef.current) === null || _eventContentRef$curr === void 0 ? void 0 : _eventContentRef$curr.onFormSetFieldsValue({
|
|
116
|
+
filterConditions: {
|
|
117
|
+
id: id,
|
|
118
|
+
name: name
|
|
119
|
+
},
|
|
120
|
+
userGroup: searchData === null || searchData === void 0 ? void 0 : searchData.userGroup
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
if (pageLoading || useBizStoreLoading) {
|
|
125
|
+
return /*#__PURE__*/React.createElement(Spin, null);
|
|
126
|
+
}
|
|
127
|
+
return /*#__PURE__*/React.createElement(Spin, {
|
|
128
|
+
spinning: false,
|
|
129
|
+
wrapperClassName: classPrefix
|
|
130
|
+
}, /*#__PURE__*/React.createElement(BizTargetFromPanel, {
|
|
131
|
+
value: panelId ? {
|
|
132
|
+
panelId: panelId,
|
|
133
|
+
target: {
|
|
134
|
+
id: elementId,
|
|
135
|
+
name: title,
|
|
136
|
+
params: _objectSpread({
|
|
137
|
+
app_id: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
|
|
138
|
+
module: 'event'
|
|
139
|
+
}, searchData),
|
|
140
|
+
showList: showListHome
|
|
141
|
+
}
|
|
142
|
+
} : undefined,
|
|
143
|
+
disabled: props === null || props === void 0 ? void 0 : props.panelDisabled,
|
|
144
|
+
styleOptions: chartTypes,
|
|
145
|
+
afterEditTarget: props.afterEditTarget
|
|
146
|
+
}, /*#__PURE__*/React.createElement(EventContext.Provider, {
|
|
147
|
+
value: {
|
|
148
|
+
refreshLoading: refreshLoading,
|
|
149
|
+
setRefreshLoading: setRefreshLoading,
|
|
150
|
+
currentApp: currentApp,
|
|
151
|
+
loading: loading,
|
|
152
|
+
setLoading: setLoading,
|
|
153
|
+
showListHome: showListHome,
|
|
154
|
+
setShowListHome: setShowListHome,
|
|
155
|
+
panelId: panelId,
|
|
156
|
+
elementId: elementId,
|
|
157
|
+
eventGroupList: eventGroupList,
|
|
158
|
+
eventEnvList: eventEnvList,
|
|
159
|
+
userPropList: userPropList,
|
|
160
|
+
searchData: searchData,
|
|
161
|
+
setSearchData: setSearchData,
|
|
162
|
+
completedSearchData: completedSearchData,
|
|
163
|
+
setCompletedSearchData: setCompletedSearchData,
|
|
164
|
+
onChangeUrlParam: onChangeUrlParam,
|
|
165
|
+
onSelectEvent: onSelectEvent,
|
|
166
|
+
panelName: title,
|
|
167
|
+
includeToday: props.includeToday,
|
|
168
|
+
showWarning: props.showWarning,
|
|
169
|
+
afterEditTarget: props.afterEditTarget,
|
|
170
|
+
onUserDrill: props.onUserDrill,
|
|
171
|
+
onLossWarning: props.onLossWarning,
|
|
172
|
+
enableGenerateReport: props.enableGenerateReport
|
|
173
|
+
}
|
|
174
|
+
}, /*#__PURE__*/React.createElement(EventContent, {
|
|
175
|
+
elementId: elementId,
|
|
176
|
+
ref: eventContentRef,
|
|
177
|
+
value: searchData,
|
|
178
|
+
initSearch: initSearch
|
|
179
|
+
}))));
|
|
180
|
+
};
|
|
181
|
+
ModuleEvent.defaultProps = {
|
|
182
|
+
includeToday: true
|
|
183
|
+
};
|
|
184
|
+
export default ModuleEvent;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
.event-module-container {
|
|
2
|
+
width: 100%;
|
|
3
|
+
min-width: 1000px;
|
|
4
|
+
height: 100% !important;
|
|
5
|
+
background: #fafafb;
|
|
6
|
+
&-header-title {
|
|
7
|
+
height: 48px;
|
|
8
|
+
padding: 0px 16px;
|
|
9
|
+
color: #021429;
|
|
10
|
+
font-weight: 500;
|
|
11
|
+
font-size: 16px;
|
|
12
|
+
line-height: 48px;
|
|
13
|
+
background: #fff;
|
|
14
|
+
}
|
|
15
|
+
.biz-layout-top {
|
|
16
|
+
margin-top: 2px;
|
|
17
|
+
padding: 0 16px 16px;
|
|
18
|
+
.biz-user-group-header {
|
|
19
|
+
.ant-space-item {
|
|
20
|
+
color: #5f6085;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
.ant-spin-container {
|
|
25
|
+
width: 100%;
|
|
26
|
+
height: 100%;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.biz-select-option:not(.biz-select-option-multiple),
|
|
30
|
+
.biz-attr-select-option {
|
|
31
|
+
&.active {
|
|
32
|
+
background: @primary-color !important;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// 设置下拉框最大高度
|
|
37
|
+
.biz-select-overlay {
|
|
38
|
+
max-height: 300px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.biz-layout-panel-content {
|
|
42
|
+
height: auto;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.biz-layout-collapse-container {
|
|
46
|
+
align-items: center;
|
|
47
|
+
height: 24px;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { SearchValue, UserDrillParamsProp } from '../../types';
|
|
2
|
+
export declare namespace EventProps {
|
|
3
|
+
interface Props {
|
|
4
|
+
defaultValue?: Value;
|
|
5
|
+
panelDisabled?: boolean;
|
|
6
|
+
includeToday?: boolean;
|
|
7
|
+
afterEditTarget?: (type: string, value?: any) => void;
|
|
8
|
+
onUserDrill: (data: UserDrillParamsProp, searchData: SearchValue) => void;
|
|
9
|
+
onLossWarning?: (id: number) => void;
|
|
10
|
+
showWarning?: boolean;
|
|
11
|
+
enableGenerateReport?: boolean;
|
|
12
|
+
onChange: (data: Value | undefined) => void;
|
|
13
|
+
}
|
|
14
|
+
interface Value {
|
|
15
|
+
panelId?: number;
|
|
16
|
+
panelType?: 'edit' | 'add';
|
|
17
|
+
source?: string;
|
|
18
|
+
name?: string;
|
|
19
|
+
id?: number;
|
|
20
|
+
data?: SearchValue;
|
|
21
|
+
chosen_data?: string[];
|
|
22
|
+
[props: string]: any;
|
|
23
|
+
}
|
|
24
|
+
interface ColumnsDataType {
|
|
25
|
+
color: string;
|
|
26
|
+
eventName?: string;
|
|
27
|
+
id: number;
|
|
28
|
+
dimension?: string;
|
|
29
|
+
name: string;
|
|
30
|
+
nameGroup: string;
|
|
31
|
+
userGroup: string;
|
|
32
|
+
[x: string]: string | number | undefined;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
8
|
+
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."); }
|
|
9
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
10
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
11
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
12
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
13
|
+
import React, { useState, useEffect, useRef, useImperativeHandle, useContext } from 'react';
|
|
14
|
+
import { Form, Button, Tooltip } from 'antd';
|
|
15
|
+
import { BizUserGroupHeader, BizSelect, useSubject, IconFont } from '@zgfe/business-lib';
|
|
16
|
+
import EventFilter from '../../components/eventFilter';
|
|
17
|
+
import './styles/index.less';
|
|
18
|
+
import _ from 'lodash';
|
|
19
|
+
import { EventContext } from '../../types';
|
|
20
|
+
var classPrefix = 'modules-event-top-panel';
|
|
21
|
+
var TopPanel = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
22
|
+
var _useContext = useContext(EventContext),
|
|
23
|
+
currentApp = _useContext.currentApp;
|
|
24
|
+
var value = props.value,
|
|
25
|
+
setIsCity = props.setIsCity,
|
|
26
|
+
setEnableSelectChart = props.setEnableSelectChart,
|
|
27
|
+
subDisplay = props.subDisplay,
|
|
28
|
+
loading = props.loading;
|
|
29
|
+
var _useState = useState(false),
|
|
30
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
31
|
+
marginStyle = _useState2[0],
|
|
32
|
+
setmarginStyle = _useState2[1];
|
|
33
|
+
var _useState3 = useState('user'),
|
|
34
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
35
|
+
analysisType = _useState4[0],
|
|
36
|
+
setAnalysisType = _useState4[1];
|
|
37
|
+
var _useState5 = useState(false),
|
|
38
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
39
|
+
inited = _useState6[0],
|
|
40
|
+
setInited = _useState6[1];
|
|
41
|
+
var _useSubject = useSubject(),
|
|
42
|
+
subjectList = _useSubject.subjectList,
|
|
43
|
+
subjectLoading = _useSubject.loading;
|
|
44
|
+
var countChange = function countChange(count) {
|
|
45
|
+
setmarginStyle(count > 0 ? true : false);
|
|
46
|
+
};
|
|
47
|
+
var _Form$useForm = Form.useForm(),
|
|
48
|
+
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
49
|
+
form = _Form$useForm2[0];
|
|
50
|
+
var userGroup = value.userGroup;
|
|
51
|
+
function onSearch(data) {
|
|
52
|
+
var _data$filterCondition, _data$filterCondition2, _data$filterCondition3;
|
|
53
|
+
var searchData = _objectSpread(_objectSpread({
|
|
54
|
+
analysisSubject: data.analysisSubject ? {
|
|
55
|
+
subjectId: data.analysisSubject.id || data.analysisSubject.subjectId,
|
|
56
|
+
subjectName: data.analysisSubject.subjectName,
|
|
57
|
+
subjectAlias: data.analysisSubject.subjectAlias,
|
|
58
|
+
unit: data.analysisSubject.unit
|
|
59
|
+
} : undefined
|
|
60
|
+
}, _.isArray(data.filterConditions) ? {} : data.filterConditions), {}, {
|
|
61
|
+
eventIds: _.isArray(data.filterConditions) ? data.filterConditions : undefined,
|
|
62
|
+
eventGroupId: (_data$filterCondition = data.filterConditions) === null || _data$filterCondition === void 0 ? void 0 : _data$filterCondition.eventGroupId,
|
|
63
|
+
userGroup: data.userGroup || [0],
|
|
64
|
+
id: ((_data$filterCondition2 = data.filterConditions) === null || _data$filterCondition2 === void 0 ? void 0 : _data$filterCondition2.id) >= 0 ? (_data$filterCondition3 = data.filterConditions) === null || _data$filterCondition3 === void 0 ? void 0 : _data$filterCondition3.id : undefined
|
|
65
|
+
});
|
|
66
|
+
props.onChange(searchData, true);
|
|
67
|
+
}
|
|
68
|
+
var collapseRef = useRef();
|
|
69
|
+
useImperativeHandle(ref, function () {
|
|
70
|
+
return {
|
|
71
|
+
onFormSetFieldsValue: function onFormSetFieldsValue(data) {
|
|
72
|
+
form.resetFields();
|
|
73
|
+
form.setFieldsValue(data);
|
|
74
|
+
},
|
|
75
|
+
getCollapseRef: function getCollapseRef() {
|
|
76
|
+
return collapseRef;
|
|
77
|
+
},
|
|
78
|
+
submit: function submit() {
|
|
79
|
+
return form.submit();
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
var resetting = function resetting() {
|
|
84
|
+
form.resetFields();
|
|
85
|
+
form.setFieldsValue({
|
|
86
|
+
userGroup: [0],
|
|
87
|
+
filterConditions: null,
|
|
88
|
+
analysisSubject: null
|
|
89
|
+
});
|
|
90
|
+
props.onChange({
|
|
91
|
+
userGroup: [0],
|
|
92
|
+
id: undefined,
|
|
93
|
+
name: undefined,
|
|
94
|
+
filters: undefined,
|
|
95
|
+
dimension: undefined,
|
|
96
|
+
analysisAttr: undefined,
|
|
97
|
+
chartType: 'line'
|
|
98
|
+
}, true);
|
|
99
|
+
};
|
|
100
|
+
useEffect(function () {
|
|
101
|
+
if (!value) {
|
|
102
|
+
setInited(true);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
setInited(false);
|
|
106
|
+
if (value.analysisSubject) {
|
|
107
|
+
setAnalysisType('eventProp');
|
|
108
|
+
props.onChangeSubjectType('eventProp');
|
|
109
|
+
} else {
|
|
110
|
+
setAnalysisType('user');
|
|
111
|
+
props.onChangeSubjectType('user');
|
|
112
|
+
}
|
|
113
|
+
setInited(true);
|
|
114
|
+
}, []);
|
|
115
|
+
if (!inited) return null;
|
|
116
|
+
return /*#__PURE__*/React.createElement(Form, {
|
|
117
|
+
form: form,
|
|
118
|
+
component: "div",
|
|
119
|
+
colon: false,
|
|
120
|
+
layout: "vertical",
|
|
121
|
+
className: "".concat(classPrefix, "-form"),
|
|
122
|
+
initialValues: {
|
|
123
|
+
userGroup: userGroup ? userGroup : [0],
|
|
124
|
+
filterConditions: (value === null || value === void 0 ? void 0 : value.eventIds) || {
|
|
125
|
+
id: value === null || value === void 0 ? void 0 : value.id,
|
|
126
|
+
name: value === null || value === void 0 ? void 0 : value.name,
|
|
127
|
+
dimension: value === null || value === void 0 ? void 0 : value.dimension,
|
|
128
|
+
filters: value === null || value === void 0 ? void 0 : value.filters,
|
|
129
|
+
eventGroupId: value === null || value === void 0 ? void 0 : value.eventGroupId
|
|
130
|
+
},
|
|
131
|
+
analysisSubject: value === null || value === void 0 ? void 0 : value.analysisSubject
|
|
132
|
+
},
|
|
133
|
+
scrollToFirstError: true,
|
|
134
|
+
onFinish: onSearch
|
|
135
|
+
}, !subDisplay ? null : (/*#__PURE__*/React.createElement(Form.Item, {
|
|
136
|
+
label: /*#__PURE__*/React.createElement("div", {
|
|
137
|
+
className: "".concat(classPrefix, "-label-hasIcon")
|
|
138
|
+
}, /*#__PURE__*/React.createElement("span", null, "\u7EDF\u8BA1\u53E3\u5F84"), "\xA0\xA0", /*#__PURE__*/React.createElement(Tooltip, {
|
|
139
|
+
title: "\u5E2E\u52A9",
|
|
140
|
+
placement: "top"
|
|
141
|
+
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
142
|
+
type: "bangzhu",
|
|
143
|
+
onClick: function onClick() {
|
|
144
|
+
return window.open("".concat(location.origin, "/webapp/app/help/intro"), '_blank');
|
|
145
|
+
}
|
|
146
|
+
}))),
|
|
147
|
+
className: "".concat(classPrefix, "-form-event hoverable-form-item")
|
|
148
|
+
}, /*#__PURE__*/React.createElement(BizSelect, {
|
|
149
|
+
className: "".concat(classPrefix, "-form-event-select"),
|
|
150
|
+
options: [{
|
|
151
|
+
label: (currentApp === null || currentApp === void 0 ? void 0 : currentApp.type) != 'user' ? '主体' : '用户',
|
|
152
|
+
value: 'user'
|
|
153
|
+
}, {
|
|
154
|
+
label: '事件属性',
|
|
155
|
+
value: 'eventProp'
|
|
156
|
+
}],
|
|
157
|
+
overlayWidth: 208,
|
|
158
|
+
keyField: "value",
|
|
159
|
+
defaultValue: {
|
|
160
|
+
value: analysisType
|
|
161
|
+
},
|
|
162
|
+
onChange: function onChange(val) {
|
|
163
|
+
props.onChangeSubjectType(val.value);
|
|
164
|
+
setAnalysisType(val.value);
|
|
165
|
+
setEnableSelectChart && setEnableSelectChart(false);
|
|
166
|
+
setIsCity && setIsCity(false);
|
|
167
|
+
resetting();
|
|
168
|
+
}
|
|
169
|
+
}))), analysisType === 'user' ? (/*#__PURE__*/React.createElement(Form.Item, {
|
|
170
|
+
label: "",
|
|
171
|
+
name: "userGroup",
|
|
172
|
+
className: "hoverable-form-item"
|
|
173
|
+
}, /*#__PURE__*/React.createElement(BizUserGroupHeader, {
|
|
174
|
+
max: 3,
|
|
175
|
+
enableTags: true
|
|
176
|
+
}))) : (/*#__PURE__*/React.createElement(Form.Item, {
|
|
177
|
+
label: "\u53E3\u5F84\u540D\u79F0",
|
|
178
|
+
name: "analysisSubject",
|
|
179
|
+
className: "".concat(classPrefix, "-form-event hoverable-form-item"),
|
|
180
|
+
rules: [{
|
|
181
|
+
validator: function validator(_rule, value) {
|
|
182
|
+
if (value && (value.id || value.subjectId)) {
|
|
183
|
+
return Promise.resolve();
|
|
184
|
+
} else {
|
|
185
|
+
return Promise.reject('请选择口径名称');
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}]
|
|
189
|
+
}, /*#__PURE__*/React.createElement(BizSelect, {
|
|
190
|
+
className: "".concat(classPrefix, "-form-event-select"),
|
|
191
|
+
options: subjectList,
|
|
192
|
+
aliasField: "subjectAlias",
|
|
193
|
+
labelField: "subjectName",
|
|
194
|
+
keyField: "id"
|
|
195
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
196
|
+
ref: collapseRef
|
|
197
|
+
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
198
|
+
label: "\u4E8B\u4EF6",
|
|
199
|
+
name: "filterConditions",
|
|
200
|
+
validateStatus: "success",
|
|
201
|
+
className: "".concat(classPrefix, "-form-event event---1"),
|
|
202
|
+
rules: [{
|
|
203
|
+
validator: function validator(_rule, value) {
|
|
204
|
+
var _value$filters, _value$filters$condit;
|
|
205
|
+
if (_.isArray(value)) {
|
|
206
|
+
if (!value.length) {
|
|
207
|
+
return Promise.reject('请选择事件');
|
|
208
|
+
} else {
|
|
209
|
+
return Promise.resolve();
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
if (!value || !value.id) {
|
|
213
|
+
return Promise.reject('请选择事件');
|
|
214
|
+
}
|
|
215
|
+
var conditionValIsNull = false;
|
|
216
|
+
value === null || value === void 0 ? void 0 : (_value$filters = value.filters) === null || _value$filters === void 0 ? void 0 : (_value$filters$condit = _value$filters.conditions) === null || _value$filters$condit === void 0 ? void 0 : _value$filters$condit.forEach(function (item) {
|
|
217
|
+
var _item$values;
|
|
218
|
+
if (!/null/.test(item.operator || '') && !((_item$values = item.values) === null || _item$values === void 0 ? void 0 : _item$values.length)) {
|
|
219
|
+
conditionValIsNull = true;
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
if (conditionValIsNull) {
|
|
223
|
+
return Promise.reject('请填写完整的条件');
|
|
224
|
+
}
|
|
225
|
+
return Promise.resolve();
|
|
226
|
+
},
|
|
227
|
+
validateTrigger: 'onBlur'
|
|
228
|
+
}]
|
|
229
|
+
}, /*#__PURE__*/React.createElement(EventFilter, {
|
|
230
|
+
countChange: countChange,
|
|
231
|
+
setIsCity: setIsCity,
|
|
232
|
+
setEnableSelectChart: setEnableSelectChart,
|
|
233
|
+
analysisType: analysisType
|
|
234
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
235
|
+
className: "".concat(classPrefix, "-form-botton-box ").concat(marginStyle ? 'margin-style' : '')
|
|
236
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
237
|
+
onClick: resetting
|
|
238
|
+
}, "\u91CD\u7F6E"), /*#__PURE__*/React.createElement(Button, {
|
|
239
|
+
loading: subjectLoading || loading,
|
|
240
|
+
type: "primary",
|
|
241
|
+
onClick: function onClick() {
|
|
242
|
+
form.submit();
|
|
243
|
+
}
|
|
244
|
+
}, "\u67E5\u8BE2"))));
|
|
245
|
+
});
|
|
246
|
+
export default TopPanel;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
.modules-event-top-panel {
|
|
2
|
+
&-form-event {
|
|
3
|
+
margin-bottom: 0;
|
|
4
|
+
& .ant-form-item-label {
|
|
5
|
+
padding-left: 24px !important;
|
|
6
|
+
font-weight: 500;
|
|
7
|
+
}
|
|
8
|
+
&-select {
|
|
9
|
+
width: 208px;
|
|
10
|
+
margin-left: 24px;
|
|
11
|
+
.biz-select-handle-input {
|
|
12
|
+
padding-left: 12px;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
.ant-form-item-row .ant-form-item-control {
|
|
16
|
+
margin-bottom: 24px;
|
|
17
|
+
padding: 4px 0;
|
|
18
|
+
}
|
|
19
|
+
.ant-form-item-explain-error {
|
|
20
|
+
padding-left: 24px;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
&-form-botton-box {
|
|
24
|
+
display: flex;
|
|
25
|
+
justify-content: flex-end;
|
|
26
|
+
margin-right: 24px;
|
|
27
|
+
> :nth-child(1) {
|
|
28
|
+
margin-right: 16px;
|
|
29
|
+
color: #fff;
|
|
30
|
+
background-color: #29bd52;
|
|
31
|
+
border-color: #29bd52;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&-label-hasIcon {
|
|
36
|
+
.bsicon {
|
|
37
|
+
cursor: pointer;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
.hoverable-form-item {
|
|
42
|
+
.ant-form-item-control {
|
|
43
|
+
&:hover {
|
|
44
|
+
background: #e8efff !important;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
.event---1 .ant-form-item-label {
|
|
49
|
+
padding-bottom: 4px !important;
|
|
50
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { AttrConditionTypes } from '@zgfe/business-lib';
|
|
2
|
+
import { bizAttributeSelectorValueProp, SearchValue, EventChartTypes } from '../../types';
|
|
3
|
+
interface filterConditions {
|
|
4
|
+
id?: number;
|
|
5
|
+
eventGroupId?: number;
|
|
6
|
+
name?: string;
|
|
7
|
+
filters?: AttrConditionTypes.GroupValue;
|
|
8
|
+
dimension?: bizAttributeSelectorValueProp;
|
|
9
|
+
}
|
|
10
|
+
interface analysisSubject {
|
|
11
|
+
id?: number;
|
|
12
|
+
subjectId?: number;
|
|
13
|
+
name?: string;
|
|
14
|
+
unit?: string;
|
|
15
|
+
subjectAlias?: string;
|
|
16
|
+
subjectName?: string;
|
|
17
|
+
analysisSubjectType?: string;
|
|
18
|
+
}
|
|
19
|
+
interface analysisSubjectType {
|
|
20
|
+
value?: string;
|
|
21
|
+
user?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface FormDataProps {
|
|
24
|
+
userGroup?: {
|
|
25
|
+
id: number;
|
|
26
|
+
}[] | any[];
|
|
27
|
+
filterConditions?: filterConditions;
|
|
28
|
+
analysisSubject?: analysisSubject | null;
|
|
29
|
+
}
|
|
30
|
+
export interface FormHandelDataProps extends filterConditions {
|
|
31
|
+
userGroup?: any[];
|
|
32
|
+
chartType?: EventChartTypes | undefined;
|
|
33
|
+
analysisSubject?: analysisSubject;
|
|
34
|
+
eventIds?: number[];
|
|
35
|
+
}
|
|
36
|
+
export interface TopPanelProps {
|
|
37
|
+
value?: SearchValue;
|
|
38
|
+
onChange: (data: SearchValue, flag: boolean) => void;
|
|
39
|
+
loading?: boolean;
|
|
40
|
+
subDisplay?: boolean;
|
|
41
|
+
setIsCity?: Function;
|
|
42
|
+
setEnableSelectChart?: Function;
|
|
43
|
+
analysisSubjectType?: analysisSubjectType;
|
|
44
|
+
onChangeSubjectType: (type: string) => void;
|
|
45
|
+
}
|
|
46
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
'primary-color': string;
|
|
3
|
+
'border-color-base': string;
|
|
4
|
+
'background-color-base': string;
|
|
5
|
+
'text-color': string;
|
|
6
|
+
'text-color-secondary': string;
|
|
7
|
+
'tooltip-bg': string;
|
|
8
|
+
'error-color': string;
|
|
9
|
+
'shadow-color': string;
|
|
10
|
+
'box-shadow-base': string;
|
|
11
|
+
'btn-text-hover-bg': string;
|
|
12
|
+
'warning-color': string;
|
|
13
|
+
'border-color-split': string;
|
|
14
|
+
};
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
'primary-color': '#165dff',
|
|
3
|
+
'border-color-base': '#ECEDF0',
|
|
4
|
+
'background-color-base': '#fafafb',
|
|
5
|
+
'text-color': '#021429',
|
|
6
|
+
'text-color-secondary': '#5f6085',
|
|
7
|
+
'tooltip-bg': '#242541',
|
|
8
|
+
'error-color': '#fb5547',
|
|
9
|
+
'shadow-color': 'rgba(0, 0, 0, 0.1)',
|
|
10
|
+
'box-shadow-base': '0px 4px 10px rgba(0, 0, 0, 0.1)',
|
|
11
|
+
'btn-text-hover-bg': '#cacdd4',
|
|
12
|
+
'warning-color': '#FD9F41',
|
|
13
|
+
'border-color-split': '#E8EFFF'
|
|
14
|
+
};
|