aldehyde 0.1.17 → 0.1.18
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/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 -0
- package/lib/controls/cquery/cquick-button.d.ts.map +1 -1
- package/lib/controls/cquery/cquick-button.js +18 -7
- package/lib/controls/cquery/cquick-button.js.map +1 -1
- package/lib/controls/entry-control.js +2 -1
- package/lib/controls/entry-control.js.map +1 -1
- package/lib/controls/view-control.js +2 -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 +7 -1
- package/lib/detail/button/submit-button-bar.js.map +1 -1
- package/lib/detail/edit/dtmpl-edit.d.ts +2 -2
- package/lib/detail/edit/dtmpl-edit.d.ts.map +1 -1
- package/lib/index.d.ts +3 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -2
- package/lib/index.js.map +1 -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} +3 -3
- package/lib/module/dtmpl-view-page.js.map +1 -0
- package/lib/table/act-table.js +2 -2
- package/lib/table/act-table.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 +1 -0
- package/lib/tmpl/hcservice-v3.d.ts.map +1 -1
- package/lib/tmpl/hcservice-v3.js +16 -0
- package/lib/tmpl/hcservice-v3.js.map +1 -1
- package/lib/tmpl/interface.d.ts +3 -1
- package/lib/tmpl/interface.d.ts.map +1 -1
- package/lib/tmpl/interface.js.map +1 -1
- package/lib/units/index.d.ts +1 -0
- package/lib/units/index.d.ts.map +1 -1
- package/lib/units/index.js +6 -0
- package/lib/units/index.js.map +1 -1
- package/package.json +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 +30 -8
- package/src/aldehyde/controls/entry-control.tsx +2 -2
- package/src/aldehyde/controls/view-control.tsx +1 -1
- package/src/aldehyde/detail/button/submit-button-bar.tsx +5 -2
- package/src/aldehyde/detail/edit/dtmpl-edit.tsx +2 -2
- package/src/aldehyde/index.tsx +4 -3
- package/src/aldehyde/layout/menu/userinfo-bar.tsx +2 -2
- package/src/aldehyde/module/{dtmpl-page.tsx → dtmpl-view-page.tsx} +4 -11
- package/src/aldehyde/table/act-table.tsx +2 -2
- package/src/aldehyde/tmpl/hc-data-source.tsx +59 -6
- package/src/aldehyde/tmpl/hcservice-v3.tsx +14 -0
- package/src/aldehyde/tmpl/interface.tsx +4 -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
package/package.json
CHANGED
|
@@ -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
|
+
}
|
|
@@ -5,13 +5,14 @@ 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
9
|
import ModalDtmplEdit from "../../detail/edit/modal-dtmpl-edit";
|
|
11
|
-
|
|
10
|
+
import DtmplEdit from "../../detail/edit/dtmpl-edit";
|
|
11
|
+
export type PageType='modal'|'drawer'
|
|
12
12
|
interface CquickButtonProps extends ButtonProps{
|
|
13
13
|
mainCode:string;
|
|
14
14
|
cQueryConfig:CQueryConfig;
|
|
15
|
+
pageType:PageType;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
interface CquickButtonState {
|
|
@@ -29,7 +30,9 @@ class CquickButton extends React.PureComponent<CquickButtonProps, CquickButtonSt
|
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
|
|
32
|
-
|
|
33
|
+
static defaultProps={
|
|
34
|
+
pageType:'modal'
|
|
35
|
+
}
|
|
33
36
|
|
|
34
37
|
showDraw=(currentId:string)=>{
|
|
35
38
|
// console.log("点击了L2MenuQuickBar",currentId);
|
|
@@ -47,9 +50,8 @@ class CquickButton extends React.PureComponent<CquickButtonProps, CquickButtonSt
|
|
|
47
50
|
|
|
48
51
|
|
|
49
52
|
render() {
|
|
50
|
-
const {cQueryConfig,mainCode,type,...button}=this.props;
|
|
53
|
+
const {cQueryConfig,mainCode,type,pageType,...button}=this.props;
|
|
51
54
|
const {showDraw,} = this.state;
|
|
52
|
-
|
|
53
55
|
console.log("cQuery mainCode",mainCode);
|
|
54
56
|
let mcode=mainCode && mainCode.indexOf("@R@")>0?mainCode.split("@R@")[0]:mainCode;
|
|
55
57
|
return (
|
|
@@ -65,13 +67,34 @@ class CquickButton extends React.PureComponent<CquickButtonProps, CquickButtonSt
|
|
|
65
67
|
}}>{outlinedMap[cQueryConfig.title]?outlinedMap[cQueryConfig.title]:cQueryConfig.title}</Button>}
|
|
66
68
|
{!showDraw?null:
|
|
67
69
|
cQueryConfig.type=='edit'?
|
|
68
|
-
<ModalDtmplEdit visible={showDraw} onCancel={()=>{
|
|
70
|
+
pageType=='modal'? <ModalDtmplEdit visible={showDraw} onCancel={()=>{
|
|
69
71
|
this.setState({
|
|
70
72
|
showDraw:false,
|
|
71
73
|
})}}
|
|
72
74
|
sourceId={cQueryConfig.id}
|
|
73
75
|
code={mcode}
|
|
74
76
|
onOk={this.closeDrawer} />:
|
|
77
|
+
<Drawer
|
|
78
|
+
placement={'left'}
|
|
79
|
+
closable={true}
|
|
80
|
+
mask={false}
|
|
81
|
+
onClose={this.closeDrawer}
|
|
82
|
+
visible={showDraw}
|
|
83
|
+
width={'calc(100% - 280px)'}
|
|
84
|
+
style={{
|
|
85
|
+
maxWidth: 1960,
|
|
86
|
+
overflowY:'hidden',
|
|
87
|
+
}}
|
|
88
|
+
extra={
|
|
89
|
+
<Space>
|
|
90
|
+
<Button onClick={this.closeDrawer}>关闭</Button>
|
|
91
|
+
</Space>
|
|
92
|
+
}
|
|
93
|
+
>
|
|
94
|
+
|
|
95
|
+
<DtmplEdit sourceId={cQueryConfig.id} code={mcode} ></DtmplEdit>
|
|
96
|
+
</Drawer>
|
|
97
|
+
:
|
|
75
98
|
<Drawer
|
|
76
99
|
placement={'left'}
|
|
77
100
|
title="关联查询"
|
|
@@ -94,8 +117,7 @@ class CquickButton extends React.PureComponent<CquickButtonProps, CquickButtonSt
|
|
|
94
117
|
}
|
|
95
118
|
</Drawer>
|
|
96
119
|
}
|
|
97
|
-
|
|
98
|
-
</>
|
|
120
|
+
</>
|
|
99
121
|
);
|
|
100
122
|
}
|
|
101
123
|
}
|
|
@@ -12,7 +12,7 @@ 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'
|
|
@@ -183,7 +183,7 @@ function renderControl(id:any,fieldConfig: FieldConfig, fieldValue: any, onChang
|
|
|
183
183
|
entryControl = <AutoComplete {...controlProps} />
|
|
184
184
|
break;
|
|
185
185
|
case 'caselect':
|
|
186
|
-
entryControl
|
|
186
|
+
entryControl =<Cascader {...controlProps}></Cascader>;
|
|
187
187
|
break;
|
|
188
188
|
case 'relation':
|
|
189
189
|
entryControl = unSupportControl;
|
|
@@ -126,7 +126,7 @@ function renderControl(fieldConfig: FieldConfig, fieldValue: any,pHolderType:Con
|
|
|
126
126
|
viewControl = unSupportControl;
|
|
127
127
|
break;
|
|
128
128
|
case 'caselect':
|
|
129
|
-
viewControl =
|
|
129
|
+
viewControl = <span className="infoStyle">{value}</span>;
|
|
130
130
|
break;
|
|
131
131
|
case 'relation':
|
|
132
132
|
viewControl = unSupportControl
|
|
@@ -104,8 +104,11 @@ class SubmitButtonBar extends React.PureComponent<SubmitButtonProps, SubmitButto
|
|
|
104
104
|
|
|
105
105
|
|
|
106
106
|
return (
|
|
107
|
-
<Affix
|
|
108
|
-
|
|
107
|
+
<Affix
|
|
108
|
+
//style={{position: 'absolute', right: 10, maxHeight: 100}}
|
|
109
|
+
// offsetBottom={this.calcOffsetBottom(buttons, actions)}>
|
|
110
|
+
style={{position: 'absolute',bottom:60,right: 15,}} offsetBottom={this.calcOffsetBottom(buttons, actions)}
|
|
111
|
+
>
|
|
109
112
|
<div className={'submitButtonBar'} >
|
|
110
113
|
<ul>
|
|
111
114
|
{buttons.includes('dtmplSave') ? <li key={100}>
|
|
@@ -12,8 +12,8 @@ import HcserviceV3 from "../../tmpl/hcservice-v3";
|
|
|
12
12
|
import CqueryButtonBar from "../button/cquery-button-bar"
|
|
13
13
|
|
|
14
14
|
interface DtmplEditProps extends DtmplBaseProps {
|
|
15
|
-
goBackToLtmpl
|
|
16
|
-
addOrUpdate
|
|
15
|
+
goBackToLtmpl?: () => void,
|
|
16
|
+
addOrUpdate?:AddOrUpdate,
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
interface DtmplEditState {
|
package/src/aldehyde/index.tsx
CHANGED
|
@@ -4,7 +4,8 @@ import Loginit from './login/login';
|
|
|
4
4
|
import DtmplRoute from './routable/dtmpl-route';
|
|
5
5
|
import ImportRoute from './routable/import-route';
|
|
6
6
|
import LtmplRoute from "./routable/ltmpl-route";
|
|
7
|
-
import
|
|
7
|
+
import DtmplViewPage from './module/dtmpl-view-page';
|
|
8
|
+
import DtmplEdit from './detail/edit/dtmpl-edit';
|
|
8
9
|
import LtmplPage from './module/ltmpl-page';
|
|
9
10
|
import Menu2layers from './layout/menu/menu-2layers';
|
|
10
11
|
import Block from './layout/menu/block';
|
|
@@ -24,7 +25,7 @@ import TmplDataSource from './tmpl/hc-data-source';
|
|
|
24
25
|
import * as TmplInterface from './tmpl/interface';
|
|
25
26
|
import Superagent from './tmpl/superagent';
|
|
26
27
|
|
|
27
|
-
export {ActTable,SelectTable,Loginit,DtmplRoute,ImportRoute,LtmplRoute,
|
|
28
|
+
export {ActTable,SelectTable,Loginit,DtmplRoute,ImportRoute,LtmplRoute,DtmplViewPage,LtmplPage,Menu2layers,Block,UserBar,
|
|
28
29
|
ResetPassword,Footer,EntryControl,ViewControl,ProgramConfig,HydrocarbonService,QuickEntrance,Workbench,PopoverEntitySelect
|
|
29
|
-
,DatePicker,ModalDtmplEdit,TmplInterface,TmplDataSource,Superagent}
|
|
30
|
+
,DatePicker,ModalDtmplEdit,TmplInterface,TmplDataSource,Superagent,DtmplEdit}
|
|
30
31
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { Drawer, Space,Button} from 'antd'
|
|
3
3
|
import {SolutionOutlined} from '@ant-design/icons';
|
|
4
|
-
import
|
|
4
|
+
import DtmplViewPage from "../../module/dtmpl-view-page";
|
|
5
5
|
|
|
6
6
|
interface UserInfoBarProps {
|
|
7
7
|
|
|
@@ -54,7 +54,7 @@ class UserInfoBar extends React.PureComponent<UserInfoBarProps, UserInfoBarState
|
|
|
54
54
|
</Space>
|
|
55
55
|
}
|
|
56
56
|
>
|
|
57
|
-
<
|
|
57
|
+
<DtmplViewPage sourceId={'0'} code={"userCode"}></DtmplViewPage>
|
|
58
58
|
</Drawer>
|
|
59
59
|
</>
|
|
60
60
|
);
|
|
@@ -1,27 +1,20 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import {DtmplConfig, DtmplData, LtmplConfigRes} from '../tmpl/interface';
|
|
3
|
-
import Units from "../units";
|
|
4
|
-
import ActTable from '../table/act-table'
|
|
5
|
-
// import StatActTable from '../table/stat-act-table'
|
|
6
|
-
import HCDataSource from "../tmpl/hc-data-source";
|
|
7
|
-
import ModalDtmplView from "../detail/view/modal-dtmpl-view";
|
|
8
2
|
import ModalDtmplEdit from "../detail/edit/modal-dtmpl-edit";
|
|
9
|
-
import HcserviceV3 from "../tmpl/hcservice-v3";
|
|
10
3
|
import ActDtmplView from "../detail/view/act-dtmpl-view";
|
|
11
4
|
|
|
12
5
|
//以列表为入口的,页面内列表,基本原则是所有交互在页面内完成,不会触发路由。
|
|
13
6
|
|
|
14
|
-
export interface
|
|
7
|
+
export interface DtmplViewPageProps {
|
|
15
8
|
sourceId?:string,
|
|
16
9
|
code?:string;
|
|
17
10
|
mainCode?:string;
|
|
18
11
|
};
|
|
19
12
|
|
|
20
|
-
export interface
|
|
13
|
+
export interface DtmplViewPageState {
|
|
21
14
|
showDtmplEdit:boolean;
|
|
22
15
|
};
|
|
23
16
|
|
|
24
|
-
class
|
|
17
|
+
class DtmplViewPage extends React.PureComponent<DtmplViewPageProps, DtmplViewPageState> {
|
|
25
18
|
|
|
26
19
|
state = {
|
|
27
20
|
showDtmplEdit:false,
|
|
@@ -66,5 +59,5 @@ class DtmplPage extends React.PureComponent<DtmplPageProps, DtmplPageState> {
|
|
|
66
59
|
}
|
|
67
60
|
}
|
|
68
61
|
|
|
69
|
-
export default
|
|
62
|
+
export default DtmplViewPage;
|
|
70
63
|
|
|
@@ -287,9 +287,9 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
287
287
|
// onClick={() => this.doRowCQuery(cQuery.id, record.code)}
|
|
288
288
|
// >{cQuery.title}</Button>;
|
|
289
289
|
console.log("record record",record);
|
|
290
|
-
return <CquickButton key={cquery.id} size={"small"}
|
|
290
|
+
return <CquickButton key={cquery.id} size={"small"} pageType={'drawer'}
|
|
291
291
|
// onClick={() => doCQuery(cquery.id)}
|
|
292
|
-
|
|
292
|
+
cQueryConfig={cquery} mainCode={cquery.mainCodeColId?record[cquery.mainCodeColId]:record.code}/>
|
|
293
293
|
}) : ""}
|
|
294
294
|
</Space>);
|
|
295
295
|
} else {
|
|
@@ -2,8 +2,8 @@ import {
|
|
|
2
2
|
BlockMenu,
|
|
3
3
|
DtmplConfig,
|
|
4
4
|
EnumItem,
|
|
5
|
-
FieldBase, LtmplConfigRes,
|
|
6
|
-
SelectConfig, Level2Menu
|
|
5
|
+
FieldBase, LtmplConfigRes,ActionConfig,
|
|
6
|
+
SelectConfig, Level2Menu,LtmplConfig
|
|
7
7
|
} from "./interface";
|
|
8
8
|
import HcserviceV3 from './hcservice-v3';
|
|
9
9
|
import ControlTypeSupportor from './control-type-supportor'
|
|
@@ -13,7 +13,8 @@ const blocksCache: BlockMenu[] = [];
|
|
|
13
13
|
const quickEntranceCache: Level2Menu[] = [];
|
|
14
14
|
const messageCache: Level2Menu[] = [];
|
|
15
15
|
const workbenchCache: Level2Menu[] = [];
|
|
16
|
-
const enumMap: Map<string, EnumItem[]> = new Map<string, EnumItem[]>()
|
|
16
|
+
const enumMap: Map<string, EnumItem[]> = new Map<string, EnumItem[]>();//key mstrucId
|
|
17
|
+
const optionsMap: Map<string, EnumItem[]> = new Map<string, EnumItem[]>();//key mstrucId
|
|
17
18
|
const selectConfigMap: Map<string, SelectConfig> = new Map<string, SelectConfig>();
|
|
18
19
|
const ltmplConfigMap: Map<string, LtmplConfigRes> = new Map<string, LtmplConfigRes>();
|
|
19
20
|
const l2LtmplConfigMap: Map<string, LtmplConfigRes> = new Map<string, LtmplConfigRes>();
|
|
@@ -35,6 +36,19 @@ function findUnloadEnumMstrucIdOfFields(fields:FieldBase[]) {
|
|
|
35
36
|
return mstrucIdArray;
|
|
36
37
|
}
|
|
37
38
|
|
|
39
|
+
function findUnloadEnumMstrucIdOfActions(actions:ActionConfig[]) {
|
|
40
|
+
const mstrucIds = [];
|
|
41
|
+
if (actions) {
|
|
42
|
+
actions.forEach((item) => {
|
|
43
|
+
let subs= findUnloadEnumMstrucIdOfFields(item.writes);
|
|
44
|
+
concat(mstrucIds,subs);
|
|
45
|
+
subs= findUnloadEnumMstrucIdOfFields(item.preposes);
|
|
46
|
+
concat(mstrucIds,subs);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return mstrucIds;
|
|
50
|
+
}
|
|
51
|
+
|
|
38
52
|
async function loadEnumOfDtmplConfig(selectConfig:DtmplConfig){
|
|
39
53
|
const mstrucIds = [];
|
|
40
54
|
if(selectConfig.groups){
|
|
@@ -43,6 +57,8 @@ async function loadEnumOfDtmplConfig(selectConfig:DtmplConfig){
|
|
|
43
57
|
concat(mstrucIds,subs);
|
|
44
58
|
})
|
|
45
59
|
}
|
|
60
|
+
let subs= findUnloadEnumMstrucIdOfActions(selectConfig.actions);
|
|
61
|
+
concat(mstrucIds,subs);
|
|
46
62
|
await loadEnum(mstrucIds);
|
|
47
63
|
}
|
|
48
64
|
|
|
@@ -57,12 +73,29 @@ function concat(mstrucIds,sub){
|
|
|
57
73
|
return mstrucIds;
|
|
58
74
|
}
|
|
59
75
|
|
|
60
|
-
async function loadEnumOfSelectConfig(selectConfig:SelectConfig){
|
|
76
|
+
async function loadEnumOfSelectConfig(selectConfig:SelectConfig ){
|
|
77
|
+
const mstrucIds = [];
|
|
78
|
+
let subs= findUnloadEnumMstrucIdOfFields(selectConfig.columns);
|
|
79
|
+
concat(mstrucIds,subs);
|
|
80
|
+
subs= findUnloadEnumMstrucIdOfFields(selectConfig.criterias);
|
|
81
|
+
concat(mstrucIds,subs);
|
|
82
|
+
await loadEnum(mstrucIds);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
async function loadEnumOfLtmplConfig(selectConfig: LtmplConfig ){
|
|
61
86
|
const mstrucIds = [];
|
|
62
87
|
let subs= findUnloadEnumMstrucIdOfFields(selectConfig.columns);
|
|
63
88
|
concat(mstrucIds,subs);
|
|
64
89
|
subs= findUnloadEnumMstrucIdOfFields(selectConfig.criterias);
|
|
65
90
|
concat(mstrucIds,subs);
|
|
91
|
+
subs= findUnloadEnumMstrucIdOfFields(selectConfig.drillingParams);
|
|
92
|
+
concat(mstrucIds,subs);
|
|
93
|
+
subs= findUnloadEnumMstrucIdOfFields(selectConfig.reStatParams);
|
|
94
|
+
concat(mstrucIds,subs);
|
|
95
|
+
subs= findUnloadEnumMstrucIdOfActions(selectConfig.actions);
|
|
96
|
+
concat(mstrucIds,subs);
|
|
97
|
+
subs= findUnloadEnumMstrucIdOfActions(selectConfig.rowActions);
|
|
98
|
+
concat(mstrucIds,subs);
|
|
66
99
|
await loadEnum(mstrucIds);
|
|
67
100
|
}
|
|
68
101
|
async function loadEnum(mstrucIds:string[]){
|
|
@@ -79,16 +112,35 @@ async function loadEnum(mstrucIds:string[]){
|
|
|
79
112
|
}
|
|
80
113
|
|
|
81
114
|
|
|
115
|
+
|
|
116
|
+
|
|
82
117
|
function HCDataSource() {
|
|
83
118
|
|
|
84
119
|
}
|
|
85
120
|
|
|
121
|
+
HCDataSource.getOptions = async function (mstrucId:string){
|
|
122
|
+
if(!mstrucId){
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
if( !optionsMap.has(mstrucId)){
|
|
126
|
+
let reqOptions= await HcserviceV3.requestOptions(mstrucId);
|
|
127
|
+
for(let option of reqOptions){
|
|
128
|
+
if(option['css']){
|
|
129
|
+
option['color']=option['css'].color;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
optionsMap.set(mstrucId,reqOptions);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return optionsMap.get(mstrucId);
|
|
136
|
+
}
|
|
137
|
+
|
|
86
138
|
HCDataSource.requestLtmplConfig = async function ( sourceId: string) {
|
|
87
139
|
if (!ltmplConfigMap.has(sourceId)) {
|
|
88
140
|
ltmplConfigMap.set(sourceId, await HcserviceV3.requestLtmplConfig(sourceId));
|
|
89
141
|
//加载枚举
|
|
90
142
|
let res:LtmplConfigRes=ltmplConfigMap.get(sourceId);
|
|
91
|
-
await
|
|
143
|
+
await loadEnumOfLtmplConfig(res.ltmplConfig);
|
|
92
144
|
}
|
|
93
145
|
return ltmplConfigMap.get(sourceId);
|
|
94
146
|
};
|
|
@@ -97,7 +149,7 @@ HCDataSource.requestL2LtmplConfig = async function (sourceId: string) {
|
|
|
97
149
|
l2LtmplConfigMap.set(sourceId, await HcserviceV3.requestL2LtmplConfig(sourceId));
|
|
98
150
|
//加载枚举
|
|
99
151
|
let res:LtmplConfigRes=l2LtmplConfigMap.get(sourceId);
|
|
100
|
-
await
|
|
152
|
+
await loadEnumOfLtmplConfig(res.ltmplConfig);
|
|
101
153
|
}
|
|
102
154
|
return l2LtmplConfigMap.get(sourceId);
|
|
103
155
|
};
|
|
@@ -218,6 +270,7 @@ HCDataSource.clearOnly =async function () {
|
|
|
218
270
|
dtmplConfigMap.clear();
|
|
219
271
|
selectConfigMap.clear();
|
|
220
272
|
l2LtmplConfigMap.clear();
|
|
273
|
+
optionsMap.clear();
|
|
221
274
|
blocksCache.splice(0,blocksCache.length);
|
|
222
275
|
quickEntranceCache.splice(0,quickEntranceCache.length);
|
|
223
276
|
messageCache.splice(0,quickEntranceCache.length);
|
|
@@ -21,6 +21,20 @@ export default class HcserviceV3 {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
static async requestOptions(mstrucId) { //有下拉菜单时,请求下拉选项操作
|
|
25
|
+
if (mstrucId) {
|
|
26
|
+
let res = await Super.super({
|
|
27
|
+
url: `/v3/enum`,
|
|
28
|
+
query: {
|
|
29
|
+
mstrucId
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
return res.options;
|
|
33
|
+
} else {
|
|
34
|
+
return {};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
24
38
|
// static async requestSelect(requestedMap, selectMSFieldIdArray) {
|
|
25
39
|
// //先从当前状态从中找,没有的才去查
|
|
26
40
|
// //后续可以放在缓存里,但需要一些策略和技巧
|
|
@@ -168,16 +168,19 @@ export interface LtmplConfig extends SelectConfig {
|
|
|
168
168
|
cQuerys?:CQueryConfig[];
|
|
169
169
|
rowCQuerys?:CQueryConfig[];
|
|
170
170
|
chartType?: ChartType[];
|
|
171
|
-
reStatParams?: CriteriaConfig[];
|
|
172
171
|
editAction:ActionConfig;
|
|
172
|
+
reStatParams?: CriteriaConfig[];
|
|
173
|
+
|
|
173
174
|
drillingParams?: CriteriaConfig[];
|
|
174
175
|
}
|
|
175
176
|
|
|
176
177
|
export interface EnumItem {
|
|
177
178
|
title: string;
|
|
178
179
|
value: string;
|
|
180
|
+
id:string;
|
|
179
181
|
color: string;
|
|
180
182
|
order:string;
|
|
183
|
+
subOptions?:EnumItem[]
|
|
181
184
|
}
|
|
182
185
|
|
|
183
186
|
export type EditStatus ='new'|'changed'|'persisted'
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dtmpl-page.d.ts","sourceRoot":"","sources":["../../../../src/aldehyde/module/dtmpl-page.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAazB,MAAM,WAAW,cAAc;IAC3B,QAAQ,CAAC,EAAC,MAAM,CAAC;IACjB,IAAI,CAAC,EAAC,MAAM,CAAC;IACb,QAAQ,CAAC,EAAC,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC3B,aAAa,EAAC,OAAO,CAAC;CACzB;AAED,cAAM,SAAU,SAAQ,KAAK,CAAC,aAAa,CAAC,cAAc,EAAE,cAAc,CAAC;IAEvE,KAAK;;MAEJ;IAaD,OAAO,aAIN;IAED,eAAe,SAAW,MAAM,UAI/B;IAED,MAAM;CAcT;AAED,eAAe,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dtmpl-page.js","sourceRoot":"","sources":["../../../../src/aldehyde/module/dtmpl-page.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAOzB,OAAO,cAAc,MAAM,iCAAiC,CAAC;AAE7D,OAAO,YAAY,MAAM,+BAA+B,CAAC;AAQxD,CAAC;AAID,CAAC;AAEF,MAAM,SAAU,SAAQ,KAAK,CAAC,aAA6C;IAA3E;;QAEI,UAAK,GAAG;YACJ,aAAa,EAAC,KAAK;SACtB,CAAA;QAED,8BAA8B;QAC9B,8BAA8B;QAC9B,IAAI;QACJ,EAAE;QACF,wCAAwC;QACxC,sCAAsC;QACtC,sDAAsD;QACtD,kCAAkC;QAClC,QAAQ;QACR,IAAI;QAEJ,YAAO,GAAC,GAAE,EAAE;YACR,IAAI,CAAC,QAAQ,CAAC;gBACV,aAAa,EAAC,IAAI;aACrB,CAAC,CAAA;QACN,CAAC,CAAA;QAED,oBAAe,GAAI,CAAC,IAAY,EAAE,EAAE;YAChC,IAAI,CAAC,QAAQ,CAAC;gBACV,aAAa,EAAC,KAAK;aACtB,CAAC,CAAA;QACN,CAAC,CAAA;IAgBL,CAAC;IAdG,MAAM;QACF,MAAM,EAAC,aAAa,EAAC,GAAG,IAAI,CAAC,KAAK,CAAC;QACnC,MAAM,EAAE,QAAQ,EAAC,IAAI,EAAC,QAAQ,EAAC,GAAG,IAAI,CAAC,KAAK,CAAC;QACzC,OAAO;YACH,oBAAC,YAAY,IAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,GAAiB;YACpG,oBAAC,cAAc,IAAC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,GAAE,EAAE;oBAClD,IAAI,CAAC,QAAQ,CAAC;wBACV,aAAa,EAAC,KAAK;qBACtB,CAAC,CAAA;gBAAA,CAAC,EACS,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,IAAI,CAAC,eAAe,GAAI,CACjD,CAAA;IACb,CAAC;CACJ;AAED,eAAe,SAAS,CAAC"}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import Super from "../../tmpl/superagent"
|
|
3
|
-
import {Cascader as AntdCascader} from 'antd'
|
|
4
|
-
|
|
5
|
-
export default class Cascader extends React.Component{
|
|
6
|
-
|
|
7
|
-
state={
|
|
8
|
-
options:[]
|
|
9
|
-
}
|
|
10
|
-
handleChange=(value)=>{
|
|
11
|
-
let res=""
|
|
12
|
-
res=value.join("->")
|
|
13
|
-
console.log(res)
|
|
14
|
-
this.triggerChange(res)
|
|
15
|
-
}
|
|
16
|
-
triggerChange = (changedValue) => {
|
|
17
|
-
const { onChange } = this.props
|
|
18
|
-
if (onChange) {
|
|
19
|
-
onChange(changedValue);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
requestLinkage=(optionKey)=>{ //第一级联动
|
|
23
|
-
const optGroupId=optionKey.split("@")[0]
|
|
24
|
-
const time=optionKey.split("@")[1]
|
|
25
|
-
Super.super({
|
|
26
|
-
url:`/meta/dict/cas_ops/${optGroupId}`,
|
|
27
|
-
}).then((res)=>{
|
|
28
|
-
const ops=[]
|
|
29
|
-
res.options.forEach((item)=>{
|
|
30
|
-
const op={}
|
|
31
|
-
op["value"]=item.title
|
|
32
|
-
op["label"]=item.title
|
|
33
|
-
op["key"]=item.id
|
|
34
|
-
op["isLeaf"]= false
|
|
35
|
-
ops.push(op)
|
|
36
|
-
})
|
|
37
|
-
this.setState({
|
|
38
|
-
options:ops,
|
|
39
|
-
time
|
|
40
|
-
})
|
|
41
|
-
})
|
|
42
|
-
}
|
|
43
|
-
loadData = (selectedOptions) => { //子集联动
|
|
44
|
-
const targetOption = selectedOptions[selectedOptions.length - 1]
|
|
45
|
-
targetOption.loading = true
|
|
46
|
-
this.setState({
|
|
47
|
-
time:this.state.time-1
|
|
48
|
-
})
|
|
49
|
-
if(selectedOptions && this.state.time>=1){
|
|
50
|
-
let id="";
|
|
51
|
-
selectedOptions.forEach((item)=>{
|
|
52
|
-
id=item.key
|
|
53
|
-
})
|
|
54
|
-
Super.super({
|
|
55
|
-
url:`v2/meta/dict/cas_ops/${id}`,
|
|
56
|
-
}).then((res)=>{
|
|
57
|
-
const ops=[]
|
|
58
|
-
const time=this.state.time
|
|
59
|
-
res.options.forEach((item)=>{
|
|
60
|
-
let op={}
|
|
61
|
-
op["value"]=item.title
|
|
62
|
-
op["label"]=item.title
|
|
63
|
-
op["key"]=item.id
|
|
64
|
-
if(time===1){
|
|
65
|
-
op["isLeaf"]= true
|
|
66
|
-
}else{
|
|
67
|
-
op["isLeaf"]= false
|
|
68
|
-
}
|
|
69
|
-
ops.push(op)
|
|
70
|
-
})
|
|
71
|
-
setTimeout(() => {
|
|
72
|
-
targetOption.loading = false;
|
|
73
|
-
targetOption.children =ops
|
|
74
|
-
this.setState({
|
|
75
|
-
options: [...this.state.options],
|
|
76
|
-
});
|
|
77
|
-
}, 300);
|
|
78
|
-
})
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
render(){
|
|
83
|
-
const { optionGroupKey,fieldName }=this.props
|
|
84
|
-
return (
|
|
85
|
-
<AntdCascader
|
|
86
|
-
onClick={()=>this.requestLinkage(optionGroupKey)}
|
|
87
|
-
placeholder={`请选择${fieldName}`}
|
|
88
|
-
style={{width:220}}
|
|
89
|
-
options={this.state.options}
|
|
90
|
-
loadData={this.loadData}
|
|
91
|
-
displayRender={label=>label.join('->')}
|
|
92
|
-
getPopupContainer={trigger => trigger.parentNode}
|
|
93
|
-
onChange={this.handleChange}
|
|
94
|
-
/>
|
|
95
|
-
)
|
|
96
|
-
}
|
|
97
|
-
}
|