@ztocwst/rc-pro-materials 0.2.22 → 0.2.24
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +5 -5
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +5 -5
- package/dist/SCM_Comps.css +1 -1
- package/dist/SCM_Comps.js +3 -3
- package/dist/SCM_Comps.js.map +1 -1
- package/es/components/z-data-table/components/custom-renderer/index.d.ts +4 -0
- package/es/components/{z-templates-data-common → z-data-table}/components/custom-renderer/index.js +28 -18
- package/{lib/components/z-templates-data-common → es/components/z-data-table}/components/dim-target/dim-target.helper.d.ts +1 -1
- package/es/components/{z-templates-data-common → z-data-table}/components/dim-target/index.js +1 -1
- package/es/components/z-data-table/components/link-renderer/index.d.ts +16 -0
- package/es/components/{z-templates-data-common → z-data-table}/components/link-renderer/index.js +202 -102
- package/es/components/{z-templates-data-common → z-data-table}/components/link-renderer/index.less +4 -0
- package/es/components/z-data-table/components/table-renderer/index.d.ts +4 -0
- package/es/components/{z-templates-data-common → z-data-table}/components/table-renderer/index.js +66 -25
- package/es/components/{z-templates-data-common → z-data-table}/components/table-renderer/table-renderer.helper.d.ts +10 -9
- package/es/components/{z-templates-data-common → z-data-table}/components/table-renderer/table-renderer.helper.js +23 -12
- package/es/components/z-data-table/data-table.d.ts +116 -0
- package/es/components/{z-templates-data-common/data-common.helper.d.ts → z-data-table/data-table.helper.d.ts} +2 -0
- package/es/components/{z-templates-data-common/data-common.helper.js → z-data-table/data-table.helper.js} +4 -1
- package/es/components/z-data-table/data-table.js +52 -0
- package/es/components/z-data-table/index.d.ts +7 -0
- package/es/components/z-data-table/index.js +5 -0
- package/es/components/z-templates-data-common/components/chart-renderer/index.d.ts +1 -1
- package/es/components/z-templates-data-common/components/chart-renderer/index.js +13 -8
- package/es/components/z-templates-data-common/data-common.d.ts +2 -111
- package/es/components/z-templates-data-common/data-common.js +1 -7
- package/es/index.d.ts +2 -0
- package/es/index.js +2 -0
- package/es/style.js +2 -2
- package/es/utils/props/form.js +5 -2
- package/es/utils/props/tpl.d.ts +2 -0
- package/lib/components/z-data-table/components/custom-renderer/index.d.ts +4 -0
- package/lib/components/{z-templates-data-common → z-data-table}/components/custom-renderer/index.js +30 -20
- package/{es/components/z-templates-data-common → lib/components/z-data-table}/components/dim-target/dim-target.helper.d.ts +1 -1
- package/lib/components/{z-templates-data-common → z-data-table}/components/dim-target/index.js +3 -3
- package/lib/components/z-data-table/components/link-renderer/index.d.ts +16 -0
- package/lib/components/{z-templates-data-common → z-data-table}/components/link-renderer/index.js +208 -108
- package/lib/components/{z-templates-data-common → z-data-table}/components/link-renderer/index.less +4 -0
- package/lib/components/z-data-table/components/table-renderer/index.d.ts +4 -0
- package/lib/components/{z-templates-data-common → z-data-table}/components/table-renderer/index.js +72 -31
- package/lib/components/{z-templates-data-common → z-data-table}/components/table-renderer/table-renderer.helper.d.ts +10 -9
- package/lib/components/{z-templates-data-common → z-data-table}/components/table-renderer/table-renderer.helper.js +30 -19
- package/lib/components/z-data-table/data-table.d.ts +116 -0
- package/lib/components/{z-templates-data-common/data-common.helper.d.ts → z-data-table/data-table.helper.d.ts} +2 -0
- package/lib/components/{z-templates-data-common/data-common.helper.js → z-data-table/data-table.helper.js} +7 -3
- package/lib/components/z-data-table/data-table.js +58 -0
- package/lib/components/z-data-table/index.d.ts +7 -0
- package/lib/components/z-data-table/index.js +14 -0
- package/lib/components/z-templates-data-common/components/chart-renderer/index.d.ts +1 -1
- package/lib/components/z-templates-data-common/components/chart-renderer/index.js +19 -14
- package/lib/components/z-templates-data-common/data-common.d.ts +2 -111
- package/lib/components/z-templates-data-common/data-common.js +1 -6
- package/lib/index.d.ts +2 -0
- package/lib/index.js +3 -1
- package/lib/style.js +2 -2
- package/lib/utils/props/form.js +5 -2
- package/lib/utils/props/tpl.d.ts +2 -0
- package/package.json +4 -4
- package/es/components/z-templates-data-common/components/custom-renderer/index.d.ts +0 -13
- package/es/components/z-templates-data-common/components/link-renderer/index.d.ts +0 -16
- package/es/components/z-templates-data-common/components/table-renderer/index.d.ts +0 -6
- package/lib/components/z-templates-data-common/components/custom-renderer/index.d.ts +0 -13
- package/lib/components/z-templates-data-common/components/link-renderer/index.d.ts +0 -16
- package/lib/components/z-templates-data-common/components/table-renderer/index.d.ts +0 -6
- /package/es/components/{z-templates-data-common → z-data-table}/components/dim-target/dim-target.helper.js +0 -0
- /package/es/components/{z-templates-data-common → z-data-table}/components/dim-target/index.d.ts +0 -0
- /package/es/components/{z-templates-data-common → z-data-table}/components/dim-target/index.less +0 -0
- /package/es/components/{z-templates-data-common → z-data-table}/components/dim-target/useUpdateEffect.d.ts +0 -0
- /package/es/components/{z-templates-data-common → z-data-table}/components/dim-target/useUpdateEffect.js +0 -0
- /package/lib/components/{z-templates-data-common → z-data-table}/components/dim-target/dim-target.helper.js +0 -0
- /package/lib/components/{z-templates-data-common → z-data-table}/components/dim-target/index.d.ts +0 -0
- /package/lib/components/{z-templates-data-common → z-data-table}/components/dim-target/index.less +0 -0
- /package/lib/components/{z-templates-data-common → z-data-table}/components/dim-target/useUpdateEffect.d.ts +0 -0
- /package/lib/components/{z-templates-data-common → z-data-table}/components/dim-target/useUpdateEffect.js +0 -0
package/es/components/{z-templates-data-common → z-data-table}/components/custom-renderer/index.js
RENAMED
|
@@ -7,12 +7,12 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
7
7
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
8
8
|
import { useState, useEffect, useRef, useContext, useImperativeHandle } from 'react';
|
|
9
9
|
import { RcConfigContext } from '@ztocwst/rc-pro';
|
|
10
|
-
import { separator, timeUnit, handleQueryParams, getReportData } from "../../data-
|
|
10
|
+
import { separator, timeUnit, handleQueryParams, getReportData } from "../../data-table.helper";
|
|
11
11
|
import LinkRenderer from "../link-renderer";
|
|
12
12
|
var CustomRenderer = function CustomRenderer(props) {
|
|
13
13
|
var _props$child;
|
|
14
14
|
var _ref = props || {},
|
|
15
|
-
|
|
15
|
+
currentKey = _ref.currentKey,
|
|
16
16
|
autoLoad = _ref.autoLoad,
|
|
17
17
|
refreshRate = _ref.refreshRate,
|
|
18
18
|
dataSetName = _ref.dataSetName,
|
|
@@ -20,6 +20,7 @@ var CustomRenderer = function CustomRenderer(props) {
|
|
|
20
20
|
indexJson = _ref.indexJson,
|
|
21
21
|
linkPage = _ref.linkPage,
|
|
22
22
|
linkPageTitle = _ref.linkPageTitle,
|
|
23
|
+
chartRef = _ref.chartRef,
|
|
23
24
|
onConfirm = _ref.onConfirm,
|
|
24
25
|
formatter = _ref.formatter;
|
|
25
26
|
var rcProContext = useContext(RcConfigContext);
|
|
@@ -121,28 +122,37 @@ var CustomRenderer = function CustomRenderer(props) {
|
|
|
121
122
|
timer = null;
|
|
122
123
|
}
|
|
123
124
|
};
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}, refreshRate * timeUnit);
|
|
134
|
-
} else {
|
|
135
|
-
onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm();
|
|
136
|
-
}
|
|
125
|
+
var onload = function onload() {
|
|
126
|
+
if (autoLoad) {
|
|
127
|
+
if (refreshRate) {
|
|
128
|
+
handleClearInterval();
|
|
129
|
+
timer = window.setInterval(function () {
|
|
130
|
+
return onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm();
|
|
131
|
+
}, refreshRate * timeUnit);
|
|
132
|
+
} else {
|
|
133
|
+
onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm();
|
|
137
134
|
}
|
|
138
135
|
} else {
|
|
139
136
|
handleClearInterval();
|
|
140
137
|
}
|
|
138
|
+
};
|
|
139
|
+
useEffect(function () {
|
|
140
|
+
if (currentKey) {
|
|
141
|
+
var _ref4 = currentKey.split(separator) || [],
|
|
142
|
+
curDataSetName = _ref4[0];
|
|
143
|
+
if (curDataSetName === dataSetName) {
|
|
144
|
+
onload();
|
|
145
|
+
} else {
|
|
146
|
+
handleClearInterval();
|
|
147
|
+
}
|
|
148
|
+
} else {
|
|
149
|
+
onload();
|
|
150
|
+
}
|
|
141
151
|
return function () {
|
|
142
152
|
handleClearInterval();
|
|
143
153
|
};
|
|
144
|
-
}, [
|
|
145
|
-
useImperativeHandle(
|
|
154
|
+
}, [currentKey, autoLoad]);
|
|
155
|
+
useImperativeHandle(chartRef, function () {
|
|
146
156
|
return {
|
|
147
157
|
onLink: onLink,
|
|
148
158
|
queryChart: queryChart
|
|
@@ -154,7 +164,7 @@ var CustomRenderer = function CustomRenderer(props) {
|
|
|
154
164
|
}
|
|
155
165
|
}, /*#__PURE__*/React.createElement(_Spin, {
|
|
156
166
|
spinning: loading
|
|
157
|
-
}, (_props$child = props.child) === null || _props$child === void 0 ? void 0 : _props$child.call(props, result))), /*#__PURE__*/React.createElement("div", {
|
|
167
|
+
}, props === null || props === void 0 ? void 0 : (_props$child = props.child) === null || _props$child === void 0 ? void 0 : _props$child.call(props, result))), /*#__PURE__*/React.createElement("div", {
|
|
158
168
|
style: {
|
|
159
169
|
display: isLink ? 'block' : 'none'
|
|
160
170
|
}
|
package/es/components/{z-templates-data-common → z-data-table}/components/dim-target/index.js
RENAMED
|
@@ -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
|
import React, { useState, useEffect, useImperativeHandle, useContext } from 'react';
|
|
12
12
|
import { ProButton, RcConfigContext } from '@ztocwst/rc-pro';
|
|
13
|
-
import { getMaxWidth, saveDimTarget } from "../../data-
|
|
13
|
+
import { getMaxWidth, saveDimTarget } from "../../data-table.helper";
|
|
14
14
|
import useUpdateEffect from "./useUpdateEffect";
|
|
15
15
|
import "./index.less";
|
|
16
16
|
var DimsDefault = {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { CheckboxValueType } from 'antd/es/checkbox/Group';
|
|
3
|
+
import type { TypeZDataTableProps } from '../../data-table';
|
|
4
|
+
import './index.less';
|
|
5
|
+
export interface linkParamsType extends Pick<TypeZDataTableProps, 'dataSetName'> {
|
|
6
|
+
index?: number | string;
|
|
7
|
+
width?: number;
|
|
8
|
+
dimension?: CheckboxValueType[];
|
|
9
|
+
record?: Record<string, any>;
|
|
10
|
+
}
|
|
11
|
+
export interface linkStateType extends linkParamsType, Pick<TypeZDataTableProps, 'chartTitle' | 'custom' | 'child' | 'title' | 'autoLoad' | 'refreshRate' | 'actionJson' | 'exporter' | 'exportConfig'> {
|
|
12
|
+
}
|
|
13
|
+
declare const LinkRenderer: (props: Pick<TypeZDataTableProps, "onConfirm" | "dimJson" | "linkPage" | "linkPageTitle" | "chartRef"> & {
|
|
14
|
+
onBack?: () => void;
|
|
15
|
+
}) => import("react").JSX.Element;
|
|
16
|
+
export default LinkRenderer;
|
package/es/components/{z-templates-data-common → z-data-table}/components/link-renderer/index.js
RENAMED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import _Spin from "antd/es/spin";
|
|
2
2
|
import _Radio from "antd/es/radio";
|
|
3
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
|
4
3
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
4
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
|
5
5
|
import _extends from "@babel/runtime/helpers/extends";
|
|
6
|
-
var _excluded = ["
|
|
6
|
+
var _excluded = ["queryBind", "formatter"],
|
|
7
|
+
_excluded2 = ["pageNum", "pageSize", "orderBy"];
|
|
7
8
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
9
|
+
function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
|
+
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); }
|
|
11
|
+
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
12
|
import { useEffect, useState, useRef, useContext, useImperativeHandle } from 'react';
|
|
9
|
-
import { ProTable, RcConfigContext } from '@ztocwst/rc-pro';
|
|
13
|
+
import { ProTable, ProButton, RcConfigContext } from '@ztocwst/rc-pro';
|
|
10
14
|
import { ArrowLeftOutlined } from '@ant-design/icons';
|
|
11
15
|
import moment from 'moment';
|
|
12
|
-
import { tableConfigDefault, dateStart, separator, timeUnit, getType, getMaxWidth, handleQueryParams, getReportData } from "../../data-
|
|
16
|
+
import { tableConfigDefault, dateStart, separator, timeUnit, defaultSort, getType, getMaxWidth, handleQueryParams, getReportData } from "../../data-table.helper";
|
|
13
17
|
import { handleDimTargetFormat, handleColumns } from "../table-renderer/table-renderer.helper";
|
|
14
18
|
import "./index.less";
|
|
15
19
|
var linkStateDefault = {
|
|
@@ -28,6 +32,7 @@ var LinkRenderer = function LinkRenderer(props) {
|
|
|
28
32
|
onBack = props.onBack;
|
|
29
33
|
var rcProContext = useContext(RcConfigContext);
|
|
30
34
|
var _ref = rcProContext || {},
|
|
35
|
+
BASE_URL = _ref.BASE_URL,
|
|
31
36
|
_ref$tableOptions = _ref.tableOptions,
|
|
32
37
|
tableOptions = _ref$tableOptions === void 0 ? {} : _ref$tableOptions;
|
|
33
38
|
var defaultPageSize = (tableOptions === null || tableOptions === void 0 ? void 0 : (_tableOptions$paginat = tableOptions.pagination) === null || _tableOptions$paginat === void 0 ? void 0 : _tableOptions$paginat.defaultPageSize) || 20;
|
|
@@ -102,106 +107,154 @@ var LinkRenderer = function LinkRenderer(props) {
|
|
|
102
107
|
// 更新表头
|
|
103
108
|
(_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : (_tableRef$current$upd = _tableRef$current.updateColumns) === null || _tableRef$current$upd === void 0 ? void 0 : _tableRef$current$upd.call(_tableRef$current, columns);
|
|
104
109
|
};
|
|
110
|
+
var getBigDataBody = function getBigDataBody(params) {
|
|
111
|
+
var _dimJson$data, _targets$indexSource;
|
|
112
|
+
if (params === void 0) {
|
|
113
|
+
params = {};
|
|
114
|
+
}
|
|
115
|
+
var dataSetName = linkState.dataSetName,
|
|
116
|
+
index = linkState.index,
|
|
117
|
+
dimension = linkState.dimension,
|
|
118
|
+
record = linkState.record;
|
|
119
|
+
var columns = handleGetColumns(_extends({}, linkState));
|
|
120
|
+
|
|
121
|
+
/** 查看queryBind是否有 当前查询条件和当前数据源参数(paraJson)建立绑定关系;有的话替换成绑定关系中的"键",没有则是默认查询配置的"键",上一级数据源的维度 "值" 或 当前查询条件的"值"入参 */
|
|
122
|
+
var _linkPage$index = linkPage[index],
|
|
123
|
+
queryBind = _linkPage$index.queryBind,
|
|
124
|
+
formatter = _linkPage$index.formatter,
|
|
125
|
+
find = _objectWithoutPropertiesLoose(_linkPage$index, _excluded);
|
|
126
|
+
var _ref3 = handleDimTargetFormat(find) || {},
|
|
127
|
+
targets = _ref3.targets;
|
|
128
|
+
var queryCache = queryCacheRef.current || {};
|
|
129
|
+
var query = {};
|
|
130
|
+
var queryKeys = Object.keys(queryCache);
|
|
131
|
+
if (queryKeys !== null && queryKeys !== void 0 && queryKeys.length) {
|
|
132
|
+
queryKeys.forEach(function (k) {
|
|
133
|
+
// 查看是否有绑定关联关系 有取绑定的入参"键" 没有则取默认的"键"
|
|
134
|
+
var queryBindFilter = queryBind === null || queryBind === void 0 ? void 0 : queryBind.filter(function (item) {
|
|
135
|
+
return (item === null || item === void 0 ? void 0 : item.currentQueryKey) === k;
|
|
136
|
+
});
|
|
137
|
+
// "键"(有建立绑定关系 取当前数据源参数(paraJson)的"键",没有则是默认查询配置的"键")
|
|
138
|
+
if (queryBindFilter !== null && queryBindFilter !== void 0 && queryBindFilter.length) {
|
|
139
|
+
// 参数为时间时会出现多个绑定关系
|
|
140
|
+
queryBindFilter.forEach(function (item) {
|
|
141
|
+
var key = item.sourceQueryKey;
|
|
142
|
+
// "值"(当前查询条件的"值")
|
|
143
|
+
var value = queryCache[k];
|
|
144
|
+
if (key) {
|
|
145
|
+
// 类型为时间时 处理
|
|
146
|
+
if (getType(value) === 'array' && value.length === 2 && value.some(function (d) {
|
|
147
|
+
return moment(d).isValid();
|
|
148
|
+
})) {
|
|
149
|
+
var i = key.includes(dateStart) ? 0 : 1;
|
|
150
|
+
query[key] = value[i];
|
|
151
|
+
} else {
|
|
152
|
+
query[key] = value;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
} else {
|
|
157
|
+
// "值"(当前查询条件的"值")
|
|
158
|
+
query[k] = queryCache[k];
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
var recordKeys = Object.keys(record || {});
|
|
163
|
+
if (recordKeys.length) {
|
|
164
|
+
recordKeys.forEach(function (k) {
|
|
165
|
+
// 查看是否有绑定关联关系
|
|
166
|
+
var queryBindFilter = queryBind === null || queryBind === void 0 ? void 0 : queryBind.filter(function (item) {
|
|
167
|
+
return (item === null || item === void 0 ? void 0 : item.parentDimKey) === k;
|
|
168
|
+
});
|
|
169
|
+
// 参数为时间时会出现多个绑定关系
|
|
170
|
+
if (queryBindFilter !== null && queryBindFilter !== void 0 && queryBindFilter.length) {
|
|
171
|
+
queryBindFilter.forEach(function (item) {
|
|
172
|
+
var key = item.sourceQueryKey;
|
|
173
|
+
if (key) {
|
|
174
|
+
// "值"(有建立绑定关系 取上一级数据源的维度的"值")
|
|
175
|
+
query[key] = record[k];
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
var dim;
|
|
182
|
+
if (dimJson !== null && dimJson !== void 0 && (_dimJson$data = dimJson.data) !== null && _dimJson$data !== void 0 && _dimJson$data.length) {
|
|
183
|
+
dim = dimension === null || dimension === void 0 ? void 0 : dimension.map(function (description) {
|
|
184
|
+
var _dimJson$data2, _dimJson$data2$find;
|
|
185
|
+
return {
|
|
186
|
+
description: description,
|
|
187
|
+
name: (_dimJson$data2 = dimJson.data) === null || _dimJson$data2 === void 0 ? void 0 : (_dimJson$data2$find = _dimJson$data2.find(function (item) {
|
|
188
|
+
return item.description === description;
|
|
189
|
+
})) === null || _dimJson$data2$find === void 0 ? void 0 : _dimJson$data2$find.name
|
|
190
|
+
};
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
var orderBys = [];
|
|
194
|
+
if (targets !== null && targets !== void 0 && (_targets$indexSource = targets.indexSource) !== null && _targets$indexSource !== void 0 && _targets$indexSource.length) {
|
|
195
|
+
for (var _iterator = _createForOfIteratorHelperLoose(targets.indexSource), _step; !(_step = _iterator()).done;) {
|
|
196
|
+
var cur = _step.value;
|
|
197
|
+
if (cur !== null && cur !== void 0 && cur.sorted) {
|
|
198
|
+
orderBys.push({
|
|
199
|
+
name: cur.name,
|
|
200
|
+
sort: defaultSort
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
var queryParams = handleQueryParams(query);
|
|
206
|
+
var _params = params,
|
|
207
|
+
pageNum = _params.pageNum,
|
|
208
|
+
pageSize = _params.pageSize,
|
|
209
|
+
orderBy = _params.orderBy,
|
|
210
|
+
other = _objectWithoutPropertiesLoose(_params, _excluded2);
|
|
211
|
+
if (orderBy !== null && orderBy !== void 0 && orderBy.length) {
|
|
212
|
+
var _loop = function _loop() {
|
|
213
|
+
var item = _step2.value;
|
|
214
|
+
var i = orderBys.findIndex(function (e) {
|
|
215
|
+
return e.name === item.name;
|
|
216
|
+
});
|
|
217
|
+
if (i > -1) {
|
|
218
|
+
orderBys.splice(i, 1);
|
|
219
|
+
}
|
|
220
|
+
orderBys.unshift(_extends({}, item));
|
|
221
|
+
};
|
|
222
|
+
for (var _iterator2 = _createForOfIteratorHelperLoose(orderBy), _step2; !(_step2 = _iterator2()).done;) {
|
|
223
|
+
_loop();
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
var data = _extends({}, other, {
|
|
227
|
+
queryParams: queryParams,
|
|
228
|
+
dim: dim,
|
|
229
|
+
target: columns.map(function (item) {
|
|
230
|
+
return {
|
|
231
|
+
description: item.dataIndex
|
|
232
|
+
};
|
|
233
|
+
}),
|
|
234
|
+
orderBy: orderBys !== null && orderBys !== void 0 && orderBys.length ? orderBys : undefined,
|
|
235
|
+
pageNum: pageNum || 1,
|
|
236
|
+
pageSize: pageSize || defaultPageSize,
|
|
237
|
+
dataSetName: dataSetName
|
|
238
|
+
});
|
|
239
|
+
return formatter ? formatter === null || formatter === void 0 ? void 0 : formatter(data) : data;
|
|
240
|
+
};
|
|
105
241
|
var getDataSource = /*#__PURE__*/function () {
|
|
106
|
-
var
|
|
107
|
-
var
|
|
108
|
-
var dataSetName, index, dimension, record, columns, _linkPage$index, queryBind, formatter, queryCache, query, queryKeys, recordKeys, dim, queryParams, _params, pageNum, pageSize, other, data, queryData;
|
|
242
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(params) {
|
|
243
|
+
var queryData;
|
|
109
244
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
110
245
|
while (1) switch (_context.prev = _context.next) {
|
|
111
246
|
case 0:
|
|
112
247
|
if (params === void 0) {
|
|
113
248
|
params = {};
|
|
114
249
|
}
|
|
115
|
-
|
|
116
|
-
columns = handleGetColumns(_extends({}, linkState));
|
|
117
|
-
/** 查看queryBind是否有 当前查询条件和当前数据源参数(paraJson)建立绑定关系;有的话替换成绑定关系中的"键",没有则是默认查询配置的"键",上一级数据源的维度 "值" 或 当前查询条件的"值"入参 */
|
|
118
|
-
_linkPage$index = linkPage[index], queryBind = _linkPage$index.queryBind, formatter = _linkPage$index.formatter;
|
|
119
|
-
queryCache = queryCacheRef.current;
|
|
120
|
-
query = {};
|
|
121
|
-
queryKeys = Object.keys(queryCache);
|
|
122
|
-
if (queryKeys !== null && queryKeys !== void 0 && queryKeys.length) {
|
|
123
|
-
queryKeys.forEach(function (k) {
|
|
124
|
-
// 查看是否有绑定关联关系 有取绑定的入参"键" 没有则取默认的"键"
|
|
125
|
-
var queryBindFilter = queryBind === null || queryBind === void 0 ? void 0 : queryBind.filter(function (item) {
|
|
126
|
-
return (item === null || item === void 0 ? void 0 : item.currentQueryKey) === k;
|
|
127
|
-
});
|
|
128
|
-
// "键"(有建立绑定关系 取当前数据源参数(paraJson)的"键",没有则是默认查询配置的"键")
|
|
129
|
-
if (queryBindFilter !== null && queryBindFilter !== void 0 && queryBindFilter.length) {
|
|
130
|
-
// 参数为时间时会出现多个绑定关系
|
|
131
|
-
queryBindFilter.forEach(function (item) {
|
|
132
|
-
var key = item.sourceQueryKey;
|
|
133
|
-
// "值"(当前查询条件的"值")
|
|
134
|
-
var value = queryCache[k];
|
|
135
|
-
if (key) {
|
|
136
|
-
// 类型为时间时 处理
|
|
137
|
-
if (getType(value) === 'array' && value.length === 2 && value.some(function (d) {
|
|
138
|
-
return moment(d).isValid();
|
|
139
|
-
})) {
|
|
140
|
-
var i = key.includes(dateStart) ? 0 : 1;
|
|
141
|
-
query[key] = value[i];
|
|
142
|
-
} else {
|
|
143
|
-
query[key] = value;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
} else {
|
|
148
|
-
// "值"(当前查询条件的"值")
|
|
149
|
-
query[k] = queryCache[k];
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
recordKeys = Object.keys(record || {});
|
|
154
|
-
if (recordKeys.length) {
|
|
155
|
-
recordKeys.forEach(function (k) {
|
|
156
|
-
// 查看是否有绑定关联关系
|
|
157
|
-
var queryBindFilter = queryBind === null || queryBind === void 0 ? void 0 : queryBind.filter(function (item) {
|
|
158
|
-
return (item === null || item === void 0 ? void 0 : item.parentDimKey) === k;
|
|
159
|
-
});
|
|
160
|
-
// 参数为时间时会出现多个绑定关系
|
|
161
|
-
if (queryBindFilter !== null && queryBindFilter !== void 0 && queryBindFilter.length) {
|
|
162
|
-
queryBindFilter.forEach(function (item) {
|
|
163
|
-
var key = item.sourceQueryKey;
|
|
164
|
-
if (key) {
|
|
165
|
-
// "值"(有建立绑定关系 取上一级数据源的维度的"值")
|
|
166
|
-
query[key] = record[k];
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
if (dimJson !== null && dimJson !== void 0 && (_dimJson$data = dimJson.data) !== null && _dimJson$data !== void 0 && _dimJson$data.length) {
|
|
173
|
-
dim = dimension === null || dimension === void 0 ? void 0 : dimension.map(function (description) {
|
|
174
|
-
var _dimJson$data2, _dimJson$data2$find;
|
|
175
|
-
return {
|
|
176
|
-
description: description,
|
|
177
|
-
name: (_dimJson$data2 = dimJson.data) === null || _dimJson$data2 === void 0 ? void 0 : (_dimJson$data2$find = _dimJson$data2.find(function (item) {
|
|
178
|
-
return item.description === description;
|
|
179
|
-
})) === null || _dimJson$data2$find === void 0 ? void 0 : _dimJson$data2$find.name
|
|
180
|
-
};
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
queryParams = handleQueryParams(query);
|
|
184
|
-
_params = params, pageNum = _params.pageNum, pageSize = _params.pageSize, other = _objectWithoutPropertiesLoose(_params, _excluded);
|
|
185
|
-
data = _extends({}, other, {
|
|
186
|
-
pageNum: pageNum || 1,
|
|
187
|
-
pageSize: pageSize || defaultPageSize,
|
|
188
|
-
queryParams: queryParams,
|
|
189
|
-
dim: dim,
|
|
190
|
-
target: columns.map(function (item) {
|
|
191
|
-
return {
|
|
192
|
-
description: item.dataIndex
|
|
193
|
-
};
|
|
194
|
-
}),
|
|
195
|
-
dataSetName: dataSetName
|
|
196
|
-
});
|
|
197
|
-
queryData = formatter ? formatter === null || formatter === void 0 ? void 0 : formatter(data) : data;
|
|
250
|
+
queryData = getBigDataBody(params);
|
|
198
251
|
if (linkState.custom) {
|
|
199
252
|
setLoading(true);
|
|
200
253
|
}
|
|
201
|
-
return _context.abrupt("return", getReportData(rcProContext, queryData).then(function (
|
|
202
|
-
var success =
|
|
203
|
-
|
|
204
|
-
result =
|
|
254
|
+
return _context.abrupt("return", getReportData(rcProContext, queryData).then(function (_ref5) {
|
|
255
|
+
var success = _ref5.success,
|
|
256
|
+
_ref5$result = _ref5.result,
|
|
257
|
+
result = _ref5$result === void 0 ? {} : _ref5$result;
|
|
205
258
|
if (linkState.custom) {
|
|
206
259
|
setLoading(false);
|
|
207
260
|
if (success) {
|
|
@@ -218,21 +271,21 @@ var LinkRenderer = function LinkRenderer(props) {
|
|
|
218
271
|
setResult(null);
|
|
219
272
|
}
|
|
220
273
|
}));
|
|
221
|
-
case
|
|
274
|
+
case 4:
|
|
222
275
|
case "end":
|
|
223
276
|
return _context.stop();
|
|
224
277
|
}
|
|
225
278
|
}, _callee);
|
|
226
279
|
}));
|
|
227
280
|
return function getDataSource(_x) {
|
|
228
|
-
return
|
|
281
|
+
return _ref4.apply(this, arguments);
|
|
229
282
|
};
|
|
230
283
|
}();
|
|
231
284
|
|
|
232
285
|
/** 初始linkState */
|
|
233
286
|
var initial = function initial(paramsState) {
|
|
234
|
-
var
|
|
235
|
-
dataSetName =
|
|
287
|
+
var _ref6 = paramsState || {},
|
|
288
|
+
dataSetName = _ref6.dataSetName;
|
|
236
289
|
/** 二级页未配置 或 自定义dataSetName配错 直接返回 */
|
|
237
290
|
var Length = linkPage === null || linkPage === void 0 ? void 0 : linkPage.length;
|
|
238
291
|
var isHave = linkPage === null || linkPage === void 0 ? void 0 : linkPage.some(function (item) {
|
|
@@ -305,9 +358,9 @@ var LinkRenderer = function LinkRenderer(props) {
|
|
|
305
358
|
var handleLinkChange = function handleLinkChange(event) {
|
|
306
359
|
var value = event.target.value;
|
|
307
360
|
// dataSetName 可能会重复配置 所以使用 dataSetName + 分隔符 + index
|
|
308
|
-
var
|
|
309
|
-
dataSetName =
|
|
310
|
-
index =
|
|
361
|
+
var _ref7 = (value === null || value === void 0 ? void 0 : value.split(separator)) || [],
|
|
362
|
+
dataSetName = _ref7[0],
|
|
363
|
+
index = _ref7[1];
|
|
311
364
|
var currentState = linkPage[index];
|
|
312
365
|
var stateData = _extends({}, linkState, currentState, {
|
|
313
366
|
dataSetName: dataSetName,
|
|
@@ -337,7 +390,54 @@ var LinkRenderer = function LinkRenderer(props) {
|
|
|
337
390
|
width: linkState.width
|
|
338
391
|
}
|
|
339
392
|
}, field === null || field === void 0 ? void 0 : field.title)) : null;
|
|
340
|
-
}))
|
|
393
|
+
})), linkState.exporter ? /*#__PURE__*/React.createElement("div", {
|
|
394
|
+
className: "link-export"
|
|
395
|
+
}, /*#__PURE__*/React.createElement(ProButton, {
|
|
396
|
+
items: [{
|
|
397
|
+
action: 'btn',
|
|
398
|
+
name: linkState === null || linkState === void 0 ? void 0 : linkState.exportConfig.name,
|
|
399
|
+
props: {
|
|
400
|
+
disabled: !queryCacheRef.current
|
|
401
|
+
},
|
|
402
|
+
fileConfig: {
|
|
403
|
+
type: 'export',
|
|
404
|
+
params: {
|
|
405
|
+
menuId: linkState === null || linkState === void 0 ? void 0 : linkState.exportConfig.menuId,
|
|
406
|
+
operateType: 'EXPORT'
|
|
407
|
+
},
|
|
408
|
+
request: {
|
|
409
|
+
submit: {
|
|
410
|
+
url: BASE_URL + "/data/forward/v1/bigdata/report/" + (linkState === null || linkState === void 0 ? void 0 : linkState.dataSetName) + "/export",
|
|
411
|
+
method: 'POST',
|
|
412
|
+
formatter: function () {
|
|
413
|
+
var _formatter = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(values) {
|
|
414
|
+
var bigDataBody, _ref8, _ref8$temp, temp;
|
|
415
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
416
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
417
|
+
case 0:
|
|
418
|
+
bigDataBody = getBigDataBody();
|
|
419
|
+
_ref8 = values || {}, _ref8$temp = _ref8.temp, temp = _ref8$temp === void 0 ? {} : _ref8$temp;
|
|
420
|
+
return _context2.abrupt("return", {
|
|
421
|
+
buttonCode: linkState === null || linkState === void 0 ? void 0 : linkState.exportConfig.code,
|
|
422
|
+
templateId: temp === null || temp === void 0 ? void 0 : temp.value,
|
|
423
|
+
bigDataBody: bigDataBody
|
|
424
|
+
});
|
|
425
|
+
case 3:
|
|
426
|
+
case "end":
|
|
427
|
+
return _context2.stop();
|
|
428
|
+
}
|
|
429
|
+
}, _callee2);
|
|
430
|
+
}));
|
|
431
|
+
function formatter(_x2) {
|
|
432
|
+
return _formatter.apply(this, arguments);
|
|
433
|
+
}
|
|
434
|
+
return formatter;
|
|
435
|
+
}()
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}]
|
|
440
|
+
})) : null), linkState.custom ? /*#__PURE__*/React.createElement(_Spin, {
|
|
341
441
|
spinning: loading
|
|
342
442
|
}, (_linkState$child = linkState.child) === null || _linkState$child === void 0 ? void 0 : _linkState$child.call(linkState, result)) : /*#__PURE__*/React.createElement(ProTable, {
|
|
343
443
|
ref: tableRef,
|