aldehyde 0.1.17 → 0.1.20
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/auto-complete/index.d.ts.map +1 -1
- package/lib/controls/auto-complete/index.js.map +1 -1
- package/lib/controls/cascader/index.d.ts +16 -7
- package/lib/controls/cascader/index.d.ts.map +1 -1
- package/lib/controls/cascader/index.js +86 -67
- package/lib/controls/cascader/index.js.map +1 -1
- package/lib/controls/cquery/cquick-button.d.ts +5 -1
- package/lib/controls/cquery/cquick-button.d.ts.map +1 -1
- package/lib/controls/cquery/cquick-button.js +13 -9
- 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 +21 -4
- 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 +7 -2
- package/lib/controls/view-control.js.map +1 -1
- package/lib/detail/button/submit-button-bar.d.ts.map +1 -1
- package/lib/detail/button/submit-button-bar.js +8 -2
- 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/detail/edit/dtmpl-edit.d.ts +2 -2
- package/lib/detail/edit/dtmpl-edit.d.ts.map +1 -1
- 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 +4 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -3
- package/lib/index.js.map +1 -1
- package/lib/layout/header/index.css +2 -1
- package/lib/layout/menu/userinfo-bar.js +2 -2
- package/lib/layout/menu/userinfo-bar.js.map +1 -1
- package/lib/module/{dtmpl-page.d.ts → dtmpl-view-page.d.ts} +5 -5
- package/lib/module/dtmpl-view-page.d.ts.map +1 -0
- package/lib/module/{dtmpl-page.js → dtmpl-view-page.js} +5 -5
- package/lib/module/dtmpl-view-page.js.map +1 -0
- package/lib/module/ltmpl-page.d.ts.map +1 -1
- package/lib/module/ltmpl-page.js +2 -2
- package/lib/module/ltmpl-page.js.map +1 -1
- package/lib/routable/ltmpl-route.d.ts +1 -0
- package/lib/routable/ltmpl-route.d.ts.map +1 -1
- package/lib/routable/ltmpl-route.js +6 -1
- package/lib/routable/ltmpl-route.js.map +1 -1
- package/lib/table/act-table.d.ts +1 -0
- package/lib/table/act-table.d.ts.map +1 -1
- package/lib/table/act-table.js +5 -5
- 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/hc-data-source.d.ts +1 -0
- package/lib/tmpl/hc-data-source.d.ts.map +1 -1
- package/lib/tmpl/hc-data-source.js +54 -3
- package/lib/tmpl/hc-data-source.js.map +1 -1
- package/lib/tmpl/hcservice-v3.d.ts +3 -1
- package/lib/tmpl/hcservice-v3.d.ts.map +1 -1
- package/lib/tmpl/hcservice-v3.js +28 -0
- package/lib/tmpl/hcservice-v3.js.map +1 -1
- package/lib/tmpl/interface.d.ts +9 -3
- 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 +5 -1
- package/lib/units/index.d.ts.map +1 -1
- package/lib/units/index.js +18 -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/auto-complete/index.tsx +0 -1
- package/src/aldehyde/controls/cascader/index.tsx +114 -0
- package/src/aldehyde/controls/cquery/cquick-button.tsx +13 -12
- 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 +22 -5
- 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 +6 -2
- package/src/aldehyde/detail/button/submit-button-bar.tsx +6 -3
- package/src/aldehyde/detail/edit/{modal-dtmpl-edit.tsx → dtmpl-edit-page.tsx} +36 -13
- package/src/aldehyde/detail/edit/dtmpl-edit.tsx +2 -2
- 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 +5 -4
- package/src/aldehyde/layout/header/index.css +2 -1
- package/src/aldehyde/layout/menu/userinfo-bar.tsx +2 -2
- package/src/aldehyde/module/{dtmpl-page.tsx → dtmpl-view-page.tsx} +9 -16
- package/src/aldehyde/module/ltmpl-page.tsx +7 -5
- package/src/aldehyde/routable/ltmpl-route.tsx +9 -1
- package/src/aldehyde/table/act-table.tsx +8 -5
- 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/hc-data-source.tsx +59 -6
- package/src/aldehyde/tmpl/hcservice-v3.tsx +30 -1
- package/src/aldehyde/tmpl/interface.tsx +10 -4
- 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
- package/lib/module/dtmpl-page.d.ts.map +0 -1
- package/lib/module/dtmpl-page.js.map +0 -1
- package/src/aldehyde/controls/cascader/index.js +0 -97
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
2
|
import {RefObject} from 'react'
|
|
3
|
-
import {Button, Checkbox as AntdCheckbox, Popconfirm, Popover,} from 'antd'
|
|
3
|
+
import {Button, Checkbox as AntdCheckbox, Popconfirm, Popover,Tooltip} from 'antd'
|
|
4
4
|
import './index.css'
|
|
5
5
|
import {ActionConfig, Comparator, DtmplData} from "../../tmpl/interface";
|
|
6
6
|
import {FormInstance} from "antd/lib/form/hooks/useForm";
|
|
@@ -8,9 +8,10 @@ import {ButtonType} from "antd/lib/button/button";
|
|
|
8
8
|
import FieldsEditCard from "../../detail/edit/fields-edit-card"
|
|
9
9
|
import {SizeType} from "antd/lib/config-provider/SizeContext";
|
|
10
10
|
import ActionUtils from './utils';
|
|
11
|
+
import Icon from '../../icon';
|
|
11
12
|
|
|
12
13
|
const CheckboxGroup = AntdCheckbox.Group;
|
|
13
|
-
|
|
14
|
+
export type ActionButtonIconType = 'icon' | 'icon-title' | 'title'
|
|
14
15
|
export type ActionButtonType = 'primary-block' | 'dashed' | 'primary'
|
|
15
16
|
export type ActionButtonHiddenType = 'hidden' | 'disabled'
|
|
16
17
|
|
|
@@ -24,6 +25,7 @@ interface ActionProps {
|
|
|
24
25
|
buttonType?: ActionButtonType,
|
|
25
26
|
hiddenType?: ActionButtonHiddenType,
|
|
26
27
|
buttonSize?: SizeType,
|
|
28
|
+
iconType:ActionButtonIconType,
|
|
27
29
|
};
|
|
28
30
|
|
|
29
31
|
interface ActionState {
|
|
@@ -37,6 +39,7 @@ export default class Action extends React.PureComponent<ActionProps, ActionState
|
|
|
37
39
|
buttonType: 'dashed',
|
|
38
40
|
hiddenType: 'hidden',
|
|
39
41
|
buttonSize: undefined,
|
|
42
|
+
iconType:'icon-title',
|
|
40
43
|
}
|
|
41
44
|
|
|
42
45
|
state = {
|
|
@@ -149,10 +152,25 @@ export default class Action extends React.PureComponent<ActionProps, ActionState
|
|
|
149
152
|
onValuesChange={this.onValuesChange}/>}>
|
|
150
153
|
<Button danger={actionConfig.beforeExeConfirm == 'danger'} type={this.getButtonType()} block={this.blockButton()} size={buttonSize}
|
|
151
154
|
onClick={() => this.setState({popoverVisible: !popoverVisible})}
|
|
152
|
-
disabled={disabled_} >{
|
|
155
|
+
disabled={disabled_} >{this.getTitle()}</Button>
|
|
153
156
|
</Popover>
|
|
154
157
|
}
|
|
155
158
|
|
|
159
|
+
getTitle=()=>{
|
|
160
|
+
const {actionConfig,iconType} = this.props;
|
|
161
|
+
if(actionConfig.icon){
|
|
162
|
+
if(iconType=='icon-title'){
|
|
163
|
+
return <><Icon type={actionConfig.icon}></Icon>{actionConfig.title}</>
|
|
164
|
+
}else if(iconType=='icon'){
|
|
165
|
+
return <Tooltip placement="top" title={actionConfig.title}><Icon type={actionConfig.icon}></Icon>{''}</Tooltip>
|
|
166
|
+
}else{
|
|
167
|
+
return actionConfig.title;
|
|
168
|
+
}
|
|
169
|
+
}else{
|
|
170
|
+
return actionConfig.title;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
156
174
|
|
|
157
175
|
getCodes = () => {
|
|
158
176
|
const {data,} = this.props;
|
|
@@ -194,7 +212,7 @@ export default class Action extends React.PureComponent<ActionProps, ActionState
|
|
|
194
212
|
cancelText="取消"
|
|
195
213
|
>
|
|
196
214
|
<Button size={buttonSize} type={bType} block={block} disabled={disabled_}
|
|
197
|
-
>{
|
|
215
|
+
>{this.getTitle()}</Button>
|
|
198
216
|
</Popconfirm> :
|
|
199
217
|
actionConfig.beforeExeConfirm == 'danger' ?
|
|
200
218
|
<Popconfirm key={actionConfig.id}
|
|
@@ -209,12 +227,12 @@ export default class Action extends React.PureComponent<ActionProps, ActionState
|
|
|
209
227
|
okType={'danger'}
|
|
210
228
|
>
|
|
211
229
|
<Button type={bType} block={block} danger={true} size={buttonSize} disabled={disabled_}
|
|
212
|
-
>{
|
|
230
|
+
>{this.getTitle()}</Button>
|
|
213
231
|
</Popconfirm> :
|
|
214
232
|
<Button type={bType} block={block} size={buttonSize}
|
|
215
233
|
onClick={() => doAction(actionConfig.id, codes, {})}
|
|
216
234
|
disabled={disabled_}
|
|
217
|
-
>{
|
|
235
|
+
>{this.getTitle()}</Button>
|
|
218
236
|
}
|
|
219
237
|
|
|
220
238
|
render() {
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import {ButtonProps, Cascader as AntdCascader} from 'antd'
|
|
3
|
+
import { EControlProps, EnumItem} from "../../tmpl/interface";
|
|
4
|
+
import HCDataSource from "../../tmpl/hc-data-source";
|
|
5
|
+
|
|
6
|
+
interface CascaderProps extends EControlProps{
|
|
7
|
+
|
|
8
|
+
baseValue?:string[],//baseValue 指定后不能修改
|
|
9
|
+
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface CascaderState {
|
|
13
|
+
options:object[]
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default class Cascader extends React.PureComponent<CascaderProps, CascaderState> {
|
|
17
|
+
|
|
18
|
+
static defaultProps={
|
|
19
|
+
baseValue:[],//['level1','level2']
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
state={
|
|
23
|
+
options:[],
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async componentDidMount() {
|
|
27
|
+
let options= await this.getOptions();
|
|
28
|
+
this.setState({
|
|
29
|
+
options
|
|
30
|
+
})
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
handleChange=(value)=>{
|
|
35
|
+
const { onChange } = this.props
|
|
36
|
+
let res=undefined
|
|
37
|
+
console.log('Cascader',value);
|
|
38
|
+
if(value){
|
|
39
|
+
res=value.join("->")
|
|
40
|
+
console.log("value.join(\"->\")",res)
|
|
41
|
+
}
|
|
42
|
+
if (onChange) {
|
|
43
|
+
onChange(res);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
getOptions=async ()=>{
|
|
48
|
+
const { fieldConfig,baseValue }=this.props
|
|
49
|
+
let options= await HCDataSource.getOptions(fieldConfig.mstrucId);
|
|
50
|
+
const ops=[]
|
|
51
|
+
let newOptions=[];
|
|
52
|
+
|
|
53
|
+
let nextOptions=options;
|
|
54
|
+
let currentOptions=newOptions;
|
|
55
|
+
//先根据 baseValue 过滤一层
|
|
56
|
+
if(baseValue.length>0){
|
|
57
|
+
baseValue.map((v,i)=>{
|
|
58
|
+
if(i>0){
|
|
59
|
+
currentOptions[0].subOptions=[];
|
|
60
|
+
currentOptions= currentOptions[0].subOptions;
|
|
61
|
+
}
|
|
62
|
+
if(nextOptions){
|
|
63
|
+
for(let option of nextOptions){
|
|
64
|
+
if(option.title==v){
|
|
65
|
+
currentOptions.push({...option});
|
|
66
|
+
nextOptions=option.subOptions;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
}else{
|
|
73
|
+
newOptions=options;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
this.buildOptions(newOptions,ops);
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
return ops;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
buildOptions=(options:EnumItem[],ops:object[])=>{
|
|
85
|
+
options.forEach((item)=>{
|
|
86
|
+
const op={}
|
|
87
|
+
op["value"]=item.title
|
|
88
|
+
op["label"]=item.title
|
|
89
|
+
op["key"]=item.id
|
|
90
|
+
ops.push(op);
|
|
91
|
+
if(item.subOptions){
|
|
92
|
+
let children=[];
|
|
93
|
+
op['children']=children;
|
|
94
|
+
this.buildOptions(item.subOptions,children);
|
|
95
|
+
}else{
|
|
96
|
+
op["isLeaf"]= true;
|
|
97
|
+
}
|
|
98
|
+
})
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
render(){
|
|
102
|
+
const {options}=this.state;
|
|
103
|
+
const { fieldConfig,onChange,value,...other}=this.props
|
|
104
|
+
return (
|
|
105
|
+
<AntdCascader
|
|
106
|
+
displayRender={label=>label.join('->')}
|
|
107
|
+
options={options}
|
|
108
|
+
value={value?value.split('->'):undefined}
|
|
109
|
+
onChange={this.handleChange}
|
|
110
|
+
{...other}
|
|
111
|
+
/>
|
|
112
|
+
)
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import {Drawer, Space,Button,ButtonProps} from 'antd'
|
|
3
|
-
import {CQueryConfig} from "../../tmpl/interface";
|
|
3
|
+
import {CQueryConfig,PageType} from "../../tmpl/interface";
|
|
4
4
|
import LtmplPage from "./../../module/ltmpl-page";
|
|
5
5
|
import {
|
|
6
6
|
EditOutlined,
|
|
7
7
|
} from '@ant-design/icons';
|
|
8
|
-
|
|
9
8
|
import Units from '../../units'
|
|
10
|
-
import
|
|
11
|
-
|
|
9
|
+
import DtmplEditPage from "../../detail/edit/dtmpl-edit-page";
|
|
10
|
+
import DtmplEdit from "../../detail/edit/dtmpl-edit";
|
|
12
11
|
interface CquickButtonProps extends ButtonProps{
|
|
13
12
|
mainCode:string;
|
|
14
13
|
cQueryConfig:CQueryConfig;
|
|
14
|
+
pageType:PageType;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
interface CquickButtonState {
|
|
@@ -29,7 +29,9 @@ class CquickButton extends React.PureComponent<CquickButtonProps, CquickButtonSt
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
static defaultProps={
|
|
33
|
+
pageType:'modal'
|
|
34
|
+
}
|
|
33
35
|
|
|
34
36
|
showDraw=(currentId:string)=>{
|
|
35
37
|
// console.log("点击了L2MenuQuickBar",currentId);
|
|
@@ -47,9 +49,8 @@ class CquickButton extends React.PureComponent<CquickButtonProps, CquickButtonSt
|
|
|
47
49
|
|
|
48
50
|
|
|
49
51
|
render() {
|
|
50
|
-
const {cQueryConfig,mainCode,type,...button}=this.props;
|
|
52
|
+
const {cQueryConfig,mainCode,type,pageType,...button}=this.props;
|
|
51
53
|
const {showDraw,} = this.state;
|
|
52
|
-
|
|
53
54
|
console.log("cQuery mainCode",mainCode);
|
|
54
55
|
let mcode=mainCode && mainCode.indexOf("@R@")>0?mainCode.split("@R@")[0]:mainCode;
|
|
55
56
|
return (
|
|
@@ -65,13 +66,14 @@ class CquickButton extends React.PureComponent<CquickButtonProps, CquickButtonSt
|
|
|
65
66
|
}}>{outlinedMap[cQueryConfig.title]?outlinedMap[cQueryConfig.title]:cQueryConfig.title}</Button>}
|
|
66
67
|
{!showDraw?null:
|
|
67
68
|
cQueryConfig.type=='edit'?
|
|
68
|
-
|
|
69
|
+
<DtmplEditPage pageType={pageType} visible={showDraw} onCancel={()=>{
|
|
69
70
|
this.setState({
|
|
70
71
|
showDraw:false,
|
|
71
72
|
})}}
|
|
72
73
|
sourceId={cQueryConfig.id}
|
|
73
|
-
|
|
74
|
-
|
|
74
|
+
code={mcode}
|
|
75
|
+
onOk={this.closeDrawer} />
|
|
76
|
+
:
|
|
75
77
|
<Drawer
|
|
76
78
|
placement={'left'}
|
|
77
79
|
title="关联查询"
|
|
@@ -94,8 +96,7 @@ class CquickButton extends React.PureComponent<CquickButtonProps, CquickButtonSt
|
|
|
94
96
|
}
|
|
95
97
|
</Drawer>
|
|
96
98
|
}
|
|
97
|
-
|
|
98
|
-
</>
|
|
99
|
+
</>
|
|
99
100
|
);
|
|
100
101
|
}
|
|
101
102
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import {DatePicker as AntdDatePicker,TimePicker} from "antd";
|
|
3
3
|
import moment from "moment";
|
|
4
|
+
import type { Moment } from "moment";
|
|
4
5
|
import {FieldConfig,EControlProps} from "../../tmpl/interface";
|
|
5
6
|
import Units from "../../units";
|
|
6
|
-
import
|
|
7
|
+
import type { RangePickerProps } from 'antd/es/date-picker';
|
|
7
8
|
|
|
8
9
|
const {RangePicker} = AntdDatePicker;
|
|
9
10
|
|
|
@@ -15,38 +16,30 @@ interface DataPickerProps extends EControlProps{
|
|
|
15
16
|
|
|
16
17
|
const DatePicker: React.FC<DataPickerProps> = (props) => {
|
|
17
18
|
|
|
18
|
-
const {id,value:propsValue, itemType, fieldConfig, onChange,style} = props;
|
|
19
|
+
const {id,value:propsValue, itemType, fieldConfig, onChange,style,min,max} = props;
|
|
19
20
|
let value=propsValue;
|
|
20
21
|
let format = Units.getMomentFormat(itemType);
|
|
21
22
|
|
|
22
|
-
const changeValue = (value) => {
|
|
23
|
+
const changeValue = (value:Moment) => {
|
|
23
24
|
if (onChange) {
|
|
24
|
-
onChange(value?
|
|
25
|
+
onChange(value?value.format(format):undefined);
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
28
|
|
|
28
|
-
const changeRangeValue = (value:
|
|
29
|
+
const changeRangeValue = (value:Moment[]) => {
|
|
29
30
|
if (onChange) {
|
|
30
31
|
if(!value){
|
|
31
32
|
onChange(value);
|
|
32
33
|
}else if(value.length===2 && value[0] && value[1]){
|
|
33
|
-
onChange(
|
|
34
|
+
onChange(value[0].format(format)+"~"+value[1].format(format));
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
38
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
// changeRangeValue(TmplConfigAnalysis.current(value,format));
|
|
43
|
-
// break;
|
|
44
|
-
// default:
|
|
45
|
-
// changeValue(TmplConfigAnalysis.current(value,format)[0]);
|
|
46
|
-
// break;
|
|
47
|
-
// }
|
|
48
|
-
//
|
|
49
|
-
// }
|
|
39
|
+
const disabledDate: RangePickerProps['disabledDate'] = current => {
|
|
40
|
+
// console.log('current',moment(min,format).format(format));
|
|
41
|
+
return current && ( (max && moment(current.format(format),format) > moment(max,format)) || (min && moment(current.format(format),format) <moment(min,format)));
|
|
42
|
+
};
|
|
50
43
|
|
|
51
44
|
let entryControl = undefined;
|
|
52
45
|
let picker:"date" | "time" | "year" | "month" | "week" | "quarter"="date";
|
|
@@ -63,6 +56,7 @@ const DatePicker: React.FC<DataPickerProps> = (props) => {
|
|
|
63
56
|
style={{...style}}
|
|
64
57
|
picker={picker}
|
|
65
58
|
format={format}
|
|
59
|
+
disabledDate={disabledDate}
|
|
66
60
|
value={momentValue}
|
|
67
61
|
disabled={fieldConfig.disabled}
|
|
68
62
|
onChange={changeValue}
|
|
@@ -75,6 +69,7 @@ const DatePicker: React.FC<DataPickerProps> = (props) => {
|
|
|
75
69
|
entryControl = <AntdDatePicker
|
|
76
70
|
id={id}
|
|
77
71
|
style={{...style}}
|
|
72
|
+
disabledDate={disabledDate}
|
|
78
73
|
showTime={{format: Units.getDateTimeFormat(itemType)}}
|
|
79
74
|
picker='date'
|
|
80
75
|
format={format}
|
|
@@ -94,6 +89,7 @@ const DatePicker: React.FC<DataPickerProps> = (props) => {
|
|
|
94
89
|
entryControl = <RangePicker id={id} picker={picker}
|
|
95
90
|
style={{...style}}
|
|
96
91
|
format={format}
|
|
92
|
+
disabledDate={disabledDate}
|
|
97
93
|
value={momentValue}
|
|
98
94
|
disabled={fieldConfig.disabled}
|
|
99
95
|
onChange={changeRangeValue}/>;
|
|
@@ -108,6 +104,7 @@ const DatePicker: React.FC<DataPickerProps> = (props) => {
|
|
|
108
104
|
format={format}
|
|
109
105
|
style={{...style}}
|
|
110
106
|
value={momentValue}
|
|
107
|
+
disabledDate={disabledDate}
|
|
111
108
|
disabled={fieldConfig.disabled}
|
|
112
109
|
onChange={changeRangeValue}/>;
|
|
113
110
|
break;
|
|
@@ -201,10 +201,12 @@ export default class EntitySelect extends React.PureComponent<InnerEntitySelectP
|
|
|
201
201
|
pageInfo = queryData.pageInfo;
|
|
202
202
|
queryData.entities.forEach((item, index) => {
|
|
203
203
|
let title = item.fieldMap[titleId];
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
204
|
+
if(title){
|
|
205
|
+
let ts=title.split('@R@');
|
|
206
|
+
let t=ts && ts.length>0?ts[ts.length-1]:title;
|
|
207
|
+
let option = this.toOption(item.code,t , onEntityClick);
|
|
208
|
+
options.push(option);
|
|
209
|
+
}
|
|
208
210
|
})
|
|
209
211
|
return {options, touchEnd: queryData.touchEnd};
|
|
210
212
|
}
|
|
@@ -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);
|
|
@@ -12,10 +12,13 @@ import loadable from "@loadable/component";
|
|
|
12
12
|
import HCDataSource from "../tmpl/hc-data-source";
|
|
13
13
|
import Upload from '../controls/upload';
|
|
14
14
|
import Progress from './progress'
|
|
15
|
-
|
|
15
|
+
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':
|
|
@@ -183,7 +196,7 @@ function renderControl(id:any,fieldConfig: FieldConfig, fieldValue: any, onChang
|
|
|
183
196
|
entryControl = <AutoComplete {...controlProps} />
|
|
184
197
|
break;
|
|
185
198
|
case 'caselect':
|
|
186
|
-
entryControl
|
|
199
|
+
entryControl =<Cascader {...controlProps}></Cascader>;
|
|
187
200
|
break;
|
|
188
201
|
case 'relation':
|
|
189
202
|
entryControl = unSupportControl;
|
|
@@ -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}
|