@cloudbase/weda-ui 3.4.9-alpha.1024 → 3.4.9
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 +65 -30
- package/dist/configs/components/chart/bar.json +1 -1
- package/dist/configs/components/chart/line.js +1 -1
- package/dist/configs/components/chart/pie.json +1 -1
- package/dist/configs/components/customer-service.js +0 -2
- package/dist/configs/components/flowgraph.json +22 -0
- package/dist/configs/components/form-checkbox.js +1 -0
- package/dist/configs/components/form-date.js +1 -0
- package/dist/configs/components/form-depart-tree-select.js +2 -4
- package/dist/configs/components/form-email.js +1 -0
- package/dist/configs/components/form-image-uploader.js +1 -0
- package/dist/configs/components/form-input.js +1 -2
- package/dist/configs/components/form-location.js +2 -2
- package/dist/configs/components/form-multi-region.js +1 -0
- package/dist/configs/components/form-phone.js +1 -0
- package/dist/configs/components/form-radio.js +1 -0
- package/dist/configs/components/form-region.js +1 -0
- package/dist/configs/components/form-rich-text.js +1 -0
- package/dist/configs/components/form-select.js +1 -0
- package/dist/configs/components/form-switch.js +1 -0
- package/dist/configs/components/form-text-area.js +1 -0
- package/dist/configs/components/form-time.js +1 -0
- package/dist/configs/components/form-upload-file.js +1 -0
- package/dist/configs/components/form-url.js +1 -0
- package/dist/configs/components/form-user-tree-select.js +3 -4
- package/dist/configs/components/modal.js +0 -2
- package/dist/configs/components/navigationBar.json +1 -3
- package/dist/configs/components/wd-button.js +2 -2
- package/dist/configs/components/wd-icon.js +2 -2
- package/dist/configs/components/wd-link.js +2 -2
- package/dist/configs/components/wd-table.js +1 -1
- package/dist/configs/index.js +2 -0
- package/dist/docs/common/components/properties-view.js +3 -6
- package/dist/docs/common/tableView.js +7 -10
- package/dist/style/index.scss +1 -1
- package/dist/web/components/chart/common/core/eChartLine.js +12 -1
- package/dist/web/components/chart/common/data-transform.js +13 -9
- package/dist/web/components/chart/line/index.old.js +2 -1
- package/dist/web/components/flow/common/request.js +3 -3
- package/dist/web/components/flow/modules/chart/index.js +42 -3
- package/dist/web/components/flow/modules/chart/preview-data.js +88 -0
- package/dist/web/components/flow-graph/constants.js +28 -0
- package/dist/web/components/flow-graph/graph.js +267 -0
- package/dist/web/components/flow-graph/index.js +2 -0
- package/dist/web/components/flow-graph/style.css +109 -0
- package/dist/web/components/flow-graph/types.js +1 -0
- package/dist/web/components/form/select/dropdown-select/index.css +4 -0
- package/dist/web/components/form/select/dropdown-select/index.js +4 -1
- package/dist/web/components/form/select/request.js +9 -9
- package/dist/web/components/form/userOrgSelect/common/fetch-data-service.js +44 -490
- package/dist/web/components/form/userOrgSelect/common/utils.js +14 -58
- package/dist/web/components/form/userOrgSelect/component/OrgPaths.js +12 -0
- package/dist/web/components/form/userOrgSelect/component/depart-select/depart-select-pc.js +1 -3
- package/dist/web/components/form/userOrgSelect/component/depart-select/departTreeSelect.h5.js +35 -56
- package/dist/web/components/form/userOrgSelect/component/depart-select/index.js +46 -24
- package/dist/web/components/form/userOrgSelect/component/depart-select/org-modal-pc.js +11 -20
- package/dist/web/components/form/userOrgSelect/component/modal-select-h5.js +57 -120
- package/dist/web/components/form/userOrgSelect/component/org-tree.js +8 -24
- package/dist/web/components/form/userOrgSelect/component/user-org-list.js +4 -4
- package/dist/web/components/form/userOrgSelect/component/user-select-h5/index.js +42 -33
- package/dist/web/components/form/userOrgSelect/component/user-select-h5/user-select-h5.js +2 -2
- package/dist/web/components/form/userOrgSelect/component/user-select-pc/model-user-list.js +20 -51
- package/dist/web/components/form/userOrgSelect/component/user-select-pc/org-tree.js +2 -2
- package/dist/web/components/form/userOrgSelect/component/user-select-pc/user-model.js +4 -17
- package/dist/web/components/form/userOrgSelect/component/user-select-pc/user-select-pc.js +4 -6
- package/dist/web/components/form/userOrgSelect/component/userOrgSelect.css +7 -3
- package/dist/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.h5.js +68 -158
- package/dist/web/components/form/userOrgSelect/hooks/use-depart-data.js +3 -109
- package/dist/web/components/form-input-hooks/index.js +5 -2
- package/dist/web/components/index.js +1 -0
- package/dist/web/components/swiper/index.js +1 -2
- package/dist/web/components/table/BaseTable.js +1 -1
- package/dist/web/components/tabs/tabs.pc.js +10 -9
- package/dist/web/components/wd-form/index.js +28 -14
- package/dist/web/components/wd-table/components/ExportFileModalByApi/index.js +1 -1
- package/dist/web/components/wd-table/components/FieldRender/index.js +13 -2
- package/dist/web/components/wd-table/hooks/useChooseList.js +3 -5
- package/dist/web/components/wd-table/hooks/useTableData.js +1 -7
- package/dist/web/components/wd-table/utils/index.js +22 -3
- package/dist/web/components/wd-table/wd-table.js +9 -3
- package/dist/web/utils/datasource.js +3 -1
- package/package.json +2 -3
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { debug } from '../../../utils/console';
|
|
2
2
|
import { ChartError } from './chart-error';
|
|
3
|
+
import lodashSet from 'lodash.set';
|
|
4
|
+
import { isNil } from '../../../utils/lodash';
|
|
3
5
|
export const checkIsNewData = (props) => {
|
|
4
6
|
var _a, _b;
|
|
5
7
|
return (Object.keys((_a = props.dataSource) !== null && _a !== void 0 ? _a : {}).length === 0 &&
|
|
@@ -55,12 +57,17 @@ export function transform(chartType, dataInput, chartInput) {
|
|
|
55
57
|
}
|
|
56
58
|
return true;
|
|
57
59
|
});
|
|
58
|
-
const
|
|
60
|
+
const formatter = ({ value, percent }) => {
|
|
59
61
|
let val = Number(value);
|
|
62
|
+
let result = '';
|
|
60
63
|
if (chartInput.isUnit) {
|
|
61
64
|
val = val / chartInput.unit;
|
|
62
65
|
}
|
|
63
|
-
|
|
66
|
+
result = `${val.toFixed(chartInput.decimalDigits)}${chartInput.suffix}`;
|
|
67
|
+
if (chartInput.isPercent && !isNil(percent)) {
|
|
68
|
+
result = `${result}(${percent}%)`;
|
|
69
|
+
}
|
|
70
|
+
return result;
|
|
64
71
|
};
|
|
65
72
|
const series = [];
|
|
66
73
|
const groups = [];
|
|
@@ -105,8 +112,8 @@ export function transform(chartType, dataInput, chartInput) {
|
|
|
105
112
|
]
|
|
106
113
|
: [eachYaxis.Value],
|
|
107
114
|
};
|
|
108
|
-
if (chartInput.isUnit) {
|
|
109
|
-
series[idx].label.formatter =
|
|
115
|
+
if (chartInput.isUnit || chartInput.isPercent) {
|
|
116
|
+
series[idx].label.formatter = formatter;
|
|
110
117
|
}
|
|
111
118
|
}
|
|
112
119
|
else {
|
|
@@ -121,10 +128,7 @@ export function transform(chartType, dataInput, chartInput) {
|
|
|
121
128
|
}
|
|
122
129
|
}
|
|
123
130
|
if (chartType === 'pie') {
|
|
124
|
-
|
|
125
|
-
series[idx].label['normal'] = {
|
|
126
|
-
position: 'inner',
|
|
127
|
-
};
|
|
131
|
+
lodashSet(series[idx], 'label.position', 'inner');
|
|
128
132
|
if (chartInput.chartType === 'pie') {
|
|
129
133
|
series[idx]['radius'] = '70%';
|
|
130
134
|
}
|
|
@@ -221,7 +225,7 @@ export function transform(chartType, dataInput, chartInput) {
|
|
|
221
225
|
return (_a = item.XLabel.Value) !== null && _a !== void 0 ? _a : null;
|
|
222
226
|
});
|
|
223
227
|
if (chartInput.isUnit) {
|
|
224
|
-
yAxis.axisLabel.formatter =
|
|
228
|
+
yAxis.axisLabel.formatter = (value) => formatter({ value });
|
|
225
229
|
}
|
|
226
230
|
if (chartInput.directionType === 'crosswise') {
|
|
227
231
|
return {
|
|
@@ -4,7 +4,7 @@ import EChartLine from '../common/core/eChartLine';
|
|
|
4
4
|
import classNames from '../../../utils/classnames';
|
|
5
5
|
import { useWedaChart } from '../common/useChart';
|
|
6
6
|
export default function Line(opts) {
|
|
7
|
-
const { id, style, className, chartType, isTitle, title, titleLocation, dataSource, filterData, xField, xStatistics, xIsCountEmpty, yField, groupKey, groupKeyTimeSpan, isLegend, legend, legend2, isXaxisName, xAxisName, isXaxisAxisLabelShow, isXaxisAxisTickShow, isXaxisAxisLabelRotate, isYAxisSplitlineLinestyleWidth, yAxisSplitlineLinestyleType, yAxisMax, yAxisMin, isYAxisName, yAxisName, isSeriesShowSymbol, isYAxisShow, isUnit, unit, decimalDigits, suffix, } = opts;
|
|
7
|
+
const { id, style, className, chartType, isTitle, title, titleLocation, dataSource, setColor, filterData, xField, xStatistics, xIsCountEmpty, yField, groupKey, groupKeyTimeSpan, isLegend, legend, legend2, isXaxisName, xAxisName, isXaxisAxisLabelShow, isXaxisAxisTickShow, isXaxisAxisLabelRotate, isYAxisSplitlineLinestyleWidth, yAxisSplitlineLinestyleType, yAxisMax, yAxisMin, isYAxisName, yAxisName, isSeriesShowSymbol, isYAxisShow, isUnit, unit, decimalDigits, suffix, } = opts;
|
|
8
8
|
const domRef = useRef();
|
|
9
9
|
useWedaChart(domRef, EChartLine, {
|
|
10
10
|
chartType,
|
|
@@ -12,6 +12,7 @@ export default function Line(opts) {
|
|
|
12
12
|
title,
|
|
13
13
|
titleLocation,
|
|
14
14
|
dataSource,
|
|
15
|
+
setColor,
|
|
15
16
|
filterData,
|
|
16
17
|
xField,
|
|
17
18
|
xStatistics,
|
|
@@ -5,15 +5,15 @@ import { isInIde } from './utils';
|
|
|
5
5
|
* @description 基于callWedaApi 封装,主要是处理出入参大小写,以及预览数据
|
|
6
6
|
*/
|
|
7
7
|
export async function flowRequest(params, config) {
|
|
8
|
-
const { previewData, upperCaseData = true, upperCaseIgnoreKeys, } = config || {};
|
|
8
|
+
const { previewData, upperCaseData = true, upperCaseIgnoreKeys, lowerCaseResult = true, } = config || {};
|
|
9
9
|
if (isInIde()) {
|
|
10
|
-
return toTransKeyCase(previewData || {}, 'toLowerCase');
|
|
10
|
+
return toTransKeyCase(previewData || {}, lowerCaseResult ? 'toLowerCase' : 'toUpperCase');
|
|
11
11
|
}
|
|
12
12
|
const result = await callWedaApi({
|
|
13
13
|
...params,
|
|
14
14
|
data: toTransKeyCase(params.data, upperCaseData ? 'toUpperCase' : 'toLowerCase', upperCaseIgnoreKeys),
|
|
15
15
|
});
|
|
16
|
-
return toTransKeyCase(result, 'toLowerCase');
|
|
16
|
+
return toTransKeyCase(result, lowerCaseResult ? 'toLowerCase' : 'toUpperCase');
|
|
17
17
|
}
|
|
18
18
|
/** 转换具体参数的首字母大小写 */
|
|
19
19
|
function toTransKeyCase(target, method, ignoreKeyValues) {
|
|
@@ -1,10 +1,49 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { message } from 'tea-component';
|
|
4
|
+
import { useFlowConfig, WedaFlowContainer, flowRequest, } from '../../common';
|
|
5
|
+
import FlowGraph from '../../../flow-graph';
|
|
6
|
+
import { processCanvasInfoPreviewData } from './preview-data';
|
|
4
7
|
export default function ModelFlowChart(props) {
|
|
5
8
|
const flowConfig = useFlowConfig({
|
|
6
9
|
moduleName: 'flow-chart',
|
|
7
10
|
wedaPlatformProps: props,
|
|
8
11
|
});
|
|
9
|
-
return (_jsx(WedaFlowContainer, { wedaPlatformProps: props, ref: flowConfig.elementRef, children: _jsx(
|
|
12
|
+
return (_jsx(WedaFlowContainer, { wedaPlatformProps: props, ref: flowConfig.elementRef, children: _jsx(FlowChart, { ...flowConfig, wedaPlatformProps: props }) }));
|
|
10
13
|
}
|
|
14
|
+
const FlowChart = (props) => {
|
|
15
|
+
const { processInstance } = props;
|
|
16
|
+
const [canvasInfo, setCanvasInfo] = useState({
|
|
17
|
+
Nodes: [],
|
|
18
|
+
Edges: [],
|
|
19
|
+
});
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
(async () => {
|
|
22
|
+
if (processInstance.instanceId) {
|
|
23
|
+
const result = await getProcessCanvasInfo({
|
|
24
|
+
flowCode: processInstance.flowCode,
|
|
25
|
+
instanceId: processInstance.instanceId,
|
|
26
|
+
appVersion: processInstance.flowVersion,
|
|
27
|
+
});
|
|
28
|
+
setCanvasInfo(result);
|
|
29
|
+
}
|
|
30
|
+
})();
|
|
31
|
+
}, [processInstance]);
|
|
32
|
+
/**
|
|
33
|
+
* 获取流程实例运行图
|
|
34
|
+
*/
|
|
35
|
+
async function getProcessCanvasInfo(data) {
|
|
36
|
+
try {
|
|
37
|
+
const result = await flowRequest({
|
|
38
|
+
data,
|
|
39
|
+
action: 'GetProcessCanvasInfo',
|
|
40
|
+
}, { lowerCaseResult: false, previewData: processCanvasInfoPreviewData });
|
|
41
|
+
return result;
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
message.error({ content: '获取流程实例运行数据失败' });
|
|
45
|
+
return {};
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return _jsx(FlowGraph, { processCanvasInfo: canvasInfo });
|
|
49
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
export const processCanvasInfoPreviewData = {
|
|
2
|
+
Nodes: [
|
|
3
|
+
{
|
|
4
|
+
visited: true,
|
|
5
|
+
Id: 2,
|
|
6
|
+
ElementId: 'approvalNode1656317642548',
|
|
7
|
+
Name: '经理审批',
|
|
8
|
+
DataType: 17,
|
|
9
|
+
Status: 1,
|
|
10
|
+
Conf: [
|
|
11
|
+
{
|
|
12
|
+
Name: '张三',
|
|
13
|
+
Status: 2,
|
|
14
|
+
OpTime: 1656502417000,
|
|
15
|
+
Comment: '',
|
|
16
|
+
AttachmentInfo: '[]',
|
|
17
|
+
NewProcessors: 'true',
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
visited: true,
|
|
23
|
+
Id: 3,
|
|
24
|
+
ElementId: 'approvalNode1656317679079',
|
|
25
|
+
Name: '总监审批',
|
|
26
|
+
DataType: 17,
|
|
27
|
+
Status: 3,
|
|
28
|
+
Conf: [
|
|
29
|
+
{ Name: '王五', Status: 0, OpTime: 0 },
|
|
30
|
+
{ Name: '李四', Status: 0, OpTime: 0 },
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
visited: true,
|
|
35
|
+
Id: 4,
|
|
36
|
+
ElementId: 'approvalNode1656317682440',
|
|
37
|
+
Name: '人事审批',
|
|
38
|
+
DataType: 17,
|
|
39
|
+
Status: 2,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
visited: true,
|
|
43
|
+
Id: 1,
|
|
44
|
+
ElementId: 'startNode',
|
|
45
|
+
Name: '开始',
|
|
46
|
+
DataType: 1,
|
|
47
|
+
Status: 1,
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
visited: true,
|
|
51
|
+
Id: 5,
|
|
52
|
+
ElementId: 'endNode',
|
|
53
|
+
Name: '结束',
|
|
54
|
+
DataType: 13,
|
|
55
|
+
Status: 2,
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
Edges: [
|
|
59
|
+
{
|
|
60
|
+
Label: '同意',
|
|
61
|
+
Type: 2,
|
|
62
|
+
Source: 'approvalNode1656317679079',
|
|
63
|
+
Target: 'approvalNode1656317682440',
|
|
64
|
+
Status: 2,
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
Label: '同意c',
|
|
68
|
+
Type: 2,
|
|
69
|
+
Source: 'approvalNode1656317682440',
|
|
70
|
+
Target: 'endNode',
|
|
71
|
+
Status: 2,
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
Label: '同意',
|
|
75
|
+
Type: 2,
|
|
76
|
+
Source: 'approvalNode1656317642548',
|
|
77
|
+
Target: 'approvalNode1656317679079',
|
|
78
|
+
Status: 2,
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
Label: '',
|
|
82
|
+
Type: 2,
|
|
83
|
+
Source: 'startNode',
|
|
84
|
+
Target: 'approvalNode1656317642548',
|
|
85
|
+
Status: 2,
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export const STATUS_COLOR_MAP = {
|
|
2
|
+
1: {
|
|
3
|
+
bgColor: 'rgba(10,191,91,0.10)',
|
|
4
|
+
lineColor: '#0ABF5B',
|
|
5
|
+
},
|
|
6
|
+
2: {
|
|
7
|
+
bgColor: 'rgba(153,153,153,0.10)',
|
|
8
|
+
lineColor: '#999999',
|
|
9
|
+
},
|
|
10
|
+
3: {
|
|
11
|
+
bgColor: 'rgba(0,110,255,0.20)',
|
|
12
|
+
lineColor: '#2473F2',
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
export const APPROVE_MAP = {
|
|
16
|
+
0: { txt: '待审批', color: '#F88000' },
|
|
17
|
+
1: { txt: '提交', color: '#09BF5B' },
|
|
18
|
+
2: { txt: '同意', color: '#09BF5B' },
|
|
19
|
+
3: { txt: '拒绝', color: '#E02020' },
|
|
20
|
+
4: { txt: '转办', color: '#333333' },
|
|
21
|
+
5: { txt: '撤销', color: '#333333' },
|
|
22
|
+
6: { txt: '回退', color: '#333333' },
|
|
23
|
+
7: { txt: '加签', color: '#333333' },
|
|
24
|
+
8: { txt: '终止', color: '#333333' },
|
|
25
|
+
9: { txt: '跳过', color: '#333333' },
|
|
26
|
+
10: { txt: '待处理', color: '#F88000' },
|
|
27
|
+
13: { txt: '已处理', color: '#09BF5B' },
|
|
28
|
+
};
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState, useRef } from 'react';
|
|
3
|
+
import ReactDOM from 'react-dom';
|
|
4
|
+
import G6 from '@antv/g6';
|
|
5
|
+
import { Status, Modal, Button, ConfigProvider } from 'tea-component';
|
|
6
|
+
import moment from 'moment';
|
|
7
|
+
import { getUuid } from '../../utils/tool';
|
|
8
|
+
import { STATUS_COLOR_MAP, APPROVE_MAP } from './constants';
|
|
9
|
+
import './style.css';
|
|
10
|
+
/** 流程图组件 */
|
|
11
|
+
export const FlowGraph = (props) => {
|
|
12
|
+
const { processCanvasInfo, ...restProps } = props;
|
|
13
|
+
const containerIdRef = useRef(getUuid());
|
|
14
|
+
// 节点审批详情弹窗显示状态
|
|
15
|
+
const [modalVisible, setModalVisible] = useState(false);
|
|
16
|
+
// 节点审批详情弹窗显示数据
|
|
17
|
+
const [modalData, setModalData] = useState({
|
|
18
|
+
nodeName: '',
|
|
19
|
+
confData: null,
|
|
20
|
+
});
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
var _a;
|
|
23
|
+
if (((_a = processCanvasInfo === null || processCanvasInfo === void 0 ? void 0 : processCanvasInfo.Nodes) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
24
|
+
renderGraph({
|
|
25
|
+
data: processCanvasInfo,
|
|
26
|
+
containerIdRef,
|
|
27
|
+
setModalData,
|
|
28
|
+
onOpenModal,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}, [processCanvasInfo]);
|
|
32
|
+
const onOpenModal = () => setModalVisible(true);
|
|
33
|
+
const onCloseModal = () => setModalVisible(false);
|
|
34
|
+
// antv注册节点
|
|
35
|
+
registerNode();
|
|
36
|
+
return (_jsx(ConfigProvider, { classPrefix: "wedatea2td", children: _jsx("div", { ...restProps, children: _jsxs("div", { id: containerIdRef.current, children: [renderStatus(!processCanvasInfo), renderTooltipContentModal({
|
|
37
|
+
modalData,
|
|
38
|
+
visible: modalVisible,
|
|
39
|
+
onClose: onCloseModal,
|
|
40
|
+
})] }) }) }));
|
|
41
|
+
};
|
|
42
|
+
// 渲染当前状态
|
|
43
|
+
const renderStatus = (isEmpty) => {
|
|
44
|
+
if (isEmpty) {
|
|
45
|
+
return _jsx(Status, { icon: "blank", size: "l", title: "\u6682\u65E0\u6D41\u8F6C\u8282\u70B9" });
|
|
46
|
+
}
|
|
47
|
+
return null;
|
|
48
|
+
};
|
|
49
|
+
// 渲染图示内容
|
|
50
|
+
const renderGraph = (config) => {
|
|
51
|
+
const { data, containerIdRef, onOpenModal, setModalData } = config;
|
|
52
|
+
const container = document.getElementById(containerIdRef.current);
|
|
53
|
+
if (!container)
|
|
54
|
+
return;
|
|
55
|
+
const width = container.scrollWidth;
|
|
56
|
+
const height = document.documentElement.clientHeight;
|
|
57
|
+
const tooltip = new G6.Tooltip({
|
|
58
|
+
offsetX: 60,
|
|
59
|
+
offsetY: -20,
|
|
60
|
+
trigger: 'click',
|
|
61
|
+
itemTypes: ['node'],
|
|
62
|
+
getContent: (e) => {
|
|
63
|
+
return renderTooltipContent(e, onOpenModal, setModalData);
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
const graphData = getGraphData(data);
|
|
67
|
+
const graph = new G6.Graph({
|
|
68
|
+
container: containerIdRef.current,
|
|
69
|
+
width,
|
|
70
|
+
height: height - 300,
|
|
71
|
+
fitView: true,
|
|
72
|
+
fitViewPadding: [20, 40, 50, 20],
|
|
73
|
+
layout: {
|
|
74
|
+
type: 'dagre',
|
|
75
|
+
ranksep: 30,
|
|
76
|
+
controlPoints: true,
|
|
77
|
+
},
|
|
78
|
+
defaultNode: {
|
|
79
|
+
type: 'sql',
|
|
80
|
+
},
|
|
81
|
+
plugins: [tooltip],
|
|
82
|
+
defaultEdge: {
|
|
83
|
+
type: 'polyline',
|
|
84
|
+
style: {
|
|
85
|
+
endArrow: true,
|
|
86
|
+
lineWidth: 2,
|
|
87
|
+
stroke: '#C2C8D5',
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
nodeStateStyles: {
|
|
91
|
+
selected: {
|
|
92
|
+
stroke: '#000',
|
|
93
|
+
fill: '#5394ef',
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
modes: {
|
|
97
|
+
default: ['drag-canvas', 'zoom-canvas'],
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
graph.data(graphData);
|
|
101
|
+
graph.render();
|
|
102
|
+
if (typeof window !== 'undefined') {
|
|
103
|
+
window.onresize = () => {
|
|
104
|
+
if (!graph || graph.get('destroyed'))
|
|
105
|
+
return;
|
|
106
|
+
if (!container || !container.scrollWidth || !container.scrollHeight)
|
|
107
|
+
return;
|
|
108
|
+
graph.changeSize(container.scrollWidth, container.scrollHeight);
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
// 渲染提示内容
|
|
113
|
+
const renderTooltipContent = (e, onOpenModal, setModalData) => {
|
|
114
|
+
var _a;
|
|
115
|
+
const outDiv = document.createElement('div');
|
|
116
|
+
outDiv.style.width = 'auto';
|
|
117
|
+
const modelData = e.item.getModel();
|
|
118
|
+
const dataSource = modelData === null || modelData === void 0 ? void 0 : modelData.dataSource;
|
|
119
|
+
let vDomContent = null;
|
|
120
|
+
if ((_a = dataSource === null || dataSource === void 0 ? void 0 : dataSource.Conf) === null || _a === void 0 ? void 0 : _a.length) {
|
|
121
|
+
const contentHtml = dataSource === null || dataSource === void 0 ? void 0 : dataSource.Conf.map((info, index) => {
|
|
122
|
+
// 区分处理节点和审批节点的 待审批/待处理 文案
|
|
123
|
+
if (modelData.dataType === 23 && info.Status === 0) {
|
|
124
|
+
info.Status = 10;
|
|
125
|
+
}
|
|
126
|
+
return (_jsxs("li", { className: "weda-flow-graph-info-item", onClick: () => {
|
|
127
|
+
onOpenModal();
|
|
128
|
+
setModalData({
|
|
129
|
+
nodeName: dataSource === null || dataSource === void 0 ? void 0 : dataSource.Name,
|
|
130
|
+
confData: info,
|
|
131
|
+
});
|
|
132
|
+
}, children: [_jsxs("div", { className: "first-line", children: [_jsx("i", { className: info.Status ? 'tootip-will_do' : '' }), _jsx("span", { className: "tootip-name", children: info.Name }), _jsx("span", { style: {
|
|
133
|
+
color: APPROVE_MAP[info.Status ? info.Status : 0].color,
|
|
134
|
+
paddingLeft: '8px',
|
|
135
|
+
}, children: APPROVE_MAP[info.Status ? info.Status : 0].txt })] }), info.Status && info.OpTime ? (_jsx("p", { className: "tooltip-time", children: moment(info.OpTime).format('YYYY-MM-DD HH:mm:ss') })) : null] }, `conf-${index}`));
|
|
136
|
+
});
|
|
137
|
+
vDomContent = (_jsxs("div", { className: "weda-flow-graph-info", children: [_jsx("h4", { children: "\u8282\u70B9\u5BA1\u6279\u4FE1\u606F" }), _jsx("ul", { className: "weda-flow-graph-info-content", children: contentHtml })] }));
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
vDomContent = _jsx("p", { children: "\u6682\u65E0\u4FE1\u606F" });
|
|
141
|
+
}
|
|
142
|
+
ReactDOM.render(vDomContent, outDiv);
|
|
143
|
+
return outDiv;
|
|
144
|
+
};
|
|
145
|
+
// 渲染提示内容弹窗
|
|
146
|
+
const renderTooltipContentModal = (config) => {
|
|
147
|
+
var _a, _b;
|
|
148
|
+
const { visible, onClose, modalData: { nodeName, confData }, } = config;
|
|
149
|
+
const showData = [
|
|
150
|
+
{
|
|
151
|
+
label: '审批节点',
|
|
152
|
+
content: nodeName,
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
label: '审批人',
|
|
156
|
+
content: confData === null || confData === void 0 ? void 0 : confData.Name,
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
label: '审批操作',
|
|
160
|
+
content: (_jsx("span", { style: {
|
|
161
|
+
color: (_a = APPROVE_MAP === null || APPROVE_MAP === void 0 ? void 0 : APPROVE_MAP[confData === null || confData === void 0 ? void 0 : confData.Status]) === null || _a === void 0 ? void 0 : _a.color,
|
|
162
|
+
}, children: (_b = APPROVE_MAP === null || APPROVE_MAP === void 0 ? void 0 : APPROVE_MAP[confData === null || confData === void 0 ? void 0 : confData.Status]) === null || _b === void 0 ? void 0 : _b.txt })),
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
label: '操作时间',
|
|
166
|
+
content: (confData === null || confData === void 0 ? void 0 : confData.OpTime)
|
|
167
|
+
? moment(confData === null || confData === void 0 ? void 0 : confData.OpTime).format('YYYY-MM-DD HH:mm:ss')
|
|
168
|
+
: undefined,
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
label: '审批意见',
|
|
172
|
+
content: confData === null || confData === void 0 ? void 0 : confData.Comment,
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
label: '操作详情',
|
|
176
|
+
content: confData === null || confData === void 0 ? void 0 : confData.NewProcessors,
|
|
177
|
+
},
|
|
178
|
+
];
|
|
179
|
+
if (!visible)
|
|
180
|
+
return null;
|
|
181
|
+
return (_jsxs(Modal, { visible: true, caption: '审批详情', onClose: onClose, className: "weda-flow-graph-info-modal", destroyOnClose: true, children: [_jsx(Modal.Body, { children: _jsx("div", { className: "weda-flow-graph-info-modal_content", children: showData
|
|
182
|
+
.filter(({ content }) => content)
|
|
183
|
+
.map(({ label, content }, index) => (_jsxs("div", { children: [_jsx("span", { className: "weda-flow-graph-info-modal_content-label", children: label }), _jsx("span", { className: "weda-flow-graph-info-modal_content-content", children: content })] }, index))) }) }), _jsx(Modal.Footer, { children: _jsx(Button, { type: "weak", onClick: onClose, children: "\u5173\u95ED" }) })] }));
|
|
184
|
+
};
|
|
185
|
+
// 获取图示数据
|
|
186
|
+
const getGraphData = (data) => {
|
|
187
|
+
var _a;
|
|
188
|
+
const graphNodes = data.Nodes.map((node) => {
|
|
189
|
+
const { ElementId, Status } = node;
|
|
190
|
+
const graphNode = {
|
|
191
|
+
style: {
|
|
192
|
+
lineWidth: 3,
|
|
193
|
+
stroke: STATUS_COLOR_MAP[node.Status].lineColor,
|
|
194
|
+
fill: STATUS_COLOR_MAP[node.Status].bgColor,
|
|
195
|
+
},
|
|
196
|
+
id: `${node.ElementId}`,
|
|
197
|
+
label: node.Name,
|
|
198
|
+
labelCfg: {
|
|
199
|
+
style: {
|
|
200
|
+
fontSize: 14,
|
|
201
|
+
fill: '#00287E',
|
|
202
|
+
fontWeight: 'bold',
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
dataSource: node,
|
|
206
|
+
};
|
|
207
|
+
if ((ElementId === null || ElementId === void 0 ? void 0 : ElementId.startsWith('startNode')) || (ElementId === null || ElementId === void 0 ? void 0 : ElementId.startsWith('end'))) {
|
|
208
|
+
graphNode.type = 'circle';
|
|
209
|
+
graphNode.size = 80;
|
|
210
|
+
if (Status === 3) {
|
|
211
|
+
graphNode.style.lineDash = [5];
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
if (ElementId.startsWith('exclusiveGateway')) {
|
|
215
|
+
graphNode.type = 'diamond';
|
|
216
|
+
graphNode.size = [160, 80];
|
|
217
|
+
graphNode.anchorPoints = [
|
|
218
|
+
[0.5, 0],
|
|
219
|
+
[0, 0.5],
|
|
220
|
+
[0.5, 1],
|
|
221
|
+
[1, 0.5],
|
|
222
|
+
];
|
|
223
|
+
}
|
|
224
|
+
return graphNode;
|
|
225
|
+
});
|
|
226
|
+
const graphEdges = (_a = data.Edges) === null || _a === void 0 ? void 0 : _a.map((edge) => {
|
|
227
|
+
const graphEdge = {
|
|
228
|
+
source: edge.Source,
|
|
229
|
+
target: edge.Target,
|
|
230
|
+
label: edge.Label,
|
|
231
|
+
};
|
|
232
|
+
if (edge.Status === 1) {
|
|
233
|
+
graphEdge.style = {
|
|
234
|
+
stroke: '#0ABF5B',
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
return graphEdge;
|
|
238
|
+
});
|
|
239
|
+
return {
|
|
240
|
+
nodes: graphNodes,
|
|
241
|
+
edges: graphEdges,
|
|
242
|
+
};
|
|
243
|
+
};
|
|
244
|
+
// 注册节点
|
|
245
|
+
const registerNode = () => {
|
|
246
|
+
G6.registerNode('sql', {
|
|
247
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
248
|
+
drawShape(cfg, group) {
|
|
249
|
+
var _a, _b;
|
|
250
|
+
const rect = group.addShape('rect', {
|
|
251
|
+
attrs: {
|
|
252
|
+
x: -75,
|
|
253
|
+
y: -25,
|
|
254
|
+
width: 150,
|
|
255
|
+
height: 50,
|
|
256
|
+
radius: 10,
|
|
257
|
+
stroke: (_a = STATUS_COLOR_MAP === null || STATUS_COLOR_MAP === void 0 ? void 0 : STATUS_COLOR_MAP[cfg === null || cfg === void 0 ? void 0 : cfg.dataSource.Status]) === null || _a === void 0 ? void 0 : _a.lineColor,
|
|
258
|
+
fill: (_b = STATUS_COLOR_MAP === null || STATUS_COLOR_MAP === void 0 ? void 0 : STATUS_COLOR_MAP[cfg === null || cfg === void 0 ? void 0 : cfg.dataSource.Status]) === null || _b === void 0 ? void 0 : _b.bgColor,
|
|
259
|
+
lineWidth: 3,
|
|
260
|
+
lineDash: (cfg === null || cfg === void 0 ? void 0 : cfg.dataSource.Status) === 3 ? [5] : undefined,
|
|
261
|
+
},
|
|
262
|
+
name: cfg === null || cfg === void 0 ? void 0 : cfg.dataSource.Name,
|
|
263
|
+
});
|
|
264
|
+
return rect;
|
|
265
|
+
},
|
|
266
|
+
}, 'single-node');
|
|
267
|
+
};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
.weda-flow-graph-info {
|
|
2
|
+
padding: 2px 4px;
|
|
3
|
+
}
|
|
4
|
+
.weda-flow-graph-info h4 {
|
|
5
|
+
margin-bottom: 4px;
|
|
6
|
+
font-size: 14px;
|
|
7
|
+
border-bottom: 1px solid #eee;
|
|
8
|
+
color: #000;
|
|
9
|
+
}
|
|
10
|
+
.weda-flow-graph-info .weda-flow-graph-info-content {
|
|
11
|
+
max-height: 160px;
|
|
12
|
+
overflow: auto;
|
|
13
|
+
}
|
|
14
|
+
.weda-flow-graph-info .weda-flow-graph-info-content .weda-flow-graph-info-item {
|
|
15
|
+
padding: 8px 0;
|
|
16
|
+
border-bottom: 1px solid #e5e8ed;
|
|
17
|
+
cursor: pointer;
|
|
18
|
+
}
|
|
19
|
+
.weda-flow-graph-info
|
|
20
|
+
.weda-flow-graph-info-content
|
|
21
|
+
.weda-flow-graph-info-item
|
|
22
|
+
.first-line {
|
|
23
|
+
height: 20px;
|
|
24
|
+
display: flex;
|
|
25
|
+
justify-content: flex-start nowrap;
|
|
26
|
+
align-items: center;
|
|
27
|
+
}
|
|
28
|
+
.weda-flow-graph-info
|
|
29
|
+
.weda-flow-graph-info-content
|
|
30
|
+
.weda-flow-graph-info-item
|
|
31
|
+
.first-line
|
|
32
|
+
i {
|
|
33
|
+
width: 16px;
|
|
34
|
+
height: 16px;
|
|
35
|
+
position: relative;
|
|
36
|
+
border-radius: 50%;
|
|
37
|
+
background: rgba(36, 115, 242, 0.15);
|
|
38
|
+
}
|
|
39
|
+
.weda-flow-graph-info
|
|
40
|
+
.weda-flow-graph-info-content
|
|
41
|
+
.weda-flow-graph-info-item
|
|
42
|
+
.first-line
|
|
43
|
+
i.tooltip-will_do {
|
|
44
|
+
background: rgba(162, 172, 189, 0.15);
|
|
45
|
+
}
|
|
46
|
+
.weda-flow-graph-info
|
|
47
|
+
.weda-flow-graph-info-content
|
|
48
|
+
.weda-flow-graph-info-item
|
|
49
|
+
.first-line
|
|
50
|
+
i.tooltip-will_do:after {
|
|
51
|
+
background: #a2acbd;
|
|
52
|
+
}
|
|
53
|
+
.weda-flow-graph-info
|
|
54
|
+
.weda-flow-graph-info-content
|
|
55
|
+
.weda-flow-graph-info-item
|
|
56
|
+
.first-line
|
|
57
|
+
i:after {
|
|
58
|
+
content: '';
|
|
59
|
+
position: absolute;
|
|
60
|
+
top: 4px;
|
|
61
|
+
left: 4px;
|
|
62
|
+
width: 8px;
|
|
63
|
+
height: 8px;
|
|
64
|
+
background-color: var(--co-common-main-color);
|
|
65
|
+
border-radius: 50%;
|
|
66
|
+
}
|
|
67
|
+
.weda-flow-graph-info
|
|
68
|
+
.weda-flow-graph-info-content
|
|
69
|
+
.weda-flow-graph-info-item
|
|
70
|
+
.first-line
|
|
71
|
+
.tootip-name {
|
|
72
|
+
padding-left: 8px;
|
|
73
|
+
}
|
|
74
|
+
.weda-flow-graph-info
|
|
75
|
+
.weda-flow-graph-info-content
|
|
76
|
+
.weda-flow-graph-info-item
|
|
77
|
+
.tooltip-time {
|
|
78
|
+
padding-left: 24px;
|
|
79
|
+
color: #999;
|
|
80
|
+
font-size: 12px;
|
|
81
|
+
height: 18px;
|
|
82
|
+
line-height: 18px;
|
|
83
|
+
}
|
|
84
|
+
.weda-flow-graph-info-modal_content > div {
|
|
85
|
+
display: flex;
|
|
86
|
+
margin-bottom: 8px;
|
|
87
|
+
}
|
|
88
|
+
.weda-flow-graph-info-modal_content
|
|
89
|
+
> div
|
|
90
|
+
.weda-flow-graph-info-modal_content-label {
|
|
91
|
+
min-width: 60px;
|
|
92
|
+
margin-right: 28px;
|
|
93
|
+
color: #999;
|
|
94
|
+
}
|
|
95
|
+
.weda-flow-graph-info-modal_content
|
|
96
|
+
> div
|
|
97
|
+
.weda-flow-graph-info-modal_content-content {
|
|
98
|
+
color: #333;
|
|
99
|
+
}
|
|
100
|
+
.weda-flow-graph-info-modal_content
|
|
101
|
+
> div
|
|
102
|
+
.weda-flow-graph-info-modal_content_link
|
|
103
|
+
> button {
|
|
104
|
+
display: block;
|
|
105
|
+
}
|
|
106
|
+
.weda-flow-graph-info-modal .tea-dialog__body {
|
|
107
|
+
max-height: 200px;
|
|
108
|
+
overflow: auto;
|
|
109
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -96,7 +96,10 @@ export function PureSelect({ params, selectedValue, updateValue, placeholder, si
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
else {
|
|
99
|
-
setOptions((
|
|
99
|
+
setOptions((oldOptions) => {
|
|
100
|
+
const newOptions = value.option.filter((item) => oldOptions.findIndex((i) => i.value === item.value) < 0);
|
|
101
|
+
return oldOptions.concat(newOptions);
|
|
102
|
+
});
|
|
100
103
|
if (pageNo === 1 && value.option.length === 0) {
|
|
101
104
|
setStatus(Status.EMPTY);
|
|
102
105
|
}
|