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,198 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {Button, FormInstance, Modal, Popconfirm} from 'antd'
|
|
3
|
+
import {DtmplBaseProps, DtmplConfig, DtmplData} from "../../tmpl/interface";
|
|
4
|
+
import DtmplForm from '../../form/dtmpl-form';
|
|
5
|
+
import HCDataSource from "../../tmpl/hc-data-source";
|
|
6
|
+
import Units from "../../units";
|
|
7
|
+
import HcserviceV3 from "../../tmpl/hcservice-v3";
|
|
8
|
+
import Action from "../../controls/action";
|
|
9
|
+
|
|
10
|
+
interface ModalEditorProps extends DtmplBaseProps {
|
|
11
|
+
height: any,
|
|
12
|
+
visible: boolean,
|
|
13
|
+
onOk: (code: string) => void,
|
|
14
|
+
onCancel: () => void,
|
|
15
|
+
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface ModalEditorState {
|
|
19
|
+
id:string,
|
|
20
|
+
dtmplConfig: DtmplConfig,
|
|
21
|
+
loading: boolean;
|
|
22
|
+
serial:number,
|
|
23
|
+
dtmplData:DtmplData,
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default class ModalDtmplEdit extends React.PureComponent<ModalEditorProps, ModalEditorState> {
|
|
27
|
+
formRef = React.createRef<FormInstance>();
|
|
28
|
+
autoSaveTimer = -1000000000000000;
|
|
29
|
+
autoSaveInterval=undefined;
|
|
30
|
+
onClickBody = (e) => {
|
|
31
|
+
// console.log(e);
|
|
32
|
+
console.log("点击了我" + this.autoSaveTimer);
|
|
33
|
+
this.autoSaveTimer = 0;
|
|
34
|
+
}
|
|
35
|
+
static defaultProps = {
|
|
36
|
+
showConfirm: true,
|
|
37
|
+
height: 500,
|
|
38
|
+
//antd modal
|
|
39
|
+
forceRender: true,
|
|
40
|
+
style: {maxWidth: 'calc(100vw - 60px)', maxHeight: 'calc(100vh - 50px)'},
|
|
41
|
+
okText: "确定",
|
|
42
|
+
cancelText: "取消",
|
|
43
|
+
|
|
44
|
+
}
|
|
45
|
+
state = {
|
|
46
|
+
id:'modelDtmplEdit'+Units.getRandomNum(6),
|
|
47
|
+
dtmplConfig: undefined,
|
|
48
|
+
loading: true,
|
|
49
|
+
serial:1,
|
|
50
|
+
dtmplData:undefined,
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async componentDidMount() {
|
|
54
|
+
|
|
55
|
+
await this.loadConfigData();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async componentDidUpdate(prevProps) {
|
|
59
|
+
const { dtmplConfig} = this.state;
|
|
60
|
+
if(prevProps && prevProps!=this.props){
|
|
61
|
+
await this.loadData(dtmplConfig);
|
|
62
|
+
}
|
|
63
|
+
// if(this.formRef.current){
|
|
64
|
+
// this.formRef.current.resetFields();
|
|
65
|
+
// }
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
componentWillUnmount(): void {
|
|
69
|
+
if(this.autoSaveInterval){
|
|
70
|
+
clearInterval( this.autoSaveInterval);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
loadConfigData = async () => {
|
|
75
|
+
const { sourceId,visible} = this.props;
|
|
76
|
+
this.setState({
|
|
77
|
+
loading: true,
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
const dtmplConfig = await HCDataSource.requestDtmplConfig(sourceId);
|
|
81
|
+
if(dtmplConfig.authSaveInterval && dtmplConfig.authSaveInterval>0){
|
|
82
|
+
if(this.autoSaveInterval){
|
|
83
|
+
clearInterval( this.autoSaveInterval);
|
|
84
|
+
}
|
|
85
|
+
this.autoSaveInterval = setInterval(() => {
|
|
86
|
+
if(this.autoSaveTimer>=dtmplConfig.authSaveInterval){
|
|
87
|
+
console.log('执行自动保存');
|
|
88
|
+
this.autoSaveTimer=-1000000000000000;
|
|
89
|
+
this.doSubmit(undefined);
|
|
90
|
+
}else{
|
|
91
|
+
this.autoSaveTimer=this.autoSaveTimer+1;
|
|
92
|
+
}
|
|
93
|
+
}, 1000);
|
|
94
|
+
}
|
|
95
|
+
await this.loadData(dtmplConfig);
|
|
96
|
+
this.setState({
|
|
97
|
+
dtmplConfig,
|
|
98
|
+
loading: false,
|
|
99
|
+
})
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
loadData = async (dtmplConfig:DtmplConfig ) => {
|
|
103
|
+
const { sourceId, code,defaultDtmplData,visible} = this.props;
|
|
104
|
+
if(!visible){
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
if (code) {
|
|
108
|
+
this.setState({
|
|
109
|
+
loading: true,
|
|
110
|
+
})
|
|
111
|
+
const dtmplData_ = await HcserviceV3.requestDtmplData( sourceId, code, null);
|
|
112
|
+
this.setState({
|
|
113
|
+
dtmplData:dtmplData_,
|
|
114
|
+
// changedGroupData:new Map<number,DtmplData[]>(),
|
|
115
|
+
loading: false,
|
|
116
|
+
})
|
|
117
|
+
}else if(defaultDtmplData){
|
|
118
|
+
this.setState({
|
|
119
|
+
dtmplData:defaultDtmplData,
|
|
120
|
+
loading: false,
|
|
121
|
+
})
|
|
122
|
+
}else{
|
|
123
|
+
this.setState({
|
|
124
|
+
dtmplData:{code:undefined,title:undefined,fieldMap:{},arrayMap:{}},
|
|
125
|
+
loading: false,
|
|
126
|
+
})
|
|
127
|
+
}
|
|
128
|
+
setTimeout(()=> this.onValuesChange(),300);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
onValuesChange=()=>{
|
|
132
|
+
this.setState({
|
|
133
|
+
serial:this.state.serial+1
|
|
134
|
+
})
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
doSubmit = (actionId?: number,codes?:string[],params?:object) => {
|
|
138
|
+
const {mainCode}=this.props;
|
|
139
|
+
if (actionId) {
|
|
140
|
+
this.formRef.current.setFieldsValue({'actionId': actionId});
|
|
141
|
+
}
|
|
142
|
+
if(mainCode){
|
|
143
|
+
this.formRef.current.setFieldsValue({'mainCode': mainCode});
|
|
144
|
+
}
|
|
145
|
+
if(params){
|
|
146
|
+
this.formRef.current.setFieldsValue(params);
|
|
147
|
+
}
|
|
148
|
+
this.formRef.current.submit();
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
getFooter = () => {
|
|
152
|
+
const {onCancel} = this.props
|
|
153
|
+
const {dtmplData,serial}=this.state;
|
|
154
|
+
const footerButtons = [];
|
|
155
|
+
footerButtons.unshift(<Popconfirm key="ok" placement="topLeft" title={"确定要保存修改吗?"} onConfirm={() =>this.doSubmit()} okText="确定" cancelText="取消">
|
|
156
|
+
<Button type={'primary'} >
|
|
157
|
+
保 存
|
|
158
|
+
</Button></Popconfirm>)
|
|
159
|
+
const {dtmplConfig} = this.state;
|
|
160
|
+
//处理action
|
|
161
|
+
if (dtmplConfig) {
|
|
162
|
+
dtmplConfig.actions.forEach((ac, index) => {
|
|
163
|
+
footerButtons.unshift(<Action hiddenType={'disabled'} serial={serial} key={ac.id} formRef={this.formRef} actionConfig={ac} doAction={this.doSubmit}></Action>);
|
|
164
|
+
})
|
|
165
|
+
}
|
|
166
|
+
footerButtons.unshift(<Popconfirm key="back" placement="topLeft" title={"确定要取消本次修改内容吗?"} onConfirm={onCancel} okText="确定" cancelText="取消">
|
|
167
|
+
<Button >
|
|
168
|
+
取 消
|
|
169
|
+
</Button></Popconfirm>);
|
|
170
|
+
return footerButtons;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
render() {
|
|
174
|
+
const {height, onOk, onCancel, code, sourceId, visible,mainCode} = this.props
|
|
175
|
+
const {dtmplConfig,id,dtmplData} = this.state;
|
|
176
|
+
|
|
177
|
+
return <Modal
|
|
178
|
+
visible={visible}
|
|
179
|
+
width={1250}
|
|
180
|
+
title={dtmplConfig ? dtmplConfig.title : ""}
|
|
181
|
+
bodyStyle={{height: height, overflow: 'auto'}}
|
|
182
|
+
destroyOnClose={true}
|
|
183
|
+
centered
|
|
184
|
+
onCancel={onCancel}
|
|
185
|
+
footer={this.getFooter()}
|
|
186
|
+
>
|
|
187
|
+
{visible} <div onClick={this.onClickBody}>
|
|
188
|
+
{/*<Scrollbars autoHide autoHideTimeout={1000}>*/}
|
|
189
|
+
<DtmplForm parentId={id} dtmplConfig={dtmplConfig} formRef={this.formRef} sourceId={sourceId}
|
|
190
|
+
onFinish={onOk}
|
|
191
|
+
showConfirm={false} dtmplData={dtmplData} onValuesChange={this.onValuesChange}> </DtmplForm>
|
|
192
|
+
{/*</Scrollbars>*/}
|
|
193
|
+
</div>
|
|
194
|
+
</Modal>
|
|
195
|
+
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {FormInstance, Modal} from 'antd'
|
|
3
|
+
import {DtmplData, FieldGroupConfig} from "../../tmpl/interface";
|
|
4
|
+
import FieldGroupForm from '../../form/field-group-form';
|
|
5
|
+
|
|
6
|
+
interface ModalRowEditorProps {
|
|
7
|
+
height?: any,
|
|
8
|
+
visible: boolean,
|
|
9
|
+
onOk: (value: DtmplData) => void,
|
|
10
|
+
onCancel: () => void,
|
|
11
|
+
fieldGroupConfig: FieldGroupConfig,
|
|
12
|
+
dtmplData?: DtmplData,
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface ModalRowEditorState {
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default class ModalRowEdit extends React.PureComponent<ModalRowEditorProps, ModalRowEditorState> {
|
|
19
|
+
formRef = React.createRef<FormInstance>();
|
|
20
|
+
static defaultProps = {
|
|
21
|
+
forceRender: true,
|
|
22
|
+
style: {maxWidth: 'calc(100vw - 60px)', maxHeight: 'calc(100vh - 50px)'},
|
|
23
|
+
}
|
|
24
|
+
state = {}
|
|
25
|
+
|
|
26
|
+
async componentDidMount() {
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async componentDidUpdate() {
|
|
30
|
+
if (this.formRef.current) {
|
|
31
|
+
this.formRef.current.resetFields();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
onOk = () => {
|
|
36
|
+
this.formRef.current.submit();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
getTitle = () => {
|
|
40
|
+
const {fieldGroupConfig, dtmplData} = this.props
|
|
41
|
+
let title = "";
|
|
42
|
+
title = fieldGroupConfig.title;
|
|
43
|
+
if (dtmplData) {
|
|
44
|
+
title = title + "【行编辑】";
|
|
45
|
+
} else {
|
|
46
|
+
title = title + "【新建一行】";
|
|
47
|
+
}
|
|
48
|
+
return title;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
render() {
|
|
52
|
+
const {height, onOk, onCancel, fieldGroupConfig, visible, dtmplData} = this.props
|
|
53
|
+
const {} = this.state;
|
|
54
|
+
return <Modal
|
|
55
|
+
visible={visible}
|
|
56
|
+
width={1150}
|
|
57
|
+
title={this.getTitle()}
|
|
58
|
+
bodyStyle={{overflow: 'auto'}}
|
|
59
|
+
destroyOnClose={true}
|
|
60
|
+
centered
|
|
61
|
+
okText={'确定'}
|
|
62
|
+
cancelText={'取消'}
|
|
63
|
+
onOk={this.onOk}
|
|
64
|
+
onCancel={onCancel}
|
|
65
|
+
>
|
|
66
|
+
<FieldGroupForm fieldGroupConfig={fieldGroupConfig} formRef={this.formRef}
|
|
67
|
+
onFinish={onOk}
|
|
68
|
+
dtmplData={dtmplData}> </FieldGroupForm>
|
|
69
|
+
</Modal>
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React, {ReactNode} from 'react'
|
|
2
|
+
import {Button, Modal, Result} from 'antd'
|
|
3
|
+
import {AddOrUpdate, SaveJumpType} from "../../../tmpl/interface";
|
|
4
|
+
import {ResultStatusType} from "antd/lib/result";
|
|
5
|
+
|
|
6
|
+
interface PostResultProps {
|
|
7
|
+
title?: ReactNode,
|
|
8
|
+
subtitle?: ReactNode,
|
|
9
|
+
visible: boolean,
|
|
10
|
+
jumpTypes: SaveJumpType[],
|
|
11
|
+
addOrUpdate: AddOrUpdate,
|
|
12
|
+
resultStatus?: ResultStatusType,
|
|
13
|
+
goAdd: () => void,
|
|
14
|
+
goEdit: () => void,
|
|
15
|
+
goList: () => void,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const PostResult: React.FC<PostResultProps> = ({resultStatus='success',...props}) => {
|
|
19
|
+
|
|
20
|
+
const {title, visible, subtitle, goAdd, goEdit, goList, jumpTypes, addOrUpdate} = props;
|
|
21
|
+
return (
|
|
22
|
+
<Modal
|
|
23
|
+
title={title ? title : "保存提示"}
|
|
24
|
+
visible={visible}
|
|
25
|
+
closable={false}
|
|
26
|
+
destroyOnClose
|
|
27
|
+
footer={[]}
|
|
28
|
+
bodyStyle={{height: 430, overflow: 'auto'}}
|
|
29
|
+
width={560}
|
|
30
|
+
maskClosable={true}
|
|
31
|
+
>
|
|
32
|
+
<Result status={resultStatus} title={resultStatus === "success" ? "保存成功" : "保存失败"}
|
|
33
|
+
subTitle={subtitle}
|
|
34
|
+
extra={[goAdd && jumpTypes && jumpTypes.includes('add') ?
|
|
35
|
+
<Button key="goOnAdd" onClick={() => goAdd()}>
|
|
36
|
+
{addOrUpdate === "update" ? "转添加" : "继续添加"}
|
|
37
|
+
</Button> : undefined,
|
|
38
|
+
goEdit && jumpTypes && jumpTypes.includes('edit') ?
|
|
39
|
+
<Button type="primary" key="goOnEdit" onClick={() => goEdit()}>
|
|
40
|
+
{addOrUpdate === "update" ? "继续编辑" : "编辑实体"}
|
|
41
|
+
</Button> : "",
|
|
42
|
+
goList && jumpTypes && jumpTypes.includes('list') ?
|
|
43
|
+
<Button type="primary" key="onBackList" onClick={() => goList()}>
|
|
44
|
+
返回列表
|
|
45
|
+
</Button> : ""
|
|
46
|
+
]}
|
|
47
|
+
></Result>
|
|
48
|
+
</Modal>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export default PostResult;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {Button, Card, FormInstance, Popconfirm, Popover, Space, Tooltip} from 'antd'
|
|
3
|
+
import {CloseOutlined} from '@ant-design/icons'
|
|
4
|
+
import {DtmplData, FieldGroupConfig} from "../../tmpl/interface";
|
|
5
|
+
import FieldGroupForm from '../../form/field-group-form';
|
|
6
|
+
import {ButtonType} from "antd/es/button";
|
|
7
|
+
|
|
8
|
+
interface RowEditCardProps {
|
|
9
|
+
height?: any,
|
|
10
|
+
onCancel?: () => void,
|
|
11
|
+
onOk: (value: DtmplData,hidden:boolean) => void,
|
|
12
|
+
fieldGroupConfig: FieldGroupConfig,
|
|
13
|
+
dtmplData?: DtmplData,
|
|
14
|
+
okButtonType?: ButtonType,
|
|
15
|
+
okDanger?: boolean,
|
|
16
|
+
needConfirm?: boolean,
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface RowEditCardState {
|
|
20
|
+
isAdded:boolean,
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default class RowEditCard extends React.PureComponent<RowEditCardProps, RowEditCardState> {
|
|
24
|
+
formRef = React.createRef<FormInstance>();
|
|
25
|
+
static defaultProps = {
|
|
26
|
+
forceRender: true,
|
|
27
|
+
style: {maxWidth: 'calc(100vw - 60px)', maxHeight: 'calc(100vh - 50px)'},
|
|
28
|
+
needConfirm: false,
|
|
29
|
+
okButtonType: 'primary',
|
|
30
|
+
okDanger: false,
|
|
31
|
+
}
|
|
32
|
+
state = {
|
|
33
|
+
isAdded:false,
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async componentDidMount() {
|
|
37
|
+
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async componentDidUpdate() {
|
|
41
|
+
//this.reset();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
reset = () => {
|
|
45
|
+
// if (this.formRef.current) {
|
|
46
|
+
// this.formRef.current.resetFields();
|
|
47
|
+
// }
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
onOk = () => {
|
|
51
|
+
this.setState({isAdded:false})
|
|
52
|
+
this.formRef.current.submit();
|
|
53
|
+
|
|
54
|
+
}
|
|
55
|
+
add = () => {
|
|
56
|
+
this.setState({isAdded:true})
|
|
57
|
+
this.formRef.current.submit();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
getTitle = () => {
|
|
61
|
+
const {fieldGroupConfig, dtmplData} = this.props
|
|
62
|
+
let title = "";
|
|
63
|
+
title = fieldGroupConfig.title;
|
|
64
|
+
if (dtmplData) {
|
|
65
|
+
title = title + "【行编辑】";
|
|
66
|
+
} else {
|
|
67
|
+
title = title + "【新建一行】";
|
|
68
|
+
}
|
|
69
|
+
return title;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
render() {
|
|
73
|
+
const {height, onOk, fieldGroupConfig, dtmplData, onCancel, okButtonType, needConfirm, okDanger} = this.props
|
|
74
|
+
const {isAdded} = this.state;
|
|
75
|
+
|
|
76
|
+
function okButton(onOk) {
|
|
77
|
+
return needConfirm ? okDanger ?
|
|
78
|
+
<Popconfirm
|
|
79
|
+
placement="rightBottom"
|
|
80
|
+
title={`确定要执行提交吗?`}
|
|
81
|
+
onConfirm={onOk}
|
|
82
|
+
okText="确定"
|
|
83
|
+
cancelText="取消"
|
|
84
|
+
okType={'danger'}
|
|
85
|
+
>
|
|
86
|
+
<Button type={okButtonType} danger={true} size="small"
|
|
87
|
+
>确定</Button>
|
|
88
|
+
</Popconfirm> :
|
|
89
|
+
<Popconfirm
|
|
90
|
+
placement="rightBottom"
|
|
91
|
+
title={`确定要执行提交吗?`}
|
|
92
|
+
onConfirm={onOk}
|
|
93
|
+
okText="确定"
|
|
94
|
+
cancelText="取消"
|
|
95
|
+
>
|
|
96
|
+
<Button size="small" type={okButtonType}
|
|
97
|
+
>确定</Button>
|
|
98
|
+
</Popconfirm> :
|
|
99
|
+
<Button type={okButtonType} size="small" onClick={onOk}
|
|
100
|
+
>确定</Button>
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return <Card
|
|
104
|
+
style={{width: 1000}}
|
|
105
|
+
title={this.getTitle()}
|
|
106
|
+
bodyStyle={{overflow: 'auto'}}
|
|
107
|
+
extra={<><Space size={[8, 0]}>
|
|
108
|
+
{/*<Button onClick={this.reset}>重置</Button>*/}
|
|
109
|
+
{okButton(this.onOk)}
|
|
110
|
+
{
|
|
111
|
+
dtmplData?"": <Tooltip placement="top" title="可连续添加">
|
|
112
|
+
<Button type={'primary'} size={'small'} onClick={this.add}>添加</Button>
|
|
113
|
+
</Tooltip>
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
{onCancel ? <Button onClick={onCancel}><CloseOutlined/></Button> : ""}
|
|
117
|
+
</Space></>}
|
|
118
|
+
>
|
|
119
|
+
<FieldGroupForm fieldGroupConfig={fieldGroupConfig} formRef={this.formRef}
|
|
120
|
+
onFinish={(value)=>onOk(value,!isAdded)}
|
|
121
|
+
dtmplData={dtmplData}> </FieldGroupForm>
|
|
122
|
+
</Card>
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {Button, FormInstance, Popover, Tooltip} from 'antd'
|
|
3
|
+
import {DtmplData, FieldGroupConfig} from "../../tmpl/interface";
|
|
4
|
+
import {RenderFunction} from "antd/lib/tooltip";
|
|
5
|
+
import RowEditCard from './row-edit-card'
|
|
6
|
+
interface RowEditorProps {
|
|
7
|
+
buttonTitle?: string,
|
|
8
|
+
buttonIcon: React.ReactNode,
|
|
9
|
+
tooltipTitle?: React.ReactNode | RenderFunction;
|
|
10
|
+
fieldGroupConfig: FieldGroupConfig;
|
|
11
|
+
dtmplData?: DtmplData;
|
|
12
|
+
onOk:(value: DtmplData) => void,
|
|
13
|
+
buttonStyle?:object,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface RowEditorState {
|
|
17
|
+
popoverVisible: boolean,
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default class RowEditor extends React.PureComponent<RowEditorProps, RowEditorState> {
|
|
21
|
+
formRef = React.createRef<FormInstance>();
|
|
22
|
+
static defaultProps = {
|
|
23
|
+
buttonIcon:undefined
|
|
24
|
+
}
|
|
25
|
+
state = {
|
|
26
|
+
popoverVisible: false,
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async componentDidMount() {
|
|
30
|
+
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async componentDidUpdate() {
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// reset = () => {
|
|
37
|
+
// if (this.formRef.current) {
|
|
38
|
+
// this.formRef.current.resetFields();
|
|
39
|
+
// }
|
|
40
|
+
// }
|
|
41
|
+
|
|
42
|
+
onOk = (value,hidden:boolean=true) => {
|
|
43
|
+
if(hidden){
|
|
44
|
+
this.setState({popoverVisible:false});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
this.props.onOk(value);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
render() {
|
|
52
|
+
const {popoverVisible}=this.state;
|
|
53
|
+
const {buttonIcon, buttonTitle, tooltipTitle, fieldGroupConfig, dtmplData,buttonStyle} = this.props;
|
|
54
|
+
return <Popover destroyTooltipOnHide={true} placement="leftBottom" visible={popoverVisible}
|
|
55
|
+
content={<RowEditCard fieldGroupConfig={fieldGroupConfig} dtmplData={dtmplData}
|
|
56
|
+
onCancel={()=>{
|
|
57
|
+
this.setState({popoverVisible:false});}
|
|
58
|
+
} onOk={this.onOk}></RowEditCard>} trigger="click">
|
|
59
|
+
<Tooltip placement="left" title={tooltipTitle}>
|
|
60
|
+
<Button
|
|
61
|
+
style={buttonStyle}
|
|
62
|
+
type='primary'
|
|
63
|
+
icon={buttonIcon}
|
|
64
|
+
size="small"
|
|
65
|
+
onClick={() => {
|
|
66
|
+
this.setState({popoverVisible:!popoverVisible});
|
|
67
|
+
}}
|
|
68
|
+
>{buttonTitle?buttonTitle:""}</Button></Tooltip></Popover>
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
.rightBar{
|
|
2
|
+
background: #fff;
|
|
3
|
+
/*position: absolute;*/
|
|
4
|
+
/*right:10px;*/
|
|
5
|
+
/*top:80px;*/
|
|
6
|
+
border:1px solid #e8e8e8;
|
|
7
|
+
border-radius: 4px;
|
|
8
|
+
box-shadow: 2px 2px 10px rgba(0,0,0,.2);
|
|
9
|
+
height:200px;
|
|
10
|
+
/*max-height:181px;*/
|
|
11
|
+
/*min-height:80px;*/
|
|
12
|
+
min-width: 96px;
|
|
13
|
+
overflow:auto;
|
|
14
|
+
}
|
|
15
|
+
.rightBar::-webkit-scrollbar {
|
|
16
|
+
display: none;
|
|
17
|
+
}
|
|
18
|
+
.rightBar ul{
|
|
19
|
+
padding:0;
|
|
20
|
+
margin:0;
|
|
21
|
+
}
|
|
22
|
+
.rightBar li{
|
|
23
|
+
list-style-type: none;
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
padding:3px 7px;
|
|
26
|
+
width:95px;
|
|
27
|
+
text-align: center;
|
|
28
|
+
white-space: nowrap;
|
|
29
|
+
text-overflow: ellipsis;
|
|
30
|
+
text-align: left;
|
|
31
|
+
overflow: hidden;
|
|
32
|
+
}
|
|
33
|
+
.rightBar li:hover{
|
|
34
|
+
background: #cfe3f5;
|
|
35
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import './index.css'
|
|
3
|
+
import {DtmplConfig, TmplBase} from "../../tmpl/interface";
|
|
4
|
+
import {Affix, Button} from "antd";
|
|
5
|
+
|
|
6
|
+
interface RightBarProps {
|
|
7
|
+
parentId:string,
|
|
8
|
+
dtmplConfig: DtmplConfig,
|
|
9
|
+
positionRight?:number
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
interface RightBarState {
|
|
14
|
+
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default class RightBar extends React.PureComponent<RightBarProps, RightBarState> {
|
|
18
|
+
|
|
19
|
+
static defaultProps = {
|
|
20
|
+
positionRight:15,
|
|
21
|
+
}
|
|
22
|
+
scrollToAnchor = (anchor: TmplBase) => {
|
|
23
|
+
if (anchor) {
|
|
24
|
+
let anchorElement = document.getElementById(this.props.parentId+anchor.id);
|
|
25
|
+
if (anchorElement) {
|
|
26
|
+
anchorElement.scrollIntoView({behavior: "smooth", block: "end"})
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
scroll = (e) => {
|
|
31
|
+
e.preventDefault()
|
|
32
|
+
e.stopPropagation()
|
|
33
|
+
const list = document.getElementsByClassName("rightBar")[0]
|
|
34
|
+
if (list) {
|
|
35
|
+
const ul = list.getElementsByTagName("ul")[0]
|
|
36
|
+
ul.style.marginTop = ""
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
render() {
|
|
41
|
+
const {dtmplConfig,positionRight} = this.props
|
|
42
|
+
const cardList: TmplBase[] = [];
|
|
43
|
+
|
|
44
|
+
if(dtmplConfig){
|
|
45
|
+
dtmplConfig.groups.forEach(g => {
|
|
46
|
+
cardList.push({
|
|
47
|
+
title: g.title,
|
|
48
|
+
id: g.id,
|
|
49
|
+
});
|
|
50
|
+
})
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (dtmplConfig && dtmplConfig.premises && dtmplConfig.premises.length > 0) {
|
|
54
|
+
cardList.push({
|
|
55
|
+
id: dtmplConfig.premises[0].id, title: '默认字段',
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// @ts-ignore
|
|
60
|
+
return (
|
|
61
|
+
cardList && cardList.length>3?
|
|
62
|
+
<Affix style={{position: 'absolute',top:60,right: positionRight,}} offsetTop={80}>
|
|
63
|
+
<div className={'rightBar'} onScroll={this.scroll}>
|
|
64
|
+
<ul>
|
|
65
|
+
{
|
|
66
|
+
cardList ? cardList.map((item, index) =>
|
|
67
|
+
<li onClick={() => this.scrollToAnchor(item)} key={index}>{item.title}</li>
|
|
68
|
+
|
|
69
|
+
) : ""
|
|
70
|
+
}
|
|
71
|
+
</ul>
|
|
72
|
+
</div>
|
|
73
|
+
</Affix>:""
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
}
|