aldehyde 0.2.92 → 0.2.94
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/lib/controls/action/index.d.ts.map +1 -1
- package/lib/controls/action/index.js +1 -1
- package/lib/controls/action/index.js.map +1 -1
- package/lib/controls/action/utils.d.ts +3 -1
- package/lib/controls/action/utils.d.ts.map +1 -1
- package/lib/controls/action/utils.js +53 -28
- package/lib/controls/action/utils.js.map +1 -1
- package/lib/controls/entity-select/entity-select.js +1 -1
- package/lib/controls/entity-select/entity-select.js.map +1 -1
- package/lib/controls/entry-control.js +1 -1
- package/lib/controls/entry-control.js.map +1 -1
- package/lib/controls/input-number/index.js +3 -3
- package/lib/controls/input-number/index.js.map +1 -1
- package/lib/detail/button/bottom-submit-button-bar.d.ts.map +1 -1
- package/lib/detail/button/bottom-submit-button-bar.js +2 -2
- package/lib/detail/button/bottom-submit-button-bar.js.map +1 -1
- package/lib/detail/button/fix-right-submit-button-bar.js +3 -3
- package/lib/detail/button/fix-right-submit-button-bar.js.map +1 -1
- package/lib/detail/button/submit-button-bar.d.ts +2 -1
- package/lib/detail/button/submit-button-bar.d.ts.map +1 -1
- package/lib/detail/button/submit-button-bar.js +3 -3
- package/lib/detail/button/submit-button-bar.js.map +1 -1
- package/lib/detail/edit/dtmpl-edit.d.ts.map +1 -1
- package/lib/detail/edit/dtmpl-edit.js +5 -5
- package/lib/detail/edit/dtmpl-edit.js.map +1 -1
- package/lib/layout/MainPage.js +4 -4
- package/lib/layout/MainPage.js.map +1 -1
- package/lib/login/context-setter.d.ts.map +1 -1
- package/lib/login/context-setter.js +1 -0
- package/lib/login/context-setter.js.map +1 -1
- package/lib/module/dtmpl-edit-card.js +4 -4
- package/lib/module/dtmpl-edit-card.js.map +1 -1
- package/lib/module/dtmpl-edit-page.js +5 -5
- package/lib/module/dtmpl-edit-page.js.map +1 -1
- package/lib/module/dtmpl-editor.js +4 -4
- package/lib/module/dtmpl-editor.js.map +1 -1
- package/lib/module/dtmpl-view-card.d.ts +1 -0
- package/lib/module/dtmpl-view-card.d.ts.map +1 -1
- package/lib/module/dtmpl-view-card.js +2 -2
- package/lib/module/dtmpl-view-card.js.map +1 -1
- package/lib/module/embed-dtmpl-edit-page.d.ts +1 -0
- package/lib/module/embed-dtmpl-edit-page.d.ts.map +1 -1
- package/lib/module/embed-dtmpl-edit-page.js +2 -2
- package/lib/module/embed-dtmpl-edit-page.js.map +1 -1
- package/lib/module/ltmpl-table.d.ts +3 -1
- package/lib/module/ltmpl-table.d.ts.map +1 -1
- package/lib/module/ltmpl-table.js +5 -3
- package/lib/module/ltmpl-table.js.map +1 -1
- package/lib/routable/dtmpl-route.d.ts.map +1 -1
- package/lib/routable/dtmpl-route.js +3 -3
- package/lib/routable/dtmpl-route.js.map +1 -1
- package/lib/routable/ltmpl-route.js +2 -2
- package/lib/routable/ltmpl-route.js.map +1 -1
- package/lib/table/act-table.d.ts +3 -2
- package/lib/table/act-table.d.ts.map +1 -1
- package/lib/table/act-table.js +19 -5
- package/lib/table/act-table.js.map +1 -1
- package/lib/table/relation-table.d.ts +5 -2
- package/lib/table/relation-table.d.ts.map +1 -1
- package/lib/table/relation-table.js +22 -5
- package/lib/table/relation-table.js.map +1 -1
- package/lib/tmpl/hc-data-source.d.ts +1 -1
- package/lib/tmpl/hc-data-source.d.ts.map +1 -1
- package/lib/tmpl/hc-data-source.js +18 -15
- package/lib/tmpl/hc-data-source.js.map +1 -1
- package/lib/tmpl/hcservice-v3.d.ts +1 -1
- package/lib/tmpl/hcservice-v3.d.ts.map +1 -1
- package/lib/tmpl/hcservice-v3.js +5 -5
- package/lib/tmpl/hcservice-v3.js.map +1 -1
- package/lib/tmpl/interface.d.ts +6 -1
- package/lib/tmpl/interface.d.ts.map +1 -1
- package/lib/tmpl/interface.js.map +1 -1
- package/lib/tmpl/superagent.js.map +1 -1
- package/lib/tree/act-tree.d.ts +4 -2
- package/lib/tree/act-tree.d.ts.map +1 -1
- package/lib/tree/act-tree.js +10 -9
- package/lib/tree/act-tree.js.map +1 -1
- package/lib/tree/tmpl-tree.d.ts +1 -1
- package/lib/tree/tmpl-tree.d.ts.map +1 -1
- package/lib/tree/tmpl-tree.js +1 -1
- package/lib/tree/tmpl-tree.js.map +1 -1
- package/package.json +1 -1
- package/src/aldehyde/controls/action/index.tsx +1 -2
- package/src/aldehyde/controls/action/utils.tsx +66 -39
- package/src/aldehyde/controls/entity-select/entity-select.tsx +1 -1
- package/src/aldehyde/controls/entry-control.tsx +1 -1
- package/src/aldehyde/controls/input-number/index.tsx +3 -3
- package/src/aldehyde/detail/button/bottom-submit-button-bar.tsx +2 -3
- package/src/aldehyde/detail/button/fix-right-submit-button-bar.tsx +3 -3
- package/src/aldehyde/detail/button/submit-button-bar.tsx +12 -4
- package/src/aldehyde/detail/edit/dtmpl-edit.tsx +6 -5
- package/src/aldehyde/layout/MainPage.tsx +4 -4
- package/src/aldehyde/login/context-setter.tsx +1 -0
- package/src/aldehyde/module/dtmpl-edit-card.tsx +4 -4
- package/src/aldehyde/module/dtmpl-edit-page.tsx +5 -5
- package/src/aldehyde/module/dtmpl-editor.tsx +4 -4
- package/src/aldehyde/module/dtmpl-view-card.tsx +3 -2
- package/src/aldehyde/module/embed-dtmpl-edit-page.tsx +3 -2
- package/src/aldehyde/module/ltmpl-table.tsx +6 -3
- package/src/aldehyde/routable/dtmpl-route.tsx +5 -3
- package/src/aldehyde/routable/ltmpl-route.tsx +2 -2
- package/src/aldehyde/table/act-table.tsx +25 -5
- package/src/aldehyde/table/relation-table.tsx +31 -6
- package/src/aldehyde/tmpl/hc-data-source.tsx +19 -17
- package/src/aldehyde/tmpl/hcservice-v3.tsx +5 -5
- package/src/aldehyde/tmpl/interface.tsx +8 -1
- package/src/aldehyde/tmpl/superagent.js +1 -1
- package/src/aldehyde/tree/act-tree.tsx +11 -9
- package/src/aldehyde/tree/tmpl-tree.tsx +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {ActionConfig, Comparator, DtmplData,
|
|
1
|
+
import {ActionConfig, Comparator, DtmplConfig, DtmplData, FieldConfig} from "../../tmpl/interface";
|
|
2
2
|
import {RefObject} from "react";
|
|
3
3
|
import {FormInstance} from "antd/lib/form/hooks/useForm";
|
|
4
4
|
import {message} from "antd";
|
|
@@ -6,77 +6,94 @@ import TmplConfigAnalysis from "../../tmpl/tmpl-config-analysis";
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
export default class ActionUtils {
|
|
9
|
-
static
|
|
9
|
+
static isShow(actionConfig: ActionConfig, data: DtmplData[] | object[], formRef: RefObject<FormInstance>) {
|
|
10
10
|
let preFieldConfigs = actionConfig.preposes;
|
|
11
11
|
if (!preFieldConfigs || preFieldConfigs.length <= 0) {
|
|
12
12
|
return true;
|
|
13
13
|
}
|
|
14
|
-
return this.isMatch(preFieldConfigs,data,formRef?.current,null);
|
|
14
|
+
return this.isMatch(preFieldConfigs, data, formRef?.current, null);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
static
|
|
17
|
+
static isMatch(fieldConfigs: FieldConfig[], data: DtmplData[] | object[], formInstance: FormInstance, dtmplConfig: DtmplConfig) {
|
|
18
18
|
|
|
19
19
|
//所有data都必须满足条件才能显示
|
|
20
20
|
//let comparator=actionConfig.comparator;
|
|
21
21
|
//debugger
|
|
22
22
|
let isMatch = true;
|
|
23
23
|
if (formInstance) {
|
|
24
|
+
let tempConfigs:FieldConfig[]=[];
|
|
24
25
|
for (let fieldConfig of fieldConfigs) {
|
|
25
26
|
if (!fieldConfig) {
|
|
26
27
|
continue;
|
|
27
28
|
}
|
|
28
|
-
let fieldId =dtmplConfig? TmplConfigAnalysis.getFieldId(dtmplConfig, fieldConfig.mstrucId):fieldConfig.id;
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
let fieldId = dtmplConfig ? TmplConfigAnalysis.getFieldId(dtmplConfig, fieldConfig.mstrucId) : fieldConfig.id;
|
|
30
|
+
if(this.containsField(formInstance, fieldId)){
|
|
31
|
+
let value = this.getFormRefValue(formInstance, fieldId);
|
|
31
32
|
if (!this.comparator(fieldConfig.comparator, value, fieldConfig.defaultValue)) {
|
|
32
33
|
isMatch = false;
|
|
33
34
|
break;
|
|
34
|
-
}
|
|
35
35
|
|
|
36
|
+
}
|
|
37
|
+
}else{
|
|
38
|
+
tempConfigs.push(fieldConfig);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if(isMatch && tempConfigs.length>0){//若果之前判断成功,则继续判断
|
|
42
|
+
isMatch = this.matchDtmplData(tempConfigs, data);
|
|
36
43
|
}
|
|
37
44
|
} else if (data) {
|
|
38
|
-
|
|
39
|
-
|
|
45
|
+
isMatch = this.matchDtmplData(fieldConfigs, data);
|
|
46
|
+
} else {
|
|
47
|
+
isMatch = false;
|
|
48
|
+
}
|
|
49
|
+
return isMatch;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
static matchDtmplData(fieldConfigs: FieldConfig[], data: DtmplData[] | object[]) {
|
|
53
|
+
let isMatch = true;
|
|
54
|
+
if(!data){
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
for (let d of data) {
|
|
58
|
+
// if (!isMatch) {
|
|
59
|
+
// break;
|
|
60
|
+
// }
|
|
61
|
+
if (!d) {
|
|
62
|
+
isMatch = false;
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
for (let fieldConfig of fieldConfigs) {
|
|
67
|
+
if (d['fieldMap']) {
|
|
68
|
+
if (!this.comparator(fieldConfig.comparator, d['fieldMap'][fieldConfig.id], fieldConfig.defaultValue)) {
|
|
69
|
+
isMatch = false;
|
|
40
70
|
break;
|
|
41
71
|
}
|
|
42
|
-
|
|
72
|
+
} else {
|
|
73
|
+
// debugger
|
|
74
|
+
if (!this.comparator(fieldConfig.comparator, d[fieldConfig.id], fieldConfig.defaultValue)) {
|
|
43
75
|
isMatch = false;
|
|
44
76
|
break;
|
|
45
77
|
}
|
|
46
|
-
|
|
47
|
-
for (let fieldConfig of fieldConfigs) {
|
|
48
|
-
if(d['fieldMap']){
|
|
49
|
-
if (!this.comparator(fieldConfig.comparator, d['fieldMap'][fieldConfig.id], fieldConfig.defaultValue)) {
|
|
50
|
-
isMatch = false;
|
|
51
|
-
break;
|
|
52
|
-
}
|
|
53
|
-
}else{
|
|
54
|
-
// debugger
|
|
55
|
-
if (!this.comparator(fieldConfig.comparator, d[fieldConfig.id], fieldConfig.defaultValue)) {
|
|
56
|
-
isMatch = false;
|
|
57
|
-
break;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
}
|
|
62
78
|
}
|
|
63
|
-
|
|
64
|
-
|
|
79
|
+
|
|
80
|
+
}
|
|
65
81
|
}
|
|
66
82
|
return isMatch;
|
|
67
83
|
}
|
|
68
|
-
|
|
84
|
+
|
|
85
|
+
static comparator(comparator: Comparator, value: string, defaultValue: string) {
|
|
69
86
|
let dvs: string[];
|
|
70
87
|
|
|
71
|
-
if(!comparator
|
|
72
|
-
comparator='equals';
|
|
88
|
+
if (!comparator) {
|
|
89
|
+
comparator = 'equals';
|
|
73
90
|
}
|
|
74
91
|
|
|
75
|
-
if (
|
|
92
|
+
if (!defaultValue) {
|
|
76
93
|
return true;
|
|
77
94
|
}
|
|
78
95
|
|
|
79
|
-
if(!value && value!='0'
|
|
96
|
+
if (!value && value != '0') {
|
|
80
97
|
return false;
|
|
81
98
|
}
|
|
82
99
|
|
|
@@ -103,16 +120,26 @@ export default class ActionUtils {
|
|
|
103
120
|
case "unequals":
|
|
104
121
|
return value != defaultValue;
|
|
105
122
|
default:
|
|
106
|
-
message.error("暂不支持的比较关系:"+comparator+";请联系管理员添加。");
|
|
107
|
-
|
|
123
|
+
message.error("暂不支持的比较关系:" + comparator + ";请联系管理员添加。");
|
|
124
|
+
return
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
static getFormRefValue(formInstance: FormInstance, key) {
|
|
129
|
+
|
|
130
|
+
if (formInstance) {
|
|
131
|
+
// console.log("formRef.current.getFieldsValue",formRef.current.getFieldValue(key));
|
|
132
|
+
return formInstance.getFieldValue(key);
|
|
133
|
+
} else {
|
|
134
|
+
return false;
|
|
108
135
|
}
|
|
109
136
|
}
|
|
110
137
|
|
|
111
|
-
static
|
|
138
|
+
static containsField(formInstance: FormInstance, key) {
|
|
112
139
|
|
|
113
140
|
if (formInstance) {
|
|
114
|
-
|
|
115
|
-
return formInstance.
|
|
141
|
+
// console.log("formRef.current.getFieldsValue",formRef.current.getFieldValue(key));
|
|
142
|
+
return formInstance.getFieldInstance(key)?true:false;
|
|
116
143
|
} else {
|
|
117
144
|
return false;
|
|
118
145
|
}
|
|
@@ -133,7 +133,7 @@ export default class EntitySelect extends React.PureComponent<InnerEntitySelectP
|
|
|
133
133
|
const {ltmplConfig} = this.state;
|
|
134
134
|
let ltmplConfig_ = ltmplConfig;
|
|
135
135
|
if (!ltmplConfig_) {
|
|
136
|
-
ltmplConfig_ = (await HCDataSource.requestLtmplConfig(fieldConfig.serverKey ? fieldConfig.serverKey : serverKey, fieldConfig.sourceId)).ltmplConfig;
|
|
136
|
+
ltmplConfig_ = (await HCDataSource.requestLtmplConfig(fieldConfig.serverKey ? fieldConfig.serverKey : serverKey, fieldConfig.sourceId?fieldConfig.sourceId:fieldConfig.id)).ltmplConfig;
|
|
137
137
|
}
|
|
138
138
|
this.setState({
|
|
139
139
|
ltmplConfig: ltmplConfig_
|
|
@@ -58,7 +58,7 @@ function getOptions(mstrucId) {
|
|
|
58
58
|
const items = HCDataSource.getEnums(mstrucId);
|
|
59
59
|
if (items) {
|
|
60
60
|
items.map((item) => {
|
|
61
|
-
options.push({label: (item.order ? item.order + "." : "") + item.title, value: item.value})
|
|
61
|
+
options.push({label: (item.order && parseInt(item.order)>0 && parseInt(item.order)<10000 ? item.order + "." : "") + item.title, value: item.value})
|
|
62
62
|
})
|
|
63
63
|
}
|
|
64
64
|
return options;
|
|
@@ -53,7 +53,7 @@ const InputNumber: React.FC<InputNumberProps> = (props) => {
|
|
|
53
53
|
|
|
54
54
|
switch (itemType) {
|
|
55
55
|
case 'int':
|
|
56
|
-
entryControl = <AntdInputNumber style={{...style}} min={min} max={max} stringMode
|
|
56
|
+
entryControl = <AntdInputNumber style={{...style}} min={min} max={max} stringMode precision={0}
|
|
57
57
|
{...antdControlProps} value={valueSingle}
|
|
58
58
|
onChange={changeValue}
|
|
59
59
|
/>
|
|
@@ -71,11 +71,11 @@ const InputNumber: React.FC<InputNumberProps> = (props) => {
|
|
|
71
71
|
entryControl =
|
|
72
72
|
<Space>
|
|
73
73
|
<AntdInputNumber min={min} max={max}
|
|
74
|
-
placeholder={`开始`} value={valueBegin}
|
|
74
|
+
placeholder={`开始`} value={valueBegin} precision={0}
|
|
75
75
|
onKeyUp={changeInt} onChange={changeBeginValue}
|
|
76
76
|
/>~
|
|
77
77
|
<AntdInputNumber min={min} max={max}
|
|
78
|
-
placeholder={`结束`} value={valueEnd}
|
|
78
|
+
placeholder={`结束`} value={valueEnd} precision={0}
|
|
79
79
|
onKeyUp={changeInt} onChange={changeEndValue}
|
|
80
80
|
/>
|
|
81
81
|
</Space>;
|
|
@@ -23,7 +23,7 @@ class BottomSubmitButtonBar extends React.PureComponent<BottomSubmitButtonBarPro
|
|
|
23
23
|
|
|
24
24
|
render() {
|
|
25
25
|
const {} = this.state;
|
|
26
|
-
const {dtmplConfig,position, doSubmit, formRef, serial, serverKey} = this.props
|
|
26
|
+
const {dtmplConfig,position, doSubmit, formRef, serial, serverKey,dtmplData} = this.props
|
|
27
27
|
const {buttons, actions} = dtmplConfig;
|
|
28
28
|
|
|
29
29
|
return (<Card bordered={false}>
|
|
@@ -39,12 +39,11 @@ class BottomSubmitButtonBar extends React.PureComponent<BottomSubmitButtonBarPro
|
|
|
39
39
|
key="btn" block
|
|
40
40
|
>保 存</Button></Col> : null}
|
|
41
41
|
{actions ? actions.map((item, index) => {
|
|
42
|
-
return <Col ><Action serverKey={serverKey} serial={serial} key={item.id}
|
|
42
|
+
return <Col ><Action serverKey={serverKey} serial={serial} key={item.id} data={[dtmplData]}
|
|
43
43
|
formRef={formRef} actionConfig={item} doAction={doSubmit}></Action></Col>
|
|
44
44
|
}
|
|
45
45
|
) : ""}
|
|
46
46
|
</Space>
|
|
47
|
-
|
|
48
47
|
</Row>
|
|
49
48
|
</Card>
|
|
50
49
|
)
|
|
@@ -40,7 +40,7 @@ class FixRightSubmitButtonBar extends React.PureComponent<FixRightSubmitButtonPr
|
|
|
40
40
|
|
|
41
41
|
render() {
|
|
42
42
|
const {}=this.state;
|
|
43
|
-
const {dtmplConfig, doSubmit,formRef,serial,serverKey} = this.props
|
|
43
|
+
const {dtmplConfig, doSubmit,formRef,serial,serverKey,dtmplData} = this.props
|
|
44
44
|
const {buttons, actions} = dtmplConfig;
|
|
45
45
|
const cardList: TmplBase[] = [];
|
|
46
46
|
|
|
@@ -71,7 +71,7 @@ class FixRightSubmitButtonBar extends React.PureComponent<FixRightSubmitButtonPr
|
|
|
71
71
|
// type="primary"
|
|
72
72
|
// >{item.title}</Button>
|
|
73
73
|
// </Popconfirm>
|
|
74
|
-
return <Action serverKey={serverKey} iconType={'icon-title'} hiddenType={'disabled'} buttonType={'primary'} serial={serial} key={item.id} formRef={formRef} actionConfig={item} doAction={doSubmit}></Action>
|
|
74
|
+
return <Action serverKey={serverKey} data={[dtmplData]} iconType={'icon-title'} hiddenType={'disabled'} buttonType={'primary'} serial={serial} key={item.id} formRef={formRef} actionConfig={item} doAction={doSubmit}></Action>
|
|
75
75
|
}
|
|
76
76
|
})
|
|
77
77
|
}
|
|
@@ -105,7 +105,7 @@ class FixRightSubmitButtonBar extends React.PureComponent<FixRightSubmitButtonPr
|
|
|
105
105
|
{/*<Button block*/}
|
|
106
106
|
{/* type={'primary'}>{item.title}</Button>*/}
|
|
107
107
|
{/*</Popconfirm>*/}
|
|
108
|
-
<Action serverKey={serverKey} hiddenType={'disabled'} buttonType={'primary-block'} serial={serial} key={item.id} formRef={formRef} actionConfig={item} doAction={doSubmit}></Action>
|
|
108
|
+
<Action data={[dtmplData]} serverKey={serverKey} hiddenType={'disabled'} buttonType={'primary-block'} serial={serial} key={item.id} formRef={formRef} actionConfig={item} doAction={doSubmit}></Action>
|
|
109
109
|
</li>
|
|
110
110
|
}
|
|
111
111
|
}
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import React, {RefObject} from 'react'
|
|
2
2
|
import './index.css'
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
ActionConfig,
|
|
5
|
+
ButtonName,
|
|
6
|
+
ButtonPosition,
|
|
7
|
+
DtmplConfig,
|
|
8
|
+
DtmplData,
|
|
9
|
+
TmplBase
|
|
10
|
+
} from "../../../aldehyde/tmpl/interface";
|
|
4
11
|
import {Affix, Button, Popconfirm, Popover} from "antd";
|
|
5
12
|
import {LeftOutlined, SaveOutlined} from '@ant-design/icons';
|
|
6
13
|
import Action from "../../controls/action";
|
|
@@ -11,6 +18,7 @@ import BottomSubmitButtonBar from "./bottom-submit-button-bar";
|
|
|
11
18
|
export interface SubmitButtonProps {
|
|
12
19
|
serverKey?:string,
|
|
13
20
|
dtmplConfig: DtmplConfig,
|
|
21
|
+
dtmplData:DtmplData,
|
|
14
22
|
position?:ButtonPosition,
|
|
15
23
|
doSubmit: (actionId?: string,codes?:string[],params?:object) => void;
|
|
16
24
|
formRef: RefObject<FormInstance>,
|
|
@@ -34,12 +42,12 @@ class SubmitButtonBar extends React.PureComponent<SubmitButtonProps, SubmitButto
|
|
|
34
42
|
}
|
|
35
43
|
|
|
36
44
|
render() {
|
|
37
|
-
const {position, doSubmit, serial, dtmplConfig, formRef} = this.props;
|
|
45
|
+
const {position, doSubmit, serial, dtmplConfig, formRef,dtmplData} = this.props;
|
|
38
46
|
let posi = position ? position : dtmplConfig.buttonPosition ? dtmplConfig.buttonPosition : undefined
|
|
39
47
|
|
|
40
48
|
return <>{!posi || posi == 'fixedBottomRight' ?
|
|
41
|
-
<FixRightSubmitButtonBar doSubmit={doSubmit} serial={serial} dtmplConfig={dtmplConfig} formRef={formRef}/>
|
|
42
|
-
: <BottomSubmitButtonBar position={posi} doSubmit={doSubmit} serial={serial} dtmplConfig={dtmplConfig} formRef={formRef}/>
|
|
49
|
+
<FixRightSubmitButtonBar doSubmit={doSubmit} serial={serial} dtmplConfig={dtmplConfig} formRef={formRef} dtmplData={dtmplData}/>
|
|
50
|
+
: <BottomSubmitButtonBar position={posi} doSubmit={doSubmit} serial={serial} dtmplConfig={dtmplConfig} formRef={formRef} dtmplData={dtmplData}/>
|
|
43
51
|
}</>
|
|
44
52
|
}
|
|
45
53
|
}
|
|
@@ -66,7 +66,7 @@ export default class DtmplEdit extends React.PureComponent<DtmplEditProps, Dtmpl
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
loadConfigData = async () => {
|
|
69
|
-
const { sourceId,code,serverKey} = this.props;
|
|
69
|
+
const { sourceId,code,serverKey,addTmplId} = this.props;
|
|
70
70
|
this.setState({
|
|
71
71
|
loading: true,
|
|
72
72
|
})
|
|
@@ -74,7 +74,7 @@ export default class DtmplEdit extends React.PureComponent<DtmplEditProps, Dtmpl
|
|
|
74
74
|
if(code){
|
|
75
75
|
dtmplConfig = await HCDataSource.requestDtmplConfig(serverKey,sourceId,code);
|
|
76
76
|
}else{
|
|
77
|
-
dtmplConfig = await HCDataSource.requestAddDtmplConfig(serverKey,sourceId);
|
|
77
|
+
dtmplConfig = await HCDataSource.requestAddDtmplConfig(serverKey,sourceId,addTmplId);
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
|
|
@@ -95,12 +95,12 @@ export default class DtmplEdit extends React.PureComponent<DtmplEditProps, Dtmpl
|
|
|
95
95
|
code=await HcserviceV3.queryCode(sourceId,codeSource,serverKey);
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
if(dtmplConfig.
|
|
98
|
+
if(dtmplConfig.autoSaveInterval && dtmplConfig.autoSaveInterval>0){
|
|
99
99
|
if(this.autoSaveInterval){
|
|
100
100
|
clearInterval(this.autoSaveInterval);
|
|
101
101
|
}
|
|
102
102
|
this.autoSaveInterval = setInterval(() => {
|
|
103
|
-
if(this.autoSaveTimer>=dtmplConfig.
|
|
103
|
+
if(this.autoSaveTimer>=dtmplConfig.autoSaveInterval){
|
|
104
104
|
//console.log('执行自动保存');
|
|
105
105
|
this.autoSaveTimer=-1000000000000000;
|
|
106
106
|
this.doSubmit(undefined);
|
|
@@ -231,7 +231,8 @@ export default class DtmplEdit extends React.PureComponent<DtmplEditProps, Dtmpl
|
|
|
231
231
|
{showRightNav ?
|
|
232
232
|
<RightBar parentId={id} dtmplConfig={dtmplConfig}/> : ""
|
|
233
233
|
}
|
|
234
|
-
|
|
234
|
+
|
|
235
|
+
<SubmitButtonBar dtmplData={dtmplData} serverKey={serverKey} serial={serial} dtmplConfig={dtmplConfig} doSubmit={this.doSubmit} formRef={this.formRef}></SubmitButtonBar>
|
|
235
236
|
<CqueryButtonBar serverKey={serverKey} dtmplConfig={dtmplConfig} mainCode={code}></CqueryButtonBar>
|
|
236
237
|
<PostResult
|
|
237
238
|
open={showPostResult}
|
|
@@ -59,10 +59,10 @@ class MainPage extends React.PureComponent<MainPageProps, MainPageState> {
|
|
|
59
59
|
let blockRes = await HCDataSource.requestBlocks(l2MenuId ? l2MenuId : undefined, blockId ? blockId : undefined);
|
|
60
60
|
this.setState((state) => ({
|
|
61
61
|
isImporter: currentURL.hash.indexOf('/importer') > 0,
|
|
62
|
-
blocks: blockRes.blocks ? blockRes.blocks : [],
|
|
63
|
-
currentL2MenuId: blockRes.l2MenuId,
|
|
64
|
-
currentBlockId: blockRes.blockId,
|
|
65
|
-
sideBartitle: blockRes.programName,
|
|
62
|
+
blocks:blockRes && blockRes.blocks ? blockRes.blocks : [],
|
|
63
|
+
currentL2MenuId: blockRes? blockRes.l2MenuId:null,
|
|
64
|
+
currentBlockId: blockRes? blockRes.blockId:null,
|
|
65
|
+
sideBartitle: blockRes ?blockRes.programName:null,
|
|
66
66
|
}));
|
|
67
67
|
|
|
68
68
|
}
|
|
@@ -102,6 +102,7 @@ class ContextSetter extends React.PureComponent<ContextSetterProps, ContextSette
|
|
|
102
102
|
controlType: 'entity-select',
|
|
103
103
|
max: "1",
|
|
104
104
|
required: true,
|
|
105
|
+
sourceId:c.groupId,
|
|
105
106
|
suppleOptions: c.canNotSet ? [{code: 'all', title: '不设置'}] : undefined
|
|
106
107
|
}}
|
|
107
108
|
/>
|
|
@@ -63,7 +63,7 @@ export default class DtmplEditCard extends React.PureComponent<DtmplEditCardProp
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
loadConfigData = async () => {
|
|
66
|
-
const { sourceId,code,serverKey} = this.props;
|
|
66
|
+
const { sourceId,code,serverKey,addTmplId} = this.props;
|
|
67
67
|
this.setState({
|
|
68
68
|
loading: true,
|
|
69
69
|
})
|
|
@@ -71,7 +71,7 @@ export default class DtmplEditCard extends React.PureComponent<DtmplEditCardProp
|
|
|
71
71
|
if(code){
|
|
72
72
|
dtmplConfig = await HCDataSource.requestDtmplConfig(serverKey,sourceId,code);
|
|
73
73
|
}else{
|
|
74
|
-
dtmplConfig = await HCDataSource.requestAddDtmplConfig(serverKey,sourceId);
|
|
74
|
+
dtmplConfig = await HCDataSource.requestAddDtmplConfig(serverKey,sourceId,addTmplId);
|
|
75
75
|
}
|
|
76
76
|
await this.loadData(dtmplConfig);
|
|
77
77
|
this.setState({
|
|
@@ -88,12 +88,12 @@ export default class DtmplEditCard extends React.PureComponent<DtmplEditCardProp
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
//重设定时器
|
|
91
|
-
if(dtmplConfig.
|
|
91
|
+
if(dtmplConfig.autoSaveInterval && dtmplConfig.autoSaveInterval>0){
|
|
92
92
|
if(this.autoSaveInterval){
|
|
93
93
|
clearInterval( this.autoSaveInterval);
|
|
94
94
|
}
|
|
95
95
|
this.autoSaveInterval = setInterval(() => {
|
|
96
|
-
if(this.autoSaveTimer>=dtmplConfig.
|
|
96
|
+
if(this.autoSaveTimer>=dtmplConfig.autoSaveInterval){
|
|
97
97
|
// console.log('执行自动保存');
|
|
98
98
|
this.autoSaveTimer=-1000000000000000;
|
|
99
99
|
this.doSubmit(undefined);
|
|
@@ -67,7 +67,7 @@ export default class DtmplEditPage extends React.PureComponent<ModalEditorProps,
|
|
|
67
67
|
async componentDidUpdate(prevProps) {
|
|
68
68
|
const { dtmplConfig} = this.state;
|
|
69
69
|
if(prevProps && prevProps!=this.props){
|
|
70
|
-
if(prevProps.sourceId!=this.props.sourceId || dtmplConfig==null){
|
|
70
|
+
if(prevProps.sourceId != this.props.sourceId || prevProps.code!=this.props.code || prevProps.addTmplId!= this.props.addTmplId || dtmplConfig==null){
|
|
71
71
|
await this.loadConfigData();
|
|
72
72
|
}else{
|
|
73
73
|
await this.loadData(dtmplConfig);
|
|
@@ -82,7 +82,7 @@ export default class DtmplEditPage extends React.PureComponent<ModalEditorProps,
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
loadConfigData = async () => {
|
|
85
|
-
const { sourceId,open,code,serverKey} = this.props;
|
|
85
|
+
const { sourceId,open,code,serverKey,addTmplId} = this.props;
|
|
86
86
|
this.setState({
|
|
87
87
|
loading: true,
|
|
88
88
|
})
|
|
@@ -90,7 +90,7 @@ export default class DtmplEditPage extends React.PureComponent<ModalEditorProps,
|
|
|
90
90
|
if(code){
|
|
91
91
|
dtmplConfig = await HCDataSource.requestDtmplConfig(serverKey,sourceId,code);
|
|
92
92
|
}else{
|
|
93
|
-
dtmplConfig = await HCDataSource.requestAddDtmplConfig(serverKey,sourceId);
|
|
93
|
+
dtmplConfig = await HCDataSource.requestAddDtmplConfig(serverKey,sourceId,addTmplId);
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
await this.loadData(dtmplConfig);
|
|
@@ -107,12 +107,12 @@ export default class DtmplEditPage extends React.PureComponent<ModalEditorProps,
|
|
|
107
107
|
return;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
if(dtmplConfig.
|
|
110
|
+
if(dtmplConfig.autoSaveInterval && dtmplConfig.autoSaveInterval>0){
|
|
111
111
|
if(this.autoSaveInterval){
|
|
112
112
|
clearInterval( this.autoSaveInterval);
|
|
113
113
|
}
|
|
114
114
|
this.autoSaveInterval = setInterval(() => {
|
|
115
|
-
if(this.autoSaveTimer>=dtmplConfig.
|
|
115
|
+
if(this.autoSaveTimer>=dtmplConfig.autoSaveInterval){
|
|
116
116
|
//console.log('执行自动保存');
|
|
117
117
|
this.autoSaveTimer=-1000000000000000;
|
|
118
118
|
this.doSubmit(undefined);
|
|
@@ -62,7 +62,7 @@ export default class DtmplEditPage extends React.PureComponent<ModalEditorProps,
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
loadConfigData = async () => {
|
|
65
|
-
const { sourceId,open,code,serverKey} = this.props;
|
|
65
|
+
const { sourceId,open,code,serverKey,addTmplId} = this.props;
|
|
66
66
|
this.setState({
|
|
67
67
|
loading: true,
|
|
68
68
|
})
|
|
@@ -70,7 +70,7 @@ export default class DtmplEditPage extends React.PureComponent<ModalEditorProps,
|
|
|
70
70
|
if(code){
|
|
71
71
|
dtmplConfig = await HCDataSource.requestDtmplConfig(serverKey,sourceId,code);
|
|
72
72
|
}else{
|
|
73
|
-
dtmplConfig = await HCDataSource.requestAddDtmplConfig(serverKey,sourceId);
|
|
73
|
+
dtmplConfig = await HCDataSource.requestAddDtmplConfig(serverKey,sourceId,addTmplId);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
|
|
@@ -87,12 +87,12 @@ export default class DtmplEditPage extends React.PureComponent<ModalEditorProps,
|
|
|
87
87
|
return;
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
if(dtmplConfig.
|
|
90
|
+
if(dtmplConfig.autoSaveInterval && dtmplConfig.autoSaveInterval>0){
|
|
91
91
|
if(this.autoSaveInterval){
|
|
92
92
|
clearInterval( this.autoSaveInterval);
|
|
93
93
|
}
|
|
94
94
|
this.autoSaveInterval = setInterval(() => {
|
|
95
|
-
if(this.autoSaveTimer>=dtmplConfig.
|
|
95
|
+
if(this.autoSaveTimer>=dtmplConfig.autoSaveInterval){
|
|
96
96
|
//console.log('执行自动保存');
|
|
97
97
|
this.autoSaveTimer=-1000000000000000;
|
|
98
98
|
this.doSubmit(undefined);
|
|
@@ -9,6 +9,7 @@ export interface DtmplViewCardProps {
|
|
|
9
9
|
title?:any,
|
|
10
10
|
serverKey?:string,
|
|
11
11
|
sourceId?:string,
|
|
12
|
+
addTmplId?:string,
|
|
12
13
|
code?:string;
|
|
13
14
|
mainCode?:string;
|
|
14
15
|
editable?:boolean;
|
|
@@ -54,10 +55,10 @@ class DtmplViewCard extends React.PureComponent<DtmplViewCardProps, DtmplViewCar
|
|
|
54
55
|
|
|
55
56
|
render() {
|
|
56
57
|
const {showDtmplEdit} = this.state;
|
|
57
|
-
const { sourceId,code,mainCode,editable,serverKey,codeSource,title,showHeader} = this.props;
|
|
58
|
+
const { sourceId,code,mainCode,editable,serverKey,codeSource,title,showHeader,addTmplId} = this.props;
|
|
58
59
|
return <>
|
|
59
60
|
<ActDtmplView showHeader={showHeader} title={title} codeSource={codeSource} serverKey={serverKey} goDtmpl={editable?this.goDtmpl:null} sourceId={sourceId} code={code} mainCode={mainCode}></ActDtmplView>
|
|
60
|
-
{showDtmplEdit? <DtmplEditModal codeSource={codeSource} serverKey={serverKey} open={showDtmplEdit} onCancel={()=>{
|
|
61
|
+
{showDtmplEdit? <DtmplEditModal addTmplId={addTmplId} codeSource={codeSource} serverKey={serverKey} open={showDtmplEdit} onCancel={()=>{
|
|
61
62
|
this.setState({
|
|
62
63
|
showDtmplEdit:false,
|
|
63
64
|
})}}
|
|
@@ -15,6 +15,7 @@ interface EmbedDtmplEditPageProps {
|
|
|
15
15
|
codeSource?:CodeSource,
|
|
16
16
|
onFinish: (code:string) => void,
|
|
17
17
|
defaultDtmplData?:DtmplData,
|
|
18
|
+
addTmplId?:string,
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
interface EmbedDtmplEditPageState {
|
|
@@ -67,7 +68,7 @@ export default class EmbedDtmplEditPage extends React.PureComponent<EmbedDtmplEd
|
|
|
67
68
|
}
|
|
68
69
|
|
|
69
70
|
loadConfigData = async () => {
|
|
70
|
-
const {code,sourceId,serverKey,group} = this.props;
|
|
71
|
+
const {code,sourceId,serverKey,group,addTmplId} = this.props;
|
|
71
72
|
this.setState({
|
|
72
73
|
loading: true,
|
|
73
74
|
})
|
|
@@ -75,7 +76,7 @@ export default class EmbedDtmplEditPage extends React.PureComponent<EmbedDtmplEd
|
|
|
75
76
|
if(code){
|
|
76
77
|
dtmplConfig = await HCDataSource.requestDtmplConfig(serverKey,sourceId,code);
|
|
77
78
|
}else{
|
|
78
|
-
dtmplConfig = await HCDataSource.requestAddDtmplConfig(serverKey,sourceId);
|
|
79
|
+
dtmplConfig = await HCDataSource.requestAddDtmplConfig(serverKey,sourceId,addTmplId);
|
|
79
80
|
}
|
|
80
81
|
await this.loadData(dtmplConfig);
|
|
81
82
|
this.setState({
|
|
@@ -40,6 +40,7 @@ export interface LtmplTableState {
|
|
|
40
40
|
showDtmplCustomEdit?: boolean;
|
|
41
41
|
ractionId?: string,
|
|
42
42
|
collapse?: boolean,
|
|
43
|
+
addTmplId?:string,
|
|
43
44
|
};
|
|
44
45
|
|
|
45
46
|
class LtmplTable extends React.PureComponent<LtmplTableProps, LtmplTableState> {
|
|
@@ -56,6 +57,7 @@ class LtmplTable extends React.PureComponent<LtmplTableProps, LtmplTableState> {
|
|
|
56
57
|
showDraw: false,
|
|
57
58
|
ractionId: undefined,
|
|
58
59
|
collapse: false,
|
|
60
|
+
addTmplId:undefined,
|
|
59
61
|
}
|
|
60
62
|
|
|
61
63
|
static defaultProps = {
|
|
@@ -143,7 +145,7 @@ class LtmplTable extends React.PureComponent<LtmplTableProps, LtmplTableState> {
|
|
|
143
145
|
ractionId
|
|
144
146
|
})
|
|
145
147
|
}
|
|
146
|
-
doCreate = (toCustomPage) => {
|
|
148
|
+
doCreate = (addTmplId:string,toCustomPage?:boolean,) => {
|
|
147
149
|
const {doCustomCreate} = this.props
|
|
148
150
|
if (toCustomPage) {
|
|
149
151
|
if (doCustomCreate) {
|
|
@@ -160,6 +162,7 @@ class LtmplTable extends React.PureComponent<LtmplTableProps, LtmplTableState> {
|
|
|
160
162
|
this.setState({
|
|
161
163
|
selectedCode: null,
|
|
162
164
|
showDtmplEdit: true,
|
|
165
|
+
addTmplId,
|
|
163
166
|
})
|
|
164
167
|
}
|
|
165
168
|
}
|
|
@@ -203,7 +206,7 @@ class LtmplTable extends React.PureComponent<LtmplTableProps, LtmplTableState> {
|
|
|
203
206
|
|
|
204
207
|
|
|
205
208
|
render() {
|
|
206
|
-
const {ltmplConfigRes, criteriaData,pageSize,pageNo, showDtmplView, selectedCode, showDtmplEdit, showDtmplCustomEdit, ractionId, showDraw, collapse} = this.state;
|
|
209
|
+
const {ltmplConfigRes, criteriaData,pageSize,pageNo, showDtmplView, selectedCode, showDtmplEdit, showDtmplCustomEdit, ractionId, showDraw, collapse,addTmplId} = this.state;
|
|
207
210
|
const {sourceId, mainCode, showView, doSearch, doRAction, funcMode, tip,title, collapsible, initCollapse,doCustomEdit,doCustomCreate,serverKey,readOnly} = this.props;
|
|
208
211
|
|
|
209
212
|
if (!ltmplConfigRes) {
|
|
@@ -227,7 +230,7 @@ class LtmplTable extends React.PureComponent<LtmplTableProps, LtmplTableState> {
|
|
|
227
230
|
sourceId={sourceId}
|
|
228
231
|
code={selectedCode}> </ModalDtmplView> : ""}
|
|
229
232
|
{(buttons.includes('dtmplEdit') || buttons.includes('dtmplAdd')) && showDtmplEdit ?
|
|
230
|
-
<DtmplEditPage serverKey={serverKey} open={showDtmplEdit} onCancel={() => {
|
|
233
|
+
<DtmplEditPage addTmplId={addTmplId} serverKey={serverKey} open={showDtmplEdit} onCancel={() => {
|
|
231
234
|
this.setState({
|
|
232
235
|
showDtmplEdit: false,
|
|
233
236
|
})
|
|
@@ -114,8 +114,10 @@ class DtmplRoute extends React.Component<DtmplRouteProps, DtmplRoutePropsStat> {
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
render() {
|
|
117
|
-
|
|
118
|
-
const {
|
|
117
|
+
|
|
118
|
+
const {location,params,searchParams}=this.props;
|
|
119
|
+
const {sourceId} = params;
|
|
120
|
+
|
|
119
121
|
const {codeSource}=this.state;
|
|
120
122
|
if(!location){
|
|
121
123
|
return <></>;
|
|
@@ -132,7 +134,7 @@ class DtmplRoute extends React.Component<DtmplRouteProps, DtmplRoutePropsStat> {
|
|
|
132
134
|
);
|
|
133
135
|
}else{
|
|
134
136
|
return (
|
|
135
|
-
<DtmplEdit serverKey={null} addOrUpdate={this.getMode()} sourceId={sourceId} code={code} mainCode={this.getMainCode()} goBackToLtmpl={codeSource?undefined:this.goBackToLtmpl} goDtmpl={this.goDtmpl}></DtmplEdit>
|
|
137
|
+
<DtmplEdit addTmplId={searchParams.get('addTmplId')} serverKey={null} addOrUpdate={this.getMode()} sourceId={sourceId} code={code} mainCode={this.getMainCode()} goBackToLtmpl={codeSource?undefined:this.goBackToLtmpl} goDtmpl={this.goDtmpl}></DtmplEdit>
|
|
136
138
|
);
|
|
137
139
|
}
|
|
138
140
|
|
|
@@ -101,11 +101,11 @@ class LtmplRoute extends React.PureComponent<LtmplRouteProps, LtmplRouteState> {
|
|
|
101
101
|
return mainCode;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
doCreate = (toCustomPage: boolean = false) => {
|
|
104
|
+
doCreate = (addTmplId:string,toCustomPage: boolean = false) => {
|
|
105
105
|
const {basePath} = this.props;
|
|
106
106
|
const {sourceId} = this.props.params;
|
|
107
107
|
const {ltmplConfigRes} = this.state;
|
|
108
|
-
let path = `${basePath}/${sourceId}/detail-edit?menuId=${this.getMenuId()}`;
|
|
108
|
+
let path = `${basePath}/${sourceId}/detail-edit?menuId=${this.getMenuId()}&addTmplId=${addTmplId?addTmplId:""}`;
|
|
109
109
|
if (toCustomPage && ltmplConfigRes.ltmplConfig.customEditPagePath) {
|
|
110
110
|
path = `${basePath}/page/${sourceId}${ltmplConfigRes.ltmplConfig.customEditPagePath}?menuId=${this.getMenuId()}`;
|
|
111
111
|
}
|