aldehyde 0.2.93 → 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 +3 -3
- 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 +2 -2
- package/lib/module/dtmpl-edit-page.js +3 -3
- package/lib/module/dtmpl-edit-page.js.map +1 -1
- package/lib/module/dtmpl-editor.js +2 -2
- package/lib/routable/ltmpl-route.js +1 -1
- package/lib/routable/ltmpl-route.js.map +1 -1
- package/lib/tmpl/hc-data-source.d.ts.map +1 -1
- package/lib/tmpl/hc-data-source.js +12 -10
- package/lib/tmpl/hc-data-source.js.map +1 -1
- package/lib/tmpl/hcservice-v3.js +3 -3
- package/lib/tmpl/hcservice-v3.js.map +1 -1
- package/lib/tmpl/interface.d.ts +1 -1
- package/lib/tmpl/interface.d.ts.map +1 -1
- package/lib/tmpl/superagent.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 +4 -3
- 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 +2 -2
- package/src/aldehyde/module/dtmpl-edit-page.tsx +3 -3
- package/src/aldehyde/module/dtmpl-editor.tsx +2 -2
- package/src/aldehyde/routable/ltmpl-route.tsx +1 -1
- package/src/aldehyde/tmpl/hc-data-source.tsx +13 -11
- package/src/aldehyde/tmpl/hcservice-v3.tsx +3 -3
- package/src/aldehyde/tmpl/interface.tsx +1 -1
- package/src/aldehyde/tmpl/superagent.js +1 -1
|
@@ -145,14 +145,13 @@ export default class Action extends React.PureComponent<ActionProps, ActionState
|
|
|
145
145
|
disabled_ = true;
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
|
-
return <Popover placement="
|
|
148
|
+
return <Popover placement="top" open={popoverOpen} trigger="click" content={
|
|
149
149
|
<FieldsEditCard serverKey={serverKey} okDanger={actionConfig.beforeExeConfirm == 'danger'} needConfirm={true} title={actionConfig.title} onCancel={() => this.onCancel()} fields={actionConfig.writes}
|
|
150
150
|
value={this.getValue()} onOk={this.onOk}
|
|
151
151
|
onValuesChange={this.onValuesChange}/>}>
|
|
152
152
|
<Button danger={actionConfig.danger } type={this.getButtonType()} shape={actionConfig.buttonShape} block={this.blockButton()} size={buttonSize}
|
|
153
153
|
onClick={() => this.setState({popoverOpen: !popoverOpen})}
|
|
154
154
|
disabled={disabled_} >{this.getTitle()}</Button>
|
|
155
|
-
|
|
156
155
|
</Popover>
|
|
157
156
|
}
|
|
158
157
|
|
|
@@ -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
|
}
|
|
@@ -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
|
/>
|
|
@@ -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 || prevProps.addTmplId!= this.props.addTmplId || 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);
|
|
@@ -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);
|
|
@@ -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);
|
|
@@ -105,7 +105,7 @@ class LtmplRoute extends React.PureComponent<LtmplRouteProps, LtmplRouteState> {
|
|
|
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()}&addTmplId=${addTmplId}`;
|
|
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
|
}
|
|
@@ -200,7 +200,7 @@ HCDataSource.requestDtmplConfig = async function (serverKey: string, sourceId: s
|
|
|
200
200
|
if (!dtmplConfigMap.has(sourceId)) {
|
|
201
201
|
let dtmplConfig:DtmplConfig=await HcserviceV3.requestDtmplConfig(serverKey, sourceId,code);
|
|
202
202
|
|
|
203
|
-
if(!dtmplConfig.dynamic){
|
|
203
|
+
if(dtmplConfig && !dtmplConfig.dynamic){
|
|
204
204
|
dtmplConfigMap.set(sourceId,dtmplConfig);
|
|
205
205
|
}else{
|
|
206
206
|
//直接返回
|
|
@@ -274,17 +274,19 @@ HCDataSource.requestBlocks = async (l2MenuId: string, blockId: string) => {
|
|
|
274
274
|
let result;
|
|
275
275
|
if (blocksCache.length < 1) {
|
|
276
276
|
let blockRes = await HcserviceV3.requestBlocks(l2MenuId ? l2MenuId : undefined, blockId ? blockId : undefined);
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
277
|
+
if(blockRes){
|
|
278
|
+
for (let block of blockRes.blocks) {
|
|
279
|
+
blocksCache.push(block);
|
|
280
|
+
}
|
|
281
|
+
programName = blockRes.programName;
|
|
282
|
+
result = {
|
|
283
|
+
blocks: blockRes.blocks,
|
|
284
|
+
l2MenuId: blockRes.l2MenuId,
|
|
285
|
+
blockId: blockRes.blockId,
|
|
286
|
+
programName: blockRes.programName,
|
|
287
|
+
};
|
|
280
288
|
}
|
|
281
|
-
|
|
282
|
-
result = {
|
|
283
|
-
blocks: blockRes.blocks,
|
|
284
|
-
l2MenuId: blockRes.l2MenuId,
|
|
285
|
-
blockId: blockRes.blockId,
|
|
286
|
-
programName: blockRes.programName,
|
|
287
|
-
};
|
|
289
|
+
|
|
288
290
|
} else {
|
|
289
291
|
result = {
|
|
290
292
|
blocks: blocksCache,
|
|
@@ -649,7 +649,7 @@ export default class HcserviceV3 {
|
|
|
649
649
|
url: '/v3/auth/context-source-value',
|
|
650
650
|
method: "GET"
|
|
651
651
|
})
|
|
652
|
-
return res.value;
|
|
652
|
+
return res?res.value:null;
|
|
653
653
|
}
|
|
654
654
|
|
|
655
655
|
static async login(json, kaptchaToken, kaptchaText, pubkey,programCode?:string) {
|
|
@@ -720,7 +720,7 @@ export default class HcserviceV3 {
|
|
|
720
720
|
header:{programCode,hydrocarbonToken},
|
|
721
721
|
url: '/v3/current-user',
|
|
722
722
|
});
|
|
723
|
-
return res.user;
|
|
723
|
+
return res?res.user:null;
|
|
724
724
|
}
|
|
725
725
|
|
|
726
726
|
// static async requestMessagebar() {
|
|
@@ -747,7 +747,7 @@ export default class HcserviceV3 {
|
|
|
747
747
|
url: url,
|
|
748
748
|
method: "GET",
|
|
749
749
|
})
|
|
750
|
-
return res.fastMenu;
|
|
750
|
+
return res?res.fastMenu:null;
|
|
751
751
|
}
|
|
752
752
|
|
|
753
753
|
static async reload() {
|
|
@@ -152,7 +152,7 @@ export interface FieldGroupConfig extends OrderableTmplBase {
|
|
|
152
152
|
export type SaveJumpType = 'list' | 'add' | 'edit';
|
|
153
153
|
|
|
154
154
|
export interface DtmplConfig extends TmplBase {
|
|
155
|
-
|
|
155
|
+
autoSaveInterval?: number;
|
|
156
156
|
//exportExcel fusionMode history dtmplSave refresh
|
|
157
157
|
buttons: ButtonName[];
|
|
158
158
|
// list add edit
|
|
@@ -143,7 +143,7 @@ export default class Superagent {
|
|
|
143
143
|
|
|
144
144
|
static getHeaderObj() {
|
|
145
145
|
return {
|
|
146
|
-
'hydrocarbon-token': Units.hydrocarbonToken() ?Units.hydrocarbonToken() : Units.getAnoHydrocarbonToken(),
|
|
146
|
+
'hydrocarbon-token': Units.hydrocarbonToken() ? Units.hydrocarbonToken() : Units.getAnoHydrocarbonToken(),
|
|
147
147
|
'hydrocarbon-program-token': Units.programCode()
|
|
148
148
|
}
|
|
149
149
|
}
|