@zgfe/modules-interval 1.0.23-zhongyuan.1 → 1.0.23-zhongyuan.11
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/dist/esm/components/eventFilter/index.js +6 -5
- package/dist/esm/components/renderContent/styles/index.css +32 -0
- package/dist/esm/components/renderContent/styles/index.less +1 -0
- package/dist/esm/components/searchPanel/index.js +6 -1
- package/dist/esm/components/table/index.js +3 -2
- package/dist/esm/constants/code.d.ts +13 -0
- package/dist/esm/constants/code.js +13 -0
- package/dist/esm/modules/chart/customTooltip.js +3 -3
- package/dist/esm/modules/chart/customTooltip1.d.ts +7 -0
- package/dist/esm/modules/chart/customTooltip1.js +46 -0
- package/dist/esm/modules/chart/index.css +52 -0
- package/dist/esm/modules/chart/index.js +19 -8
- package/dist/esm/modules/chart/index.less +1 -1
- package/dist/esm/modules/chart/intervalChart copy.d.ts +4 -0
- package/dist/esm/modules/chart/intervalChart copy.js +295 -0
- package/dist/esm/modules/chart/intervalChart.js +323 -37
- package/dist/esm/modules/chart/types.d.ts +5 -0
- package/dist/esm/modules/content/index.js +50 -20
- package/dist/esm/modules/content/utils.d.ts +0 -1
- package/dist/esm/modules/content/utils.js +15 -16
- package/dist/esm/modules/home/demo/create.js +5 -3
- package/dist/esm/modules/home/demo/edit.js +132 -34
- package/dist/esm/modules/home/demo/index.js +1 -1
- package/dist/esm/modules/home/demo/scene.js +1 -1
- package/dist/esm/modules/home/index.js +8 -1
- package/dist/esm/modules/home/types.d.ts +0 -1
- package/dist/esm/modules/topPanel/index.js +32 -23
- package/dist/esm/modules/topPanel/styles/index.less +6 -6
- package/dist/esm/modules/topPanel/types.d.ts +1 -0
- package/dist/esm/utils/formData.d.ts +1 -1
- package/dist/esm/utils/formData.js +13 -8
- package/package.json +3 -3
|
@@ -18,7 +18,8 @@ import _ from 'lodash';
|
|
|
18
18
|
var classPrefix = 'interval-box';
|
|
19
19
|
var EventFilter = function EventFilter(props) {
|
|
20
20
|
var _useContext = useContext(BizGlobalDataContext),
|
|
21
|
-
eventIdMap = _useContext.eventIdMap
|
|
21
|
+
eventIdMap = _useContext.eventIdMap,
|
|
22
|
+
envs = _useContext.envs;
|
|
22
23
|
// 筛选条件个数
|
|
23
24
|
var _useState = useState(0),
|
|
24
25
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -95,8 +96,8 @@ var EventFilter = function EventFilter(props) {
|
|
|
95
96
|
return;
|
|
96
97
|
}
|
|
97
98
|
// 最多可添加10条属性筛选
|
|
98
|
-
if (count >= 10) {
|
|
99
|
-
message.error(
|
|
99
|
+
if (count >= ((envs === null || envs === void 0 ? void 0 : envs.propertyNum) || 10)) {
|
|
100
|
+
message.error("\u6700\u591A\u53EF\u6DFB\u52A0 ".concat((envs === null || envs === void 0 ? void 0 : envs.propertyNum) || 10, " \u6761\u5C5E\u6027\u7B5B\u9009"));
|
|
100
101
|
return;
|
|
101
102
|
}
|
|
102
103
|
setIsAdd(true);
|
|
@@ -169,9 +170,9 @@ var EventFilter = function EventFilter(props) {
|
|
|
169
170
|
placeholder: "\u8BF7\u9009\u62E9\u4E8B\u4EF6"
|
|
170
171
|
}), /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Tooltip, {
|
|
171
172
|
placement: "top",
|
|
172
|
-
title: !eventOverview ? '请先选择目标事件' : count < 10 ? '添加属性筛选' :
|
|
173
|
+
title: !eventOverview ? '请先选择目标事件' : count < ((envs === null || envs === void 0 ? void 0 : envs.propertyNum) || 10) ? '添加属性筛选' : "\u6700\u591A\u53EF\u6DFB\u52A0 ".concat((envs === null || envs === void 0 ? void 0 : envs.propertyNum) || 10, " \u6761\u5C5E\u6027\u7B5B\u9009")
|
|
173
174
|
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
174
|
-
className: "".concat(count >= 10 || event.id === -1 || !eventOverview ? 'disable' : ''),
|
|
175
|
+
className: "".concat(count >= ((envs === null || envs === void 0 ? void 0 : envs.propertyNum) || 10) || event.id === -1 || !eventOverview ? 'disable' : ''),
|
|
175
176
|
type: "shaixuan",
|
|
176
177
|
onClick: function onClick() {
|
|
177
178
|
return onAdd();
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
.render-content-interval-chart-container {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
align-items: center;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
min-height: 300px;
|
|
7
|
+
}
|
|
8
|
+
.render-content-interval-chart-container .echarts-for-react {
|
|
9
|
+
width: 100%;
|
|
10
|
+
background: #fff;
|
|
11
|
+
border: 1px solid var(--unnamed, #ecedf0);
|
|
12
|
+
border-radius: 8px;
|
|
13
|
+
}
|
|
14
|
+
.render-content-interval-MiNone {
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
justify-content: center;
|
|
18
|
+
width: 100%;
|
|
19
|
+
height: 368px;
|
|
20
|
+
padding: 24px 16px;
|
|
21
|
+
border: 1px solid #ecedf0;
|
|
22
|
+
border-radius: 8px;
|
|
23
|
+
}
|
|
24
|
+
.render-content-interval-spin-container {
|
|
25
|
+
display: flex !important;
|
|
26
|
+
align-items: center;
|
|
27
|
+
justify-content: center;
|
|
28
|
+
min-height: 300px;
|
|
29
|
+
}
|
|
30
|
+
.render-content-interval-spin-container .biz-loading-wrapper {
|
|
31
|
+
width: 100%;
|
|
32
|
+
}
|
|
@@ -10,7 +10,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
10
10
|
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; }
|
|
11
11
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
12
12
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
-
import { BizSelect, IconFont, BizDatePickerV2 } from '@zgfe/business-lib';
|
|
13
|
+
import { BizSelect, IconFont, BizDatePickerV2, BizGlobalDataContext } from '@zgfe/business-lib';
|
|
14
14
|
import { DatePickerTypes } from '@zgfe/business-lib/es/datePickerV2/types';
|
|
15
15
|
import React, { useContext, useEffect, useState } from 'react';
|
|
16
16
|
import { chartTypeOptions, getInitDate } from "../../constants";
|
|
@@ -24,6 +24,8 @@ var SearchPanel = function SearchPanel(props) {
|
|
|
24
24
|
includeToday = _useContext.includeToday,
|
|
25
25
|
searchData = _useContext.searchData,
|
|
26
26
|
refreshLoading = _useContext.refreshLoading;
|
|
27
|
+
var _useContext2 = useContext(BizGlobalDataContext),
|
|
28
|
+
envs = _useContext2.envs;
|
|
27
29
|
// 当前时间段
|
|
28
30
|
var _useState = useState(props.time || getInitDate(includeToday)),
|
|
29
31
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -108,6 +110,9 @@ var SearchPanel = function SearchPanel(props) {
|
|
|
108
110
|
dateTypeList: [DatePickerTypes.Unit.day, DatePickerTypes.Unit.week, DatePickerTypes.Unit.month, DatePickerTypes.Unit.custom],
|
|
109
111
|
value: time,
|
|
110
112
|
includeToday: true,
|
|
113
|
+
selectRange: envs && envs.timeRangeOpen ? envs.timeRangeOpen : 36,
|
|
114
|
+
timeRangeOpen: envs && envs.timeRangeOpen ? envs.timeRangeOpen : 36,
|
|
115
|
+
selectRangeUnit: envs && envs.timeRangeOpen ? 'months' : 'days',
|
|
111
116
|
onChange: onChangeTime
|
|
112
117
|
}), /*#__PURE__*/React.createElement(BizSelect, {
|
|
113
118
|
multiple: true,
|
|
@@ -35,7 +35,8 @@ var EventTable = function EventTable(props) {
|
|
|
35
35
|
eventGroupList = _useContext$eventGrou === void 0 ? [] : _useContext$eventGrou,
|
|
36
36
|
eventEnvList = _useContext.eventEnvList,
|
|
37
37
|
userPropList = _useContext.userPropList,
|
|
38
|
-
authority = _useContext.authority
|
|
38
|
+
authority = _useContext.authority,
|
|
39
|
+
showProdDownload = _useContext.showProdDownload;
|
|
39
40
|
var _useContext2 = useContext(IntervalContext),
|
|
40
41
|
panelName = _useContext2.panelName,
|
|
41
42
|
onUserDrill = _useContext2.onUserDrill;
|
|
@@ -107,7 +108,7 @@ var EventTable = function EventTable(props) {
|
|
|
107
108
|
className: classPrefix
|
|
108
109
|
}, /*#__PURE__*/React.createElement("div", {
|
|
109
110
|
className: "".concat(classPrefix, "-table-header")
|
|
110
|
-
}, /*#__PURE__*/React.createElement("span", null, "\u6307\u6807\u8BE6\u60C5"), authority[100059] && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
111
|
+
}, /*#__PURE__*/React.createElement("span", null, "\u6307\u6807\u8BE6\u60C5"), authority[100059] && showProdDownload && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
111
112
|
onClick: download
|
|
112
113
|
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
113
114
|
type: "xiazai1"
|
|
@@ -13,14 +13,14 @@ var CustomTooltip = function CustomTooltip(_ref) {
|
|
|
13
13
|
}
|
|
14
14
|
// 根据payload中的数据定义弹窗内容
|
|
15
15
|
var marker = payload === null || payload === void 0 ? void 0 : payload.marker;
|
|
16
|
-
var value = payload === null || payload === void 0 ? void 0 : payload.
|
|
16
|
+
var value = payload === null || payload === void 0 ? void 0 : payload.data;
|
|
17
17
|
return /*#__PURE__*/React.createElement("div", {
|
|
18
18
|
className: "custom-tooltip-chart"
|
|
19
19
|
}, /*#__PURE__*/React.createElement("div", {
|
|
20
20
|
className: "custom-tooltip-name"
|
|
21
21
|
}, payload.name, " "), /*#__PURE__*/React.createElement("div", {
|
|
22
22
|
className: "custom-tooltip-div"
|
|
23
|
-
},
|
|
23
|
+
}, payload.seriesName && /*#__PURE__*/React.createElement("div", {
|
|
24
24
|
className: "tooltip-marker"
|
|
25
25
|
}, /*#__PURE__*/React.createElement("div", {
|
|
26
26
|
dangerouslySetInnerHTML: {
|
|
@@ -28,7 +28,7 @@ var CustomTooltip = function CustomTooltip(_ref) {
|
|
|
28
28
|
}
|
|
29
29
|
}), /*#__PURE__*/React.createElement("div", {
|
|
30
30
|
className: "tooltip-span"
|
|
31
|
-
},
|
|
31
|
+
}, payload.seriesName)), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", {
|
|
32
32
|
className: "tooltip-span"
|
|
33
33
|
}, "\u6700\u5927\u503C\uFF1A"), /*#__PURE__*/React.createElement("div", null, convertToHMS(value[5]))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", {
|
|
34
34
|
className: "tooltip-span"
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import "./index.less";
|
|
3
|
+
var CustomTooltip = function CustomTooltip(_ref) {
|
|
4
|
+
var payload = _ref.payload,
|
|
5
|
+
series = _ref.series;
|
|
6
|
+
// 初始化,判断showList是否有值,如果没值,取结果的前10条
|
|
7
|
+
function convertToHMS(seconds) {
|
|
8
|
+
var hours = Math.floor(seconds / 3600);
|
|
9
|
+
var minutes = Math.floor(seconds % 3600 / 60);
|
|
10
|
+
var remainingSeconds = seconds % 60;
|
|
11
|
+
return ('00' + hours).slice(-2) + ':' + ('00' + minutes).slice(-2) + ':' + ('00' + remainingSeconds).slice(-2);
|
|
12
|
+
}
|
|
13
|
+
// 根据payload中的数据定义弹窗内容
|
|
14
|
+
// const marker = payload?.marker;
|
|
15
|
+
|
|
16
|
+
// const value = payload?.value;
|
|
17
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, payload.map(function (o, index) {
|
|
18
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
19
|
+
className: "custom-tooltip-chart",
|
|
20
|
+
key: index
|
|
21
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
22
|
+
className: "custom-tooltip-name"
|
|
23
|
+
}, o.name, " "), /*#__PURE__*/React.createElement("div", {
|
|
24
|
+
className: "custom-tooltip-div"
|
|
25
|
+
}, o.seriesName && /*#__PURE__*/React.createElement("div", {
|
|
26
|
+
className: "tooltip-marker"
|
|
27
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
28
|
+
dangerouslySetInnerHTML: {
|
|
29
|
+
__html: o === null || o === void 0 ? void 0 : o.marker
|
|
30
|
+
}
|
|
31
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
32
|
+
className: "tooltip-span"
|
|
33
|
+
}, o.seriesName)), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", {
|
|
34
|
+
className: "tooltip-span"
|
|
35
|
+
}, "\u6700\u5927\u503C\uFF1A"), /*#__PURE__*/React.createElement("div", null, convertToHMS(o.value[5]))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", {
|
|
36
|
+
className: "tooltip-span"
|
|
37
|
+
}, "\u4E0A\u56DB\u5206\u4F4D\uFF1A"), convertToHMS(o.value[2])), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", {
|
|
38
|
+
className: "tooltip-span"
|
|
39
|
+
}, "\u4E2D\u4F4D\u6570\uFF1A"), convertToHMS(o.value[3])), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", {
|
|
40
|
+
className: "tooltip-span"
|
|
41
|
+
}, "\u4E0B\u56DB\u5206\u4F4D\uFF1A"), convertToHMS(o.value[4])), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", {
|
|
42
|
+
className: "tooltip-span"
|
|
43
|
+
}, "\u6700\u5C0F\u503C\uFF1A"), convertToHMS(o.value[1]))));
|
|
44
|
+
}));
|
|
45
|
+
};
|
|
46
|
+
export default CustomTooltip;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
.custom-tooltip-chart {
|
|
2
|
+
display: inline-block;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
flex-shrink: 0;
|
|
5
|
+
gap: 4px;
|
|
6
|
+
align-items: flex-start;
|
|
7
|
+
width: 146px;
|
|
8
|
+
height: 100%;
|
|
9
|
+
padding: 8px;
|
|
10
|
+
color: var(--io-n, #021429);
|
|
11
|
+
font-weight: 500;
|
|
12
|
+
font-size: 12px;
|
|
13
|
+
font-style: normal;
|
|
14
|
+
border-radius: 10px;
|
|
15
|
+
box-shadow: 0px 4px 10px 0px #0000001a;
|
|
16
|
+
}
|
|
17
|
+
.custom-tooltip-chart .custom-tooltip-name {
|
|
18
|
+
color: var(--io-n, #021429);
|
|
19
|
+
font-weight: 500;
|
|
20
|
+
font-size: 12px;
|
|
21
|
+
font-family: PingFang SC;
|
|
22
|
+
font-style: normal;
|
|
23
|
+
line-height: normal;
|
|
24
|
+
}
|
|
25
|
+
.custom-tooltip-chart .custom-tooltip-div {
|
|
26
|
+
display: flex;
|
|
27
|
+
flex-direction: column;
|
|
28
|
+
gap: 6px;
|
|
29
|
+
width: 100%;
|
|
30
|
+
height: 100%;
|
|
31
|
+
padding: 0px 8px;
|
|
32
|
+
background: #fff;
|
|
33
|
+
border-radius: 4px;
|
|
34
|
+
box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.04);
|
|
35
|
+
}
|
|
36
|
+
.custom-tooltip-chart .custom-tooltip-div .tooltip-span {
|
|
37
|
+
display: block;
|
|
38
|
+
color: var(--3, #5f6085);
|
|
39
|
+
font-weight: 400;
|
|
40
|
+
font-size: 12px;
|
|
41
|
+
font-family: PingFang SC;
|
|
42
|
+
font-style: normal;
|
|
43
|
+
line-height: normal;
|
|
44
|
+
}
|
|
45
|
+
.custom-tooltip-chart .custom-tooltip-div > div {
|
|
46
|
+
display: flex;
|
|
47
|
+
align-items: center;
|
|
48
|
+
justify-content: space-between;
|
|
49
|
+
}
|
|
50
|
+
.custom-tooltip-chart .custom-tooltip-div .tooltip-marker {
|
|
51
|
+
justify-content: flex-start;
|
|
52
|
+
}
|
|
@@ -11,15 +11,18 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
11
11
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
12
12
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
13
|
import React, { useContext, useEffect, useState } from 'react';
|
|
14
|
-
import { BizEmpty, BizGlobalDataContext,
|
|
14
|
+
import { BizEmpty, BizGlobalDataContext, ajax } from '@zgfe/business-lib';
|
|
15
15
|
import { EventTable, MiNone } from "../../components";
|
|
16
16
|
import { extractNames, getDefaultShow } from "../../utils/formData";
|
|
17
17
|
import { Apis } from "../../constants";
|
|
18
18
|
import IntervalChart from "./intervalChart";
|
|
19
19
|
import { searchDataParams } from "../content/utils";
|
|
20
|
+
import { ERROR_RESPONESE_CODE } from "../../constants/code";
|
|
21
|
+
import { Spin } from 'antd';
|
|
20
22
|
var IntervalEventChart = function IntervalEventChart(props) {
|
|
21
23
|
var _dataSource$appData2;
|
|
22
|
-
var params = props.params
|
|
24
|
+
var params = props.params,
|
|
25
|
+
onChangeException = props.onChangeException;
|
|
23
26
|
// 显示内容
|
|
24
27
|
var _useState = useState(),
|
|
25
28
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -49,6 +52,7 @@ var IntervalEventChart = function IntervalEventChart(props) {
|
|
|
49
52
|
// 初始化,判断showList是否有值,如果没值,取结果的前10条
|
|
50
53
|
useEffect(function () {
|
|
51
54
|
var _dataSource$appData, _dataSource$appData$s;
|
|
55
|
+
var dataSource = props.dataSource;
|
|
52
56
|
if ((dataSource === null || dataSource === void 0 ? void 0 : (_dataSource$appData = dataSource.appData) === null || _dataSource$appData === void 0 ? void 0 : (_dataSource$appData$s = _dataSource$appData.series) === null || _dataSource$appData$s === void 0 ? void 0 : _dataSource$appData$s.length) > 0) {
|
|
53
57
|
var _extractNames;
|
|
54
58
|
var arr = params !== null && params !== void 0 && params.displaySetup ? params === null || params === void 0 ? void 0 : params.displaySetup : (_extractNames = extractNames(dataSource)) === null || _extractNames === void 0 ? void 0 : _extractNames.splice(0, 4);
|
|
@@ -56,7 +60,8 @@ var IntervalEventChart = function IntervalEventChart(props) {
|
|
|
56
60
|
setShowList(app);
|
|
57
61
|
setDataSourceList(arr);
|
|
58
62
|
}
|
|
59
|
-
|
|
63
|
+
setDataSource(dataSource);
|
|
64
|
+
}, [params === null || params === void 0 ? void 0 : params.displaySetup, props.dataSource]);
|
|
60
65
|
var fetchResult = function fetchResult() {
|
|
61
66
|
var _obj$start, _obj$end, _params$start, _params$end;
|
|
62
67
|
var obj = searchDataParams(params);
|
|
@@ -66,12 +71,17 @@ var IntervalEventChart = function IntervalEventChart(props) {
|
|
|
66
71
|
method: 'post',
|
|
67
72
|
data: _objectSpread(_objectSpread({
|
|
68
73
|
appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId
|
|
69
|
-
}, params), obj)
|
|
74
|
+
}, params), obj),
|
|
75
|
+
intercept: false
|
|
70
76
|
}).then(function (res) {
|
|
77
|
+
setLoading(false);
|
|
71
78
|
if (!res) {
|
|
72
79
|
return;
|
|
73
80
|
}
|
|
74
|
-
|
|
81
|
+
if (res.code == ERROR_RESPONESE_CODE.EXCEPTION) {
|
|
82
|
+
onChangeException === null || onChangeException === void 0 ? void 0 : onChangeException();
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
75
85
|
setDataSource(res.data);
|
|
76
86
|
}).catch(function () {
|
|
77
87
|
setLoading(false);
|
|
@@ -84,9 +94,10 @@ var IntervalEventChart = function IntervalEventChart(props) {
|
|
|
84
94
|
if (props.onChangeShow) props.onChangeShow(names);
|
|
85
95
|
};
|
|
86
96
|
if (loading) {
|
|
87
|
-
return /*#__PURE__*/React.createElement(
|
|
88
|
-
|
|
89
|
-
|
|
97
|
+
return /*#__PURE__*/React.createElement(Spin, {
|
|
98
|
+
tip: "",
|
|
99
|
+
size: "default"
|
|
100
|
+
}, "\u6570\u636E\u6B63\u5728\u52AA\u529B\u52A0\u8F7D\u4E2D\uFF0C\u8BF7\u7A0D\u7B49~");
|
|
90
101
|
}
|
|
91
102
|
if (dataSource !== null && dataSource !== void 0 && dataSource.appData.delEvent) {
|
|
92
103
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -0,0 +1,295 @@
|
|
|
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 = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
8
|
+
import ReactECharts from 'echarts-for-react';
|
|
9
|
+
import * as echarts from 'echarts';
|
|
10
|
+
import { renderToString } from 'react-dom/server';
|
|
11
|
+
import CustomTooltip from "./customTooltip";
|
|
12
|
+
import { chartColors } from "../../constants";
|
|
13
|
+
import { getRandomColor } from "../../constants/color";
|
|
14
|
+
import { convertDateArray } from "../../utils/formData";
|
|
15
|
+
var _currentAxisBreaks = [{
|
|
16
|
+
start: 5000,
|
|
17
|
+
end: 100000,
|
|
18
|
+
gap: '1.5%'
|
|
19
|
+
}, {
|
|
20
|
+
start: 105000,
|
|
21
|
+
end: 3100000,
|
|
22
|
+
gap: '1.5%'
|
|
23
|
+
}];
|
|
24
|
+
var IntervalChart = function IntervalChart(props) {
|
|
25
|
+
var _useState = useState({}),
|
|
26
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
27
|
+
option = _useState2[0],
|
|
28
|
+
setOption = _useState2[1];
|
|
29
|
+
var chartRef = useRef(null);
|
|
30
|
+
useEffect(function () {
|
|
31
|
+
var _props$showList, _seriesData$series;
|
|
32
|
+
chartRef && chartRef.current.getEchartsInstance().clear();
|
|
33
|
+
var seriesData = props === null || props === void 0 ? void 0 : (_props$showList = props.showList) === null || _props$showList === void 0 ? void 0 : _props$showList.appData;
|
|
34
|
+
var params = props === null || props === void 0 ? void 0 : props.params;
|
|
35
|
+
var eCharts = {
|
|
36
|
+
tooltip: {
|
|
37
|
+
trigger: 'item',
|
|
38
|
+
// tooltip 跟随鼠标
|
|
39
|
+
position: function position(point, params, dom, rect, size) {
|
|
40
|
+
return [point[0] + 10, point[1] - 10];
|
|
41
|
+
},
|
|
42
|
+
axisPointer: {
|
|
43
|
+
type: 'line'
|
|
44
|
+
}
|
|
45
|
+
// formatter: (params: any) => {
|
|
46
|
+
// let tooltipString = ``;
|
|
47
|
+
// tooltipString += params.map((k) => {
|
|
48
|
+
// const item = seriesData?.series.find((it: any) => it.names[0] === k.name);
|
|
49
|
+
// return renderToString(<CustomTooltip series={item} payload={k} />);
|
|
50
|
+
// });
|
|
51
|
+
// return tooltipString;
|
|
52
|
+
// },
|
|
53
|
+
// formatter: (params: any) => {
|
|
54
|
+
// return renderToString(<CustomTooltip1 series={seriesData?.series} payload={params} />);
|
|
55
|
+
// },
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
legend: {
|
|
59
|
+
bottom: 0,
|
|
60
|
+
icon: 'circle',
|
|
61
|
+
type: 'scroll',
|
|
62
|
+
itemWidth: 10,
|
|
63
|
+
// 设置图例的宽度为10px
|
|
64
|
+
itemHeight: 10 // 设置图例的高度为10px
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
grid: {
|
|
68
|
+
top: '10',
|
|
69
|
+
left: '0',
|
|
70
|
+
right: '0',
|
|
71
|
+
bottom: props.onlyChart ? '0' : '68px',
|
|
72
|
+
containLabel: true
|
|
73
|
+
},
|
|
74
|
+
xAxis: {
|
|
75
|
+
type: 'category',
|
|
76
|
+
boundaryGap: true,
|
|
77
|
+
nameGap: 30,
|
|
78
|
+
data: convertDateArray(params, seriesData === null || seriesData === void 0 ? void 0 : seriesData.xAxis),
|
|
79
|
+
splitArea: {
|
|
80
|
+
show: false
|
|
81
|
+
},
|
|
82
|
+
splitLine: {
|
|
83
|
+
show: false
|
|
84
|
+
},
|
|
85
|
+
axisLine: {
|
|
86
|
+
lineStyle: {
|
|
87
|
+
color: '#E6E7EA' // 设置线条颜色
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
|
|
91
|
+
axisLabel: {
|
|
92
|
+
color: '#67727F' // 设置文字颜色
|
|
93
|
+
},
|
|
94
|
+
|
|
95
|
+
axisPointer: {
|
|
96
|
+
type: 'shadow'
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
yAxis: {
|
|
100
|
+
type: 'value',
|
|
101
|
+
splitLine: {
|
|
102
|
+
show: true,
|
|
103
|
+
lineStyle: {
|
|
104
|
+
type: 'dashed' // 设置线条类型为虚线
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
|
|
108
|
+
axisLabel: {
|
|
109
|
+
color: '#67727F' // 设置文字颜色
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
breaks: _currentAxisBreaks,
|
|
113
|
+
breakArea: {
|
|
114
|
+
itemStyle: {
|
|
115
|
+
opacity: 1
|
|
116
|
+
},
|
|
117
|
+
zigzagZ: 200
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
dataZoom: [{
|
|
121
|
+
type: 'inside',
|
|
122
|
+
start: 0,
|
|
123
|
+
end: 20,
|
|
124
|
+
right: 3,
|
|
125
|
+
height: 20 // 设置内置的dataZoom的高度
|
|
126
|
+
}, {
|
|
127
|
+
show: props.onlyChart ? false : true,
|
|
128
|
+
type: 'slider',
|
|
129
|
+
bottom: '38px',
|
|
130
|
+
xAxisIndex: [0],
|
|
131
|
+
start: 0,
|
|
132
|
+
end: 20,
|
|
133
|
+
right: 3,
|
|
134
|
+
height: 20 // 设置滑动条的高度
|
|
135
|
+
}],
|
|
136
|
+
|
|
137
|
+
series: seriesData === null || seriesData === void 0 ? void 0 : (_seriesData$series = seriesData.series) === null || _seriesData$series === void 0 ? void 0 : _seriesData$series.map(function (item, i) {
|
|
138
|
+
var _seriesData$series$i, _seriesData$series$i2;
|
|
139
|
+
// 生成随机颜色
|
|
140
|
+
var color = i < chartColors.length ? chartColors[i] : getRandomColor();
|
|
141
|
+
return {
|
|
142
|
+
type: 'boxplot',
|
|
143
|
+
datasetIndex: i,
|
|
144
|
+
name: seriesData === null || seriesData === void 0 ? void 0 : (_seriesData$series$i = seriesData.series[i]) === null || _seriesData$series$i === void 0 ? void 0 : _seriesData$series$i.names[0],
|
|
145
|
+
data: seriesData === null || seriesData === void 0 ? void 0 : (_seriesData$series$i2 = seriesData.series[i]) === null || _seriesData$series$i2 === void 0 ? void 0 : _seriesData$series$i2.values,
|
|
146
|
+
showBackground: true,
|
|
147
|
+
// 关键修改:背景改为透明
|
|
148
|
+
backgroundStyle: {
|
|
149
|
+
color: 'transparent'
|
|
150
|
+
},
|
|
151
|
+
emphasis: {
|
|
152
|
+
itemStyle: {
|
|
153
|
+
borderColor: item.type ? 'rgba(0,0,0,0.2)' : color // 设置盒子的颜色
|
|
154
|
+
},
|
|
155
|
+
|
|
156
|
+
tooltip: {
|
|
157
|
+
show: true,
|
|
158
|
+
// 单独配置series中的tooltip为显示
|
|
159
|
+
extraCssText: 'border: none;padding:0;border-radius:10px;background: rgba(250, 251, 253, 0.8)',
|
|
160
|
+
// 添加自定义的CSS样式,去掉边框
|
|
161
|
+
formatter: function formatter(params) {
|
|
162
|
+
var tooltipString = renderToString( /*#__PURE__*/React.createElement(CustomTooltip, {
|
|
163
|
+
series: seriesData === null || seriesData === void 0 ? void 0 : seriesData.series[i],
|
|
164
|
+
payload: params
|
|
165
|
+
}));
|
|
166
|
+
return tooltipString;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
itemStyle: {
|
|
171
|
+
borderColor: item.type ? 'rgba(0,0,0,0.2)' : color
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
})
|
|
175
|
+
};
|
|
176
|
+
setOption(eCharts);
|
|
177
|
+
}, [props === null || props === void 0 ? void 0 : props.showList]);
|
|
178
|
+
var updateCollapseButton = function updateCollapseButton(params) {
|
|
179
|
+
// If there is any axis break expanded, we need to show the collapse button.
|
|
180
|
+
var needReset = false;
|
|
181
|
+
for (var i = 0; i < params.breaks.length; i++) {
|
|
182
|
+
var changedBreakItem = params.breaks[i];
|
|
183
|
+
if (changedBreakItem.isExpanded) {
|
|
184
|
+
needReset = true;
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
setOption({
|
|
189
|
+
// Draw the collapse button.
|
|
190
|
+
graphic: [{
|
|
191
|
+
elements: [{
|
|
192
|
+
type: 'rect',
|
|
193
|
+
ignore: !needReset,
|
|
194
|
+
name: 'collapseAxisBreakBtn',
|
|
195
|
+
top: 5,
|
|
196
|
+
left: 5,
|
|
197
|
+
shape: {
|
|
198
|
+
r: 3,
|
|
199
|
+
width: 140,
|
|
200
|
+
height: 24
|
|
201
|
+
},
|
|
202
|
+
style: {
|
|
203
|
+
fill: '#eee',
|
|
204
|
+
stroke: '#999',
|
|
205
|
+
lineWidth: 1
|
|
206
|
+
},
|
|
207
|
+
textContent: {
|
|
208
|
+
type: 'text',
|
|
209
|
+
style: {
|
|
210
|
+
text: 'Collapse Axis Breaks',
|
|
211
|
+
fontSize: 13,
|
|
212
|
+
fontWeight: 'bold'
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
textConfig: {
|
|
216
|
+
position: 'inside'
|
|
217
|
+
}
|
|
218
|
+
}]
|
|
219
|
+
}]
|
|
220
|
+
});
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
// 获取实例
|
|
224
|
+
var _useState3 = useState(null),
|
|
225
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
226
|
+
echartsInstance = _useState4[0],
|
|
227
|
+
setEchartsInstance = _useState4[1];
|
|
228
|
+
useEffect(function () {
|
|
229
|
+
setEchartsInstance(chartRef.current.getEchartsInstance());
|
|
230
|
+
}, []);
|
|
231
|
+
return /*#__PURE__*/React.createElement(ReactECharts, {
|
|
232
|
+
ref: chartRef,
|
|
233
|
+
style: {
|
|
234
|
+
height: '431px',
|
|
235
|
+
padding: 24
|
|
236
|
+
},
|
|
237
|
+
option: option,
|
|
238
|
+
onEvents: {
|
|
239
|
+
axisbreakchanged: function axisbreakchanged(params) {
|
|
240
|
+
return updateCollapseButton(params);
|
|
241
|
+
},
|
|
242
|
+
mousemove: function mousemove(params) {
|
|
243
|
+
var pointInPixel = [params.offsetX, params.offsetY];
|
|
244
|
+
// 检查是否在网格区域内
|
|
245
|
+
if (echartsInstance && echartsInstance.containPixel('grid', pointInPixel)) {
|
|
246
|
+
var pointInGrid = echartsInstance && echartsInstance.convertFromPixel({
|
|
247
|
+
seriesIndex: 0
|
|
248
|
+
}, pointInPixel);
|
|
249
|
+
if (pointInGrid) {
|
|
250
|
+
var xIndex = Math.round(pointInGrid[0]);
|
|
251
|
+
var option = echartsInstance && echartsInstance.getOption();
|
|
252
|
+
var series = option.series;
|
|
253
|
+
var seriesCount = series.length;
|
|
254
|
+
|
|
255
|
+
// 获取网格区域信息
|
|
256
|
+
var grid = echartsInstance && echartsInstance.getModel().getComponent('grid', 0);
|
|
257
|
+
var gridRect = grid.coordinateSystem.getRect();
|
|
258
|
+
|
|
259
|
+
// 计算每个类目的宽度
|
|
260
|
+
var categoryCount = option.xAxis[0].data.length;
|
|
261
|
+
var categoryWidth = gridRect.width / categoryCount;
|
|
262
|
+
|
|
263
|
+
// 计算当前类目内的相对位置
|
|
264
|
+
var categoryStartX = gridRect.x + xIndex * categoryWidth;
|
|
265
|
+
var relativeX = params.offsetX - categoryStartX;
|
|
266
|
+
|
|
267
|
+
// 计算每个柱子的宽度(考虑柱子间距)
|
|
268
|
+
var barWidth = categoryWidth / seriesCount;
|
|
269
|
+
|
|
270
|
+
// 计算鼠标悬停在哪个系列的柱子上
|
|
271
|
+
var seriesIndex = Math.floor(relativeX / barWidth);
|
|
272
|
+
|
|
273
|
+
// 确保索引有效
|
|
274
|
+
if (seriesIndex >= 0 && seriesIndex < seriesCount && xIndex >= 0 && xIndex < categoryCount) {
|
|
275
|
+
// 显示跟随鼠标的 tooltip
|
|
276
|
+
echartsInstance && echartsInstance.dispatchAction({
|
|
277
|
+
type: 'showTip',
|
|
278
|
+
seriesIndex: seriesIndex,
|
|
279
|
+
dataIndex: xIndex,
|
|
280
|
+
position: [params.offsetX + 10, params.offsetY - 10]
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
},
|
|
286
|
+
mouseout: function mouseout() {
|
|
287
|
+
echartsInstance && echartsInstance.dispatchAction({
|
|
288
|
+
type: 'hideTip'
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
},
|
|
292
|
+
echarts: echarts
|
|
293
|
+
});
|
|
294
|
+
};
|
|
295
|
+
export default IntervalChart;
|