aldehyde 0.2.229 → 0.2.232
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/entity-select/popover-entity-select.d.ts.map +1 -1
- package/lib/controls/entity-select/popover-entity-select.js +12 -11
- 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 +8 -0
- package/lib/controls/entry-control.js.map +1 -1
- package/lib/controls/tree-select/tree-entity-select.d.ts +12 -0
- package/lib/controls/tree-select/tree-entity-select.d.ts.map +1 -0
- package/lib/controls/tree-select/tree-entity-select.js +86 -0
- package/lib/controls/tree-select/tree-entity-select.js.map +1 -0
- package/lib/controls/upload/index.d.ts.map +1 -1
- package/lib/controls/upload/index.js +0 -17
- package/lib/controls/upload/index.js.map +1 -1
- package/lib/module/dtmpl-edit-page.d.ts +1 -0
- package/lib/module/dtmpl-edit-page.d.ts.map +1 -1
- package/lib/module/dtmpl-edit-page.js.map +1 -1
- package/lib/module/dtmpl-view-drawer.d.ts.map +1 -1
- package/lib/module/dtmpl-view-drawer.js +5 -1
- package/lib/module/dtmpl-view-drawer.js.map +1 -1
- package/lib/routable/ltmpl-route.d.ts.map +1 -1
- package/lib/routable/ltmpl-route.js +33 -25
- package/lib/routable/ltmpl-route.js.map +1 -1
- package/lib/table/act-table.d.ts.map +1 -1
- package/lib/table/act-table.js +37 -24
- package/lib/table/act-table.js.map +1 -1
- package/lib/table/column/column-builder.d.ts.map +1 -1
- package/lib/table/column/column-builder.js.map +1 -1
- package/lib/table/column/summary-builder.d.ts +39 -0
- package/lib/table/column/summary-builder.d.ts.map +1 -0
- package/lib/table/column/summary-builder.js +508 -0
- package/lib/table/column/summary-builder.js.map +1 -0
- package/lib/table/query-table.d.ts +0 -20
- package/lib/table/query-table.d.ts.map +1 -1
- package/lib/table/query-table.js +14 -598
- package/lib/table/query-table.js.map +1 -1
- package/lib/tmpl/control-type-supportor.d.ts.map +1 -1
- package/lib/tmpl/control-type-supportor.js +6 -1
- package/lib/tmpl/control-type-supportor.js.map +1 -1
- package/lib/tmpl/interface.d.ts +0 -6
- package/lib/tmpl/interface.d.ts.map +1 -1
- package/lib/tmpl/interface.js.map +1 -1
- package/lib/tree/tmpl-tree.d.ts +9 -4
- package/lib/tree/tmpl-tree.d.ts.map +1 -1
- package/lib/tree/tmpl-tree.js +70 -94
- package/lib/tree/tmpl-tree.js.map +1 -1
- package/lib/tree/tree-node.js +1 -1
- package/lib/tree/tree-utils.d.ts +19 -0
- package/lib/tree/tree-utils.d.ts.map +1 -1
- package/lib/tree/tree-utils.js +128 -0
- package/lib/tree/tree-utils.js.map +1 -1
- package/package.json +1 -1
- package/src/aldehyde/controls/entity-select/popover-entity-select.tsx +9 -12
- package/src/aldehyde/controls/entry-control.tsx +20 -0
- package/src/aldehyde/controls/tree-select/tree-entity-select.tsx +113 -0
- package/src/aldehyde/controls/upload/index.tsx +1 -17
- package/src/aldehyde/module/dtmpl-edit-page.tsx +1 -0
- package/src/aldehyde/module/dtmpl-view-drawer.tsx +5 -0
- package/src/aldehyde/routable/ltmpl-route.tsx +54 -47
- package/src/aldehyde/table/act-table.tsx +102 -84
- package/src/aldehyde/table/column/column-builder.tsx +1 -0
- package/src/aldehyde/table/column/summary-builder.tsx +713 -0
- package/src/aldehyde/table/query-table.tsx +15 -835
- package/src/aldehyde/tmpl/control-type-supportor.tsx +8 -1
- package/src/aldehyde/tmpl/interface.tsx +0 -2
- package/src/aldehyde/tree/tmpl-tree.tsx +72 -89
- package/src/aldehyde/tree/tree-node.tsx +1 -1
- package/src/aldehyde/tree/tree-utils.tsx +138 -0
|
@@ -57,7 +57,8 @@ SupportInputTypes.add('float');
|
|
|
57
57
|
SupportInputTypes.add('double');
|
|
58
58
|
SupportInputTypes.add('int');
|
|
59
59
|
SupportInputTypes.add('relselect');
|
|
60
|
-
SupportInputTypes.add('relselectvalue')
|
|
60
|
+
SupportInputTypes.add('relselectvalue');//弃用
|
|
61
|
+
SupportInputTypes.add('entity-select-value');
|
|
61
62
|
SupportInputTypes.add('refselect');
|
|
62
63
|
SupportInputTypes.add('field-history');
|
|
63
64
|
|
|
@@ -73,7 +74,13 @@ SupportInputTypes.add('color');
|
|
|
73
74
|
SupportInputTypes.add('url');
|
|
74
75
|
SupportInputTypes.add('hidden');
|
|
75
76
|
SupportInputTypes.add('lab-tree-select');
|
|
77
|
+
SupportInputTypes.add('tree-entity-select-value');
|
|
78
|
+
SupportInputTypes.add('tree-entity-select');
|
|
79
|
+
SupportInputTypes.add('ltree-entity-select-value');
|
|
80
|
+
SupportInputTypes.add('ltree-entity-select');
|
|
76
81
|
SupportInputTypes.add('field-history');
|
|
82
|
+
|
|
83
|
+
|
|
77
84
|
function ControlTypeSupportor(){
|
|
78
85
|
|
|
79
86
|
}
|
|
@@ -54,7 +54,6 @@ export interface QueryTableProps extends ReportTableProps{
|
|
|
54
54
|
aggFunc: "sum" | "avg" | "groupIsum" | "groupIavg";
|
|
55
55
|
}[];
|
|
56
56
|
subtotalXColumn?: { id: string }[];
|
|
57
|
-
subtotalYColumn?: { id: string }[];
|
|
58
57
|
groupIColumns?: { id: string; title: string; sourceId: string }[]; // 组间合计key
|
|
59
58
|
doSearch?: (params: object) => void;
|
|
60
59
|
sortColumnData?: string[];
|
|
@@ -481,7 +480,6 @@ export interface LtmplConfig extends SelectConfig {
|
|
|
481
480
|
originalId:string;
|
|
482
481
|
}[];
|
|
483
482
|
subtotalXColumn?: { id: string }[];
|
|
484
|
-
subtotalYColumn?: { id: string }[];
|
|
485
483
|
updrillButtonConfigs?: UpdrillButtonConfig[];
|
|
486
484
|
groupIColumns?: { id: string; title: string; sourceId: string; originalId:string;}[];
|
|
487
485
|
}
|
|
@@ -10,7 +10,6 @@ import {
|
|
|
10
10
|
Space,
|
|
11
11
|
Tooltip,
|
|
12
12
|
Tree,
|
|
13
|
-
Typography,
|
|
14
13
|
} from "antd";
|
|
15
14
|
import {
|
|
16
15
|
AlignLeftOutlined,
|
|
@@ -20,18 +19,20 @@ import {
|
|
|
20
19
|
PlusSquareOutlined,
|
|
21
20
|
ReloadOutlined,
|
|
22
21
|
} from "@ant-design/icons";
|
|
23
|
-
|
|
22
|
+
|
|
24
23
|
import Scrollbars from "react-custom-scrollbars";
|
|
25
24
|
import { HydrocarbonService } from "../index";
|
|
26
25
|
import TreeUtils, { TtmplNodeConfig } from "./tree-utils";
|
|
27
26
|
import { TreeDataNode } from "./tree-utils";
|
|
28
27
|
import { LocaleContext } from "../locale/LocaleProvider";
|
|
29
28
|
|
|
30
|
-
const { Text, Title } = Typography;
|
|
31
|
-
|
|
32
29
|
interface TmplTreeProps {
|
|
30
|
+
showFilterInput?:boolean;
|
|
33
31
|
ttmplNodeConfig: TtmplNodeConfig;
|
|
34
|
-
|
|
32
|
+
checkable:boolean,
|
|
33
|
+
onChangeCheck?:(checkCodes:string[])=>any,
|
|
34
|
+
currentId?: string,
|
|
35
|
+
checkedCodes?:string[],
|
|
35
36
|
doEditSub?: (
|
|
36
37
|
title: string,
|
|
37
38
|
ratmplId: string,
|
|
@@ -65,6 +66,7 @@ interface TmplTreeState {
|
|
|
65
66
|
currentNodeData?: TreeDataNode;
|
|
66
67
|
rootAddable?: boolean;
|
|
67
68
|
searchValue?: string;
|
|
69
|
+
checkedKeys?:string[];
|
|
68
70
|
}
|
|
69
71
|
|
|
70
72
|
class TmplTree extends React.PureComponent<TmplTreeProps, TmplTreeState> {
|
|
@@ -78,17 +80,21 @@ class TmplTree extends React.PureComponent<TmplTreeProps, TmplTreeState> {
|
|
|
78
80
|
currentNodeData: undefined,
|
|
79
81
|
rootAddable: false,
|
|
80
82
|
searchValue: undefined,
|
|
83
|
+
checkedKeys:undefined,
|
|
81
84
|
};
|
|
82
85
|
|
|
83
86
|
static defaultProps = {
|
|
84
87
|
draggable: false,
|
|
85
88
|
readOnly: false,
|
|
89
|
+
checkable:true,
|
|
90
|
+
showFilterInput:true,
|
|
86
91
|
};
|
|
87
92
|
static contextType = LocaleContext;
|
|
88
93
|
context: React.ContextType<typeof LocaleContext>;
|
|
89
94
|
|
|
90
95
|
doDelete = async (node: TreeDataNode) => {
|
|
91
96
|
let { ttmplNodeConfig } = this.props;
|
|
97
|
+
const {data,expandedKeys}=this.state;
|
|
92
98
|
let sourceId;
|
|
93
99
|
if (node.isLeaf) {
|
|
94
100
|
sourceId = ttmplNodeConfig.leafRatmplId;
|
|
@@ -99,9 +105,11 @@ class TmplTree extends React.PureComponent<TmplTreeProps, TmplTreeState> {
|
|
|
99
105
|
node.code,
|
|
100
106
|
]);
|
|
101
107
|
if (node.parent) {
|
|
102
|
-
|
|
108
|
+
let v= await TreeUtils.reloadData(node.parent.code,ttmplNodeConfig,data,expandedKeys);
|
|
109
|
+
this.setState({...v})
|
|
103
110
|
}else{
|
|
104
|
-
|
|
111
|
+
let v= await TreeUtils.reloadData(null,ttmplNodeConfig,data,expandedKeys);
|
|
112
|
+
this.setState({...v})
|
|
105
113
|
}
|
|
106
114
|
};
|
|
107
115
|
|
|
@@ -131,21 +139,21 @@ class TmplTree extends React.PureComponent<TmplTreeProps, TmplTreeState> {
|
|
|
131
139
|
loading: true,
|
|
132
140
|
});
|
|
133
141
|
//let loadedKeys = [];
|
|
134
|
-
let data = await
|
|
142
|
+
let data = await TreeUtils.loadRootNodeData(ttmplNodeConfig);
|
|
135
143
|
this.setState({
|
|
136
144
|
searchValue: null,
|
|
137
145
|
data,
|
|
138
146
|
rootAddable:
|
|
139
|
-
ttmplNodeConfig.rootLTmplConfig
|
|
147
|
+
ttmplNodeConfig.rootLTmplConfig?.buttons?.indexOf("dtmplAdd") > 0,
|
|
140
148
|
loading: false,
|
|
141
149
|
});
|
|
142
150
|
}
|
|
143
151
|
|
|
144
|
-
loadRootNodeData = async () => {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
};
|
|
152
|
+
// loadRootNodeData = async () => {
|
|
153
|
+
// const { ttmplNodeConfig } = this.props;
|
|
154
|
+
// let data = await TreeUtils.loadRootNodeData(ttmplNodeConfig);
|
|
155
|
+
// return data;
|
|
156
|
+
// };
|
|
149
157
|
|
|
150
158
|
async componentWillUnmount() {}
|
|
151
159
|
|
|
@@ -216,10 +224,10 @@ class TmplTree extends React.PureComponent<TmplTreeProps, TmplTreeState> {
|
|
|
216
224
|
} else {
|
|
217
225
|
//说明是root
|
|
218
226
|
//判断是否允许编辑
|
|
219
|
-
if (ttmplNodeConfig.rootLTmplConfig
|
|
227
|
+
if (ttmplNodeConfig.rootLTmplConfig?.buttons.indexOf("dtmplEdit") > 0) {
|
|
220
228
|
doEditRoot(ttmplNodeConfig.branchTitle, dataNode.code);
|
|
221
229
|
} else if (
|
|
222
|
-
ttmplNodeConfig.rootLTmplConfig
|
|
230
|
+
ttmplNodeConfig.rootLTmplConfig?.buttons.indexOf("detail") > 0
|
|
223
231
|
) {
|
|
224
232
|
doViewRoot(ttmplNodeConfig.branchTitle, dataNode.code);
|
|
225
233
|
}
|
|
@@ -236,69 +244,14 @@ class TmplTree extends React.PureComponent<TmplTreeProps, TmplTreeState> {
|
|
|
236
244
|
}
|
|
237
245
|
};
|
|
238
246
|
|
|
239
|
-
reloadData = async (branchCode: string) => {
|
|
240
|
-
const { ttmplNodeConfig } = this.props;
|
|
241
|
-
const { data, expandedKeys } = this.state;
|
|
242
|
-
let newData;
|
|
243
|
-
if (branchCode == null) {
|
|
244
|
-
//加载根
|
|
245
|
-
newData = await this.loadRootNodeData();
|
|
246
|
-
this.mergeRootData(data, newData);
|
|
247
|
-
this.setState({
|
|
248
|
-
data: newData,
|
|
249
|
-
});
|
|
250
|
-
} else {
|
|
251
|
-
//重新加载 await
|
|
252
|
-
//先找到树节点
|
|
253
|
-
let rdatas = [];
|
|
254
|
-
this.searchNode(data, branchCode, rdatas);
|
|
255
|
-
await TreeUtils.pushSameCodeNodeData(rdatas, ttmplNodeConfig);
|
|
256
|
-
let newExpandeds = [];
|
|
257
|
-
for (let d of rdatas) {
|
|
258
|
-
newExpandeds.push(d.key);
|
|
259
|
-
}
|
|
260
|
-
this.setState({
|
|
261
|
-
expandedKeys: [...expandedKeys, ...newExpandeds],
|
|
262
|
-
data: [...data],
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
};
|
|
266
247
|
|
|
267
|
-
mergeRootData = (data, newData) => {
|
|
268
|
-
if (newData && data) {
|
|
269
|
-
for (let nd of newData) {
|
|
270
|
-
for (let d of data) {
|
|
271
|
-
if (nd.code == d.code) {
|
|
272
|
-
nd.children = d.children;
|
|
273
|
-
break;
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
};
|
|
279
248
|
|
|
280
|
-
|
|
281
|
-
data: TreeDataNode[],
|
|
282
|
-
brachCode: string,
|
|
283
|
-
result: TreeDataNode[]
|
|
284
|
-
) => {
|
|
285
|
-
if (!data) {
|
|
286
|
-
return;
|
|
287
|
-
}
|
|
288
|
-
for (let d of data) {
|
|
289
|
-
if (d.code == brachCode) {
|
|
290
|
-
result.push(d);
|
|
291
|
-
break;
|
|
292
|
-
} else if (d.children.length > 0) {
|
|
293
|
-
//继续寻找
|
|
294
|
-
this.searchNode(d.children, brachCode, result);
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
};
|
|
249
|
+
|
|
298
250
|
|
|
299
251
|
getDeleteButton = (sourceId, node: TreeDataNode) => {
|
|
300
|
-
const { doDelete } = this.props;
|
|
252
|
+
const { doDelete ,ttmplNodeConfig} = this.props;
|
|
301
253
|
const { translate } = this.context;
|
|
254
|
+
|
|
302
255
|
return (
|
|
303
256
|
<div
|
|
304
257
|
onClick={(e) => {
|
|
@@ -309,11 +262,17 @@ class TmplTree extends React.PureComponent<TmplTreeProps, TmplTreeState> {
|
|
|
309
262
|
placement="topLeft"
|
|
310
263
|
title={translate("${确定要删除吗}?")}
|
|
311
264
|
onConfirm={ async () => {
|
|
265
|
+
const {data,expandedKeys}=this.state;
|
|
312
266
|
await doDelete(sourceId, node.code);
|
|
313
267
|
if (node.parent) {
|
|
314
|
-
|
|
268
|
+
let v = await TreeUtils.reloadData(node.parent.code,ttmplNodeConfig,data,expandedKeys);
|
|
269
|
+
this.setState({
|
|
270
|
+
...v
|
|
271
|
+
})
|
|
315
272
|
}else{
|
|
316
|
-
|
|
273
|
+
const {data,expandedKeys}=this.state;
|
|
274
|
+
let v = await TreeUtils.reloadData(null,ttmplNodeConfig,data,expandedKeys);
|
|
275
|
+
this.setState({...v})
|
|
317
276
|
}
|
|
318
277
|
}}
|
|
319
278
|
okText={translate("${确定}")}
|
|
@@ -350,6 +309,23 @@ class TmplTree extends React.PureComponent<TmplTreeProps, TmplTreeState> {
|
|
|
350
309
|
</Button>
|
|
351
310
|
);
|
|
352
311
|
};
|
|
312
|
+
onCheck=(checkedKeys,e)=>{
|
|
313
|
+
console.log(checkedKeys);
|
|
314
|
+
console.log(e);
|
|
315
|
+
if(this.props.onChangeCheck){
|
|
316
|
+
let checks:string[]=[];
|
|
317
|
+
if(e.checkedNodes){
|
|
318
|
+
e.checkedNodes.forEach((c)=>{
|
|
319
|
+
checks.push(c.code+"@R@"+c.title);
|
|
320
|
+
})
|
|
321
|
+
}
|
|
322
|
+
this.props.onChangeCheck(checks);
|
|
323
|
+
|
|
324
|
+
}
|
|
325
|
+
this.setState({
|
|
326
|
+
checkedKeys
|
|
327
|
+
})
|
|
328
|
+
}
|
|
353
329
|
|
|
354
330
|
packageTitle = (dataNode) => {
|
|
355
331
|
const {
|
|
@@ -500,7 +476,7 @@ class TmplTree extends React.PureComponent<TmplTreeProps, TmplTreeState> {
|
|
|
500
476
|
} else {
|
|
501
477
|
//说明是root
|
|
502
478
|
//判断是否允许编辑
|
|
503
|
-
if (ttmplNodeConfig.rootLTmplConfig
|
|
479
|
+
if (ttmplNodeConfig.rootLTmplConfig?.buttons.indexOf("dtmplEdit") > 0) {
|
|
504
480
|
buttons.push(
|
|
505
481
|
<Button
|
|
506
482
|
onClick={(e) => {
|
|
@@ -514,7 +490,7 @@ class TmplTree extends React.PureComponent<TmplTreeProps, TmplTreeState> {
|
|
|
514
490
|
</Button>
|
|
515
491
|
);
|
|
516
492
|
}
|
|
517
|
-
if (ttmplNodeConfig.rootLTmplConfig
|
|
493
|
+
if (ttmplNodeConfig.rootLTmplConfig?.buttons.indexOf("detail") > 0) {
|
|
518
494
|
buttons.push(
|
|
519
495
|
<Button
|
|
520
496
|
onClick={(e) => {
|
|
@@ -530,7 +506,7 @@ class TmplTree extends React.PureComponent<TmplTreeProps, TmplTreeState> {
|
|
|
530
506
|
}
|
|
531
507
|
//debugger
|
|
532
508
|
if (ttmplNodeConfig.branchLTmplConfig) {
|
|
533
|
-
if (ttmplNodeConfig.rootLTmplConfig
|
|
509
|
+
if (ttmplNodeConfig.rootLTmplConfig?.buttons.indexOf("dtmplAdd") > 0) {
|
|
534
510
|
buttons.push(
|
|
535
511
|
this.getAddButton(
|
|
536
512
|
ttmplNodeConfig.branchTitle,
|
|
@@ -552,7 +528,7 @@ class TmplTree extends React.PureComponent<TmplTreeProps, TmplTreeState> {
|
|
|
552
528
|
);
|
|
553
529
|
}
|
|
554
530
|
|
|
555
|
-
if (ttmplNodeConfig.rootLTmplConfig
|
|
531
|
+
if (ttmplNodeConfig.rootLTmplConfig?.buttons.indexOf("singleDelete") > 0) {
|
|
556
532
|
buttons.push(
|
|
557
533
|
this.getDeleteButton(ttmplNodeConfig.branchRatmplId?ttmplNodeConfig.branchRatmplId:ttmplNodeConfig.rootGtmplId, dataNode)
|
|
558
534
|
);
|
|
@@ -579,7 +555,7 @@ class TmplTree extends React.PureComponent<TmplTreeProps, TmplTreeState> {
|
|
|
579
555
|
};
|
|
580
556
|
|
|
581
557
|
render() {
|
|
582
|
-
const { doEditRoot, ttmplNodeConfig } = this.props;
|
|
558
|
+
const { doEditRoot, ttmplNodeConfig,checkable,checkedCodes,showFilterInput } = this.props;
|
|
583
559
|
const {
|
|
584
560
|
data,
|
|
585
561
|
loading,
|
|
@@ -592,14 +568,17 @@ class TmplTree extends React.PureComponent<TmplTreeProps, TmplTreeState> {
|
|
|
592
568
|
if (searchValue) {
|
|
593
569
|
treeData = TreeUtils.filterTree(data, searchValue);
|
|
594
570
|
}
|
|
571
|
+
|
|
572
|
+
|
|
573
|
+
|
|
595
574
|
return (
|
|
596
575
|
<>
|
|
597
576
|
<Row>
|
|
598
577
|
<Col span={24}>
|
|
599
578
|
<Card
|
|
600
579
|
style={{ marginBottom: 0, width: "100%" }}
|
|
601
|
-
|
|
602
|
-
|
|
580
|
+
variant={"borderless"}
|
|
581
|
+
styles={ { body:{ padding: "0px 2px 0px 8px"} }}
|
|
603
582
|
>
|
|
604
583
|
<Row align="middle">
|
|
605
584
|
<Col span={8}>
|
|
@@ -612,6 +591,7 @@ class TmplTree extends React.PureComponent<TmplTreeProps, TmplTreeState> {
|
|
|
612
591
|
</Button>
|
|
613
592
|
) : null}
|
|
614
593
|
</Col>
|
|
594
|
+
{showFilterInput?
|
|
615
595
|
<Col span={16}>
|
|
616
596
|
<Input.Search
|
|
617
597
|
value={searchValue}
|
|
@@ -627,7 +607,7 @@ class TmplTree extends React.PureComponent<TmplTreeProps, TmplTreeState> {
|
|
|
627
607
|
}}
|
|
628
608
|
enterButton={<ReloadOutlined />}
|
|
629
609
|
/>
|
|
630
|
-
</Col
|
|
610
|
+
</Col>:null}
|
|
631
611
|
</Row>
|
|
632
612
|
</Card>
|
|
633
613
|
</Col>
|
|
@@ -635,11 +615,11 @@ class TmplTree extends React.PureComponent<TmplTreeProps, TmplTreeState> {
|
|
|
635
615
|
<Row>
|
|
636
616
|
<Col span={24}>
|
|
637
617
|
<Card
|
|
638
|
-
|
|
639
|
-
padding: "4px
|
|
618
|
+
styles={{body:{
|
|
619
|
+
padding: "4px 0px 4px 0px",
|
|
640
620
|
height: "80vh",
|
|
641
|
-
minWidth: "
|
|
642
|
-
}}
|
|
621
|
+
minWidth: "194px",
|
|
622
|
+
}}}
|
|
643
623
|
loading={loading}
|
|
644
624
|
>
|
|
645
625
|
{treeData.length == 0 ? (
|
|
@@ -651,9 +631,12 @@ class TmplTree extends React.PureComponent<TmplTreeProps, TmplTreeState> {
|
|
|
651
631
|
autoHideTimeout={1000}
|
|
652
632
|
>
|
|
653
633
|
<Tree
|
|
634
|
+
checkStrictly
|
|
654
635
|
blockNode
|
|
655
636
|
showLine={ttmplNodeConfig.showLine}
|
|
656
|
-
checkable={
|
|
637
|
+
// checkable={checkable}
|
|
638
|
+
// onCheck={this.onCheck}
|
|
639
|
+
// checkedKeys={checkKeys}
|
|
657
640
|
expandedKeys={expandedKeys}
|
|
658
641
|
onExpand={this.onExpand}
|
|
659
642
|
titleRender={(nodeData) => {
|
|
@@ -53,6 +53,70 @@ export default class TreeUtils {
|
|
|
53
53
|
return ttmplNodeConfig;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
|
|
57
|
+
static mergeRootData = (data, newData) => {
|
|
58
|
+
if (newData && data) {
|
|
59
|
+
for (let nd of newData) {
|
|
60
|
+
for (let d of data) {
|
|
61
|
+
if (nd.code == d.code) {
|
|
62
|
+
nd.children = d.children;
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
static reloadData = async (branchCode: string,ttmplNodeConfig,data:TreeDataNode[],expandedKeys:string[]) => {
|
|
71
|
+
let newData;
|
|
72
|
+
if (branchCode == null) {
|
|
73
|
+
//加载根
|
|
74
|
+
newData = await this.loadRootNodeData(ttmplNodeConfig);
|
|
75
|
+
this.mergeRootData(data, newData);
|
|
76
|
+
return {
|
|
77
|
+
data: newData,
|
|
78
|
+
};
|
|
79
|
+
} else {
|
|
80
|
+
//重新加载 await
|
|
81
|
+
//先找到树节点
|
|
82
|
+
let rdatas = [];
|
|
83
|
+
this.searchNode(data, branchCode, rdatas);
|
|
84
|
+
await TreeUtils.pushSameCodeNodeData(rdatas, ttmplNodeConfig);
|
|
85
|
+
let newExpandeds = [];
|
|
86
|
+
for (let d of rdatas) {
|
|
87
|
+
newExpandeds.push(d.key);
|
|
88
|
+
}
|
|
89
|
+
if(expandedKeys){
|
|
90
|
+
newExpandeds.push(expandedKeys)
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
return {
|
|
94
|
+
expandedKeys: [...newExpandeds],
|
|
95
|
+
data: [...data],
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
static searchNode = (
|
|
101
|
+
data: TreeDataNode[],
|
|
102
|
+
brachCode: string,
|
|
103
|
+
result: TreeDataNode[]
|
|
104
|
+
) => {
|
|
105
|
+
if (!data) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
for (let d of data) {
|
|
109
|
+
if (d.code == brachCode) {
|
|
110
|
+
result.push(d);
|
|
111
|
+
break;
|
|
112
|
+
} else if (d.children.length > 0) {
|
|
113
|
+
//继续寻找
|
|
114
|
+
this.searchNode(d.children, brachCode, result);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
|
|
56
120
|
static loadRootNodeData = async (config: TtmplNodeConfig) => {
|
|
57
121
|
let res = await HydrocarbonService.requestTtmplRootData(null, config.id, {});
|
|
58
122
|
let data = [];
|
|
@@ -120,10 +184,12 @@ export default class TreeUtils {
|
|
|
120
184
|
let d = {
|
|
121
185
|
code: item.code,
|
|
122
186
|
key: keyPrex + parent?.code+item.code,
|
|
187
|
+
value:keyPrex + parent?.code+item.code,
|
|
123
188
|
name,
|
|
124
189
|
title: <><span>{name?name:item.code}</span></>,
|
|
125
190
|
children: [],
|
|
126
191
|
isLeaf,
|
|
192
|
+
selectable:isLeaf,
|
|
127
193
|
parent,
|
|
128
194
|
};
|
|
129
195
|
|
|
@@ -161,6 +227,78 @@ export default class TreeUtils {
|
|
|
161
227
|
return newNodes;
|
|
162
228
|
}
|
|
163
229
|
|
|
230
|
+
static getNodesOfArrayNode=(nodes:any[], nodeCodes: string[])=>{
|
|
231
|
+
let newNodes: TreeDataNode[] = [];
|
|
232
|
+
if(!nodeCodes || nodeCodes.length==0){
|
|
233
|
+
return newNodes;
|
|
234
|
+
}
|
|
235
|
+
//let tagNodes: TreeDataNode[] = [];
|
|
236
|
+
nodes.forEach((no) => {
|
|
237
|
+
let n = {...no};
|
|
238
|
+
let v=no.code;
|
|
239
|
+
let vn=no.name;
|
|
240
|
+
if (nodeCodes.includes(v) || nodeCodes.includes(vn)) {
|
|
241
|
+
newNodes.push(n);
|
|
242
|
+
}
|
|
243
|
+
if (n.children && n.children.length > 0) {
|
|
244
|
+
let retNodes: TreeDataNode[] = this.getNodes(n, nodeCodes);
|
|
245
|
+
if (retNodes && retNodes.length > 0) {
|
|
246
|
+
newNodes.push(...retNodes);
|
|
247
|
+
} else {
|
|
248
|
+
// 没有子节点情况
|
|
249
|
+
n.children = [];
|
|
250
|
+
// 标记,循环结束后删除
|
|
251
|
+
//tagNodes.push(n);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
})
|
|
255
|
+
return newNodes;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
static getNodes = (node, nodeCodes: string[]) => {
|
|
259
|
+
let children:any[] = [...node.children];
|
|
260
|
+
return this.getNodesOfArrayNode(children,nodeCodes);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
static getNodesOfKey = (node, nodeCodes: string[]) => {
|
|
264
|
+
let children:any[] = [...node.children];
|
|
265
|
+
let newNodes: TreeDataNode[] = [];
|
|
266
|
+
if(!nodeCodes || nodeCodes.length==0){
|
|
267
|
+
return newNodes;
|
|
268
|
+
}
|
|
269
|
+
//let tagNodes: TreeDataNode[] = [];
|
|
270
|
+
children.forEach((no) => {
|
|
271
|
+
let n = {...no};
|
|
272
|
+
let v=no.key;
|
|
273
|
+
if (nodeCodes.includes(v)) {
|
|
274
|
+
newNodes.push(n);
|
|
275
|
+
}
|
|
276
|
+
if (n.children && n.children.length > 0) {
|
|
277
|
+
let retNodes: TreeDataNode[] = this.getNodesOfKey(n, nodeCodes);
|
|
278
|
+
if (retNodes && retNodes.length > 0) {
|
|
279
|
+
newNodes.push(...retNodes);
|
|
280
|
+
} else {
|
|
281
|
+
// 没有子节点情况
|
|
282
|
+
n.children = [];
|
|
283
|
+
// 标记,循环结束后删除
|
|
284
|
+
//tagNodes.push(n);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
})
|
|
288
|
+
return newNodes;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
static getNodeKeys(node, nodeCodes: string[]){
|
|
292
|
+
let newNodes: TreeDataNode[] = this.getNodes(node,nodeCodes);
|
|
293
|
+
let keys:string[]=[];
|
|
294
|
+
newNodes.forEach(n=>{
|
|
295
|
+
// @ts-ignore
|
|
296
|
+
keys.push(n.key);
|
|
297
|
+
})
|
|
298
|
+
return keys;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
|
|
164
302
|
static filterTree = (nodes: any[], searchValue: string) => {
|
|
165
303
|
let root = {code: "", config: undefined, key: undefined, children: [...nodes]};
|
|
166
304
|
this.filterNode(root, searchValue);
|