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,112 @@
|
|
|
1
|
+
import React, {RefObject} from 'react'
|
|
2
|
+
import './index.css'
|
|
3
|
+
import {ActionConfig, ButtonName, CQueryConfig, DtmplConfig, DtmplData, TmplBase} from "../../tmpl/interface";
|
|
4
|
+
import {Affix, Button, Popconfirm, Popover,Space} from "antd";
|
|
5
|
+
import {LeftOutlined, SaveOutlined} from '@ant-design/icons';
|
|
6
|
+
import CquickButton from "../../controls/cquery/cquick-button";
|
|
7
|
+
|
|
8
|
+
interface CqueryButtonBarProps {
|
|
9
|
+
dtmplConfig: DtmplConfig,
|
|
10
|
+
mainCode:string,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
interface CqueryButtonBarState {
|
|
15
|
+
// stateSerial:number
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
class CqueryButtonBar extends React.PureComponent<CqueryButtonBarProps, CqueryButtonBarState> {
|
|
19
|
+
|
|
20
|
+
state={
|
|
21
|
+
// stateSerial:0,
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
calcOffsetBottom = (cQuerys: CQueryConfig[]) => {
|
|
25
|
+
|
|
26
|
+
if (cQuerys.length>=3) {
|
|
27
|
+
return 120;
|
|
28
|
+
} else if (cQuerys.length==2){
|
|
29
|
+
return 86;
|
|
30
|
+
}else{
|
|
31
|
+
return 80;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// async componentDidMount() {
|
|
36
|
+
// console.log("SubmitButtonBar this.loadData()");
|
|
37
|
+
//
|
|
38
|
+
// console.log("SubmitButtonBar this.loadData()1");
|
|
39
|
+
// // if(code!=preCode || (!code && preCode)){
|
|
40
|
+
// // await this.loadData();
|
|
41
|
+
// // }else{
|
|
42
|
+
// // formRef.current.resetFields();
|
|
43
|
+
// // }
|
|
44
|
+
// }
|
|
45
|
+
|
|
46
|
+
// loadData = async () => {
|
|
47
|
+
// console.log("SubmitButtonBar this.loadData()2");
|
|
48
|
+
// this.setState({
|
|
49
|
+
// stateSerial: this.state.stateSerial + 1,
|
|
50
|
+
// })
|
|
51
|
+
// }
|
|
52
|
+
|
|
53
|
+
render() {
|
|
54
|
+
const {}=this.state;
|
|
55
|
+
const {dtmplConfig,mainCode} = this.props
|
|
56
|
+
|
|
57
|
+
if(!dtmplConfig){
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const {buttons, cQuerys} = dtmplConfig;
|
|
62
|
+
const cardList: TmplBase[] = [];
|
|
63
|
+
|
|
64
|
+
let content
|
|
65
|
+
if (cQuerys && cQuerys.length > 3) {
|
|
66
|
+
content = (
|
|
67
|
+
<div style={{width:'100px'}} className="btns">
|
|
68
|
+
<Space direction="vertical">
|
|
69
|
+
{cQuerys.map((item, index) => {
|
|
70
|
+
if (index > 2) {
|
|
71
|
+
return <CquickButton block={true} key={item.id} mainCode={mainCode} cQueryConfig={item} ></CquickButton>
|
|
72
|
+
}
|
|
73
|
+
})
|
|
74
|
+
}
|
|
75
|
+
</Space>
|
|
76
|
+
|
|
77
|
+
</div>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
//offsetBottom={this.calcOffsetBottom(cQuerys)}
|
|
81
|
+
return (
|
|
82
|
+
(cQuerys && cQuerys.length>0 && mainCode)?<Affix style={{position: 'absolute',top:180, right: 10, maxHeight: 90}}
|
|
83
|
+
offsetTop={300} >
|
|
84
|
+
<div className={'submitButtonBar'} >
|
|
85
|
+
<ul>
|
|
86
|
+
{
|
|
87
|
+
cQuerys ? cQuerys.map((item, index) => {
|
|
88
|
+
if (index < 3) {
|
|
89
|
+
return <li key={index}>
|
|
90
|
+
<CquickButton type={'text'} block={true} key={item.id} mainCode={mainCode} cQueryConfig={item} ></CquickButton>
|
|
91
|
+
</li>
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
) : ""
|
|
95
|
+
}
|
|
96
|
+
{//处理后面的
|
|
97
|
+
cQuerys && cQuerys.length > 2 ?
|
|
98
|
+
<Popover placement="leftTop" content={content} trigger="hover">
|
|
99
|
+
<Button block >
|
|
100
|
+
<LeftOutlined/>{'更多'}
|
|
101
|
+
</Button>
|
|
102
|
+
</Popover> : ""
|
|
103
|
+
}
|
|
104
|
+
</ul>
|
|
105
|
+
</div>
|
|
106
|
+
</Affix>:""
|
|
107
|
+
)
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export default CqueryButtonBar;
|
|
112
|
+
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
.submitButtonBar{
|
|
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
|
+
max-height:158px;
|
|
10
|
+
/*min-height:80px;*/
|
|
11
|
+
overflow:auto;
|
|
12
|
+
width:100px;
|
|
13
|
+
}
|
|
14
|
+
.submitButtonBar::-webkit-scrollbar {
|
|
15
|
+
display: none;
|
|
16
|
+
}
|
|
17
|
+
.submitButtonBar ul{
|
|
18
|
+
padding:0;
|
|
19
|
+
margin:0;
|
|
20
|
+
}
|
|
21
|
+
.submitButtonBar li{
|
|
22
|
+
list-style-type: none;
|
|
23
|
+
padding:4px;
|
|
24
|
+
margin:0;
|
|
25
|
+
text-align: left;
|
|
26
|
+
white-space: nowrap;
|
|
27
|
+
overflow: hidden;
|
|
28
|
+
}
|
|
29
|
+
/*.rightBar li:hover{*/
|
|
30
|
+
/* background: #cfe3f5;*/
|
|
31
|
+
/*}*/
|
|
32
|
+
|
|
33
|
+
.btns button{
|
|
34
|
+
margin-right: 10px
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.cquickTextButton {
|
|
38
|
+
cursor:pointer;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.cquickTextButton:hover{
|
|
42
|
+
color: #1890ff;
|
|
43
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import React, {RefObject} from 'react'
|
|
2
|
+
import './index.css'
|
|
3
|
+
import {ActionConfig, ButtonName, DtmplConfig, DtmplData, TmplBase} from "../../tmpl/interface";
|
|
4
|
+
import {Affix, Button, Popconfirm, Popover} from "antd";
|
|
5
|
+
import {LeftOutlined, SaveOutlined} from '@ant-design/icons';
|
|
6
|
+
import Action from "../../controls/action";
|
|
7
|
+
import {FormInstance} from "antd/lib/form/hooks/useForm";
|
|
8
|
+
|
|
9
|
+
interface SubmitButtonProps {
|
|
10
|
+
dtmplConfig: DtmplConfig,
|
|
11
|
+
// dtmplData:DtmplData,
|
|
12
|
+
doSubmit: (actionId?: string,codes?:string[],params?:object) => void;
|
|
13
|
+
formRef: RefObject<FormInstance>,
|
|
14
|
+
serial:number,
|
|
15
|
+
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
interface SubmitButtonState {
|
|
20
|
+
// stateSerial:number
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
class SubmitButtonBar extends React.PureComponent<SubmitButtonProps, SubmitButtonState> {
|
|
24
|
+
|
|
25
|
+
state={
|
|
26
|
+
// stateSerial:0,
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
calcOffsetBottom = (buttons: ButtonName[], actions: ActionConfig[]) => {
|
|
30
|
+
let buttonSize:number=0;
|
|
31
|
+
if(actions ){
|
|
32
|
+
buttonSize=buttonSize+actions.length;
|
|
33
|
+
}
|
|
34
|
+
if((buttons && buttons.includes('dtmplSave')) ){
|
|
35
|
+
buttonSize=buttonSize+1;
|
|
36
|
+
}
|
|
37
|
+
if (buttonSize>=3) {
|
|
38
|
+
return 120;
|
|
39
|
+
} else if (buttonSize==2){
|
|
40
|
+
return 86;
|
|
41
|
+
}else{
|
|
42
|
+
return 80;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// async componentDidMount() {
|
|
47
|
+
// console.log("SubmitButtonBar this.loadData()");
|
|
48
|
+
//
|
|
49
|
+
// console.log("SubmitButtonBar this.loadData()1");
|
|
50
|
+
// // if(code!=preCode || (!code && preCode)){
|
|
51
|
+
// // await this.loadData();
|
|
52
|
+
// // }else{
|
|
53
|
+
// // formRef.current.resetFields();
|
|
54
|
+
// // }
|
|
55
|
+
// }
|
|
56
|
+
|
|
57
|
+
// loadData = async () => {
|
|
58
|
+
// console.log("SubmitButtonBar this.loadData()2");
|
|
59
|
+
// this.setState({
|
|
60
|
+
// stateSerial: this.state.stateSerial + 1,
|
|
61
|
+
// })
|
|
62
|
+
// }
|
|
63
|
+
|
|
64
|
+
render() {
|
|
65
|
+
const {}=this.state;
|
|
66
|
+
const {dtmplConfig, doSubmit,formRef,serial} = this.props
|
|
67
|
+
const {buttons, actions} = dtmplConfig;
|
|
68
|
+
const cardList: TmplBase[] = [];
|
|
69
|
+
|
|
70
|
+
console.log(" submit-button-bar serial:",serial);
|
|
71
|
+
// console.log(" submit-button-bar stateSerial:",stateSerial);
|
|
72
|
+
|
|
73
|
+
if (dtmplConfig.premises && dtmplConfig.premises.length > 0) {
|
|
74
|
+
cardList.push({
|
|
75
|
+
id: '1', title: '默认字段',
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
dtmplConfig.groups.forEach(g => {
|
|
79
|
+
cardList.push({
|
|
80
|
+
title: g.title,
|
|
81
|
+
id: g.id,
|
|
82
|
+
});
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
let content
|
|
86
|
+
if (actions && actions.length > 1) {
|
|
87
|
+
content = (
|
|
88
|
+
<div className="btns">
|
|
89
|
+
{actions.map((item, index) => {
|
|
90
|
+
if (index > 1) {
|
|
91
|
+
// return <Popconfirm key={item.id} placement="top" title={"确定要保存修改并执行此操作吗?"}
|
|
92
|
+
// onConfirm={() => doSubmit(item.id)} okText="确定" cancelText="取消">
|
|
93
|
+
// <Button
|
|
94
|
+
// type="primary"
|
|
95
|
+
// >{item.title}</Button>
|
|
96
|
+
// </Popconfirm>
|
|
97
|
+
return <Action hiddenType={'disabled'} buttonType={'primary'} serial={serial} key={item.id} formRef={formRef} actionConfig={item} doAction={doSubmit}></Action>
|
|
98
|
+
}
|
|
99
|
+
})
|
|
100
|
+
}
|
|
101
|
+
</div>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
return (
|
|
107
|
+
<Affix style={{position: 'absolute', right: 10, maxHeight: 100}}
|
|
108
|
+
offsetBottom={this.calcOffsetBottom(buttons, actions)}>
|
|
109
|
+
<div className={'submitButtonBar'} >
|
|
110
|
+
<ul>
|
|
111
|
+
{buttons.includes('dtmplSave') ? <li key={100}>
|
|
112
|
+
<Popconfirm placement="left" title={"确定要保存修改吗?"} onConfirm={() => doSubmit()} okText="确定" cancelText="取消">
|
|
113
|
+
<Button
|
|
114
|
+
type='primary'
|
|
115
|
+
icon={<SaveOutlined/>}
|
|
116
|
+
key="btn" block
|
|
117
|
+
>保 存</Button>
|
|
118
|
+
</Popconfirm>
|
|
119
|
+
</li> : ""
|
|
120
|
+
}
|
|
121
|
+
{//处理前两个
|
|
122
|
+
actions ? actions.map((item, index) => {
|
|
123
|
+
if (index < 2) {
|
|
124
|
+
return <li key={index}>
|
|
125
|
+
{/*<Popconfirm placement="left" title={"确定要保存修改并执行此操作吗?"} onConfirm={() => doSubmit(item.id)} okText="确定" cancelText="取消">*/}
|
|
126
|
+
{/*<Button block*/}
|
|
127
|
+
{/* type={'primary'}>{item.title}</Button>*/}
|
|
128
|
+
{/*</Popconfirm>*/}
|
|
129
|
+
<Action hiddenType={'disabled'} buttonType={'primary-block'} serial={serial} key={item.id} formRef={formRef} actionConfig={item} doAction={doSubmit}></Action>
|
|
130
|
+
</li>
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
) : ""
|
|
134
|
+
}
|
|
135
|
+
{//处理后面的
|
|
136
|
+
actions && actions.length > 2 ?
|
|
137
|
+
<Popover placement="leftTop" content={content} trigger="hover">
|
|
138
|
+
<Button block>
|
|
139
|
+
<LeftOutlined/>{'更多'}
|
|
140
|
+
</Button>
|
|
141
|
+
</Popover> : ""
|
|
142
|
+
}
|
|
143
|
+
</ul>
|
|
144
|
+
</div>
|
|
145
|
+
</Affix>
|
|
146
|
+
)
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export default SubmitButtonBar;
|
|
151
|
+
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/*.labelcss label{*/
|
|
2
|
+
/* display:table-cell!important;*/
|
|
3
|
+
/* vertical-align: middle;*/
|
|
4
|
+
/* width:120px;*/
|
|
5
|
+
/*}*/
|
|
6
|
+
|
|
7
|
+
.downEditPic{
|
|
8
|
+
display:inline-block;
|
|
9
|
+
}
|
|
10
|
+
.downEditPic a{
|
|
11
|
+
visibility: hidden;
|
|
12
|
+
color:#1890ff;
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
}
|
|
15
|
+
.downEditPic:hover a{
|
|
16
|
+
visibility:visible;
|
|
17
|
+
}
|
|
18
|
+
.editPic .ant-upload-list{
|
|
19
|
+
width:150px
|
|
20
|
+
}
|
|
21
|
+
.buttonGroup{
|
|
22
|
+
position: fixed;
|
|
23
|
+
width:100px;
|
|
24
|
+
bottom: 30px;
|
|
25
|
+
right: 20px;
|
|
26
|
+
z-index: 99;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.buttonGroup button{
|
|
30
|
+
margin-bottom: 10px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.detailPage h3{
|
|
34
|
+
font-size: 18px;
|
|
35
|
+
}
|
|
36
|
+
.detailPage.showRightNav .ant-card{
|
|
37
|
+
min-width: 740px;
|
|
38
|
+
max-width: 1440px;
|
|
39
|
+
width:90%
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.detailPage.noRightNav .ant-card{
|
|
43
|
+
min-width: 740px;
|
|
44
|
+
width:100%
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.actionbtn button{
|
|
48
|
+
margin-right: 5px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.detailPage .pad{
|
|
52
|
+
margin-right: 100px;
|
|
53
|
+
}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {Card, FormInstance} from 'antd';
|
|
3
|
+
import DtmplForm from '../../form/dtmpl-form';
|
|
4
|
+
import PostResult from "./post-result";
|
|
5
|
+
import RightBar from '../rightbar';
|
|
6
|
+
import {DtmplBaseProps, DtmplConfig, DtmplData,AddOrUpdate} from "../../tmpl/interface";
|
|
7
|
+
import HCDataSource from "../../tmpl/hc-data-source";
|
|
8
|
+
import '../dtmpl.css'
|
|
9
|
+
import SubmitButtonBar from "../button/submit-button-bar";
|
|
10
|
+
import Units from '../../units';
|
|
11
|
+
import HcserviceV3 from "../../tmpl/hcservice-v3";
|
|
12
|
+
import CqueryButtonBar from "../button/cquery-button-bar"
|
|
13
|
+
|
|
14
|
+
interface DtmplEditProps extends DtmplBaseProps {
|
|
15
|
+
goBackToLtmpl: () => void,
|
|
16
|
+
addOrUpdate:AddOrUpdate,
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface DtmplEditState {
|
|
20
|
+
id:string,
|
|
21
|
+
dtmplConfig: DtmplConfig,
|
|
22
|
+
dtmplData:DtmplData,
|
|
23
|
+
showPostResult: boolean;
|
|
24
|
+
// addOrUpdate?: AddOrUpdate;
|
|
25
|
+
// dtmplData: DtmplData;
|
|
26
|
+
loading: boolean;
|
|
27
|
+
serial:number,
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default class DtmplEdit extends React.PureComponent<DtmplEditProps, DtmplEditState> {
|
|
31
|
+
formRef = React.createRef<FormInstance>();
|
|
32
|
+
newCode=undefined;
|
|
33
|
+
static defaultProps = {
|
|
34
|
+
showRightNav: true,
|
|
35
|
+
}
|
|
36
|
+
state = {
|
|
37
|
+
id:'dtmplEdit'+Units.getRandomNum(6),
|
|
38
|
+
showPostResult: false,
|
|
39
|
+
dtmplConfig: undefined,
|
|
40
|
+
loading: true,
|
|
41
|
+
serial:1,
|
|
42
|
+
dtmplData:undefined,
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
componentDidMount() {
|
|
46
|
+
this.loadConfigData();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async componentDidUpdate(prevProps, prevState, snapshot) {
|
|
50
|
+
const { dtmplConfig} = this.state;
|
|
51
|
+
if(prevProps && prevProps!=this.props){
|
|
52
|
+
await this.loadData(dtmplConfig);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
autoSaveTimer = -1000000000000000;
|
|
57
|
+
autoSaveInterval=undefined;
|
|
58
|
+
|
|
59
|
+
onClickBody = (e) => {
|
|
60
|
+
// console.log(e);
|
|
61
|
+
console.log("点击了我" + this.autoSaveTimer);
|
|
62
|
+
this.autoSaveTimer = 0;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
onValuesChange=()=>{
|
|
66
|
+
this.setState({
|
|
67
|
+
serial:this.state.serial+1
|
|
68
|
+
})
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
loadConfigData = async () => {
|
|
72
|
+
const { sourceId} = this.props;
|
|
73
|
+
this.setState({
|
|
74
|
+
loading: true,
|
|
75
|
+
})
|
|
76
|
+
const dtmplConfig = await HCDataSource.requestDtmplConfig(sourceId);
|
|
77
|
+
|
|
78
|
+
if(dtmplConfig.authSaveInterval && dtmplConfig.authSaveInterval>0){
|
|
79
|
+
if(this.autoSaveInterval){
|
|
80
|
+
clearInterval( this.autoSaveInterval);
|
|
81
|
+
}
|
|
82
|
+
this.autoSaveInterval = setInterval(() => {
|
|
83
|
+
if(this.autoSaveTimer>=dtmplConfig.authSaveInterval){
|
|
84
|
+
console.log('执行自动保存');
|
|
85
|
+
this.autoSaveTimer=-1000000000000000;
|
|
86
|
+
this.doSubmit(undefined);
|
|
87
|
+
}else{
|
|
88
|
+
this.autoSaveTimer=this.autoSaveTimer+1;
|
|
89
|
+
}
|
|
90
|
+
}, 1000);
|
|
91
|
+
}
|
|
92
|
+
await this.loadData(dtmplConfig);
|
|
93
|
+
this.setState({
|
|
94
|
+
dtmplConfig,
|
|
95
|
+
loading: false,
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
loadData = async (dtmplConfig:DtmplConfig ) => {
|
|
101
|
+
const { sourceId, code,addOrUpdate} = this.props;
|
|
102
|
+
if (code) {
|
|
103
|
+
this.setState({
|
|
104
|
+
loading: true,
|
|
105
|
+
})
|
|
106
|
+
const dtmplData_ = await HcserviceV3.requestDtmplData( sourceId, code, null);
|
|
107
|
+
if(addOrUpdate=='copy'&& dtmplData_){
|
|
108
|
+
dtmplData_.code=undefined;
|
|
109
|
+
}
|
|
110
|
+
this.setState({
|
|
111
|
+
dtmplData:dtmplData_,
|
|
112
|
+
// changedGroupData:new Map<number,DtmplData[]>(),
|
|
113
|
+
loading: false,
|
|
114
|
+
})
|
|
115
|
+
}else{
|
|
116
|
+
this.setState({
|
|
117
|
+
dtmplData:{code:undefined,title:undefined,fieldMap:{},arrayMap:{}},
|
|
118
|
+
loading: false,
|
|
119
|
+
})
|
|
120
|
+
}
|
|
121
|
+
setTimeout(()=> this.onValuesChange(),300);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
componentWillUnmount(): void {
|
|
125
|
+
if(this.autoSaveInterval){
|
|
126
|
+
clearInterval( this.autoSaveInterval);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
doSubmit = (actionId: string) => {
|
|
131
|
+
const {mainCode}=this.props;
|
|
132
|
+
if (actionId) {
|
|
133
|
+
//actionid 直接放在表单中
|
|
134
|
+
this.formRef.current.setFieldsValue({'actionId': actionId});
|
|
135
|
+
};
|
|
136
|
+
if(mainCode){
|
|
137
|
+
this.formRef.current.setFieldsValue({'mainCode': mainCode});
|
|
138
|
+
}
|
|
139
|
+
this.formRef.current.submit();
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
onFinish = (currentCode:string) => {
|
|
143
|
+
console.log("提交返回的Code:", currentCode);
|
|
144
|
+
this.newCode=currentCode;
|
|
145
|
+
//默认返回到列表页面
|
|
146
|
+
const {dtmplConfig} = this.state;
|
|
147
|
+
const saveJumpTo=dtmplConfig.saveJumpTo?dtmplConfig.saveJumpTo:[];
|
|
148
|
+
if(saveJumpTo.length>1){
|
|
149
|
+
this.setState({
|
|
150
|
+
showPostResult:true,
|
|
151
|
+
})
|
|
152
|
+
}else if(saveJumpTo.includes('edit')){
|
|
153
|
+
this.goEdit()
|
|
154
|
+
}else if(saveJumpTo.includes('add')){
|
|
155
|
+
this.goAdd();
|
|
156
|
+
}else {
|
|
157
|
+
this.goList();
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
goList = () => {
|
|
162
|
+
this.newCode=undefined;
|
|
163
|
+
this.props.goBackToLtmpl();
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
goEdit = () => {
|
|
167
|
+
const code=this.newCode;
|
|
168
|
+
const {goDtmpl,code:propCode,goBackToLtmpl}=this.props;
|
|
169
|
+
this.newCode=undefined;
|
|
170
|
+
goDtmpl(code);
|
|
171
|
+
this.setState({
|
|
172
|
+
showPostResult:false,
|
|
173
|
+
})
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
goAdd = () => {
|
|
177
|
+
this.newCode=undefined;
|
|
178
|
+
const {goDtmpl,code:propCode}=this.props;
|
|
179
|
+
if(propCode){
|
|
180
|
+
goDtmpl();
|
|
181
|
+
}
|
|
182
|
+
this.setState({
|
|
183
|
+
showPostResult:false,
|
|
184
|
+
})
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
render() {
|
|
188
|
+
const {dtmplConfig, showPostResult,loading,id,serial,dtmplData} = this.state;
|
|
189
|
+
console.log(" dtmpl edit serial:",serial);
|
|
190
|
+
const { sourceId, showRightNav, code,addOrUpdate} = this.props;
|
|
191
|
+
//const {title} = dtmplConfig;
|
|
192
|
+
if (!dtmplConfig) {
|
|
193
|
+
return <Card loading={loading}>
|
|
194
|
+
</Card>
|
|
195
|
+
}
|
|
196
|
+
return (
|
|
197
|
+
<div className={`detailPage ${showRightNav ? 'showRightNav' : 'noRightNav'}`} onClick={this.onClickBody}>
|
|
198
|
+
<DtmplForm parentId={id} dtmplConfig={dtmplConfig} formRef={this.formRef} sourceId={sourceId}
|
|
199
|
+
onFinish={this.onFinish}
|
|
200
|
+
showConfirm={true} dtmplData={dtmplData} onValuesChange={this.onValuesChange}></DtmplForm>
|
|
201
|
+
{showRightNav ?
|
|
202
|
+
<RightBar parentId={id} dtmplConfig={dtmplConfig}/> : ""
|
|
203
|
+
}
|
|
204
|
+
<SubmitButtonBar serial={serial} dtmplConfig={dtmplConfig} doSubmit={this.doSubmit} formRef={this.formRef}></SubmitButtonBar>
|
|
205
|
+
<CqueryButtonBar dtmplConfig={dtmplConfig} mainCode={code}></CqueryButtonBar>
|
|
206
|
+
<PostResult
|
|
207
|
+
visible={showPostResult}
|
|
208
|
+
addOrUpdate={addOrUpdate=='copy' ? 'add' : addOrUpdate}
|
|
209
|
+
resultStatus={"success"}
|
|
210
|
+
goList={this.goList}
|
|
211
|
+
goEdit={this.goEdit}
|
|
212
|
+
goAdd={this.goAdd}
|
|
213
|
+
jumpTypes={dtmplConfig.saveJumpTo}
|
|
214
|
+
> </PostResult>
|
|
215
|
+
</div>)
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {Button, Card, FormInstance, Popconfirm, Space} from 'antd'
|
|
3
|
+
import {CloseOutlined} from '@ant-design/icons'
|
|
4
|
+
import {DtmplData, FieldConfig, FieldGroupConfig} from "../../tmpl/interface";
|
|
5
|
+
import FieldGroupForm from '../../form/field-group-form';
|
|
6
|
+
import {ButtonType} from "antd/es/button";
|
|
7
|
+
import FieldsForm from "../../form/fields-form";
|
|
8
|
+
|
|
9
|
+
interface FieldsEditCardProps {
|
|
10
|
+
title?:any,
|
|
11
|
+
height?: any,
|
|
12
|
+
onCancel?: () => void,
|
|
13
|
+
onOk: (value: object) => void,
|
|
14
|
+
fields: FieldConfig[],
|
|
15
|
+
value?: object,
|
|
16
|
+
okButtonType?: ButtonType,
|
|
17
|
+
okDanger?: boolean,
|
|
18
|
+
needConfirm?: boolean,
|
|
19
|
+
onValuesChange:(value:object)=>void,
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface FieldsEditCardState {
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default class FieldsEditCard extends React.PureComponent<FieldsEditCardProps, FieldsEditCardState> {
|
|
26
|
+
formRef = React.createRef<FormInstance>();
|
|
27
|
+
static defaultProps = {
|
|
28
|
+
forceRender: true,
|
|
29
|
+
style: {maxWidth: 'calc(100vw - 60px)', maxHeight: 'calc(100vh - 50px)'},
|
|
30
|
+
needConfirm: false,
|
|
31
|
+
okButtonType: 'primary',
|
|
32
|
+
okDanger: false,
|
|
33
|
+
|
|
34
|
+
}
|
|
35
|
+
state = {}
|
|
36
|
+
|
|
37
|
+
async componentDidMount() {
|
|
38
|
+
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async componentDidUpdate() {
|
|
42
|
+
this.reset();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
reset = () => {
|
|
46
|
+
if (this.formRef.current) {
|
|
47
|
+
this.formRef.current.resetFields();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
onOk = () => {
|
|
52
|
+
this.formRef.current.submit();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
render() {
|
|
58
|
+
const {title,height, onOk, fields, value, onCancel, okButtonType, needConfirm, okDanger,onValuesChange} = this.props
|
|
59
|
+
const {} = this.state;
|
|
60
|
+
|
|
61
|
+
function okButton(onOk) {
|
|
62
|
+
return needConfirm ? okDanger ?
|
|
63
|
+
<Popconfirm
|
|
64
|
+
placement="rightBottom"
|
|
65
|
+
title={`确定要执行提交吗?`}
|
|
66
|
+
onConfirm={onOk}
|
|
67
|
+
okText="确定"
|
|
68
|
+
cancelText="取消"
|
|
69
|
+
okType={'danger'}
|
|
70
|
+
>
|
|
71
|
+
<Button type={okButtonType} danger={true}
|
|
72
|
+
>确定</Button>
|
|
73
|
+
</Popconfirm> :
|
|
74
|
+
<Popconfirm
|
|
75
|
+
placement="rightBottom"
|
|
76
|
+
title={`确定要执行提交吗?`}
|
|
77
|
+
onConfirm={onOk}
|
|
78
|
+
okText="确定"
|
|
79
|
+
cancelText="取消"
|
|
80
|
+
>
|
|
81
|
+
<Button type={okButtonType}
|
|
82
|
+
>确定</Button>
|
|
83
|
+
</Popconfirm> :
|
|
84
|
+
<Button type={okButtonType} onClick={onOk}
|
|
85
|
+
>确定</Button>
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return <Card
|
|
89
|
+
style={{width: 1000}}
|
|
90
|
+
title={title}
|
|
91
|
+
bodyStyle={{overflow: 'auto'}}
|
|
92
|
+
extra={<><Space size={[8, 0]}><Button onClick={this.reset}>重置</Button>
|
|
93
|
+
{okButton(this.onOk)}
|
|
94
|
+
{onCancel ? <Button onClick={onCancel}><CloseOutlined/></Button> : ""}
|
|
95
|
+
</Space></>}
|
|
96
|
+
>
|
|
97
|
+
<FieldsForm onValuesChange={onValuesChange} fields={fields} formRef={this.formRef}
|
|
98
|
+
value={value}
|
|
99
|
+
onFinish={onOk} ></FieldsForm>
|
|
100
|
+
</Card>
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
}
|