@zgfe/modules-attribution 1.0.1-alpha.0
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/README.md +35 -0
- package/es/components/common/index.d.ts +6 -0
- package/es/components/common/index.js +17 -0
- package/es/components/common/styles/index.less +27 -0
- package/es/components/index.d.ts +5 -0
- package/es/components/index.js +5 -0
- package/es/components/option/index.d.ts +5 -0
- package/es/components/option/index.js +134 -0
- package/es/components/option/styles/index.less +17 -0
- package/es/components/option/types.d.ts +8 -0
- package/es/components/option/types.js +1 -0
- package/es/components/searchTime/index.d.ts +5 -0
- package/es/components/searchTime/index.js +41 -0
- package/es/components/searchTime/styles/index.less +19 -0
- package/es/components/searchTime/types.d.ts +8 -0
- package/es/components/searchTime/types.js +1 -0
- package/es/components/tableList/index.d.ts +8 -0
- package/es/components/tableList/index.js +23 -0
- package/es/components/tableList/styles/index.less +7 -0
- package/es/components/title/index.d.ts +5 -0
- package/es/components/title/index.js +187 -0
- package/es/components/title/searchTitle.d.ts +7 -0
- package/es/components/title/searchTitle.js +47 -0
- package/es/components/title/styles/index.less +83 -0
- package/es/components/title/styles/search.less +27 -0
- package/es/components/title/types.d.ts +7 -0
- package/es/components/title/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 +24 -0
- package/es/constants/color.d.ts +1 -0
- package/es/constants/color.js +1 -0
- package/es/constants/fields.d.ts +146 -0
- package/es/constants/fields.js +179 -0
- package/es/constants/index.d.ts +6 -0
- package/es/constants/index.js +6 -0
- package/es/constants/initData.d.ts +17 -0
- package/es/constants/initData.js +24 -0
- package/es/index.d.ts +3 -0
- package/es/index.js +2 -0
- package/es/modules/content/index.d.ts +5 -0
- package/es/modules/content/index.js +125 -0
- package/es/modules/content/styles/index.less +7 -0
- package/es/modules/content/types.d.ts +8 -0
- package/es/modules/content/types.js +1 -0
- package/es/modules/content/utils.d.ts +8 -0
- package/es/modules/content/utils.js +192 -0
- package/es/modules/home/demo/create.d.ts +2 -0
- package/es/modules/home/demo/create.js +53 -0
- package/es/modules/home/demo/edit.d.ts +2 -0
- package/es/modules/home/demo/edit.js +190 -0
- package/es/modules/home/demo/index.d.ts +3 -0
- package/es/modules/home/demo/index.js +51 -0
- package/es/modules/home/demo/scene.d.ts +2 -0
- package/es/modules/home/demo/scene.js +74 -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 +150 -0
- package/es/modules/home/styles/index.less +63 -0
- package/es/modules/home/types.d.ts +20 -0
- package/es/modules/home/types.js +1 -0
- package/es/modules/searchPanel/components/attributableEvents.d.ts +4 -0
- package/es/modules/searchPanel/components/attributableEvents.js +172 -0
- package/es/modules/searchPanel/components/globalAttribute.d.ts +8 -0
- package/es/modules/searchPanel/components/globalAttribute.js +58 -0
- package/es/modules/searchPanel/components/index.d.ts +4 -0
- package/es/modules/searchPanel/components/index.js +21 -0
- package/es/modules/searchPanel/components/targetEvent.d.ts +4 -0
- package/es/modules/searchPanel/components/targetEvent.js +149 -0
- package/es/modules/searchPanel/demo/index.d.ts +2 -0
- package/es/modules/searchPanel/demo/index.js +28 -0
- package/es/modules/searchPanel/index.d.ts +6 -0
- package/es/modules/searchPanel/index.js +316 -0
- package/es/modules/searchPanel/styles/index.less +202 -0
- package/es/modules/searchPanel/types.d.ts +31 -0
- package/es/modules/searchPanel/types.js +1 -0
- package/es/modules/searchPanel/utils.d.ts +5 -0
- package/es/modules/searchPanel/utils.js +139 -0
- package/es/style/image/noData.png +0 -0
- package/es/style/image/ring.svg +9 -0
- package/es/style/index.less +47 -0
- package/es/style/theme.d.ts +15 -0
- package/es/style/theme.js +14 -0
- package/es/types.d.ts +62 -0
- package/es/types.js +2 -0
- package/es/utils/ajaxConfig.d.ts +8 -0
- package/es/utils/ajaxConfig.js +40 -0
- package/es/utils/request.d.ts +3 -0
- package/es/utils/request.js +5 -0
- package/es/utils/transfer.d.ts +65 -0
- package/es/utils/transfer.js +173 -0
- package/es/utils/util.d.ts +32 -0
- package/es/utils/util.js +139 -0
- package/package.json +54 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
3
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
5
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
6
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
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
|
+
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
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
10
|
+
import { BizGlobalDataContext } from '@zgfe/business-lib';
|
|
11
|
+
import request from '../../utils/request';
|
|
12
|
+
import React, { useContext, useEffect, useState } from 'react';
|
|
13
|
+
import Request from 'umi-request';
|
|
14
|
+
import SearchPanel from '../searchPanel';
|
|
15
|
+
import './styles/index.less';
|
|
16
|
+
import { Apis } from '../../constants';
|
|
17
|
+
import { handleTableData } from './utils';
|
|
18
|
+
import { TableList, OptionGroup, SearchTime } from '../../components';
|
|
19
|
+
var CancelToken = Request.CancelToken;
|
|
20
|
+
var cancel;
|
|
21
|
+
var classPrefix = 'attribution-content';
|
|
22
|
+
var InsightContent = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
23
|
+
var _useState = useState(props.value),
|
|
24
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
25
|
+
searchData = _useState2[0],
|
|
26
|
+
setSearchData = _useState2[1];
|
|
27
|
+
var _useState3 = useState(false),
|
|
28
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
29
|
+
loading = _useState4[0],
|
|
30
|
+
setLoading = _useState4[1];
|
|
31
|
+
var _useState5 = useState(0),
|
|
32
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
33
|
+
timer = _useState6[0],
|
|
34
|
+
setTimer = _useState6[1];
|
|
35
|
+
var _useContext = useContext(BizGlobalDataContext),
|
|
36
|
+
currentApp = _useContext.currentApp;
|
|
37
|
+
var _useState7 = useState(null),
|
|
38
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
39
|
+
time = _useState8[0],
|
|
40
|
+
setTime = _useState8[1];
|
|
41
|
+
useEffect(function () {
|
|
42
|
+
if (timer) clearTimeout(timer);
|
|
43
|
+
var flag = true;
|
|
44
|
+
setTimer(setTimeout(function () {
|
|
45
|
+
if (flag) {
|
|
46
|
+
fetchRequest();
|
|
47
|
+
}
|
|
48
|
+
}, 500));
|
|
49
|
+
return function () {
|
|
50
|
+
if (timer) clearTimeout(timer);
|
|
51
|
+
flag = false;
|
|
52
|
+
};
|
|
53
|
+
}, [searchData, time]);
|
|
54
|
+
useEffect(function () {
|
|
55
|
+
props.onSearching && props.onSearching(loading);
|
|
56
|
+
}, [loading]);
|
|
57
|
+
var _useState9 = useState(100),
|
|
58
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
59
|
+
total = _useState10[0],
|
|
60
|
+
setTotal = _useState10[1];
|
|
61
|
+
var fetchRequest = function fetchRequest() {
|
|
62
|
+
if (typeof cancel === 'function') {
|
|
63
|
+
cancel();
|
|
64
|
+
}
|
|
65
|
+
request(Apis.getAnalyseData, {
|
|
66
|
+
method: 'post',
|
|
67
|
+
data: _objectSpread(_objectSpread(_objectSpread({}, currentApp), searchData), time),
|
|
68
|
+
cancelToken: new CancelToken(function executor(c) {
|
|
69
|
+
cancel = c;
|
|
70
|
+
})
|
|
71
|
+
}).then(function (res) {
|
|
72
|
+
if (res.data) {
|
|
73
|
+
var _data = handleTableData(res.data);
|
|
74
|
+
console.log('表格数据', _data);
|
|
75
|
+
setTableDataList(_data);
|
|
76
|
+
setTotal(res.data.total);
|
|
77
|
+
}
|
|
78
|
+
setTimeout(function () {
|
|
79
|
+
setLoading(false);
|
|
80
|
+
}, 0);
|
|
81
|
+
}).catch(function () {
|
|
82
|
+
setLoading(false);
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
var onChangeSearch = function onChangeSearch(allData) {
|
|
86
|
+
console.log('查询条件:', allData);
|
|
87
|
+
setSearchData(function (data) {
|
|
88
|
+
return _objectSpread(_objectSpread({}, allData), {}, {
|
|
89
|
+
time: data === null || data === void 0 ? void 0 : data.time
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
var onChangeContent = function onChangeContent(data) {
|
|
94
|
+
setTime(data);
|
|
95
|
+
setSearchData(function (value) {
|
|
96
|
+
return _objectSpread(_objectSpread({}, value), data);
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
var _useState11 = useState({}),
|
|
100
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
101
|
+
tableDataList = _useState12[0],
|
|
102
|
+
setTableDataList = _useState12[1];
|
|
103
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
104
|
+
className: classPrefix
|
|
105
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
106
|
+
className: "".concat(classPrefix, "-top-content-box")
|
|
107
|
+
}, /*#__PURE__*/React.createElement(SearchPanel, {
|
|
108
|
+
defaultValue: searchData,
|
|
109
|
+
onChange: onChangeSearch
|
|
110
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
111
|
+
className: "".concat(classPrefix, "-bottom-content-box")
|
|
112
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
113
|
+
className: "".concat(classPrefix, "-bottom-content-box-times")
|
|
114
|
+
}, /*#__PURE__*/React.createElement(SearchTime, {
|
|
115
|
+
time: time,
|
|
116
|
+
onChange: onChangeContent
|
|
117
|
+
}), searchData && /*#__PURE__*/React.createElement(OptionGroup, {
|
|
118
|
+
ref: ref,
|
|
119
|
+
searchData: searchData
|
|
120
|
+
})), /*#__PURE__*/React.createElement(TableList, {
|
|
121
|
+
total: total,
|
|
122
|
+
tableDataList: tableDataList
|
|
123
|
+
})));
|
|
124
|
+
});
|
|
125
|
+
export default InsightContent;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TableDataHandleProps, TableDataProps } from '../../types';
|
|
2
|
+
export declare function getSortData(data: any, userGroup?: number[]): {
|
|
3
|
+
x_axis: any;
|
|
4
|
+
series: any[];
|
|
5
|
+
} | undefined;
|
|
6
|
+
export declare const sortData: (data: Array<any>, hasUserGroup?: boolean) => any[];
|
|
7
|
+
export declare function getChartTypes(type: string): any;
|
|
8
|
+
export declare const handleTableData: (data: TableDataHandleProps) => TableDataProps;
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
3
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
+
import { nanoid } from 'nanoid';
|
|
5
|
+
export function getSortData(data, userGroup) {
|
|
6
|
+
if (!data) {
|
|
7
|
+
return undefined;
|
|
8
|
+
}
|
|
9
|
+
if (userGroup && userGroup.length === 1 && userGroup[0] === 0) {
|
|
10
|
+
data.series.forEach(function (item) {
|
|
11
|
+
item.names.splice(item.names.length - 2, 1);
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
var seriesData = (data.series || []).map(function (item) {
|
|
15
|
+
var names = item.names,
|
|
16
|
+
values = item.values;
|
|
17
|
+
var len = names.length - 1;
|
|
18
|
+
if (names[len] === '平均使用时长') {
|
|
19
|
+
names[len] += '(s)';
|
|
20
|
+
values = values.map(function (data) {
|
|
21
|
+
return Math.round(data / 10) / 100;
|
|
22
|
+
});
|
|
23
|
+
} else {
|
|
24
|
+
names[len] += item.index ? "\uFF08".concat(item.index, "\uFF09") : '';
|
|
25
|
+
}
|
|
26
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
27
|
+
names: names,
|
|
28
|
+
values: values
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
var hasUserGroup = userGroup && userGroup.length > 1;
|
|
32
|
+
var series = sortData(seriesData, hasUserGroup);
|
|
33
|
+
return {
|
|
34
|
+
x_axis: data.xAxis || [],
|
|
35
|
+
series: series
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export var sortData = function sortData(data, hasUserGroup) {
|
|
39
|
+
if (!data.length) return data;
|
|
40
|
+
var len = data[0].names.length;
|
|
41
|
+
var compare = function compare(a, b) {
|
|
42
|
+
var flag = 0;
|
|
43
|
+
var aNames = a.names;
|
|
44
|
+
var bNames = b.names;
|
|
45
|
+
for (var i = 0; i < len; i++) {
|
|
46
|
+
var k = i;
|
|
47
|
+
if (hasUserGroup) {
|
|
48
|
+
if (i === len - 2) {
|
|
49
|
+
k = len - 1;
|
|
50
|
+
} else if (i === len - 1) {
|
|
51
|
+
k = len - 2;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
var aName = aNames[k];
|
|
55
|
+
var bName = bNames[k];
|
|
56
|
+
if (aName !== bName) {
|
|
57
|
+
flag = sortDevName(aName, bName);
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return flag;
|
|
62
|
+
};
|
|
63
|
+
data.sort(compare);
|
|
64
|
+
return data;
|
|
65
|
+
};
|
|
66
|
+
function sortDevName(str1, str2) {
|
|
67
|
+
str1 = String(str1);
|
|
68
|
+
str2 = String(str2);
|
|
69
|
+
var res = 0;
|
|
70
|
+
for (var i = 0;; i++) {
|
|
71
|
+
if (!str1[i] || !str2[i]) {
|
|
72
|
+
res = str1.length - str2.length;
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
var char1 = str1[i];
|
|
76
|
+
var char1Type = getCharType(char1);
|
|
77
|
+
var char2 = str2[i];
|
|
78
|
+
var char2Type = getCharType(char2);
|
|
79
|
+
if (char1Type[0] === char2Type[0]) {
|
|
80
|
+
if (char1 === char2) {
|
|
81
|
+
continue;
|
|
82
|
+
} else {
|
|
83
|
+
if (char1Type[0] === 'zh') {
|
|
84
|
+
res = char1.localeCompare(char2);
|
|
85
|
+
} else if (char1Type[0] === 'en') {
|
|
86
|
+
res = char2.charCodeAt(0) - char1.charCodeAt(0);
|
|
87
|
+
} else {
|
|
88
|
+
res = parseInt(char1) - parseInt(char2);
|
|
89
|
+
}
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
} else {
|
|
93
|
+
res = char1Type[1] - char2Type[1];
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return res;
|
|
98
|
+
}
|
|
99
|
+
function getCharType(char) {
|
|
100
|
+
if (/^[\u4e00-\u9fa5]$/.test(char)) {
|
|
101
|
+
return ['zh', 300];
|
|
102
|
+
}
|
|
103
|
+
if (/^[a-zA-Z]$/.test(char)) {
|
|
104
|
+
return ['en', 200];
|
|
105
|
+
}
|
|
106
|
+
if (/^[0-9]$/.test(char)) {
|
|
107
|
+
return ['number', 100];
|
|
108
|
+
}
|
|
109
|
+
return ['others', 999];
|
|
110
|
+
}
|
|
111
|
+
export function getChartTypes(type) {
|
|
112
|
+
var result = [{
|
|
113
|
+
label: '趋势图',
|
|
114
|
+
value: 'line',
|
|
115
|
+
icon: 'qushitu1'
|
|
116
|
+
}, {
|
|
117
|
+
label: '汇总图',
|
|
118
|
+
value: 'bar',
|
|
119
|
+
icon: 'huizongtu'
|
|
120
|
+
}];
|
|
121
|
+
var gridChildren = [{
|
|
122
|
+
label: '',
|
|
123
|
+
value: 'line',
|
|
124
|
+
icon: 'qushitu1'
|
|
125
|
+
}, {
|
|
126
|
+
label: '',
|
|
127
|
+
value: 'bar',
|
|
128
|
+
icon: 'huizongtu'
|
|
129
|
+
}];
|
|
130
|
+
if (type === 'whole' || type === 'revenue') {
|
|
131
|
+
result.push({
|
|
132
|
+
label: '占比图',
|
|
133
|
+
icon: 'pie',
|
|
134
|
+
value: 'pie'
|
|
135
|
+
});
|
|
136
|
+
gridChildren.push({
|
|
137
|
+
value: 'pie',
|
|
138
|
+
icon: 'pie',
|
|
139
|
+
label: ''
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
if (type === 'event' || type === 'whole' || type === 'revenue') {
|
|
143
|
+
gridChildren.push({
|
|
144
|
+
value: 'map',
|
|
145
|
+
icon: 'ditu',
|
|
146
|
+
label: ''
|
|
147
|
+
});
|
|
148
|
+
result.push({
|
|
149
|
+
label: '地图',
|
|
150
|
+
icon: 'ditu',
|
|
151
|
+
value: 'map'
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
result.push({
|
|
155
|
+
label: '表格',
|
|
156
|
+
icon: 'biaoge',
|
|
157
|
+
value: 'grid',
|
|
158
|
+
children: gridChildren
|
|
159
|
+
});
|
|
160
|
+
result.push({
|
|
161
|
+
label: '数值',
|
|
162
|
+
icon: 'fenshu',
|
|
163
|
+
disable: true,
|
|
164
|
+
value: 'number'
|
|
165
|
+
});
|
|
166
|
+
return result;
|
|
167
|
+
}
|
|
168
|
+
export var handleTableData = function handleTableData(data) {
|
|
169
|
+
var tableData = {};
|
|
170
|
+
var dataSource = [],
|
|
171
|
+
columns = [];
|
|
172
|
+
var _columns = data.xAxis;
|
|
173
|
+
data.series.map(function (item) {
|
|
174
|
+
var _json = {};
|
|
175
|
+
item.values.map(function (_item, _index) {
|
|
176
|
+
_json[_columns[_index]] = _item;
|
|
177
|
+
});
|
|
178
|
+
dataSource.push(_objectSpread({
|
|
179
|
+
key: nanoid()
|
|
180
|
+
}, _json));
|
|
181
|
+
});
|
|
182
|
+
_columns.map(function (item) {
|
|
183
|
+
columns.push({
|
|
184
|
+
title: item,
|
|
185
|
+
dataIndex: item,
|
|
186
|
+
key: item
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
tableData.dataSource = dataSource;
|
|
190
|
+
tableData.columns = columns;
|
|
191
|
+
return tableData;
|
|
192
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
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, { useEffect, useState } from 'react';
|
|
8
|
+
import { DemoWrapper, setGlobalConfig } from '@zgfe/business-lib';
|
|
9
|
+
import { AttributionHome } from '@zgfe/modules-attribution';
|
|
10
|
+
import { requestConfig } from '../../../utils/ajaxConfig';
|
|
11
|
+
import { Button } from 'antd';
|
|
12
|
+
var defaultValue = {
|
|
13
|
+
panelId: 438,
|
|
14
|
+
panelType: 'add'
|
|
15
|
+
};
|
|
16
|
+
export default (function () {
|
|
17
|
+
var _useState = useState(false),
|
|
18
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
19
|
+
isDetail = _useState2[0],
|
|
20
|
+
setIsDetail = _useState2[1];
|
|
21
|
+
var _useState3 = useState(),
|
|
22
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
23
|
+
detailParams = _useState4[0],
|
|
24
|
+
setDetailParams = _useState4[1];
|
|
25
|
+
var _useState5 = useState(defaultValue),
|
|
26
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
27
|
+
searchParams = _useState6[0],
|
|
28
|
+
setSearchParams = _useState6[1];
|
|
29
|
+
useEffect(function () {
|
|
30
|
+
setGlobalConfig(requestConfig);
|
|
31
|
+
}, []);
|
|
32
|
+
var afterEditTarget = function afterEditTarget(type, data) {
|
|
33
|
+
console.log("".concat(type, "\u56DE\u8C03"), data);
|
|
34
|
+
};
|
|
35
|
+
var onUserDrill = function onUserDrill(data, searchData) {
|
|
36
|
+
console.log('onUserDrill:', data, searchData);
|
|
37
|
+
setIsDetail(true);
|
|
38
|
+
setSearchParams(searchData);
|
|
39
|
+
setDetailParams(data);
|
|
40
|
+
};
|
|
41
|
+
return /*#__PURE__*/React.createElement(DemoWrapper, {
|
|
42
|
+
needMeta: true,
|
|
43
|
+
defaultApp: 3
|
|
44
|
+
}, isDetail ? /*#__PURE__*/React.createElement("div", null, JSON.stringify(detailParams), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Button, {
|
|
45
|
+
onClick: function onClick() {
|
|
46
|
+
return setIsDetail(false);
|
|
47
|
+
}
|
|
48
|
+
}, "\u8FD4\u56DE")) : /*#__PURE__*/React.createElement(AttributionHome, {
|
|
49
|
+
defaultValue: searchParams,
|
|
50
|
+
afterEditTarget: afterEditTarget,
|
|
51
|
+
onUserDrill: onUserDrill
|
|
52
|
+
}));
|
|
53
|
+
});
|
|
@@ -0,0 +1,190 @@
|
|
|
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, { useEffect, useState } from 'react';
|
|
8
|
+
import { DemoWrapper, setGlobalConfig } from '@zgfe/business-lib';
|
|
9
|
+
import { AttributionHome } from '@zgfe/modules-attribution';
|
|
10
|
+
import { requestConfig } from '../../../utils/ajaxConfig';
|
|
11
|
+
import { Button } from 'antd';
|
|
12
|
+
var defaultValue = {
|
|
13
|
+
id: 1426,
|
|
14
|
+
name: '洞察',
|
|
15
|
+
type: 0,
|
|
16
|
+
enlarged: 0,
|
|
17
|
+
panelId: 438,
|
|
18
|
+
panelType: 'edit',
|
|
19
|
+
data: {
|
|
20
|
+
appId: 1,
|
|
21
|
+
platform: 0,
|
|
22
|
+
windowType: 'day',
|
|
23
|
+
windowCnt: 1,
|
|
24
|
+
attributionType: 1,
|
|
25
|
+
otherEvent: 0,
|
|
26
|
+
time: {
|
|
27
|
+
unit: 'day',
|
|
28
|
+
relative: [7, 0],
|
|
29
|
+
begin: '2023-05-11',
|
|
30
|
+
end: '2023-05-18'
|
|
31
|
+
},
|
|
32
|
+
targetFilters: {
|
|
33
|
+
eventId: 35,
|
|
34
|
+
eventName: '目标事件名称',
|
|
35
|
+
indexType: 0,
|
|
36
|
+
filters: {
|
|
37
|
+
relation: 'and',
|
|
38
|
+
conditions: [{
|
|
39
|
+
attrId: 263,
|
|
40
|
+
propCategory: 'eventProp',
|
|
41
|
+
type: 1,
|
|
42
|
+
operator: 'equal',
|
|
43
|
+
values: ['事件属性1', '事件属性2'],
|
|
44
|
+
dimensionSub: 'event_attr',
|
|
45
|
+
label: '机身宽度',
|
|
46
|
+
attrName: '机身宽度'
|
|
47
|
+
}, {
|
|
48
|
+
attrId: 3,
|
|
49
|
+
propCategory: 'userProp',
|
|
50
|
+
type: 1,
|
|
51
|
+
operator: 'equal',
|
|
52
|
+
values: ['用户属性【名称1】', '用户属性【名称2】'],
|
|
53
|
+
dimensionSub: 'name',
|
|
54
|
+
label: '名称',
|
|
55
|
+
attrName: 'name',
|
|
56
|
+
category: 'fixed'
|
|
57
|
+
}, {
|
|
58
|
+
attrId: 0,
|
|
59
|
+
propCategory: 'envProp',
|
|
60
|
+
type: 1,
|
|
61
|
+
operator: 'equal',
|
|
62
|
+
values: ['触发环境1', '触发环境2'],
|
|
63
|
+
dimensionSub: 'utm_source',
|
|
64
|
+
label: 'utm_source',
|
|
65
|
+
attrName: 'utm_source',
|
|
66
|
+
category: 'fixed'
|
|
67
|
+
}]
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
sourceFilters: [{
|
|
71
|
+
eventId: 19,
|
|
72
|
+
eventName: '埋点事件-12',
|
|
73
|
+
propFilters: {
|
|
74
|
+
relation: 'and',
|
|
75
|
+
conditions: [{
|
|
76
|
+
propCategory: 'envProp',
|
|
77
|
+
type: 1,
|
|
78
|
+
attrId: 3,
|
|
79
|
+
attrName: 'name',
|
|
80
|
+
category: 'fixed'
|
|
81
|
+
}]
|
|
82
|
+
},
|
|
83
|
+
filters: {
|
|
84
|
+
relation: 'and',
|
|
85
|
+
conditions: [{
|
|
86
|
+
attrId: 263,
|
|
87
|
+
propCategory: 'eventProp',
|
|
88
|
+
type: 1,
|
|
89
|
+
operator: 'equal',
|
|
90
|
+
values: ['事件属性1', '事件属性2'],
|
|
91
|
+
dimensionSub: 'event_attr',
|
|
92
|
+
label: '机身宽度',
|
|
93
|
+
attrName: '机身宽度'
|
|
94
|
+
}, {
|
|
95
|
+
attrId: 3,
|
|
96
|
+
propCategory: 'userProp',
|
|
97
|
+
type: 1,
|
|
98
|
+
operator: 'equal',
|
|
99
|
+
values: ['用户属性【名称1】', '用户属性【名称2】'],
|
|
100
|
+
dimensionSub: 'name',
|
|
101
|
+
label: '名称',
|
|
102
|
+
attrName: 'name',
|
|
103
|
+
category: 'fixed'
|
|
104
|
+
}, {
|
|
105
|
+
attrId: 0,
|
|
106
|
+
propCategory: 'envProp',
|
|
107
|
+
type: 1,
|
|
108
|
+
operator: 'equal',
|
|
109
|
+
values: ['触发环境1', '触发环境2'],
|
|
110
|
+
dimensionSub: 'utm_source',
|
|
111
|
+
label: 'utm_source',
|
|
112
|
+
attrName: 'utm_source',
|
|
113
|
+
category: 'fixed'
|
|
114
|
+
}]
|
|
115
|
+
}
|
|
116
|
+
}],
|
|
117
|
+
globalFilters: {
|
|
118
|
+
relation: 'and',
|
|
119
|
+
conditions: [{
|
|
120
|
+
attrId: 263,
|
|
121
|
+
propCategory: 'eventProp',
|
|
122
|
+
type: 1,
|
|
123
|
+
operator: 'equal',
|
|
124
|
+
values: ['事件属性1', '事件属性2'],
|
|
125
|
+
dimensionSub: 'event_attr',
|
|
126
|
+
label: '机身宽度',
|
|
127
|
+
attrName: '机身宽度'
|
|
128
|
+
}, {
|
|
129
|
+
attrId: 3,
|
|
130
|
+
propCategory: 'userProp',
|
|
131
|
+
type: 1,
|
|
132
|
+
operator: 'equal',
|
|
133
|
+
values: ['用户属性【名称1】', '用户属性【名称2】'],
|
|
134
|
+
dimensionSub: 'name',
|
|
135
|
+
label: '名称',
|
|
136
|
+
attrName: 'name',
|
|
137
|
+
category: 'fixed'
|
|
138
|
+
}, {
|
|
139
|
+
attrId: 0,
|
|
140
|
+
propCategory: 'envProp',
|
|
141
|
+
type: 1,
|
|
142
|
+
operator: 'equal',
|
|
143
|
+
values: ['触发环境1', '触发环境2'],
|
|
144
|
+
dimensionSub: 'utm_source',
|
|
145
|
+
label: 'utm_source',
|
|
146
|
+
attrName: 'utm_source',
|
|
147
|
+
category: 'fixed'
|
|
148
|
+
}]
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
chosen_data: ['所有用户,崩溃(人数)', '所有用户,查看商品(人数)', '所有用户,访问次数', '所有用户,购买商品(人数)', '所有用户,活跃用户', '所有用户,加购商品(人数)', '所有用户,平均使用时长(s)', '所有用户,评价商品(人数)', '所有用户,使用时长分布(访问次数)', '所有用户,使用时长分布(活跃用户)']
|
|
152
|
+
};
|
|
153
|
+
export default (function () {
|
|
154
|
+
var _useState = useState(false),
|
|
155
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
156
|
+
isDetail = _useState2[0],
|
|
157
|
+
setIsDetail = _useState2[1];
|
|
158
|
+
var _useState3 = useState(),
|
|
159
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
160
|
+
detailParams = _useState4[0],
|
|
161
|
+
setDetailParams = _useState4[1];
|
|
162
|
+
var _useState5 = useState(defaultValue),
|
|
163
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
164
|
+
searchParams = _useState6[0],
|
|
165
|
+
setSearchParams = _useState6[1];
|
|
166
|
+
useEffect(function () {
|
|
167
|
+
setGlobalConfig(requestConfig);
|
|
168
|
+
}, []);
|
|
169
|
+
var afterEditTarget = function afterEditTarget(type, data) {
|
|
170
|
+
console.log("".concat(type, "\u56DE\u8C03"), data);
|
|
171
|
+
};
|
|
172
|
+
var onUserDrill = function onUserDrill(data, searchData) {
|
|
173
|
+
console.log('onUserDrill:', data, searchData);
|
|
174
|
+
setIsDetail(true);
|
|
175
|
+
setSearchParams(searchData);
|
|
176
|
+
setDetailParams(data);
|
|
177
|
+
};
|
|
178
|
+
return /*#__PURE__*/React.createElement(DemoWrapper, {
|
|
179
|
+
needMeta: true,
|
|
180
|
+
defaultApp: 3
|
|
181
|
+
}, isDetail ? /*#__PURE__*/React.createElement("div", null, JSON.stringify(detailParams), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Button, {
|
|
182
|
+
onClick: function onClick() {
|
|
183
|
+
return setIsDetail(false);
|
|
184
|
+
}
|
|
185
|
+
}, "\u8FD4\u56DE")) : /*#__PURE__*/React.createElement(AttributionHome, {
|
|
186
|
+
defaultValue: searchParams,
|
|
187
|
+
afterEditTarget: afterEditTarget,
|
|
188
|
+
onUserDrill: onUserDrill
|
|
189
|
+
}));
|
|
190
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
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 { DemoWrapper, setGlobalConfig } from '@zgfe/business-lib';
|
|
8
|
+
import React, { useEffect, useState } from 'react';
|
|
9
|
+
import { AttributionHome } from '@zgfe/modules-attribution';
|
|
10
|
+
import './styles/index.less';
|
|
11
|
+
import { requestConfig } from '../../../utils/ajaxConfig';
|
|
12
|
+
import { Button } from 'antd';
|
|
13
|
+
export default (function () {
|
|
14
|
+
var _useState = useState(false),
|
|
15
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
16
|
+
isDetail = _useState2[0],
|
|
17
|
+
setIsDetail = _useState2[1];
|
|
18
|
+
var _useState3 = useState(),
|
|
19
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
20
|
+
detailParams = _useState4[0],
|
|
21
|
+
setDetailParams = _useState4[1];
|
|
22
|
+
var _useState5 = useState(),
|
|
23
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
24
|
+
searchParams = _useState6[0],
|
|
25
|
+
setSearchParams = _useState6[1];
|
|
26
|
+
useEffect(function () {
|
|
27
|
+
setGlobalConfig(requestConfig);
|
|
28
|
+
}, []);
|
|
29
|
+
var afterEditTarget = function afterEditTarget(type, data) {
|
|
30
|
+
console.log("".concat(type, "\u56DE\u8C03"), data);
|
|
31
|
+
};
|
|
32
|
+
var onUserDrill = function onUserDrill(data, searchData) {
|
|
33
|
+
console.log('onUserDrill:', data, searchData);
|
|
34
|
+
setIsDetail(true);
|
|
35
|
+
setSearchParams(searchData);
|
|
36
|
+
setDetailParams(data);
|
|
37
|
+
};
|
|
38
|
+
return /*#__PURE__*/React.createElement(DemoWrapper, {
|
|
39
|
+
needMeta: true,
|
|
40
|
+
defaultApp: 3
|
|
41
|
+
}, isDetail ? /*#__PURE__*/React.createElement("div", null, JSON.stringify(detailParams), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Button, {
|
|
42
|
+
onClick: function onClick() {
|
|
43
|
+
return setIsDetail(false);
|
|
44
|
+
}
|
|
45
|
+
}, "\u8FD4\u56DE")) : /*#__PURE__*/React.createElement(AttributionHome, {
|
|
46
|
+
defaultValue: searchParams,
|
|
47
|
+
enableGenerateReport: true,
|
|
48
|
+
afterEditTarget: afterEditTarget,
|
|
49
|
+
onUserDrill: onUserDrill
|
|
50
|
+
}));
|
|
51
|
+
});
|