aldehyde 0.2.133 → 0.2.134
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/layout/menu/block.d.ts.map +1 -1
- package/lib/layout/menu/block.js.map +1 -1
- package/lib/layout/menu/menu-render.js +1 -1
- package/lib/layout/menu/menu-render.js.map +1 -1
- package/lib/module/block-menu-tree-drawer.d.ts +39 -0
- package/lib/module/block-menu-tree-drawer.d.ts.map +1 -0
- package/lib/module/block-menu-tree-drawer.js +99 -0
- package/lib/module/block-menu-tree-drawer.js.map +1 -0
- package/lib/table/act-table.d.ts +4 -0
- package/lib/table/act-table.d.ts.map +1 -1
- package/lib/table/act-table.js +21 -4
- package/lib/table/act-table.js.map +1 -1
- package/lib/table/query-table.d.ts.map +1 -1
- package/lib/table/query-table.js +9 -6
- package/lib/table/query-table.js.map +1 -1
- package/lib/tmpl/hcservice-v3.d.ts +3 -0
- package/lib/tmpl/hcservice-v3.d.ts.map +1 -1
- package/lib/tmpl/hcservice-v3.js +37 -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/tree/block-menu-auth-tree.d.ts +33 -0
- package/lib/tree/block-menu-auth-tree.d.ts.map +1 -0
- package/lib/tree/block-menu-auth-tree.js +144 -0
- package/lib/tree/block-menu-auth-tree.js.map +1 -0
- package/lib/welcome/HCWelcome.js +35 -6
- package/lib/welcome/HCWelcome.js.map +1 -1
- package/package.json +1 -1
- package/src/aldehyde/index.tsx +1 -1
- package/src/aldehyde/layout/menu/block.tsx +0 -1
- package/src/aldehyde/layout/menu/menu-render.tsx +2 -2
- package/src/aldehyde/module/block-menu-tree-drawer.tsx +117 -0
- package/src/aldehyde/table/act-table.tsx +32 -4
- package/src/aldehyde/table/query-table.tsx +38 -20
- package/src/aldehyde/tmpl/hcservice-v3.tsx +35 -0
- package/src/aldehyde/tmpl/interface.tsx +15 -5
- package/src/aldehyde/tree/block-menu-auth-tree.tsx +188 -0
- package/src/aldehyde/welcome/HCWelcome.js +43 -5
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import {Card, Col, Row, Tree,Space} from 'antd';
|
|
3
|
+
import './index.css'
|
|
4
|
+
import HCserviceV3 from "../tmpl/hcservice-v3";
|
|
5
|
+
import {BlockMenu, Level2Menu, ProgramAuth} from "../tmpl/interface";
|
|
6
|
+
// import type {TreeDataNode, TreeProps} from 'antd';
|
|
7
|
+
import {DeleteOutlined, KeyOutlined, LockOutlined, PlusOutlined, RedoOutlined, UnlockOutlined} from '@ant-design/icons'
|
|
8
|
+
interface BlockMenuAuthTreeProps {
|
|
9
|
+
checks: string[],
|
|
10
|
+
//checkAuthCodes: string[],
|
|
11
|
+
onChange: (checkeds:string[]) => void,
|
|
12
|
+
// onCheck: (keys, info: object) => void,
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface BlockMenuAuthTreeState {
|
|
16
|
+
treeData?: Object[],
|
|
17
|
+
loading?: boolean,
|
|
18
|
+
// treekeyAuthId?:{},
|
|
19
|
+
// authIdtreekeys?:{}
|
|
20
|
+
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class BlockMenuAuthTree extends React.PureComponent<BlockMenuAuthTreeProps, BlockMenuAuthTreeState> {
|
|
25
|
+
|
|
26
|
+
static defaultProps = {checkeds: []}
|
|
27
|
+
|
|
28
|
+
treekeyAuthId= {};
|
|
29
|
+
authIdtreekeys={};
|
|
30
|
+
|
|
31
|
+
state = {
|
|
32
|
+
treeData: undefined,
|
|
33
|
+
loading: false,
|
|
34
|
+
// treekeyAuthId:{},
|
|
35
|
+
// authIdtreekeys:{}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
async componentDidMount() {
|
|
40
|
+
await this.refresh();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
async componentDidUpdate(prevProps, prevState) {
|
|
46
|
+
// const {checks:prechecks,} = prevProps;
|
|
47
|
+
// const {checks} = this.props;
|
|
48
|
+
// if(checks!=prechecks){
|
|
49
|
+
// await this.refresh();
|
|
50
|
+
// }
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async componentWillUnmount() {
|
|
54
|
+
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
initData = async () => {
|
|
59
|
+
|
|
60
|
+
this.setState({
|
|
61
|
+
loading: true
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
let data: BlockMenu[] = await HCserviceV3.requestBlockMenuAuths();
|
|
65
|
+
|
|
66
|
+
//转换成Treenode
|
|
67
|
+
|
|
68
|
+
let treeData= [];
|
|
69
|
+
|
|
70
|
+
if (data) {
|
|
71
|
+
treeData = this.toTreeNode(data);
|
|
72
|
+
console.log("treeData",treeData)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
//已经选了那些
|
|
76
|
+
this.setState({
|
|
77
|
+
treeData, loading: false
|
|
78
|
+
})
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
toTreeNode = (blockMenus: (BlockMenu | Level2Menu)[]): Object[] => {
|
|
82
|
+
let treeData= [];
|
|
83
|
+
// let authIdtreekeys={};
|
|
84
|
+
// let treekeyAuthId={};
|
|
85
|
+
if (blockMenus) {
|
|
86
|
+
blockMenus.forEach((block) => {
|
|
87
|
+
let blockNode = {key: block.id, title: block.title}
|
|
88
|
+
treeData.push(blockNode);
|
|
89
|
+
let nextBlockMenus = [];
|
|
90
|
+
blockNode["children"]=nextBlockMenus;
|
|
91
|
+
nextBlockMenus.push(...this.toTreeNode(block.items));
|
|
92
|
+
//处理权限
|
|
93
|
+
if (block["programAuths"]) {
|
|
94
|
+
|
|
95
|
+
block["programAuths"].forEach((auth) => {
|
|
96
|
+
let key= blockNode.key + auth.id;
|
|
97
|
+
this.treekeyAuthId[key]=auth.id;
|
|
98
|
+
if(!this.authIdtreekeys[auth.id]){
|
|
99
|
+
this.authIdtreekeys[auth.id]=[];
|
|
100
|
+
}
|
|
101
|
+
this.authIdtreekeys[auth.id].push(key);
|
|
102
|
+
let authNode= {key, title: auth.title, isLeaf: true}
|
|
103
|
+
authNode["code"] = auth.id;
|
|
104
|
+
nextBlockMenus.push(authNode);
|
|
105
|
+
});
|
|
106
|
+
}else{
|
|
107
|
+
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return treeData;
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
onCheck=(checkedKeys)=>{
|
|
118
|
+
let checks=[];
|
|
119
|
+
|
|
120
|
+
if(checkedKeys){
|
|
121
|
+
checkedKeys.forEach((k)=>{
|
|
122
|
+
if(this.treekeyAuthId[k]){
|
|
123
|
+
checks.push(this.treekeyAuthId[k]);
|
|
124
|
+
}
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
}
|
|
128
|
+
this.props.onChange(checks);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
async refresh() {
|
|
132
|
+
this.setState({
|
|
133
|
+
loading: true
|
|
134
|
+
})
|
|
135
|
+
await this.initData();
|
|
136
|
+
this.setState({
|
|
137
|
+
loading: false,
|
|
138
|
+
})
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
renderTitle = (nodeData) => {
|
|
142
|
+
return <Card bordered={false} style={{width:'100%',minWidth:'180px',marginBottom:2}} bodyStyle={{padding:'2px'}} >
|
|
143
|
+
<Row>
|
|
144
|
+
<Col span={24}>
|
|
145
|
+
<Space>
|
|
146
|
+
{nodeData["isLeaf"]?<KeyOutlined rotate={180} style={{color: '#f5222d', marginRight: '4px'}}/>:null}
|
|
147
|
+
{nodeData.title}
|
|
148
|
+
</Space>
|
|
149
|
+
|
|
150
|
+
</Col>
|
|
151
|
+
</Row>
|
|
152
|
+
</Card>
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
render() {
|
|
156
|
+
const {checks, onChange} = this.props;
|
|
157
|
+
const {loading, treeData} = this.state;
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
let checkedKeys=[];
|
|
161
|
+
checks.forEach((id)=>{
|
|
162
|
+
if(this.authIdtreekeys[id]){
|
|
163
|
+
checkedKeys.push(...this.authIdtreekeys[id]);
|
|
164
|
+
}
|
|
165
|
+
})
|
|
166
|
+
console.log("treeData",treeData);
|
|
167
|
+
console.log("checkedKeys",checkedKeys);
|
|
168
|
+
return <Card bodyStyle={{padding: '2px', "overflowY": "scroll", height: 'calc(78vh)', minWidth: '420px'}}
|
|
169
|
+
loading={loading}>
|
|
170
|
+
<Tree
|
|
171
|
+
checkable={true}
|
|
172
|
+
defaultExpandAll={true}
|
|
173
|
+
//defaultCheckedKeys={defaultCheckedKeys}
|
|
174
|
+
checkedKeys={checkedKeys}
|
|
175
|
+
|
|
176
|
+
showLine={{showLeafIcon: false}}
|
|
177
|
+
selectable={false}
|
|
178
|
+
onCheck={(checkedKeys)=>this.onCheck(checkedKeys)}
|
|
179
|
+
titleRender={(nodeData) => {
|
|
180
|
+
return this.renderTitle(nodeData)
|
|
181
|
+
}}
|
|
182
|
+
treeData={treeData}
|
|
183
|
+
/>
|
|
184
|
+
</Card>
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export default BlockMenuAuthTree
|
|
@@ -1,13 +1,27 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import {Card, Col, Row} from 'antd';
|
|
2
|
+
import {Button, Card, Col, Row} from 'antd';
|
|
3
3
|
import { BarChartOutlined } from "@ant-design/icons";
|
|
4
4
|
import QuickEntrance from './quick-entrance'
|
|
5
5
|
import Workbench from './workbench';
|
|
6
6
|
import './index.css';
|
|
7
7
|
import Units from "../units";
|
|
8
8
|
import withRouter from "../routable/withroute";
|
|
9
|
+
import BlockMenuAuthTree from "../tree/block-menu-auth-tree";
|
|
10
|
+
import BlockMenuAuthTreeDrawer from "../module/block-menu-tree-drawer"
|
|
11
|
+
|
|
12
|
+
// interface HCWelcomeProps {
|
|
13
|
+
//
|
|
14
|
+
// }
|
|
15
|
+
//
|
|
16
|
+
// interface HCWelcomeState {
|
|
17
|
+
// // // selectedAuths:string[]
|
|
18
|
+
// openDrawer:boolean
|
|
19
|
+
// }
|
|
20
|
+
|
|
9
21
|
class HCWelcome extends React.Component {
|
|
10
|
-
state = {
|
|
22
|
+
state = {
|
|
23
|
+
openDrawer:false
|
|
24
|
+
}
|
|
11
25
|
|
|
12
26
|
intervals = [];
|
|
13
27
|
|
|
@@ -122,9 +136,9 @@ class HCWelcome extends React.Component {
|
|
|
122
136
|
|
|
123
137
|
// option && myChart.setOption(option);
|
|
124
138
|
//
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
139
|
+
this.setState({
|
|
140
|
+
openDrawer:false
|
|
141
|
+
})
|
|
128
142
|
}
|
|
129
143
|
|
|
130
144
|
componentWillUnmount() {
|
|
@@ -147,6 +161,7 @@ class HCWelcome extends React.Component {
|
|
|
147
161
|
|
|
148
162
|
render() {
|
|
149
163
|
const {params} = this.props;
|
|
164
|
+
const {openDrawer}=this.state
|
|
150
165
|
Units.setProgramCode4RoutePath(params);
|
|
151
166
|
return <>
|
|
152
167
|
<Row className={'home-page'} gutter={{xs: 4, sm: 8, md: 12, lg: 16}}>
|
|
@@ -214,6 +229,29 @@ class HCWelcome extends React.Component {
|
|
|
214
229
|
{/* <DtmplEditCard code={'8999231441132377'} sourceId={'246909250609153'} ></DtmplEditCard>*/}
|
|
215
230
|
{/* </Col>*/}
|
|
216
231
|
{/*</Row>*/}
|
|
232
|
+
|
|
233
|
+
<Row>
|
|
234
|
+
<Col>
|
|
235
|
+
<Button onClick={()=>{
|
|
236
|
+
this.setState({
|
|
237
|
+
openDrawer:!this.state.openDrawer
|
|
238
|
+
})
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
} >打开权限</Button>
|
|
242
|
+
{/*<BlockMenuAuthTree />*/}
|
|
243
|
+
</Col>
|
|
244
|
+
</Row>
|
|
245
|
+
<BlockMenuAuthTreeDrawer onCancel={ ()=>{
|
|
246
|
+
this.setState({
|
|
247
|
+
openDrawer:false
|
|
248
|
+
})
|
|
249
|
+
}} onOk={ ()=>{
|
|
250
|
+
this.setState({
|
|
251
|
+
openDrawer:false
|
|
252
|
+
})
|
|
253
|
+
}} open={openDrawer} roleCode={'374901611447492611'}></BlockMenuAuthTreeDrawer>
|
|
254
|
+
|
|
217
255
|
</>
|
|
218
256
|
}
|
|
219
257
|
|