aldehyde 0.0.1
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/LICENSE +201 -0
- package/README.md +1 -0
- package/dist/163.js +2 -0
- package/dist/163.js.LICENSE.txt +43 -0
- package/dist/41.js +1 -0
- package/dist/aldehyde.js +2 -0
- package/dist/aldehyde.js.LICENSE.txt +122 -0
- package/dist/chemstruc-graph.js +1 -0
- package/dist/css/163-24392163d3c7b54ea806.css +11 -0
- package/dist/css/290-5e8e152675ab7d201c00.css +886 -0
- package/dist/css/chemstruc-graph-87868f791bf92fb80db9.css +29 -0
- package/dist/css/main-2e6725ec1b56da516cee.css +256 -0
- package/dist/html-editor-draft.js +2 -0
- package/dist/html-editor-draft.js.LICENSE.txt +5 -0
- package/dist/images/logo-06f6a5d8.png +0 -0
- package/dist/index.html +4 -0
- package/dist/signature.js +2 -0
- package/dist/signature.js.LICENSE.txt +17 -0
- package/package.json +180 -0
- package/src/components/chart/antd/Chart.js +32 -0
- package/src/components/chart/antd/Chart10000.js +90 -0
- package/src/components/chart/antd/Max2DimLineChart.js +128 -0
- package/src/components/chart/antd/PieChart1.js +54 -0
- package/src/components/chart/antd/PieChart2.js +56 -0
- package/src/components/chart/antd/chart-utils.tsx +50 -0
- package/src/components/chart/antd/column-chart-sub.tsx +67 -0
- package/src/components/chart/antd/line-chart-sub.tsx +65 -0
- package/src/components/chart/antd/pie-chart-sub.tsx +54 -0
- package/src/components/chart/antd/statview-d2-chart.tsx +125 -0
- package/src/components/chart/statview-l2-chart.tsx +69 -0
- package/src/components/controls/action/index.css +9 -0
- package/src/components/controls/action/index.tsx +228 -0
- package/src/components/controls/action/utils.tsx +122 -0
- package/src/components/controls/auto-complete/index.tsx +80 -0
- package/src/components/controls/cascader/index.js +97 -0
- package/src/components/controls/chemstruc/graph.tsx +150 -0
- package/src/components/controls/chemstruc/index.css +28 -0
- package/src/components/controls/collapse-card/index.css +9 -0
- package/src/components/controls/collapse-card/index.tsx +59 -0
- package/src/components/controls/color-picker/index.css +27 -0
- package/src/components/controls/color-picker/index.tsx +88 -0
- package/src/components/controls/cquery/cquick-button.tsx +117 -0
- package/src/components/controls/date-picker/index.tsx +141 -0
- package/src/components/controls/entity-select/entity-select.tsx +277 -0
- package/src/components/controls/entity-select/index.css +6 -0
- package/src/components/controls/entity-select/popover-entity-select.tsx +112 -0
- package/src/components/controls/entry-control.tsx +240 -0
- package/src/components/controls/enum-badge/index.tsx +28 -0
- package/src/components/controls/enum-tag/index.tsx +30 -0
- package/src/components/controls/file-view/drawer-file-view.tsx +69 -0
- package/src/components/controls/file-view/index.tsx +145 -0
- package/src/components/controls/html-editor/draft.tsx +161 -0
- package/src/components/controls/html-editor/tinymce.js +55 -0
- package/src/components/controls/input-number/index.tsx +101 -0
- package/src/components/controls/input-range/index.tsx +48 -0
- package/src/components/controls/password-setter/index.css +3 -0
- package/src/components/controls/password-setter/index.js +70 -0
- package/src/components/controls/progress/index.tsx +61 -0
- package/src/components/controls/relation-existion/index.css +4 -0
- package/src/components/controls/relation-existion/index.tsx +108 -0
- package/src/components/controls/rfield/index.css +4 -0
- package/src/components/controls/rfield/index.tsx +161 -0
- package/src/components/controls/signature/index.tsx +162 -0
- package/src/components/controls/steps/index.tsx +58 -0
- package/src/components/controls/text/ellipsis-text.tsx +70 -0
- package/src/components/controls/upload/index.tsx +122 -0
- package/src/components/controls/view-control.tsx +177 -0
- package/src/components/detail/button/cquery-button-bar.tsx +112 -0
- package/src/components/detail/button/index.css +43 -0
- package/src/components/detail/button/submit-button-bar.tsx +151 -0
- package/src/components/detail/dtmpl.css +53 -0
- package/src/components/detail/edit/dtmpl-edit.tsx +218 -0
- package/src/components/detail/edit/fields-edit-card.tsx +103 -0
- package/src/components/detail/edit/modal-dtmpl-edit.tsx +198 -0
- package/src/components/detail/edit/modal-row-edit.tsx +72 -0
- package/src/components/detail/edit/post-result/index.tsx +52 -0
- package/src/components/detail/edit/row-edit-card.tsx +125 -0
- package/src/components/detail/edit/row-editor.tsx +71 -0
- package/src/components/detail/rightbar/index.css +35 -0
- package/src/components/detail/rightbar/index.tsx +76 -0
- package/src/components/detail/view/act-dtmpl-view.tsx +155 -0
- package/src/components/detail/view/dtmpl-view.tsx +143 -0
- package/src/components/detail/view/field-view-group.tsx +73 -0
- package/src/components/detail/view/modal-dtmpl-view.tsx +56 -0
- package/src/components/detail/view/snapshot-timeline.tsx +130 -0
- package/src/components/exportor/export-frame.css +3 -0
- package/src/components/exportor/export-frame.tsx +194 -0
- package/src/components/exportor/index.tsx +60 -0
- package/src/components/form/criteria-form.tsx +241 -0
- package/src/components/form/dtmpl-form.css +4 -0
- package/src/components/form/dtmpl-form.tsx +272 -0
- package/src/components/form/field-group-form.tsx +75 -0
- package/src/components/form/fields-form.tsx +51 -0
- package/src/components/form/form-Item-group.tsx +99 -0
- package/src/components/form/index.css +13 -0
- package/src/components/import/excel-import.tsx +316 -0
- package/src/components/import/index.css +54 -0
- package/src/components/import/template-builder.js +474 -0
- package/src/components/import/template.css +51 -0
- package/src/components/layout/MainPage.tsx +230 -0
- package/src/components/layout/footer/index.css +6 -0
- package/src/components/layout/footer/index.js +17 -0
- package/src/components/layout/header/index.css +86 -0
- package/src/components/layout/header/index.tsx +58 -0
- package/src/components/layout/menu/block.tsx +88 -0
- package/src/components/layout/menu/l2menu-message-bar.tsx +118 -0
- package/src/components/layout/menu/l2menu-quick-bar.tsx +132 -0
- package/src/components/layout/menu/menu-2layers.tsx +92 -0
- package/src/components/layout/menu/menu-render.tsx +49 -0
- package/src/components/layout/menu/reset-password.tsx +185 -0
- package/src/components/layout/menu/user-bar.tsx +97 -0
- package/src/components/layout/menu/userinfo-bar.tsx +70 -0
- package/src/components/layout/sidebar/index.css +26 -0
- package/src/components/layout/sidebar/index.tsx +38 -0
- package/src/components/login.js +137 -0
- package/src/components/module/criteria-page.tsx +175 -0
- package/src/components/module/dtmpl-page.tsx +70 -0
- package/src/components/module/ltmpl-page.tsx +181 -0
- package/src/components/routable/dtmpl-route.tsx +96 -0
- package/src/components/routable/import-route.tsx +28 -0
- package/src/components/routable/ltmpl-route.tsx +158 -0
- package/src/components/table/act-table.tsx +635 -0
- package/src/components/table/column/column-selector.tsx +79 -0
- package/src/components/table/column/index.css +14 -0
- package/src/components/table/index.css +45 -0
- package/src/components/table/l2-act-table.tsx +85 -0
- package/src/components/table/modal-select-table.tsx +248 -0
- package/src/components/table/pagination.css +15 -0
- package/src/components/table/pagination.tsx +72 -0
- package/src/components/table/query-table.tsx +331 -0
- package/src/components/table/relation-table.tsx +600 -0
- package/src/components/table/select-table.tsx +247 -0
- package/src/components/table/selected-rows-card.tsx +62 -0
- package/src/components/table/stat/restat.tsx +79 -0
- package/src/components/table/table-util.tsx +33 -0
- package/src/components/tmpl/control-type-supportor.tsx +97 -0
- package/src/components/tmpl/hc-data-source.tsx +230 -0
- package/src/components/tmpl/hcservice-v3.tsx +624 -0
- package/src/components/tmpl/interface.tsx +308 -0
- package/src/components/tmpl/superagent.js +93 -0
- package/src/components/tmpl/tmpl-config-analysis.tsx +111 -0
- package/src/components/units/EncryptUtils.js +38 -0
- package/src/components/units/image.d.ts +8 -0
- package/src/components/units/index.tsx +536 -0
- package/src/components/units/logo.png +0 -0
- package/src/components/units/storage.js +3 -0
- package/src/components/welcome/HCWelcome.js +232 -0
- package/src/components/welcome/index.css +13 -0
- package/src/components/welcome/logo.png +0 -0
- package/src/components/welcome/quick-entrance.tsx +77 -0
- package/src/components/welcome/workbench.tsx +76 -0
- package/src/index.js +4 -0
- package/src/style/common.css +79 -0
- package/src/style/coverstyle.css +49 -0
- package/src/style/transstyle.css +24 -0
- package/tsconfig.json +106 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React , { useRef } from "react";
|
|
2
|
+
import {Column} from '@ant-design/charts';
|
|
3
|
+
import {Plot,ColumnOptions} from '@antv/g2plot';
|
|
4
|
+
import {Space} from 'antd';
|
|
5
|
+
import {SubChartProps} from "../../tmpl/interface";
|
|
6
|
+
|
|
7
|
+
interface ColumnChartProps extends SubChartProps {
|
|
8
|
+
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const ColumnChart: React.FC<ColumnChartProps> = (paras) => {
|
|
12
|
+
|
|
13
|
+
// const ref = React.createRef<Plot<ColumnOptions>>();
|
|
14
|
+
const ref = useRef();
|
|
15
|
+
|
|
16
|
+
const downloadImage = () => {
|
|
17
|
+
if(ref.current){
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
ref.current.downloadImage()
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const config = {
|
|
24
|
+
data: paras.data,
|
|
25
|
+
height: 400,
|
|
26
|
+
xField: paras.config.xField,
|
|
27
|
+
yField: paras.config.yField,
|
|
28
|
+
point: {
|
|
29
|
+
size: 5,
|
|
30
|
+
shape: 'diamond',
|
|
31
|
+
},
|
|
32
|
+
xAxis: {
|
|
33
|
+
title: {
|
|
34
|
+
text: paras.config.xAxisTitle,
|
|
35
|
+
style: {fontSize: 14},
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
yAxis: {
|
|
39
|
+
title: {
|
|
40
|
+
text: paras.config.yAxisTitle,
|
|
41
|
+
style: {fontSize: 14},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
label: {
|
|
45
|
+
style: {
|
|
46
|
+
fill: '#aaa',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
return <div>
|
|
52
|
+
<Space direction="vertical" size={'middle'} style={{width: '100%'}}>
|
|
53
|
+
<button type="button" onClick={downloadImage} style={{marginRight: 24}}>
|
|
54
|
+
导出
|
|
55
|
+
</button>
|
|
56
|
+
<Column {...config} onReady={(plot) => {
|
|
57
|
+
// @ts-ignore
|
|
58
|
+
ref.current = plot;
|
|
59
|
+
}}/>
|
|
60
|
+
</Space>
|
|
61
|
+
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export default ColumnChart;
|
|
67
|
+
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import React, {useRef} from "react";
|
|
2
|
+
import {Line } from '@ant-design/charts';
|
|
3
|
+
import {Space} from 'antd';
|
|
4
|
+
import {SubChartProps} from "../../tmpl/interface";
|
|
5
|
+
|
|
6
|
+
interface LineChartProps extends SubChartProps {
|
|
7
|
+
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const LineChart: React.FC<LineChartProps> = (paras) => {
|
|
11
|
+
|
|
12
|
+
const ref = useRef();
|
|
13
|
+
|
|
14
|
+
const downloadImage = () => {
|
|
15
|
+
if (ref.current) {
|
|
16
|
+
// @ts-ignore
|
|
17
|
+
ref.current.downloadImage(paras.config.xAxisTitle+"_"+paras.config.yAxisTitle)
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const config = {
|
|
22
|
+
data: paras.data,
|
|
23
|
+
height: 400,
|
|
24
|
+
xField: paras.config.xField,
|
|
25
|
+
yField: paras.config.yField,
|
|
26
|
+
point: {
|
|
27
|
+
size: 5,
|
|
28
|
+
shape: 'diamond',
|
|
29
|
+
},
|
|
30
|
+
xAxis: {
|
|
31
|
+
title: {
|
|
32
|
+
text: paras.config.xAxisTitle,
|
|
33
|
+
style: { fontSize: 14 },
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
yAxis: {
|
|
37
|
+
title: {
|
|
38
|
+
text: paras.config.yAxisTitle,
|
|
39
|
+
style: { fontSize: 14 },
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
label: {
|
|
43
|
+
style: {
|
|
44
|
+
fill: '#aaa',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
return <div>
|
|
50
|
+
<Space direction="vertical" size={'middle'} style={{width:'100%'}}>
|
|
51
|
+
<button type="button" onClick={downloadImage} style={{marginRight: 24}}>
|
|
52
|
+
导出
|
|
53
|
+
</button>
|
|
54
|
+
<Line {...config} onReady={(plot) => {
|
|
55
|
+
// @ts-ignore
|
|
56
|
+
ref.current = plot;
|
|
57
|
+
}}/>
|
|
58
|
+
</Space>
|
|
59
|
+
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export default LineChart;
|
|
65
|
+
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React, {useRef} from "react";
|
|
2
|
+
import {Pie } from '@ant-design/charts';
|
|
3
|
+
import {Space} from 'antd';
|
|
4
|
+
import {SubChartProps} from "../../tmpl/interface";
|
|
5
|
+
|
|
6
|
+
interface PieChartProps extends SubChartProps {
|
|
7
|
+
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const PieChart: React.FC<PieChartProps> = (paras) => {
|
|
11
|
+
|
|
12
|
+
const ref = useRef();
|
|
13
|
+
|
|
14
|
+
const downloadImage = () => {
|
|
15
|
+
if (ref.current) {
|
|
16
|
+
// @ts-ignore
|
|
17
|
+
ref.current.downloadImage()
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const config = {
|
|
22
|
+
appendPadding: 4,
|
|
23
|
+
data: paras.data,
|
|
24
|
+
angleField: paras.config.yField,
|
|
25
|
+
colorField: paras.config.xField,
|
|
26
|
+
radius: 0.75,
|
|
27
|
+
label: {
|
|
28
|
+
type: 'spider',
|
|
29
|
+
labelHeight: 28,
|
|
30
|
+
content: '{name}\n{percentage}',
|
|
31
|
+
},
|
|
32
|
+
interactions: [{ type: 'element-selected' }, { type: 'element-active' }],
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
return <div >
|
|
36
|
+
<Space direction="vertical" size={'middle'} style={{width:'100%'}}>
|
|
37
|
+
<Space>
|
|
38
|
+
<button type="button" onClick={downloadImage} style={{marginRight: 24}}>
|
|
39
|
+
导出
|
|
40
|
+
</button>
|
|
41
|
+
<div style={{fontSize:'16px'}} >{paras.groupName+"-"+paras.config.xField+"-"+paras.config.yField}</div>
|
|
42
|
+
</Space>
|
|
43
|
+
<Pie {...config} onReady={(plot) => {
|
|
44
|
+
// @ts-ignore
|
|
45
|
+
ref.current = plot;
|
|
46
|
+
}}/>
|
|
47
|
+
</Space>
|
|
48
|
+
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export default PieChart;
|
|
54
|
+
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import LineChart from './line-chart-sub';
|
|
3
|
+
import ColumnChart from './column-chart-sub';
|
|
4
|
+
import PieChart from './pie-chart-sub';
|
|
5
|
+
import {Col, Divider, Row} from "antd";
|
|
6
|
+
import chartUtils from "./chart-utils";
|
|
7
|
+
import {ChartType, DtmplData, LtmplConfig} from "../../tmpl/interface";
|
|
8
|
+
|
|
9
|
+
interface StatView2DChartProps {
|
|
10
|
+
ltmplConfig: LtmplConfig;
|
|
11
|
+
dataSource: DtmplData[];
|
|
12
|
+
hiddenColIds?:string[];
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
interface StatView2DChartStat {
|
|
16
|
+
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
class StatviewD2Chart extends React.PureComponent<StatView2DChartProps, StatView2DChartStat> {
|
|
20
|
+
|
|
21
|
+
initData = () => {
|
|
22
|
+
const {dataSource, ltmplConfig,hiddenColIds} = this.props;
|
|
23
|
+
let data_;
|
|
24
|
+
|
|
25
|
+
console.log("chart hiddenColIds:",hiddenColIds)
|
|
26
|
+
let firstDim = undefined, secondDim = undefined, dimensions = [], facts = [];
|
|
27
|
+
ltmplConfig.columns.forEach((col) => {
|
|
28
|
+
if(!hiddenColIds || !hiddenColIds.includes(col.id)){
|
|
29
|
+
if ("fact" == col.statColType) {
|
|
30
|
+
facts.push(col);
|
|
31
|
+
} else if ("dimension" == col.statColType) {
|
|
32
|
+
dimensions.push(col);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
let lineData;
|
|
37
|
+
if (dimensions.length > 1) {
|
|
38
|
+
firstDim = dimensions[0];
|
|
39
|
+
secondDim = dimensions[1];
|
|
40
|
+
data_ = chartUtils.transValueFloatGroupByDim(ltmplConfig, dataSource, firstDim);
|
|
41
|
+
lineData = new Map();
|
|
42
|
+
for (let [key, data1] of data_) {
|
|
43
|
+
lineData.set(key, []);
|
|
44
|
+
facts.forEach((fact) => {
|
|
45
|
+
let obj1 = {};
|
|
46
|
+
obj1['data'] = data1;
|
|
47
|
+
obj1['config'] = {
|
|
48
|
+
xAxisTitle: key,
|
|
49
|
+
yAxisTitle: fact.title,
|
|
50
|
+
xField: secondDim.title,
|
|
51
|
+
yField: fact.title
|
|
52
|
+
};
|
|
53
|
+
lineData.get(key).push(obj1);
|
|
54
|
+
})
|
|
55
|
+
}
|
|
56
|
+
} else if (dimensions.length == 1) {
|
|
57
|
+
lineData = [];
|
|
58
|
+
secondDim = dimensions[0];
|
|
59
|
+
data_ = chartUtils.transValueFloat(ltmplConfig, dataSource);
|
|
60
|
+
facts.forEach((fact) => {
|
|
61
|
+
let obj1 = {};
|
|
62
|
+
obj1['data'] = data_;
|
|
63
|
+
obj1['config'] = {
|
|
64
|
+
xAxisTitle: secondDim.title,
|
|
65
|
+
yAxisTitle: fact.title,
|
|
66
|
+
xField: secondDim.title,
|
|
67
|
+
yField: fact.title
|
|
68
|
+
};
|
|
69
|
+
lineData.push(obj1);
|
|
70
|
+
})
|
|
71
|
+
}
|
|
72
|
+
return lineData;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
get2DimChart = (lineData) => {
|
|
76
|
+
let {ltmplConfig} = this.props;
|
|
77
|
+
let refL2ChartType:ChartType[] = ltmplConfig.chartType;
|
|
78
|
+
let list = [];
|
|
79
|
+
let that = this;
|
|
80
|
+
for (let [key, obj] of lineData) {
|
|
81
|
+
obj.map(function (val) {
|
|
82
|
+
list.push(<Col span={12} key={val.config.yAxisTitle+val.config.xAxisTitle}>
|
|
83
|
+
{that.getChart1(refL2ChartType, val)}
|
|
84
|
+
{/*<PieChart groupName={key} data={val.data} config={val.config}/>*/}
|
|
85
|
+
<Divider dashed style={{borderTopColor: "#40a9ff",}} plain></Divider>
|
|
86
|
+
</Col>)
|
|
87
|
+
})
|
|
88
|
+
}
|
|
89
|
+
return list;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
getChart1 = (refL2ChartType:ChartType[], val) => {
|
|
93
|
+
return refL2ChartType.includes('line') ?
|
|
94
|
+
<LineChart data={val.data} config={val.config}/>
|
|
95
|
+
: refL2ChartType.includes('column') ?
|
|
96
|
+
<ColumnChart data={val.data} config={val.config}/>
|
|
97
|
+
:
|
|
98
|
+
refL2ChartType.includes('pie') ?
|
|
99
|
+
<PieChart data={val.data} config={val.config}/> :
|
|
100
|
+
<div>暂不支持的图形</div>
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
render() {
|
|
104
|
+
const {dataSource, ltmplConfig} = this.props;
|
|
105
|
+
let lineData = this.initData();
|
|
106
|
+
console.log("lineData:",lineData);
|
|
107
|
+
let refL2ChartType = ltmplConfig.chartType;
|
|
108
|
+
let that = this;
|
|
109
|
+
return (<div>
|
|
110
|
+
<Row style={{padding: '8px 0'}} gutter={[32, {xs: 8, sm: 16, md: 24, lg: 32}]}>
|
|
111
|
+
{lineData instanceof Map ?
|
|
112
|
+
that.get2DimChart(lineData)
|
|
113
|
+
: lineData ? lineData.map(function (val) {
|
|
114
|
+
return <Col span={12} key={val.config.yAxisTitle+val.config.xAxisTitle}>
|
|
115
|
+
{that.getChart1(refL2ChartType, val)}
|
|
116
|
+
<Divider dashed style={{borderTopColor: "#40a9ff",}} plain></Divider>
|
|
117
|
+
</Col>
|
|
118
|
+
}) : ""
|
|
119
|
+
}
|
|
120
|
+
</Row>
|
|
121
|
+
</div>);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export default StatviewD2Chart;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import {DtmplData, LtmplConfig, QueryData} from "../tmpl/interface";
|
|
3
|
+
import HcserviceV3 from "../tmpl/hcservice-v3";
|
|
4
|
+
import StatView2DChartProps from './antd/statview-d2-chart'
|
|
5
|
+
|
|
6
|
+
interface StatViewL2ChartProps {
|
|
7
|
+
queryKey: string;
|
|
8
|
+
ltmplConfig:LtmplConfig;
|
|
9
|
+
hiddenColIds?:string[];
|
|
10
|
+
hiddenRowCodes?:string[];
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
interface StatViewL2ChartStat {
|
|
14
|
+
dataSource: DtmplData[],
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class StatViewL2Chart extends React.PureComponent<StatViewL2ChartProps, StatViewL2ChartStat> {
|
|
19
|
+
state = {
|
|
20
|
+
dataSource: undefined,
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
loadData = async () => {
|
|
24
|
+
const {queryKey} = this.props;
|
|
25
|
+
if(queryKey) {
|
|
26
|
+
let queryData: QueryData = await HcserviceV3.requestQueryData(queryKey, {pageNo: 1, pageSize: 10000});
|
|
27
|
+
this.setState({
|
|
28
|
+
dataSource: queryData.entities,
|
|
29
|
+
})
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async componentDidMount() {
|
|
34
|
+
this.loadData();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async componentDidUpdate(prevProps) {
|
|
38
|
+
const {queryKey} = this.props;
|
|
39
|
+
let {queryKey: preQueryKey} = prevProps;
|
|
40
|
+
|
|
41
|
+
if (queryKey && queryKey!=preQueryKey ){
|
|
42
|
+
this.loadData();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
getDataSource=()=>{//过滤
|
|
47
|
+
let {hiddenRowCodes} = this.props;
|
|
48
|
+
let {dataSource} = this.state;
|
|
49
|
+
let ds=[];
|
|
50
|
+
for(let d of dataSource){
|
|
51
|
+
if(!hiddenRowCodes || !hiddenRowCodes.includes(d.code)){
|
|
52
|
+
ds.push(d);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return ds;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
render() {
|
|
59
|
+
let {dataSource} = this.state;
|
|
60
|
+
let {ltmplConfig,hiddenColIds} = this.props;
|
|
61
|
+
return (
|
|
62
|
+
ltmplConfig && dataSource ?
|
|
63
|
+
<StatView2DChartProps hiddenColIds={hiddenColIds} dataSource={this.getDataSource()}
|
|
64
|
+
ltmplConfig={ltmplConfig}/> : ""
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export default StatViewL2Chart;
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import {RefObject} from 'react'
|
|
3
|
+
import {Button, Checkbox as AntdCheckbox, Popconfirm, Popover,} from 'antd'
|
|
4
|
+
import './index.css'
|
|
5
|
+
import {ActionConfig, Comparator, DtmplData} from "../../tmpl/interface";
|
|
6
|
+
import {FormInstance} from "antd/lib/form/hooks/useForm";
|
|
7
|
+
import {ButtonType} from "antd/lib/button/button";
|
|
8
|
+
import FieldsEditCard from "../../detail/edit/fields-edit-card"
|
|
9
|
+
import {SizeType} from "antd/lib/config-provider/SizeContext";
|
|
10
|
+
import ActionUtils from './utils';
|
|
11
|
+
|
|
12
|
+
const CheckboxGroup = AntdCheckbox.Group;
|
|
13
|
+
|
|
14
|
+
export type ActionButtonType = 'primary-block' | 'dashed' | 'primary'
|
|
15
|
+
export type ActionButtonHiddenType = 'hidden' | 'disabled'
|
|
16
|
+
|
|
17
|
+
interface ActionProps {
|
|
18
|
+
disabled?: boolean,
|
|
19
|
+
actionConfig: ActionConfig,
|
|
20
|
+
data?: DtmplData[] |object[],
|
|
21
|
+
formRef?: RefObject<FormInstance>,
|
|
22
|
+
doAction: (string, Array, object) => void,
|
|
23
|
+
serial?: number,
|
|
24
|
+
buttonType?: ActionButtonType,
|
|
25
|
+
hiddenType?: ActionButtonHiddenType,
|
|
26
|
+
buttonSize?: SizeType,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
interface ActionState {
|
|
30
|
+
popoverVisible: boolean,
|
|
31
|
+
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export default class Action extends React.PureComponent<ActionProps, ActionState> {
|
|
35
|
+
|
|
36
|
+
static defaultProps = {
|
|
37
|
+
buttonType: 'dashed',
|
|
38
|
+
hiddenType: 'hidden',
|
|
39
|
+
buttonSize: undefined,
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
state = {
|
|
43
|
+
popoverVisible: false,
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
componentDidMount() {
|
|
47
|
+
const {} = this.props;
|
|
48
|
+
this.setState({})
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
componentDidUpdate(prevProps) {
|
|
52
|
+
const {} = this.props;
|
|
53
|
+
if (this.props != prevProps) {
|
|
54
|
+
// this.setState({collapse:!this.state.collapse})
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
isShow = () => {
|
|
60
|
+
const {actionConfig, data, formRef} = this.props;
|
|
61
|
+
return ActionUtils.isShow(actionConfig, data, formRef);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
getValue = () => {
|
|
66
|
+
const {data, formRef, actionConfig} = this.props;
|
|
67
|
+
let value = {};
|
|
68
|
+
//从 dtmplData 与 ref
|
|
69
|
+
//dtmplData取第一个
|
|
70
|
+
let dtmplValue = data ? data[0] : undefined;
|
|
71
|
+
let upperFormValue = formRef ? formRef.current : undefined;
|
|
72
|
+
for (let fieldConfig of actionConfig.writes) {
|
|
73
|
+
if(!fieldConfig){
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
if (upperFormValue) {
|
|
77
|
+
if (upperFormValue.getFieldValue(fieldConfig.id)) {
|
|
78
|
+
value[fieldConfig.id] = ActionUtils.getFormRefValue(formRef, fieldConfig.id);
|
|
79
|
+
}else{
|
|
80
|
+
if(dtmplValue){
|
|
81
|
+
if(dtmplValue['fieldMap']){
|
|
82
|
+
value[fieldConfig.id] = dtmplValue ?dtmplValue['fieldMap'][fieldConfig.id] : undefined;
|
|
83
|
+
}else{
|
|
84
|
+
value[fieldConfig.id] = dtmplValue ?dtmplValue[fieldConfig.id] : undefined;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}else{
|
|
89
|
+
if(dtmplValue) {
|
|
90
|
+
if (dtmplValue['fieldMap']) {
|
|
91
|
+
value[fieldConfig.id] = dtmplValue ? dtmplValue['fieldMap'][fieldConfig.id] : undefined;
|
|
92
|
+
} else {
|
|
93
|
+
value[fieldConfig.id] = dtmplValue ? dtmplValue[fieldConfig.id] : undefined;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
console.log("actionValue:",value);
|
|
99
|
+
return value;
|
|
100
|
+
}
|
|
101
|
+
onOk = (value: object) => {
|
|
102
|
+
console.log('action form value:', value);
|
|
103
|
+
const {actionConfig, doAction, data, disabled, buttonType} = this.props;
|
|
104
|
+
this.setState({
|
|
105
|
+
popoverVisible: false,
|
|
106
|
+
})
|
|
107
|
+
doAction(actionConfig.id, this.getCodes(), value);
|
|
108
|
+
}
|
|
109
|
+
onCancel = () => {
|
|
110
|
+
this.setState({
|
|
111
|
+
popoverVisible: false,
|
|
112
|
+
})
|
|
113
|
+
}
|
|
114
|
+
onValuesChange = (value: object) => {
|
|
115
|
+
const {actionConfig, doAction, data, formRef} = this.props;
|
|
116
|
+
if (formRef && formRef.current) {
|
|
117
|
+
formRef.current.setFieldsValue(value);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
getButtonType = () => {
|
|
123
|
+
const {buttonType} = this.props;
|
|
124
|
+
let bType: ButtonType = !buttonType ? "dashed" : buttonType.split("-")[0] == "dashed" ? "dashed" : "primary";
|
|
125
|
+
return bType;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
blockButton = (): boolean => {
|
|
129
|
+
const {buttonType} = this.props;
|
|
130
|
+
let block = buttonType && buttonType.includes('block');
|
|
131
|
+
return block;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
formButton = () => {
|
|
136
|
+
const {popoverVisible} = this.state;
|
|
137
|
+
const {actionConfig, doAction, data, disabled, buttonType,hiddenType, buttonSize} = this.props;
|
|
138
|
+
let disabled_ = disabled;
|
|
139
|
+
if (!this.isShow()) {
|
|
140
|
+
if (!hiddenType || hiddenType == 'hidden') {
|
|
141
|
+
return null;
|
|
142
|
+
} else {
|
|
143
|
+
disabled_ = true;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return <Popover placement="leftBottom" visible={popoverVisible} trigger="click" content={
|
|
147
|
+
<FieldsEditCard okDanger={actionConfig.beforeExeConfirm == 'danger'} needConfirm={true} title={actionConfig.title} onCancel={() => this.onCancel()} fields={actionConfig.writes}
|
|
148
|
+
value={this.getValue()} onOk={this.onOk}
|
|
149
|
+
onValuesChange={this.onValuesChange}/>}>
|
|
150
|
+
<Button danger={actionConfig.beforeExeConfirm == 'danger'} type={this.getButtonType()} block={this.blockButton()} size={buttonSize}
|
|
151
|
+
onClick={() => this.setState({popoverVisible: !popoverVisible})}
|
|
152
|
+
disabled={disabled_} >{actionConfig.title}</Button>
|
|
153
|
+
</Popover>
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
getCodes = () => {
|
|
158
|
+
const {data,} = this.props;
|
|
159
|
+
let codes = [];
|
|
160
|
+
if (data) {
|
|
161
|
+
if (data instanceof Array) {
|
|
162
|
+
for (let d of data) {
|
|
163
|
+
if (d) {
|
|
164
|
+
codes.push(d['code']);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return codes;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
withoutFormButton = () => {
|
|
173
|
+
const {actionConfig, doAction, data, disabled, buttonType, hiddenType, buttonSize} = this.props;
|
|
174
|
+
let disabled_ = disabled;
|
|
175
|
+
if (!this.isShow()) {
|
|
176
|
+
if (!hiddenType || hiddenType == 'hidden') {
|
|
177
|
+
return null;
|
|
178
|
+
} else {
|
|
179
|
+
disabled_ = true;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
let codes = this.getCodes();
|
|
183
|
+
let block = this.blockButton();
|
|
184
|
+
let bType = this.getButtonType();
|
|
185
|
+
return !actionConfig.beforeExeConfirm || actionConfig.beforeExeConfirm == 'default' ?
|
|
186
|
+
<Popconfirm key={actionConfig.id}
|
|
187
|
+
placement="rightBottom"
|
|
188
|
+
title={`确定要执行【${actionConfig.title}】吗?`}
|
|
189
|
+
onConfirm={() => {
|
|
190
|
+
doAction(actionConfig.id, codes, {})
|
|
191
|
+
}}
|
|
192
|
+
disabled={disabled_}
|
|
193
|
+
okText="确定"
|
|
194
|
+
cancelText="取消"
|
|
195
|
+
>
|
|
196
|
+
<Button size={buttonSize} type={bType} block={block} disabled={disabled_}
|
|
197
|
+
>{actionConfig.title}</Button>
|
|
198
|
+
</Popconfirm> :
|
|
199
|
+
actionConfig.beforeExeConfirm == 'danger' ?
|
|
200
|
+
<Popconfirm key={actionConfig.id}
|
|
201
|
+
placement="rightBottom"
|
|
202
|
+
title={`确定要执行【${actionConfig.title}】吗?`}
|
|
203
|
+
onConfirm={() => {
|
|
204
|
+
doAction(actionConfig.id, codes, {})
|
|
205
|
+
}}
|
|
206
|
+
disabled={disabled_}
|
|
207
|
+
okText="确定"
|
|
208
|
+
cancelText="取消"
|
|
209
|
+
okType={'danger'}
|
|
210
|
+
>
|
|
211
|
+
<Button type={bType} block={block} danger={true} size={buttonSize} disabled={disabled_}
|
|
212
|
+
>{actionConfig.title}</Button>
|
|
213
|
+
</Popconfirm> :
|
|
214
|
+
<Button type={bType} block={block} size={buttonSize}
|
|
215
|
+
onClick={() => doAction(actionConfig.id, codes, {})}
|
|
216
|
+
disabled={disabled_}
|
|
217
|
+
>{actionConfig.title}</Button>
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
render() {
|
|
221
|
+
const {} = this.state;
|
|
222
|
+
const {actionConfig, doAction, data, disabled, buttonType} = this.props;
|
|
223
|
+
return <>
|
|
224
|
+
{actionConfig.writes && actionConfig.writes.length > 0 ? this.formButton() : this.withoutFormButton()}
|
|
225
|
+
</>;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
}
|