@ibiz-template/runtime 0.5.0-beta.5 → 0.5.1-beta.1
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/dist/index.esm.js +238 -151
- package/dist/index.system.min.js +1 -1
- package/out/app-hub.d.ts +1 -0
- package/out/app-hub.d.ts.map +1 -1
- package/out/app-hub.js +5 -0
- package/out/controller/control/exp-bar/tree-exp-bar.controller.d.ts +0 -1
- package/out/controller/control/exp-bar/tree-exp-bar.controller.d.ts.map +1 -1
- package/out/controller/control/exp-bar/tree-exp-bar.controller.js +5 -6
- package/out/controller/control/gantt/gantt.controller.js +2 -2
- package/out/controller/control/gantt/gantt.service.js +2 -2
- package/out/controller/control/grid/grid/grid.controller.d.ts +3 -1
- package/out/controller/control/grid/grid/grid.controller.d.ts.map +1 -1
- package/out/controller/control/grid/grid/grid.controller.js +8 -5
- package/out/controller/control/tree/tree.controller.d.ts +7 -2
- package/out/controller/control/tree/tree.controller.d.ts.map +1 -1
- package/out/controller/control/tree/tree.controller.js +59 -59
- package/out/controller/control/tree/tree.service.js +8 -8
- package/out/controller/control/tree-grid/tree-grid.controller.d.ts +35 -2
- package/out/controller/control/tree-grid/tree-grid.controller.d.ts.map +1 -1
- package/out/controller/control/tree-grid/tree-grid.controller.js +60 -0
- package/out/interface/common/i-app-hub-service/i-app-hub-service.d.ts +6 -0
- package/out/interface/common/i-app-hub-service/i-app-hub-service.d.ts.map +1 -1
- package/out/interface/controller/controller/control/i-grid.controller.d.ts +1 -1
- package/out/interface/controller/controller/control/i-grid.controller.d.ts.map +1 -1
- package/out/interface/controller/controller/control/i-tree-grid.controller.d.ts +11 -1
- package/out/interface/controller/controller/control/i-tree-grid.controller.d.ts.map +1 -1
- package/out/interface/controller/state/control/i-gantt.state.d.ts +2 -2
- package/out/interface/controller/state/control/i-gantt.state.d.ts.map +1 -1
- package/out/interface/controller/state/control/i-tree-grid.state.d.ts +5 -0
- package/out/interface/controller/state/control/i-tree-grid.state.d.ts.map +1 -1
- package/out/interface/controller/state/control/i-tree.state.d.ts +26 -25
- package/out/interface/controller/state/control/i-tree.state.d.ts.map +1 -1
- package/out/interface/service/service/i-auth.service.d.ts +23 -0
- package/out/interface/service/service/i-auth.service.d.ts.map +1 -1
- package/out/interface/service/service/index.d.ts +1 -1
- package/out/interface/service/service/index.d.ts.map +1 -1
- package/out/service/service/auth/v7-auth.service.d.ts +3 -1
- package/out/service/service/auth/v7-auth.service.d.ts.map +1 -1
- package/out/service/service/auth/v7-auth.service.js +26 -3
- package/out/service/service/entity/method/de-action.d.ts.map +1 -1
- package/out/service/service/entity/method/de-action.js +4 -3
- package/out/service/vo/gantt-node-data/gantt-code-list-node-data.d.ts +2 -2
- package/out/service/vo/gantt-node-data/gantt-code-list-node-data.d.ts.map +1 -1
- package/out/service/vo/gantt-node-data/gantt-data-set-node-data.d.ts +2 -2
- package/out/service/vo/gantt-node-data/gantt-data-set-node-data.d.ts.map +1 -1
- package/out/service/vo/gantt-node-data/gantt-static-node-data.d.ts +2 -2
- package/out/service/vo/gantt-node-data/gantt-static-node-data.d.ts.map +1 -1
- package/out/service/vo/tree-node-data/tree-code-list-node-data.d.ts +3 -3
- package/out/service/vo/tree-node-data/tree-code-list-node-data.d.ts.map +1 -1
- package/out/service/vo/tree-node-data/tree-code-list-node-data.js +9 -9
- package/out/service/vo/tree-node-data/tree-data-set-node-data.d.ts +4 -4
- package/out/service/vo/tree-node-data/tree-data-set-node-data.d.ts.map +1 -1
- package/out/service/vo/tree-node-data/tree-data-set-node-data.js +19 -21
- package/out/service/vo/tree-node-data/tree-node-data.d.ts +12 -13
- package/out/service/vo/tree-node-data/tree-node-data.d.ts.map +1 -1
- package/out/service/vo/tree-node-data/tree-node-data.js +10 -8
- package/out/service/vo/tree-node-data/tree-static-node-data.d.ts +4 -4
- package/out/service/vo/tree-node-data/tree-static-node-data.d.ts.map +1 -1
- package/out/service/vo/tree-node-data/tree-static-node-data.js +10 -10
- package/package.json +3 -3
- package/src/app-hub.ts +6 -0
- package/src/controller/control/exp-bar/tree-exp-bar.controller.ts +5 -6
- package/src/controller/control/gantt/gantt.controller.ts +2 -2
- package/src/controller/control/gantt/gantt.service.ts +2 -2
- package/src/controller/control/grid/grid/grid.controller.ts +17 -8
- package/src/controller/control/tree/tree.controller.ts +61 -61
- package/src/controller/control/tree/tree.service.ts +8 -8
- package/src/controller/control/tree-grid/tree-grid.controller.ts +79 -4
- package/src/interface/common/i-app-hub-service/i-app-hub-service.ts +7 -0
- package/src/interface/controller/controller/control/i-grid.controller.ts +5 -2
- package/src/interface/controller/controller/control/i-tree-grid.controller.ts +16 -1
- package/src/interface/controller/state/control/i-gantt.state.ts +2 -2
- package/src/interface/controller/state/control/i-tree-grid.state.ts +7 -1
- package/src/interface/controller/state/control/i-tree.state.ts +27 -25
- package/src/interface/service/service/i-auth.service.ts +26 -0
- package/src/interface/service/service/index.ts +1 -1
- package/src/service/service/auth/v7-auth.service.ts +31 -2
- package/src/service/service/entity/method/de-action.ts +4 -3
- package/src/service/vo/gantt-node-data/gantt-code-list-node-data.ts +2 -2
- package/src/service/vo/gantt-node-data/gantt-data-set-node-data.ts +2 -2
- package/src/service/vo/gantt-node-data/gantt-static-node-data.ts +2 -2
- package/src/service/vo/tree-node-data/tree-code-list-node-data.ts +12 -12
- package/src/service/vo/tree-node-data/tree-data-set-node-data.ts +26 -29
- package/src/service/vo/tree-node-data/tree-node-data.ts +20 -20
- package/src/service/vo/tree-node-data/tree-static-node-data.ts +14 -14
|
@@ -305,7 +305,7 @@ export class TreeController<
|
|
|
305
305
|
|
|
306
306
|
// 有父节点绑定到父节点数据上,无父节点替换rootNodes
|
|
307
307
|
if (parentNode) {
|
|
308
|
-
parentNode.
|
|
308
|
+
parentNode._children = nodes;
|
|
309
309
|
} else {
|
|
310
310
|
this.state.rootNodes = nodes;
|
|
311
311
|
}
|
|
@@ -349,7 +349,7 @@ export class TreeController<
|
|
|
349
349
|
): Promise<void> {
|
|
350
350
|
// 节点有配置常用操作的上下文菜单时,触发界面行为,后续逻辑都不走
|
|
351
351
|
const clickActionItem =
|
|
352
|
-
this.contextMenuInfos[nodeData.
|
|
352
|
+
this.contextMenuInfos[nodeData._nodeId]?.clickTBUIActionItem;
|
|
353
353
|
if (clickActionItem) {
|
|
354
354
|
return this.doUIAction(
|
|
355
355
|
clickActionItem.uiactionId!,
|
|
@@ -361,7 +361,7 @@ export class TreeController<
|
|
|
361
361
|
|
|
362
362
|
// 导航的时候,没有导航视图的时候,节点后续点击逻辑都不走,也不选中
|
|
363
363
|
if (this.state.navigational) {
|
|
364
|
-
const nodeModel = this.getNodeModel(nodeData.
|
|
364
|
+
const nodeModel = this.getNodeModel(nodeData._nodeId);
|
|
365
365
|
if (!nodeModel?.navAppViewId) {
|
|
366
366
|
return;
|
|
367
367
|
}
|
|
@@ -372,7 +372,7 @@ export class TreeController<
|
|
|
372
372
|
// 选中相关处理
|
|
373
373
|
const { selectedData } = this.state;
|
|
374
374
|
// 选中里没有则添加,有则删除
|
|
375
|
-
const filterArr = selectedData.filter(item => item.
|
|
375
|
+
const filterArr = selectedData.filter(item => item._id !== nodeData._id);
|
|
376
376
|
if (filterArr.length === selectedData.length) {
|
|
377
377
|
this.setSelection(
|
|
378
378
|
this.state.singleSelect
|
|
@@ -398,11 +398,11 @@ export class TreeController<
|
|
|
398
398
|
* @param {boolean} isExpand true为展开,false为折叠
|
|
399
399
|
*/
|
|
400
400
|
onExpandChange(nodeData: ITreeNodeData, isExpand: boolean): void {
|
|
401
|
-
const hasKey = this.state.expandedKeys.includes(nodeData.
|
|
401
|
+
const hasKey = this.state.expandedKeys.includes(nodeData._id);
|
|
402
402
|
if (isExpand && !hasKey) {
|
|
403
|
-
this.state.expandedKeys.push(nodeData.
|
|
403
|
+
this.state.expandedKeys.push(nodeData._id);
|
|
404
404
|
} else if (!isExpand && hasKey) {
|
|
405
|
-
const index = this.state.expandedKeys.indexOf(nodeData.
|
|
405
|
+
const index = this.state.expandedKeys.indexOf(nodeData._id);
|
|
406
406
|
if (index !== -1) {
|
|
407
407
|
this.state.expandedKeys.splice(index, 1);
|
|
408
408
|
}
|
|
@@ -427,13 +427,13 @@ export class TreeController<
|
|
|
427
427
|
return this._evt.emit('onActive', { ...nodeParams, nodeData: item });
|
|
428
428
|
}
|
|
429
429
|
|
|
430
|
-
setSelection(selection:
|
|
430
|
+
setSelection(selection: { _id: string }[]): void {
|
|
431
431
|
// todo 当自己点选中时,父节点选不选中,如果选中需要在这边优化
|
|
432
432
|
|
|
433
433
|
// 通过id过滤出原始的树节点数据,避免外部使用的时候传入的选中数据有问题。
|
|
434
|
-
const selectionIds = selection.map(item => item.
|
|
434
|
+
const selectionIds = selection.map(item => item._id);
|
|
435
435
|
const filterArr = this.state.items.filter(item =>
|
|
436
|
-
selectionIds.includes(item.
|
|
436
|
+
selectionIds.includes(item._id),
|
|
437
437
|
);
|
|
438
438
|
super.setSelection(filterArr);
|
|
439
439
|
}
|
|
@@ -457,7 +457,7 @@ export class TreeController<
|
|
|
457
457
|
* @return {*} {(ITreeNodeData | undefined)}
|
|
458
458
|
*/
|
|
459
459
|
getNodeData(key: string): ITreeNodeData | undefined {
|
|
460
|
-
const find = this.state.items.find(item => item.
|
|
460
|
+
const find = this.state.items.find(item => item._id === key);
|
|
461
461
|
if (find) {
|
|
462
462
|
return find;
|
|
463
463
|
}
|
|
@@ -526,9 +526,9 @@ export class TreeController<
|
|
|
526
526
|
params: IParams;
|
|
527
527
|
} {
|
|
528
528
|
return {
|
|
529
|
-
data: [{ ...nodeData, ...(nodeData.
|
|
530
|
-
context: Object.assign(this.context.clone(), nodeData.
|
|
531
|
-
params: { ...this.params, ...(nodeData.
|
|
529
|
+
data: [{ ...nodeData, ...(nodeData._deData || {}) }],
|
|
530
|
+
context: Object.assign(this.context.clone(), nodeData._context || {}),
|
|
531
|
+
params: { ...this.params, ...(nodeData._params || {}) },
|
|
532
532
|
};
|
|
533
533
|
}
|
|
534
534
|
|
|
@@ -546,8 +546,8 @@ export class TreeController<
|
|
|
546
546
|
|
|
547
547
|
// 计算加载回来的里面带的默认展开
|
|
548
548
|
recursiveIterate({ children: nodes }, (node: ITreeNodeData) => {
|
|
549
|
-
if (node.
|
|
550
|
-
expandedKeys.push(node.
|
|
549
|
+
if (node._children?.length) {
|
|
550
|
+
expandedKeys.push(node._id);
|
|
551
551
|
}
|
|
552
552
|
});
|
|
553
553
|
|
|
@@ -565,10 +565,10 @@ export class TreeController<
|
|
|
565
565
|
* @return {*} {Promise<void>}
|
|
566
566
|
*/
|
|
567
567
|
async refreshNodeChildren(
|
|
568
|
-
nodeData:
|
|
568
|
+
nodeData: { _id?: string; srfkey?: string },
|
|
569
569
|
refreshParent = false,
|
|
570
570
|
): Promise<void> {
|
|
571
|
-
const key = nodeData.srfkey ? 'srfkey' : '
|
|
571
|
+
const key = nodeData.srfkey ? 'srfkey' : '_id';
|
|
572
572
|
const currentNode = this.state.items.find(
|
|
573
573
|
item => item[key] === nodeData[key],
|
|
574
574
|
);
|
|
@@ -579,18 +579,18 @@ export class TreeController<
|
|
|
579
579
|
|
|
580
580
|
// 刷新父,但是没父,刷新根
|
|
581
581
|
if (refreshParent) {
|
|
582
|
-
const {
|
|
582
|
+
const { _parent } = currentNode;
|
|
583
583
|
// 没有父,或者父是不显示的根节点,那么刷新所有
|
|
584
584
|
if (
|
|
585
|
-
!
|
|
586
|
-
(!this.model.rootVisible && this.state.rootNodes.includes(
|
|
585
|
+
!_parent ||
|
|
586
|
+
(!this.model.rootVisible && this.state.rootNodes.includes(_parent))
|
|
587
587
|
) {
|
|
588
|
-
this.refresh();
|
|
588
|
+
await this.refresh();
|
|
589
589
|
return;
|
|
590
590
|
}
|
|
591
591
|
}
|
|
592
592
|
|
|
593
|
-
const targetNode = refreshParent ? currentNode.
|
|
593
|
+
const targetNode = refreshParent ? currentNode._parent! : currentNode;
|
|
594
594
|
|
|
595
595
|
const nodes = await this.loadNodes(targetNode);
|
|
596
596
|
this._evt.emit('onAfterRefreshParent', {
|
|
@@ -609,7 +609,7 @@ export class TreeController<
|
|
|
609
609
|
|
|
610
610
|
// 找到已存在的要展开的节点
|
|
611
611
|
const existNodes = this.state.items.filter(item =>
|
|
612
|
-
noExpandKeys.includes(item.
|
|
612
|
+
noExpandKeys.includes(item._id),
|
|
613
613
|
);
|
|
614
614
|
|
|
615
615
|
// 补充所有未展开的节点标识,查询过程中会自动加载后续展开
|
|
@@ -634,7 +634,7 @@ export class TreeController<
|
|
|
634
634
|
* @return {*} {boolean}
|
|
635
635
|
*/
|
|
636
636
|
calcAllowDrag(draggingNode: ITreeNodeData): boolean {
|
|
637
|
-
const nodeModel = this.getNodeModel(draggingNode.
|
|
637
|
+
const nodeModel = this.getNodeModel(draggingNode._nodeId);
|
|
638
638
|
return nodeModel?.allowDrag === true;
|
|
639
639
|
}
|
|
640
640
|
|
|
@@ -652,30 +652,30 @@ export class TreeController<
|
|
|
652
652
|
dropNode: ITreeNodeData,
|
|
653
653
|
type: 'inner' | 'prev' | 'next',
|
|
654
654
|
): boolean {
|
|
655
|
-
const draggingNodeModel = this.getNodeModel(draggingNode.
|
|
655
|
+
const draggingNodeModel = this.getNodeModel(draggingNode._nodeId)!;
|
|
656
656
|
// * 移入的情况
|
|
657
657
|
if (type === 'inner') {
|
|
658
658
|
return !!this.findDropNodeRS(
|
|
659
|
-
dropNode.
|
|
659
|
+
dropNode._nodeId!,
|
|
660
660
|
draggingNodeModel.appDataEntityId!,
|
|
661
661
|
);
|
|
662
662
|
}
|
|
663
663
|
// * 前后的情况
|
|
664
664
|
|
|
665
665
|
// 父相同的情况下,就是排序,看当前节点是否能排序
|
|
666
|
-
if (draggingNode.
|
|
667
|
-
const currentNodeModel = this.getNodeModel(dropNode.
|
|
666
|
+
if (draggingNode._parent?._id === dropNode._parent?._id) {
|
|
667
|
+
const currentNodeModel = this.getNodeModel(dropNode._nodeId)!;
|
|
668
668
|
return currentNodeModel?.allowOrder === true;
|
|
669
669
|
}
|
|
670
670
|
|
|
671
671
|
// 没有父就是根节点,根节点没有上层关系,无法换父
|
|
672
|
-
if (!dropNode.
|
|
672
|
+
if (!dropNode._parent) {
|
|
673
673
|
return false;
|
|
674
674
|
}
|
|
675
675
|
|
|
676
676
|
// 父不一样的时候需要判断能否移入到对方的父节点内
|
|
677
677
|
return !!this.findDropNodeRS(
|
|
678
|
-
dropNode.
|
|
678
|
+
dropNode._parent!._nodeId!,
|
|
679
679
|
draggingNodeModel.appDataEntityId!,
|
|
680
680
|
);
|
|
681
681
|
}
|
|
@@ -714,31 +714,31 @@ export class TreeController<
|
|
|
714
714
|
): Promise<void> {
|
|
715
715
|
if (
|
|
716
716
|
dropType === 'inner' &&
|
|
717
|
-
!dropNode.
|
|
718
|
-
dropNode.
|
|
717
|
+
!dropNode._leaf &&
|
|
718
|
+
dropNode._children === undefined
|
|
719
719
|
) {
|
|
720
|
-
await this.expandNodeByKey([dropNode.
|
|
720
|
+
await this.expandNodeByKey([dropNode._id]);
|
|
721
721
|
}
|
|
722
722
|
|
|
723
723
|
/** 修改的树节点数据 */
|
|
724
724
|
const modifiedNodeDatas: ITreeNodeData[] = [];
|
|
725
|
-
const draggingNodeModel = this.getNodeModel(draggingNode.
|
|
726
|
-
const dropInNode = dropType === 'inner' ? dropNode : dropNode.
|
|
727
|
-
const isChangedParent = dropNode?.
|
|
728
|
-
let orderNodeModel = this.getNodeModel(dropNode.
|
|
725
|
+
const draggingNodeModel = this.getNodeModel(draggingNode._nodeId)!;
|
|
726
|
+
const dropInNode = dropType === 'inner' ? dropNode : dropNode._parent!;
|
|
727
|
+
const isChangedParent = dropNode?._id !== draggingNode._parent?._id;
|
|
728
|
+
let orderNodeModel = this.getNodeModel(dropNode._nodeId)!;
|
|
729
729
|
|
|
730
730
|
// * 处理切换父节点
|
|
731
731
|
if (
|
|
732
732
|
dropType === 'inner' ||
|
|
733
|
-
dropNode.
|
|
733
|
+
dropNode._parent?._id !== draggingNode._parent?._id
|
|
734
734
|
) {
|
|
735
735
|
const dropNodeRs = this.findDropNodeRS(
|
|
736
|
-
dropInNode.
|
|
736
|
+
dropInNode._nodeId,
|
|
737
737
|
draggingNodeModel.appDataEntityId!,
|
|
738
738
|
);
|
|
739
739
|
if (dropNodeRs) {
|
|
740
740
|
// 修改关系属性的值为父节点的主键和树节点id
|
|
741
|
-
draggingNode.
|
|
741
|
+
draggingNode._deData![dropNodeRs.pickupDEFName] = dropInNode._value;
|
|
742
742
|
modifiedNodeDatas.push(draggingNode);
|
|
743
743
|
orderNodeModel = this.getNodeModel(dropNodeRs.childDETreeNodeId)!;
|
|
744
744
|
}
|
|
@@ -746,33 +746,33 @@ export class TreeController<
|
|
|
746
746
|
|
|
747
747
|
// *修改节点数据
|
|
748
748
|
// 所有情况都先从原来的父的子集合里删除自己
|
|
749
|
-
const originArr = draggingNode.
|
|
749
|
+
const originArr = draggingNode._parent!._children!;
|
|
750
750
|
originArr.splice(originArr.indexOf(draggingNode), 1);
|
|
751
751
|
|
|
752
752
|
if (dropType === 'inner') {
|
|
753
753
|
// 移入时放到最后
|
|
754
|
-
if (!dropNode.
|
|
755
|
-
dropNode.
|
|
756
|
-
dropNode.
|
|
757
|
-
this.state.expandedKeys.push(dropNode.
|
|
754
|
+
if (!dropNode._children) {
|
|
755
|
+
dropNode._children = [];
|
|
756
|
+
dropNode._leaf = true;
|
|
757
|
+
this.state.expandedKeys.push(dropNode._id);
|
|
758
758
|
}
|
|
759
759
|
|
|
760
|
-
dropNode.
|
|
760
|
+
dropNode._children.push(draggingNode);
|
|
761
761
|
} else {
|
|
762
762
|
// 非插入时,放入指定节点前后
|
|
763
|
-
let insertIndex = dropInNode.
|
|
763
|
+
let insertIndex = dropInNode._children!.indexOf(dropNode);
|
|
764
764
|
if (dropType === 'next') {
|
|
765
765
|
insertIndex += 1;
|
|
766
766
|
}
|
|
767
|
-
dropInNode.
|
|
767
|
+
dropInNode._children!.splice(insertIndex, 0, draggingNode);
|
|
768
768
|
}
|
|
769
769
|
|
|
770
770
|
//* 变更父节点后的,拖动节点调整
|
|
771
771
|
if (dropType === 'inner' || isChangedParent) {
|
|
772
772
|
// 更改父节点
|
|
773
|
-
draggingNode.
|
|
773
|
+
draggingNode._parent = dropInNode;
|
|
774
774
|
// 修改指向的节点模型
|
|
775
|
-
draggingNode.
|
|
775
|
+
draggingNode._nodeId = orderNodeModel.id!;
|
|
776
776
|
// 维护拖拽的节点和其子孙的展开,维护拖入节点的展开
|
|
777
777
|
this.state.expandedKeys = this.calcExpandedKeys([dropInNode]);
|
|
778
778
|
}
|
|
@@ -788,7 +788,7 @@ export class TreeController<
|
|
|
788
788
|
const sortField = sortAppDEFieldId.toLowerCase();
|
|
789
789
|
const isAsc = sortDir === 'ASC';
|
|
790
790
|
|
|
791
|
-
const changedArr = [...dropInNode.
|
|
791
|
+
const changedArr = [...dropInNode._children!];
|
|
792
792
|
|
|
793
793
|
// 降序把数组反转,保证两个数组都是从小到大排
|
|
794
794
|
if (!isAsc) {
|
|
@@ -812,7 +812,7 @@ export class TreeController<
|
|
|
812
812
|
|
|
813
813
|
let lastSort: number;
|
|
814
814
|
changedArr.forEach((item, index) => {
|
|
815
|
-
const deData = item.
|
|
815
|
+
const deData = item._deData!;
|
|
816
816
|
if (lastSort === undefined) {
|
|
817
817
|
// 第一次出现要调整顺序的时候一定是从拖拽节点开始
|
|
818
818
|
if (item === draggingNode) {
|
|
@@ -821,7 +821,7 @@ export class TreeController<
|
|
|
821
821
|
lastSort = 100;
|
|
822
822
|
} else {
|
|
823
823
|
// 最后一个时,把前一个的排序值加100
|
|
824
|
-
lastSort = getNextSort(getSort(changedArr[index - 1].
|
|
824
|
+
lastSort = getNextSort(getSort(changedArr[index - 1]._deData!));
|
|
825
825
|
}
|
|
826
826
|
deData[sortField] = lastSort;
|
|
827
827
|
|
|
@@ -859,8 +859,8 @@ export class TreeController<
|
|
|
859
859
|
const app = ibiz.hub.getApp(this.context.srfappid);
|
|
860
860
|
await Promise.all(
|
|
861
861
|
nodeDatas.map(async node => {
|
|
862
|
-
const model = this.getNodeModel(node.
|
|
863
|
-
const deData = node.
|
|
862
|
+
const model = this.getNodeModel(node._nodeId)!;
|
|
863
|
+
const deData = node._deData!;
|
|
864
864
|
// 往上下文添加主键
|
|
865
865
|
const deName = calcDeCodeNameById(model.appDataEntityId!);
|
|
866
866
|
const tempContext = this.context.clone();
|
|
@@ -876,7 +876,7 @@ export class TreeController<
|
|
|
876
876
|
|
|
877
877
|
// 更新完之后更新state里的数据。
|
|
878
878
|
if (res.data) {
|
|
879
|
-
node.
|
|
879
|
+
node._deData = res.data;
|
|
880
880
|
}
|
|
881
881
|
}),
|
|
882
882
|
);
|
|
@@ -891,15 +891,15 @@ export class TreeController<
|
|
|
891
891
|
* @return {*} {Promise<void>}
|
|
892
892
|
*/
|
|
893
893
|
async modifyNodeText(nodeData: ITreeNodeData, text: string): Promise<void> {
|
|
894
|
-
const model = this.getNodeModel(nodeData.
|
|
894
|
+
const model = this.getNodeModel(nodeData._nodeId)! as IDETreeDataSetNode;
|
|
895
895
|
if (!model.allowEditText) {
|
|
896
896
|
throw new RuntimeModelError(model, '树节点没有配置编辑模式:名称');
|
|
897
897
|
}
|
|
898
|
-
if (!nodeData.
|
|
898
|
+
if (!nodeData._deData) {
|
|
899
899
|
throw new RuntimeError('不是实体树节点数据');
|
|
900
900
|
}
|
|
901
|
-
nodeData.
|
|
902
|
-
nodeData.
|
|
901
|
+
nodeData._text = text;
|
|
902
|
+
nodeData._deData[model.textAppDEFieldId!] = text;
|
|
903
903
|
await this.updateDeNodeData([nodeData]);
|
|
904
904
|
}
|
|
905
905
|
}
|
|
@@ -99,7 +99,7 @@ export class TreeService<
|
|
|
99
99
|
} else {
|
|
100
100
|
// 有父节点的计算节点关系查询对应节点数据并合并
|
|
101
101
|
const childNodeRSs = getChildNodeRSs(this.model, {
|
|
102
|
-
parentId: parentNodeData?.
|
|
102
|
+
parentId: parentNodeData?._nodeId,
|
|
103
103
|
hasQuery,
|
|
104
104
|
});
|
|
105
105
|
|
|
@@ -201,14 +201,14 @@ export class TreeService<
|
|
|
201
201
|
(expanded && // 全展开合只展开首节点expanded都为true
|
|
202
202
|
(!expandFirstOnly || (expandFirstOnly && index === 0))) ||
|
|
203
203
|
(opts.defaultExpandedKeys?.length &&
|
|
204
|
-
opts.defaultExpandedKeys.includes(childNode.
|
|
204
|
+
opts.defaultExpandedKeys.includes(childNode._id)) || // 外部回显给的默认展开节点集合有的展开
|
|
205
205
|
isExpandedRoot
|
|
206
206
|
) {
|
|
207
207
|
const subChildrenNodes = await this.fetchChildNodes(
|
|
208
208
|
childNode,
|
|
209
209
|
opts,
|
|
210
210
|
);
|
|
211
|
-
childNode.
|
|
211
|
+
childNode._children = subChildrenNodes;
|
|
212
212
|
}
|
|
213
213
|
}),
|
|
214
214
|
);
|
|
@@ -275,7 +275,7 @@ export class TreeService<
|
|
|
275
275
|
// 合并部件上下文和父节点资源上下文
|
|
276
276
|
const context = {
|
|
277
277
|
...opts.context,
|
|
278
|
-
...(parentNodeData?.
|
|
278
|
+
...(parentNodeData?._context || {}),
|
|
279
279
|
};
|
|
280
280
|
|
|
281
281
|
// 计算关系过滤用到的实体数据
|
|
@@ -285,18 +285,18 @@ export class TreeService<
|
|
|
285
285
|
if (parentNodeData) {
|
|
286
286
|
parentData = parentNodeData;
|
|
287
287
|
for (let index = 1; index < parentValueLevel!; index++) {
|
|
288
|
-
parentData = parentData?.
|
|
288
|
+
parentData = parentData?._parent;
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
291
|
let derValue;
|
|
292
292
|
let deName;
|
|
293
293
|
if (parentData) {
|
|
294
|
-
data = parentData.
|
|
295
|
-
const parentNodeModel = getTreeNode(this.model, parentData.
|
|
294
|
+
data = parentData._deData || {};
|
|
295
|
+
const parentNodeModel = getTreeNode(this.model, parentData._nodeId);
|
|
296
296
|
if (parentNodeModel.appDataEntityId) {
|
|
297
297
|
deName = calcDeCodeNameById(parentNodeModel.appDataEntityId);
|
|
298
298
|
}
|
|
299
|
-
derValue = parentData.
|
|
299
|
+
derValue = parentData._value;
|
|
300
300
|
}
|
|
301
301
|
|
|
302
302
|
// 导航相关参数处理
|
|
@@ -1,6 +1,81 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IDEGridFieldColumn, IDETreeGrid } from '@ibiz/model-core';
|
|
2
|
+
import { RuntimeModelError } from '@ibiz-template/core';
|
|
3
|
+
import {
|
|
4
|
+
ITreeGridController,
|
|
5
|
+
ITreeGridEvent,
|
|
6
|
+
ITreeGridState,
|
|
7
|
+
} from '../../../interface';
|
|
2
8
|
import { GridController } from '../grid';
|
|
3
9
|
|
|
4
|
-
export class TreeGridController
|
|
5
|
-
|
|
6
|
-
|
|
10
|
+
export class TreeGridController<
|
|
11
|
+
T extends IDETreeGrid = IDETreeGrid,
|
|
12
|
+
S extends ITreeGridState = ITreeGridState,
|
|
13
|
+
E extends ITreeGridEvent = ITreeGridEvent,
|
|
14
|
+
>
|
|
15
|
+
extends GridController<T, S, E>
|
|
16
|
+
implements ITreeGridController<T, S, E>
|
|
17
|
+
{
|
|
18
|
+
/**
|
|
19
|
+
* 树表格值属性名称
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
22
|
+
treeGridValueField: string = '';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 树表格父属性名称
|
|
26
|
+
*
|
|
27
|
+
*/
|
|
28
|
+
treeGridParentField: string = '';
|
|
29
|
+
|
|
30
|
+
protected initState(): void {
|
|
31
|
+
super.initState();
|
|
32
|
+
this.state.showTreeGrid = true;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* 初始化方法
|
|
37
|
+
*
|
|
38
|
+
* @author lxm
|
|
39
|
+
* @date 2022-08-18 22:08:17
|
|
40
|
+
* @protected
|
|
41
|
+
* @returns {*} {Promise<void>}
|
|
42
|
+
*/
|
|
43
|
+
protected async onCreated(): Promise<void> {
|
|
44
|
+
await super.onCreated();
|
|
45
|
+
|
|
46
|
+
this.initTreeGridField();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* 初始化树表格字段
|
|
51
|
+
* @return {*}
|
|
52
|
+
* @author: zhujiamin
|
|
53
|
+
*/
|
|
54
|
+
protected initTreeGridField(): void {
|
|
55
|
+
const treeGridParent: IDEGridFieldColumn | undefined =
|
|
56
|
+
this.model.degridColumns?.find((item: IDEGridFieldColumn) => {
|
|
57
|
+
return item.treeColumnMode === 4 || item.treeColumnMode === 12;
|
|
58
|
+
});
|
|
59
|
+
const treeGridValue: IDEGridFieldColumn | undefined =
|
|
60
|
+
this.model.degridColumns?.find((item: IDEGridFieldColumn) => {
|
|
61
|
+
return item.treeColumnMode === 2 || item.treeColumnMode === 3;
|
|
62
|
+
});
|
|
63
|
+
if (!treeGridParent) {
|
|
64
|
+
throw new RuntimeModelError(this.model, '树表格无值列模式');
|
|
65
|
+
}
|
|
66
|
+
if (!treeGridValue) {
|
|
67
|
+
throw new RuntimeModelError(this.model, '树表格无父值列模式');
|
|
68
|
+
}
|
|
69
|
+
this.treeGridValueField = treeGridValue.appDEFieldId!.toLowerCase();
|
|
70
|
+
this.treeGridParentField = treeGridParent.appDEFieldId!.toLowerCase();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* 切换树表格显示
|
|
75
|
+
* @return {*}
|
|
76
|
+
* @author: zhujiamin
|
|
77
|
+
*/
|
|
78
|
+
switchTreeGridShow(): void {
|
|
79
|
+
this.state.showTreeGrid = !this.state.showTreeGrid;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -13,8 +13,11 @@ import { CodeListItem } from '../../../service';
|
|
|
13
13
|
* @interface IGridController
|
|
14
14
|
* @extends {IMDControlController}
|
|
15
15
|
*/
|
|
16
|
-
export interface IGridController
|
|
17
|
-
extends
|
|
16
|
+
export interface IGridController<
|
|
17
|
+
T extends IDEGrid = IDEGrid,
|
|
18
|
+
S extends IGridState = IGridState,
|
|
19
|
+
E extends IGridEvent = IGridEvent,
|
|
20
|
+
> extends IMDControlController<T, S, E> {
|
|
18
21
|
/**
|
|
19
22
|
* 新建行
|
|
20
23
|
*
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { IDETreeGrid } from '@ibiz/model-core';
|
|
1
2
|
import { IGridController } from './i-grid.controller';
|
|
3
|
+
import { ITreeGridState } from '../../state';
|
|
4
|
+
import { ITreeGridEvent } from '../../event';
|
|
2
5
|
|
|
3
6
|
/**
|
|
4
7
|
* 树表格部件控制器
|
|
@@ -9,4 +12,16 @@ import { IGridController } from './i-grid.controller';
|
|
|
9
12
|
* @interface ITreeGridController
|
|
10
13
|
* @extends {IMDControlController<IDETreeGrid, ITreeGridState, ITreeGridEvent>}
|
|
11
14
|
*/
|
|
12
|
-
export interface ITreeGridController
|
|
15
|
+
export interface ITreeGridController<
|
|
16
|
+
T extends IDETreeGrid = IDETreeGrid,
|
|
17
|
+
S extends ITreeGridState = ITreeGridState,
|
|
18
|
+
E extends ITreeGridEvent = ITreeGridEvent,
|
|
19
|
+
> extends IGridController<T, S, E> {
|
|
20
|
+
/**
|
|
21
|
+
* 切换树表格显示
|
|
22
|
+
* @return {*}
|
|
23
|
+
* @author: zhujiamin
|
|
24
|
+
*
|
|
25
|
+
*/
|
|
26
|
+
switchTreeGridShow(): void;
|
|
27
|
+
}
|
|
@@ -108,7 +108,7 @@ export interface IGanttNodeData extends ITreeNodeData {
|
|
|
108
108
|
* @date 2023-12-11 18:12:16
|
|
109
109
|
* @type {(IGanttNodeData[] | undefined)}
|
|
110
110
|
*/
|
|
111
|
-
|
|
111
|
+
_children?: IGanttNodeData[] | undefined;
|
|
112
112
|
|
|
113
113
|
/**
|
|
114
114
|
* 父节点数据对象
|
|
@@ -116,5 +116,5 @@ export interface IGanttNodeData extends ITreeNodeData {
|
|
|
116
116
|
* @type {IGanttNodeData}
|
|
117
117
|
* @memberof IGanttNodeData
|
|
118
118
|
*/
|
|
119
|
-
|
|
119
|
+
_parent?: IGanttNodeData;
|
|
120
120
|
}
|
|
@@ -9,4 +9,10 @@ import { IGridState } from './i-grid.state';
|
|
|
9
9
|
* @interface ITreeGridState
|
|
10
10
|
* @extends {IMDControlState}
|
|
11
11
|
*/
|
|
12
|
-
export interface ITreeGridState extends IGridState {
|
|
12
|
+
export interface ITreeGridState extends IGridState {
|
|
13
|
+
/**
|
|
14
|
+
* 树表格是否显示树形结构(默认为true)
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
showTreeGrid: boolean;
|
|
18
|
+
}
|