aldehyde 0.1.18 → 0.1.19
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 +4 -0
- package/lib/controls/action/index.d.ts.map +1 -1
- package/lib/controls/action/index.js +28 -5
- package/lib/controls/action/index.js.map +1 -1
- package/lib/controls/action/utils.js +1 -1
- package/lib/controls/action/utils.js.map +1 -1
- package/lib/controls/cquery/cquick-button.d.ts +1 -2
- package/lib/controls/cquery/cquick-button.d.ts.map +1 -1
- package/lib/controls/cquery/cquick-button.js +3 -10
- package/lib/controls/cquery/cquick-button.js.map +1 -1
- package/lib/controls/date-picker/index.d.ts.map +1 -1
- package/lib/controls/date-picker/index.js +11 -19
- package/lib/controls/date-picker/index.js.map +1 -1
- package/lib/controls/entity-select/entity-select.d.ts.map +1 -1
- package/lib/controls/entity-select/entity-select.js +6 -4
- package/lib/controls/entity-select/entity-select.js.map +1 -1
- package/lib/controls/entity-select/lab-tree-select.d.ts +25 -0
- package/lib/controls/entity-select/lab-tree-select.d.ts.map +1 -0
- package/lib/controls/entity-select/lab-tree-select.js +121 -0
- package/lib/controls/entity-select/lab-tree-select.js.map +1 -0
- package/lib/controls/entity-select/popover-entity-select.d.ts.map +1 -1
- package/lib/controls/entity-select/popover-entity-select.js +13 -1
- package/lib/controls/entity-select/popover-entity-select.js.map +1 -1
- package/lib/controls/entry-control.d.ts.map +1 -1
- package/lib/controls/entry-control.js +19 -3
- package/lib/controls/entry-control.js.map +1 -1
- package/lib/controls/enum-tag/index.d.ts.map +1 -1
- package/lib/controls/enum-tag/index.js +7 -1
- package/lib/controls/enum-tag/index.js.map +1 -1
- package/lib/controls/input-number/index.js +7 -7
- package/lib/controls/input-number/index.js.map +1 -1
- package/lib/controls/view-control.d.ts.map +1 -1
- package/lib/controls/view-control.js +5 -0
- package/lib/controls/view-control.js.map +1 -1
- package/lib/detail/button/submit-button-bar.js +1 -1
- package/lib/detail/button/submit-button-bar.js.map +1 -1
- package/lib/detail/edit/{modal-dtmpl-edit.d.ts → dtmpl-edit-page.d.ts} +8 -4
- package/lib/detail/edit/dtmpl-edit-page.d.ts.map +1 -0
- package/lib/detail/edit/{modal-dtmpl-edit.js → dtmpl-edit-page.js} +19 -10
- package/lib/detail/edit/dtmpl-edit-page.js.map +1 -0
- package/lib/form/criteria-form.js.map +1 -1
- package/lib/form/dtmpl-form.d.ts +4 -0
- package/lib/form/dtmpl-form.d.ts.map +1 -1
- package/lib/form/dtmpl-form.js +7 -4
- package/lib/form/dtmpl-form.js.map +1 -1
- package/lib/form/form-Item-group.d.ts +2 -0
- package/lib/form/form-Item-group.d.ts.map +1 -1
- package/lib/form/form-Item-group.js +5 -1
- package/lib/form/form-Item-group.js.map +1 -1
- package/lib/icon/index.d.ts +11 -0
- package/lib/icon/index.d.ts.map +1 -0
- package/lib/icon/index.js +22 -0
- package/lib/icon/index.js.map +1 -0
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/module/dtmpl-view-page.js +2 -2
- package/lib/module/dtmpl-view-page.js.map +1 -1
- package/lib/module/ltmpl-page.js +2 -2
- package/lib/module/ltmpl-page.js.map +1 -1
- package/lib/table/act-table.js +1 -1
- package/lib/table/act-table.js.map +1 -1
- package/lib/table/column/column-selector.d.ts +0 -1
- package/lib/table/column/column-selector.d.ts.map +1 -1
- package/lib/table/column/column-selector.js +0 -1
- package/lib/table/column/column-selector.js.map +1 -1
- package/lib/table/index.css +1 -1
- package/lib/table/relation-table.d.ts +3 -1
- package/lib/table/relation-table.d.ts.map +1 -1
- package/lib/table/relation-table.js +11 -5
- package/lib/table/relation-table.js.map +1 -1
- package/lib/tmpl/control-type-supportor.d.ts.map +1 -1
- package/lib/tmpl/control-type-supportor.js +8 -1
- package/lib/tmpl/control-type-supportor.js.map +1 -1
- package/lib/tmpl/hcservice-v3.d.ts +2 -1
- package/lib/tmpl/hcservice-v3.d.ts.map +1 -1
- package/lib/tmpl/hcservice-v3.js +12 -0
- package/lib/tmpl/hcservice-v3.js.map +1 -1
- package/lib/tmpl/interface.d.ts +6 -2
- package/lib/tmpl/interface.d.ts.map +1 -1
- package/lib/tmpl/interface.js.map +1 -1
- package/lib/tmpl/tmpl-config-analysis.js +2 -2
- package/lib/tmpl/tmpl-config-analysis.js.map +1 -1
- package/lib/units/index.d.ts +4 -1
- package/lib/units/index.d.ts.map +1 -1
- package/lib/units/index.js +12 -0
- package/lib/units/index.js.map +1 -1
- package/package.json +1 -1
- package/src/aldehyde/controls/action/index.tsx +24 -6
- package/src/aldehyde/controls/action/utils.tsx +1 -1
- package/src/aldehyde/controls/cquery/cquick-button.tsx +5 -26
- package/src/aldehyde/controls/date-picker/index.tsx +15 -18
- package/src/aldehyde/controls/entity-select/entity-select.tsx +6 -4
- package/src/aldehyde/controls/entity-select/lab-tree-select.tsx +148 -0
- package/src/aldehyde/controls/entity-select/popover-entity-select.tsx +13 -1
- package/src/aldehyde/controls/entry-control.tsx +20 -3
- package/src/aldehyde/controls/enum-tag/index.tsx +8 -2
- package/src/aldehyde/controls/input-number/index.tsx +7 -7
- package/src/aldehyde/controls/view-control.tsx +5 -1
- package/src/aldehyde/detail/button/submit-button-bar.tsx +1 -1
- package/src/aldehyde/detail/edit/{modal-dtmpl-edit.tsx → dtmpl-edit-page.tsx} +36 -13
- package/src/aldehyde/form/criteria-form.tsx +1 -1
- package/src/aldehyde/form/dtmpl-form.tsx +8 -4
- package/src/aldehyde/form/form-Item-group.tsx +6 -1
- package/src/aldehyde/icon/index.tsx +30 -0
- package/src/aldehyde/index.tsx +2 -2
- package/src/aldehyde/module/dtmpl-view-page.tsx +5 -5
- package/src/aldehyde/module/ltmpl-page.tsx +5 -5
- package/src/aldehyde/table/act-table.tsx +1 -1
- package/src/aldehyde/table/column/column-selector.tsx +0 -1
- package/src/aldehyde/table/index.css +1 -1
- package/src/aldehyde/table/relation-table.tsx +17 -8
- package/src/aldehyde/tmpl/control-type-supportor.tsx +7 -1
- package/src/aldehyde/tmpl/hcservice-v3.tsx +16 -1
- package/src/aldehyde/tmpl/interface.tsx +6 -3
- package/src/aldehyde/tmpl/tmpl-config-analysis.tsx +2 -2
- package/src/aldehyde/units/index.tsx +20 -1
- package/lib/detail/edit/modal-dtmpl-edit.d.ts.map +0 -1
- package/lib/detail/edit/modal-dtmpl-edit.js.map +0 -1
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import {Button, Select, Spin,TreeSelect} from 'antd'
|
|
3
|
+
import {EControlProps, PageInfo, QueryData, QueryKey, SelectConfig, SourceName} from "../../tmpl/interface";
|
|
4
|
+
import {SearchOutlined} from '@ant-design/icons';
|
|
5
|
+
import debounce from 'lodash/debounce';
|
|
6
|
+
import './index.css';
|
|
7
|
+
import HcserviceV3 from "../../tmpl/hcservice-v3";
|
|
8
|
+
import HCDataSource from "../../tmpl/hc-data-source";
|
|
9
|
+
|
|
10
|
+
interface LabTreeSelectProps extends EControlProps {
|
|
11
|
+
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
interface LabTreeSelectState {
|
|
15
|
+
treeData: object[],
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
type LoadDataSource = {
|
|
19
|
+
options: any[],
|
|
20
|
+
touchEnd: boolean,
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default class LabTreeSelect extends React.PureComponent<LabTreeSelectProps, LabTreeSelectState> {
|
|
24
|
+
|
|
25
|
+
static defaultProps = {
|
|
26
|
+
maxSelected: 100,
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
state = {
|
|
30
|
+
treeData: [],
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async componentDidMount() {
|
|
34
|
+
this.setState({treeData:await this.loadSchoolLevelUnit()}) ;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
//第一步查根
|
|
38
|
+
loadSchoolLevelUnit=async ()=>{
|
|
39
|
+
let data=[];
|
|
40
|
+
let res=await HcserviceV3.requestLtmplQueryTop('221036732522497',{});
|
|
41
|
+
|
|
42
|
+
if(res.entities){
|
|
43
|
+
res.entities.forEach((item, index) => {
|
|
44
|
+
let d={};
|
|
45
|
+
d["id"]=item.code;
|
|
46
|
+
d['level']=1;
|
|
47
|
+
d["pId"]=0;
|
|
48
|
+
d["title"]= item.fieldMap['228431869288450'];
|
|
49
|
+
d["value"]=d["id"]+"@R@"+d["title"];
|
|
50
|
+
d["key"]=d["value"];
|
|
51
|
+
d["selectable"]=false;
|
|
52
|
+
data.push(d);
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
return data;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
loadLab=async (mainCode)=>{
|
|
59
|
+
let data=[];
|
|
60
|
+
let res=await HcserviceV3.requestLtmplQueryTop('228261345665025',{mainCode});
|
|
61
|
+
|
|
62
|
+
if(res.entities){
|
|
63
|
+
res.entities.forEach((item, index) => {
|
|
64
|
+
let d={};
|
|
65
|
+
d["id"]=item.code;
|
|
66
|
+
d['level']=2;
|
|
67
|
+
d["pId"]=mainCode;
|
|
68
|
+
d["title"]= item.fieldMap['227350535774211'];
|
|
69
|
+
d["value"]=d["id"]+"@R@"+d["title"];
|
|
70
|
+
d["key"]=d["value"];
|
|
71
|
+
d["selectable"]=false;
|
|
72
|
+
data.push(d);
|
|
73
|
+
})
|
|
74
|
+
}
|
|
75
|
+
return data;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
loadRoom=async (mainCode)=>{
|
|
79
|
+
let data=[];
|
|
80
|
+
let res=await HcserviceV3.requestLtmplQueryTop('228261733638145',{mainCode});
|
|
81
|
+
|
|
82
|
+
if(res.entities){
|
|
83
|
+
res.entities.forEach((item, index) => {
|
|
84
|
+
let d={};
|
|
85
|
+
d["id"]=item.code;
|
|
86
|
+
d['level']=3;
|
|
87
|
+
d["pId"]=mainCode;
|
|
88
|
+
d["title"]= item.fieldMap['227349996806149'];
|
|
89
|
+
d["value"]=d["id"]+"@R@"+d["title"];
|
|
90
|
+
d["key"]=d["value"];
|
|
91
|
+
d["isLeaf"]=true;
|
|
92
|
+
data.push(d);
|
|
93
|
+
})
|
|
94
|
+
}
|
|
95
|
+
return data;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
onChange=(newValue: string)=>{
|
|
99
|
+
const {onChange} = this.props;
|
|
100
|
+
console.log("newValue",newValue);
|
|
101
|
+
onChange(newValue);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
onLoadData = async (node) => {
|
|
106
|
+
console.log('node:',node);
|
|
107
|
+
const {treeData}=this.state;
|
|
108
|
+
if(node['level']==1){
|
|
109
|
+
//加载实验室
|
|
110
|
+
let d = await this.loadLab(node['id']);
|
|
111
|
+
console.log('treeData dddd ',d);
|
|
112
|
+
this.setState({
|
|
113
|
+
treeData:[...treeData,...d]
|
|
114
|
+
})
|
|
115
|
+
}else if(node['level']==2){
|
|
116
|
+
let d = await this.loadRoom(node['id']);
|
|
117
|
+
console.log('treeData dddd ',d);
|
|
118
|
+
this.setState({
|
|
119
|
+
treeData:[...treeData,...d]
|
|
120
|
+
})
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
render() {
|
|
125
|
+
const {id,value, fieldConfig, style} = this.props;
|
|
126
|
+
const {treeData} = this.state;
|
|
127
|
+
let v;
|
|
128
|
+
if(value){
|
|
129
|
+
v=value.split("@R@")[1];
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
console.log('treeData',treeData);
|
|
133
|
+
return (
|
|
134
|
+
<TreeSelect
|
|
135
|
+
treeDataSimpleMode
|
|
136
|
+
style={{ width: '100%' ,minWidth:'260px'}}
|
|
137
|
+
value={v}
|
|
138
|
+
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
|
|
139
|
+
placeholder="--请选择--"
|
|
140
|
+
onChange={this.onChange}
|
|
141
|
+
loadData={this.onLoadData}
|
|
142
|
+
treeData={treeData}
|
|
143
|
+
/>
|
|
144
|
+
)
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
|
|
@@ -33,7 +33,19 @@ export default class EntitySelect extends React.PureComponent<EntitySelectProps,
|
|
|
33
33
|
let newValue = [];
|
|
34
34
|
if (selectedRows) {
|
|
35
35
|
for (let row of selectedRows) {
|
|
36
|
-
|
|
36
|
+
let title:string=null;
|
|
37
|
+
if(row.title instanceof Array){
|
|
38
|
+
title = row.title[0];
|
|
39
|
+
}else{
|
|
40
|
+
title = row.title;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
console.log('1323',title);
|
|
44
|
+
if(row.title && row.title.includes("@R@")){
|
|
45
|
+
let ts= title.split('@R@');
|
|
46
|
+
title=ts[ts.length-1];
|
|
47
|
+
}
|
|
48
|
+
newValue.push(row.code + '@R@' + title);
|
|
37
49
|
}
|
|
38
50
|
}
|
|
39
51
|
onChange(newValue);
|
|
@@ -16,6 +16,9 @@ import Cascader from './cascader'
|
|
|
16
16
|
import EntitySelect from "./entity-select/entity-select";
|
|
17
17
|
import PopoverEntitySelect from './entity-select/popover-entity-select'
|
|
18
18
|
import ColorPicker from './color-picker'
|
|
19
|
+
import LabTreeSelect from './entity-select/lab-tree-select'
|
|
20
|
+
import Units from "../units";
|
|
21
|
+
import {ProgramConfig} from "../index";
|
|
19
22
|
// import EntitySelect from "./entity-select/inner-entity-select";
|
|
20
23
|
// import ChemStruc from "./chemstruc/graph";
|
|
21
24
|
const CheckboxGroup=Checkbox.Group;
|
|
@@ -66,8 +69,13 @@ function renderControl(id:any,fieldConfig: FieldConfig, fieldValue: any, onChang
|
|
|
66
69
|
let disabled: boolean = fieldConfig.disabled;
|
|
67
70
|
|
|
68
71
|
let viewOrEdit: ViewOrEdit = 'edit';
|
|
72
|
+
let fieldConfigM:string=fieldConfig.min;
|
|
73
|
+
let min=(fieldConfigM || fieldConfigM=='0' ) ? Units.configParamTrans(fieldConfigM) : undefined;
|
|
74
|
+
fieldConfigM=fieldConfig.max;
|
|
75
|
+
let max=(fieldConfigM || fieldConfigM=='0' ) ? Units.configParamTrans(fieldConfigM) : undefined;;
|
|
76
|
+
|
|
69
77
|
let controlProps = {
|
|
70
|
-
id, fieldConfig, itemType, viewOrEdit, onChange, disabled, value: fieldValue, style: {minWidth: 220, width: '100%'}
|
|
78
|
+
id, fieldConfig,min,max, itemType, viewOrEdit, onChange, disabled, value: fieldValue, style: {minWidth: 220, width: '100%'}
|
|
71
79
|
}
|
|
72
80
|
|
|
73
81
|
let antdControlProps = {
|
|
@@ -80,6 +88,11 @@ function renderControl(id:any,fieldConfig: FieldConfig, fieldValue: any, onChang
|
|
|
80
88
|
disabled={true}
|
|
81
89
|
/>;
|
|
82
90
|
|
|
91
|
+
//自定义组件为先
|
|
92
|
+
if(ProgramConfig.getCustomEditControl(itemType)){
|
|
93
|
+
return React.createElement(ProgramConfig.getCustomEditControl(itemType),controlProps);
|
|
94
|
+
}
|
|
95
|
+
|
|
83
96
|
switch (itemType) {
|
|
84
97
|
case 'int':
|
|
85
98
|
case 'decimal':
|
|
@@ -200,11 +213,15 @@ function renderControl(id:any,fieldConfig: FieldConfig, fieldValue: any, onChang
|
|
|
200
213
|
case 'relselect':
|
|
201
214
|
case 'refselect':
|
|
202
215
|
case 'entity-select':
|
|
203
|
-
entryControl=<EntitySelect maxSelected={
|
|
216
|
+
entryControl=<EntitySelect maxSelected={max?parseInt(max):undefined} {...controlProps} />
|
|
204
217
|
// entryControl = <EntitySelect {...controlProps} sourceName={'rcriteria'}></EntitySelect>
|
|
205
218
|
break;
|
|
206
219
|
case 'table-entity-select':
|
|
207
|
-
entryControl=<PopoverEntitySelect maxSelected={
|
|
220
|
+
entryControl=<PopoverEntitySelect maxSelected={max?parseInt(max):undefined} {...controlProps} />
|
|
221
|
+
// entryControl = <EntitySelect {...controlProps} sourceName={'rcriteria'}></EntitySelect>
|
|
222
|
+
break;
|
|
223
|
+
case 'lab-tree-select':
|
|
224
|
+
entryControl=<LabTreeSelect maxSelected={max?parseInt(max):undefined} {...controlProps} />
|
|
208
225
|
// entryControl = <EntitySelect {...controlProps} sourceName={'rcriteria'}></EntitySelect>
|
|
209
226
|
break;
|
|
210
227
|
case 'progress':
|
|
@@ -5,7 +5,6 @@ import HCDataSource from "../../tmpl/hc-data-source";
|
|
|
5
5
|
|
|
6
6
|
interface EnumTagsProps extends VControlProps {
|
|
7
7
|
|
|
8
|
-
|
|
9
8
|
}
|
|
10
9
|
|
|
11
10
|
|
|
@@ -15,10 +14,17 @@ const EnumTags: React.FC<EnumTagsProps> = (props) => {
|
|
|
15
14
|
let viewControl = undefined;
|
|
16
15
|
let tagList = [];
|
|
17
16
|
if (value) {
|
|
18
|
-
value
|
|
17
|
+
let v=value;
|
|
18
|
+
if(value instanceof Array){
|
|
19
|
+
|
|
20
|
+
}else {
|
|
21
|
+
v=value.split(',');
|
|
22
|
+
}
|
|
23
|
+
v.forEach(v => {
|
|
19
24
|
let color = HCDataSource.getEnumValueColor(fieldConfig.mstrucId, value);
|
|
20
25
|
tagList.push(<Tag key={v} color={color ? color : 'blue'}>{v}</Tag>)
|
|
21
26
|
})
|
|
27
|
+
|
|
22
28
|
}
|
|
23
29
|
viewControl = <span className="infoStyle">
|
|
24
30
|
{tagList}
|
|
@@ -9,7 +9,7 @@ interface InputNumberProps extends EControlProps {
|
|
|
9
9
|
|
|
10
10
|
const InputNumber: React.FC<InputNumberProps> = (props) => {
|
|
11
11
|
|
|
12
|
-
const {id,value, itemType, fieldConfig, onChange,style} = props;
|
|
12
|
+
const {id,value, itemType, fieldConfig, onChange,style,min,max} = props;
|
|
13
13
|
|
|
14
14
|
let entryControl = undefined;
|
|
15
15
|
|
|
@@ -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={
|
|
56
|
+
entryControl = <AntdInputNumber style={{...style}} min={min} max={max}
|
|
57
57
|
{...antdControlProps} value={valueSingle}
|
|
58
58
|
onKeyUp={changeInt} onChange={changeValue}
|
|
59
59
|
/>
|
|
@@ -62,7 +62,7 @@ const InputNumber: React.FC<InputNumberProps> = (props) => {
|
|
|
62
62
|
case 'float':
|
|
63
63
|
case 'double':
|
|
64
64
|
entryControl = <AntdInputNumber style={{...style}}
|
|
65
|
-
{...antdControlProps} value={valueSingle} min={
|
|
65
|
+
{...antdControlProps} value={valueSingle} min={min} max={max}
|
|
66
66
|
// style={{width}}
|
|
67
67
|
step={0.1} onChange={changeValue}
|
|
68
68
|
/>
|
|
@@ -70,11 +70,11 @@ const InputNumber: React.FC<InputNumberProps> = (props) => {
|
|
|
70
70
|
case 'intrange':
|
|
71
71
|
entryControl =
|
|
72
72
|
<Space>
|
|
73
|
-
<AntdInputNumber min={
|
|
73
|
+
<AntdInputNumber min={min} max={max}
|
|
74
74
|
placeholder={`开始`} value={valueBegin}
|
|
75
75
|
onKeyUp={changeInt} onChange={changeBeginValue}
|
|
76
76
|
/>~
|
|
77
|
-
<AntdInputNumber min={
|
|
77
|
+
<AntdInputNumber min={min} max={max}
|
|
78
78
|
placeholder={`结束`} value={valueEnd}
|
|
79
79
|
onKeyUp={changeInt} onChange={changeEndValue}
|
|
80
80
|
/>
|
|
@@ -83,12 +83,12 @@ const InputNumber: React.FC<InputNumberProps> = (props) => {
|
|
|
83
83
|
case 'decimalrange':
|
|
84
84
|
entryControl =
|
|
85
85
|
<Space>
|
|
86
|
-
<AntdInputNumber min={
|
|
86
|
+
<AntdInputNumber min={min} max={max}
|
|
87
87
|
placeholder={`开始`} value={valueBegin}
|
|
88
88
|
onChange={changeBeginValue} step={0.1}
|
|
89
89
|
disabled={disabled}
|
|
90
90
|
/>~
|
|
91
|
-
<AntdInputNumber min={
|
|
91
|
+
<AntdInputNumber min={min} max={max}
|
|
92
92
|
placeholder={`结束`} value={valueEnd} step={0.1}
|
|
93
93
|
onChange={changeEndValue} disabled={disabled}
|
|
94
94
|
/>
|
|
@@ -13,6 +13,7 @@ import moment from "moment";
|
|
|
13
13
|
import Progress from './progress'
|
|
14
14
|
import ColorPicker from "./color-picker";
|
|
15
15
|
import EllipsisText from './text/ellipsis-text'
|
|
16
|
+
import {ProgramConfig} from "../index";
|
|
16
17
|
//import ChemStruc from "./chemstruc/graph";
|
|
17
18
|
// import HtmlEditor from "../HtmlEditor/tinymce";
|
|
18
19
|
const Loading = <Spin tip="Loading...">
|
|
@@ -59,7 +60,10 @@ function renderControl(fieldConfig: FieldConfig, fieldValue: any,pHolderType:Con
|
|
|
59
60
|
let controlProps = {
|
|
60
61
|
fieldConfig, itemType, value,viewOrEdit,
|
|
61
62
|
}
|
|
62
|
-
|
|
63
|
+
//自定义组件为先
|
|
64
|
+
if(ProgramConfig.getCustomEditControl(itemType)){
|
|
65
|
+
return React.createElement(ProgramConfig.getCustomViewControl(itemType),controlProps);
|
|
66
|
+
}
|
|
63
67
|
const unSupportControl =
|
|
64
68
|
<span className="infoStyle">{`暂未完成-${itemType}`}</span>;
|
|
65
69
|
|
|
@@ -94,7 +94,7 @@ class SubmitButtonBar extends React.PureComponent<SubmitButtonProps, SubmitButto
|
|
|
94
94
|
// type="primary"
|
|
95
95
|
// >{item.title}</Button>
|
|
96
96
|
// </Popconfirm>
|
|
97
|
-
return <Action hiddenType={'disabled'} buttonType={'primary'} serial={serial} key={item.id} formRef={formRef} actionConfig={item} doAction={doSubmit}></Action>
|
|
97
|
+
return <Action iconType={'icon-title'} hiddenType={'disabled'} buttonType={'primary'} serial={serial} key={item.id} formRef={formRef} actionConfig={item} doAction={doSubmit}></Action>
|
|
98
98
|
}
|
|
99
99
|
})
|
|
100
100
|
}
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {Button, FormInstance, Modal, Popconfirm} from 'antd'
|
|
3
|
-
import {DtmplBaseProps, DtmplConfig, DtmplData} from "../../tmpl/interface";
|
|
2
|
+
import {Button, Drawer, FormInstance, Modal, Popconfirm, Space} from 'antd'
|
|
3
|
+
import {DtmplBaseProps, DtmplConfig, DtmplData, PageType} from "../../tmpl/interface";
|
|
4
4
|
import DtmplForm from '../../form/dtmpl-form';
|
|
5
5
|
import HCDataSource from "../../tmpl/hc-data-source";
|
|
6
6
|
import Units from "../../units";
|
|
7
7
|
import HcserviceV3 from "../../tmpl/hcservice-v3";
|
|
8
8
|
import Action from "../../controls/action";
|
|
9
|
+
import DtmplEdit from "./dtmpl-edit";
|
|
9
10
|
|
|
10
11
|
interface ModalEditorProps extends DtmplBaseProps {
|
|
11
|
-
height
|
|
12
|
+
height?: any,
|
|
13
|
+
width?:number,
|
|
12
14
|
visible: boolean,
|
|
13
15
|
onOk: (code: string) => void,
|
|
14
16
|
onCancel: () => void,
|
|
15
|
-
|
|
17
|
+
pageType:PageType;
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
interface ModalEditorState {
|
|
@@ -23,7 +25,7 @@ interface ModalEditorState {
|
|
|
23
25
|
dtmplData:DtmplData,
|
|
24
26
|
}
|
|
25
27
|
|
|
26
|
-
export default class
|
|
28
|
+
export default class DtmplEditPage extends React.PureComponent<ModalEditorProps, ModalEditorState> {
|
|
27
29
|
formRef = React.createRef<FormInstance>();
|
|
28
30
|
autoSaveTimer = -1000000000000000;
|
|
29
31
|
autoSaveInterval=undefined;
|
|
@@ -35,12 +37,13 @@ export default class ModalDtmplEdit extends React.PureComponent<ModalEditorProps
|
|
|
35
37
|
static defaultProps = {
|
|
36
38
|
showConfirm: true,
|
|
37
39
|
height: 500,
|
|
40
|
+
width:1250,
|
|
38
41
|
//antd modal
|
|
39
42
|
forceRender: true,
|
|
40
43
|
style: {maxWidth: 'calc(100vw - 60px)', maxHeight: 'calc(100vh - 50px)'},
|
|
41
44
|
okText: "确定",
|
|
42
45
|
cancelText: "取消",
|
|
43
|
-
|
|
46
|
+
pageType:'modal'
|
|
44
47
|
}
|
|
45
48
|
state = {
|
|
46
49
|
id:'modelDtmplEdit'+Units.getRandomNum(6),
|
|
@@ -160,7 +163,7 @@ export default class ModalDtmplEdit extends React.PureComponent<ModalEditorProps
|
|
|
160
163
|
//处理action
|
|
161
164
|
if (dtmplConfig) {
|
|
162
165
|
dtmplConfig.actions.forEach((ac, index) => {
|
|
163
|
-
footerButtons.unshift(<Action hiddenType={'disabled'} serial={serial} key={ac.id} formRef={this.formRef} actionConfig={ac} doAction={this.doSubmit}></Action>);
|
|
166
|
+
footerButtons.unshift(<Action iconType={'icon-title'} hiddenType={'disabled'} serial={serial} key={ac.id} formRef={this.formRef} actionConfig={ac} doAction={this.doSubmit}></Action>);
|
|
164
167
|
})
|
|
165
168
|
}
|
|
166
169
|
footerButtons.unshift(<Popconfirm key="back" placement="topLeft" title={"确定要取消本次修改内容吗?"} onConfirm={onCancel} okText="确定" cancelText="取消">
|
|
@@ -171,12 +174,12 @@ export default class ModalDtmplEdit extends React.PureComponent<ModalEditorProps
|
|
|
171
174
|
}
|
|
172
175
|
|
|
173
176
|
render() {
|
|
174
|
-
const {height, onOk, onCancel, code, sourceId, visible,mainCode} = this.props
|
|
177
|
+
const {height, onOk, onCancel, code, sourceId, visible,mainCode,width,pageType} = this.props
|
|
175
178
|
const {dtmplConfig,id,dtmplData} = this.state;
|
|
176
179
|
|
|
177
|
-
return <Modal
|
|
180
|
+
return (<> {pageType=='modal'? <Modal
|
|
178
181
|
visible={visible}
|
|
179
|
-
width={
|
|
182
|
+
width={width}
|
|
180
183
|
title={dtmplConfig ? dtmplConfig.title : ""}
|
|
181
184
|
bodyStyle={{height: height, overflow: 'auto'}}
|
|
182
185
|
destroyOnClose={true}
|
|
@@ -185,13 +188,33 @@ export default class ModalDtmplEdit extends React.PureComponent<ModalEditorProps
|
|
|
185
188
|
footer={this.getFooter()}
|
|
186
189
|
>
|
|
187
190
|
{visible} <div onClick={this.onClickBody}>
|
|
188
|
-
{/*<Scrollbars autoHide autoHideTimeout={1000}>*/}
|
|
189
191
|
<DtmplForm parentId={id} dtmplConfig={dtmplConfig} formRef={this.formRef} sourceId={sourceId}
|
|
190
192
|
onFinish={onOk}
|
|
191
193
|
showConfirm={false} dtmplData={dtmplData} onValuesChange={this.onValuesChange} />
|
|
192
|
-
{/*</Scrollbars>*/}
|
|
193
194
|
</div>
|
|
194
|
-
|
|
195
|
+
</Modal>
|
|
196
|
+
:
|
|
197
|
+
<Drawer
|
|
198
|
+
placement={'left'}
|
|
199
|
+
closable={true}
|
|
200
|
+
mask={false}
|
|
201
|
+
onClose={onCancel}
|
|
202
|
+
visible={visible}
|
|
203
|
+
width={width}
|
|
204
|
+
style={{
|
|
205
|
+
maxWidth: 1960,
|
|
206
|
+
}}
|
|
207
|
+
extra={
|
|
208
|
+
<Space>{this.getFooter()}</Space>
|
|
209
|
+
}
|
|
210
|
+
>
|
|
211
|
+
<DtmplForm parentId={id} dtmplConfig={dtmplConfig} formRef={this.formRef} sourceId={sourceId}
|
|
212
|
+
onFinish={onOk}
|
|
213
|
+
showConfirm={false} dtmplData={dtmplData} onValuesChange={this.onValuesChange} />
|
|
214
|
+
</Drawer>
|
|
215
|
+
}
|
|
216
|
+
</>
|
|
217
|
+
)
|
|
195
218
|
|
|
196
219
|
}
|
|
197
220
|
|
|
@@ -68,7 +68,7 @@ const CriteriaForm: React.FC<CriteriaFormProps> = (props) => {
|
|
|
68
68
|
// <Button type="primary" key={action.id}
|
|
69
69
|
// disabled={disabled}>{action.title}</Button>
|
|
70
70
|
// </Popconfirm>;
|
|
71
|
-
return <Action
|
|
71
|
+
return <Action hiddenType={"disabled"} key={action.id} disabled={disabled} data={selectedDatas} actionConfig={action} doAction={doAction} serial={1} ></Action>
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
74
|
}
|
|
@@ -18,6 +18,7 @@ export interface DtmplFormProps extends DtmplBaseProps {
|
|
|
18
18
|
showConfirm: boolean,
|
|
19
19
|
onFinish: (code:string) => void,
|
|
20
20
|
onValuesChange?:()=>void,
|
|
21
|
+
maxColsOnRow?:number,// 2
|
|
21
22
|
};
|
|
22
23
|
|
|
23
24
|
interface DtmplFormStat {
|
|
@@ -37,6 +38,9 @@ export default class Form extends React.PureComponent<DtmplFormProps, DtmplFormS
|
|
|
37
38
|
dtmplData: undefined,
|
|
38
39
|
// changedGroupData:new Map<number,DtmplData[]>()
|
|
39
40
|
}
|
|
41
|
+
static defaultPorps={
|
|
42
|
+
maxCols:2,
|
|
43
|
+
}
|
|
40
44
|
|
|
41
45
|
async componentDidMount() {
|
|
42
46
|
await this.loadData();
|
|
@@ -140,11 +144,11 @@ export default class Form extends React.PureComponent<DtmplFormProps, DtmplFormS
|
|
|
140
144
|
if (ds) {
|
|
141
145
|
ds.forEach((d, index) => {
|
|
142
146
|
values[`${group.id}[${index}].$$relation$$`] = d.relationLabel;
|
|
143
|
-
if (d.editStatus
|
|
147
|
+
if (d.editStatus && d.editStatus=='new') {
|
|
144
148
|
for (let field of group.fields) {
|
|
145
149
|
values[`${group.id}[${index}].${field.id}`] = d.fieldMap[field.id];
|
|
146
150
|
}
|
|
147
|
-
} else if(d.editStatus
|
|
151
|
+
} else if(d.editStatus && d.editStatus=='changed'){
|
|
148
152
|
values[`${group.id}[${index}].唯一编码`] = d.code;
|
|
149
153
|
for (let field of group.fields) {
|
|
150
154
|
values[`${group.id}[${index}].${field.id}`] = d.fieldMap[field.id];
|
|
@@ -175,7 +179,7 @@ export default class Form extends React.PureComponent<DtmplFormProps, DtmplFormS
|
|
|
175
179
|
|
|
176
180
|
fieldGroupList = () => {
|
|
177
181
|
|
|
178
|
-
const {dtmplConfig,parentId} = this.props;
|
|
182
|
+
const {dtmplConfig,parentId,maxColsOnRow} = this.props;
|
|
179
183
|
const {dtmplData, loading} = this.state;
|
|
180
184
|
|
|
181
185
|
let groups: FieldGroupConfig[];
|
|
@@ -202,7 +206,7 @@ export default class Form extends React.PureComponent<DtmplFormProps, DtmplFormS
|
|
|
202
206
|
headStyle={{background: "#f2f4f5"}}
|
|
203
207
|
loading={loading}
|
|
204
208
|
>
|
|
205
|
-
<FormItemGroup
|
|
209
|
+
<FormItemGroup maxColsOnRow={maxColsOnRow} fields={item?item.fields:undefined} valueMap={dtmplData ? dtmplData.fieldMap : undefined}
|
|
206
210
|
></FormItemGroup>
|
|
207
211
|
</CollapseCard>
|
|
208
212
|
}
|
|
@@ -14,6 +14,7 @@ export interface FieldGroupProps {
|
|
|
14
14
|
nameAttr?:string,
|
|
15
15
|
valueMap: object,
|
|
16
16
|
width?: number,
|
|
17
|
+
maxColsOnRow?:number,
|
|
17
18
|
};
|
|
18
19
|
|
|
19
20
|
interface FieldGroupState {
|
|
@@ -24,6 +25,7 @@ export default class FormItemGroup extends React.PureComponent<FieldGroupProps,
|
|
|
24
25
|
|
|
25
26
|
static defaultProps={
|
|
26
27
|
nameAttr:'id',
|
|
28
|
+
maxColsOnRow:2,
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
constructor(props) {
|
|
@@ -34,7 +36,7 @@ export default class FormItemGroup extends React.PureComponent<FieldGroupProps,
|
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
initFormList = () => {
|
|
37
|
-
const {fields, valueMap,nameAttr} = this.props
|
|
39
|
+
const {fields, valueMap,nameAttr,maxColsOnRow} = this.props
|
|
38
40
|
const formItemList = [];
|
|
39
41
|
|
|
40
42
|
if ( fields && fields.length > 0) {
|
|
@@ -75,8 +77,11 @@ export default class FormItemGroup extends React.PureComponent<FieldGroupProps,
|
|
|
75
77
|
|
|
76
78
|
for (let i = 0; i < formItemList.length; i = i + 1) {
|
|
77
79
|
let colNum = fields[i].colNum;
|
|
80
|
+
|
|
78
81
|
if(fields[i].extControlType=='hidden'){
|
|
79
82
|
colNum=0;
|
|
83
|
+
}else if(maxColsOnRow && maxColsOnRow==1){
|
|
84
|
+
colNum=2;
|
|
80
85
|
}
|
|
81
86
|
let col = <Col key={i} span={12 * colNum}>
|
|
82
87
|
{formItemList[i]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {FileDoneOutlined,CheckOutlined,CloseCircleOutlined,FileAddOutlined,ThunderboltOutlined} from '@ant-design/icons';
|
|
3
|
+
|
|
4
|
+
interface IconProps{
|
|
5
|
+
type:string,
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface IconStat {
|
|
9
|
+
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const iconMap={
|
|
13
|
+
FileDoneOutlined:FileDoneOutlined,
|
|
14
|
+
CheckOutlined:CheckOutlined,
|
|
15
|
+
CloseCircleOutlined:CloseCircleOutlined,
|
|
16
|
+
FileAddOutlined:FileAddOutlined,
|
|
17
|
+
ThunderboltOutlined:ThunderboltOutlined,
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default class Icon extends React.PureComponent<IconProps, IconStat>{
|
|
21
|
+
render(){
|
|
22
|
+
const {type}=this.props;
|
|
23
|
+
if(iconMap[type]){
|
|
24
|
+
return React.createElement(iconMap[type]);
|
|
25
|
+
}else{
|
|
26
|
+
return <ThunderboltOutlined />
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
}
|
package/src/aldehyde/index.tsx
CHANGED
|
@@ -20,12 +20,12 @@ import QuickEntrance from './welcome/quick-entrance'
|
|
|
20
20
|
import Workbench from './welcome/workbench';
|
|
21
21
|
import PopoverEntitySelect from "./controls/entity-select/popover-entity-select";
|
|
22
22
|
import DatePicker from "./controls/date-picker";
|
|
23
|
-
import
|
|
23
|
+
import DtmplEditPage from "./detail/edit/dtmpl-edit-page";
|
|
24
24
|
import TmplDataSource from './tmpl/hc-data-source';
|
|
25
25
|
import * as TmplInterface from './tmpl/interface';
|
|
26
26
|
import Superagent from './tmpl/superagent';
|
|
27
27
|
|
|
28
28
|
export {ActTable,SelectTable,Loginit,DtmplRoute,ImportRoute,LtmplRoute,DtmplViewPage,LtmplPage,Menu2layers,Block,UserBar,
|
|
29
29
|
ResetPassword,Footer,EntryControl,ViewControl,ProgramConfig,HydrocarbonService,QuickEntrance,Workbench,PopoverEntitySelect
|
|
30
|
-
,DatePicker,
|
|
30
|
+
,DatePicker,DtmplEditPage,TmplInterface,TmplDataSource,Superagent,DtmplEdit}
|
|
31
31
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import
|
|
2
|
+
import DtmplEditPage from "../detail/edit/dtmpl-edit-page";
|
|
3
3
|
import ActDtmplView from "../detail/view/act-dtmpl-view";
|
|
4
4
|
|
|
5
5
|
//以列表为入口的,页面内列表,基本原则是所有交互在页面内完成,不会触发路由。
|
|
@@ -48,13 +48,13 @@ class DtmplViewPage extends React.PureComponent<DtmplViewPageProps, DtmplViewPag
|
|
|
48
48
|
const { sourceId,code,mainCode} = this.props;
|
|
49
49
|
return <>
|
|
50
50
|
<ActDtmplView goDtmpl={this.goDtmpl} sourceId={sourceId} code={code} mainCode={mainCode}></ActDtmplView>
|
|
51
|
-
<
|
|
51
|
+
<DtmplEditPage visible={showDtmplEdit} onCancel={()=>{
|
|
52
52
|
this.setState({
|
|
53
53
|
showDtmplEdit:false,
|
|
54
54
|
})}}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
sourceId={sourceId}
|
|
56
|
+
code={code}
|
|
57
|
+
onOk={this.handleDtmplEdit} />
|
|
58
58
|
</>
|
|
59
59
|
}
|
|
60
60
|
}
|
|
@@ -5,7 +5,7 @@ import ActTable from '../table/act-table'
|
|
|
5
5
|
// import StatActTable from '../table/stat-act-table'
|
|
6
6
|
import HCDataSource from "../tmpl/hc-data-source";
|
|
7
7
|
import ModalDtmplView from "../detail/view/modal-dtmpl-view";
|
|
8
|
-
import
|
|
8
|
+
import DtmplEditPage from "../detail/edit/dtmpl-edit-page";
|
|
9
9
|
import HcserviceV3 from "../tmpl/hcservice-v3";
|
|
10
10
|
|
|
11
11
|
//以列表为入口的,页面内列表,基本原则是所有交互在页面内完成,不会触发路由。
|
|
@@ -163,13 +163,13 @@ class LtmplPage extends React.PureComponent<LtmplPageProps, LtmplPageState> {
|
|
|
163
163
|
sourceId={sourceId}
|
|
164
164
|
code={selectedCode}> </ModalDtmplView> : ""}
|
|
165
165
|
{buttons.includes('dtmplEdit') || buttons.includes('dtmplAdd') ?
|
|
166
|
-
<
|
|
166
|
+
<DtmplEditPage visible={showDtmplEdit} onCancel={()=>{
|
|
167
167
|
this.setState({
|
|
168
168
|
showDtmplEdit:false,
|
|
169
169
|
})}}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
170
|
+
sourceId={sourceId}
|
|
171
|
+
code={selectedCode}
|
|
172
|
+
onOk={this.handleDtmplEdit} />
|
|
173
173
|
: ""}
|
|
174
174
|
</>
|
|
175
175
|
}
|
|
@@ -273,7 +273,7 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
273
273
|
}) : ""}
|
|
274
274
|
{ltmplConfig.rowActions && ltmplConfig.rowActions.length > 0 ?
|
|
275
275
|
ltmplConfig.rowActions.map((action) => {
|
|
276
|
-
return <Action key={action.id} data={[record]} actionConfig={action} doAction={this.doRowAction} buttonSize={'small'} serial={1}></Action>
|
|
276
|
+
return <Action iconType={'icon'} key={action.id} data={[record]} actionConfig={action} doAction={this.doRowAction} buttonSize={'small'} serial={1}></Action>
|
|
277
277
|
}) : ""}
|
|
278
278
|
{ltmplConfig.jumps && ltmplConfig.jumps.length > 0 ?
|
|
279
279
|
ltmplConfig.jumps.map((jump) => {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import {Checkbox, Col, Row} from "antd";
|
|
3
3
|
import {ColumnConfig,} from "../../tmpl/interface";
|
|
4
|
-
import '../pagination.css';
|
|
5
4
|
import {MenuOutlined} from '@ant-design/icons';
|
|
6
5
|
import {SortableContainer, SortableElement, SortableHandle} from 'react-sortable-hoc';
|
|
7
6
|
import {arrayMoveImmutable} from 'array-move';
|