Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibizlab-generator
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibizlab-generator
提交
74e5086e
提交
74e5086e
编写于
1月 11, 2022
作者:
Mosher
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update:更新支持树导航视图
上级
e907bef8
变更
20
隐藏空白字符变更
内嵌
并排
正在显示
20 个修改的文件
包含
1492 行增加
和
71 行删除
+1492
-71
tree-exp-view.ts
...s}}/src/core/modules/views/tree-exp-view/tree-exp-view.ts
+3
-7
exp-bar-control-state.ts
.../modules/widgets/exp-bar-control/exp-bar-control-state.ts
+10
-2
exp-bar-control.ts
...c/core/modules/widgets/exp-bar-control/exp-bar-control.ts
+45
-4
tree-control-prop.ts
...rc/core/modules/widgets/tree-control/tree-control-prop.ts
+30
-2
tree-control.ts
...s}}/src/core/modules/widgets/tree-control/tree-control.ts
+122
-2
tree-exp-bar-control.ts
...ules/widgets/tree-exp-bar-control/tree-exp-bar-control.ts
+94
-38
index.ts
...empl/r7/app_{{apps}}/src/core/runtime/control-vo/index.ts
+2
-1
index.ts
...ps}}/src/core/runtime/control-vo/tree-control-vo/index.ts
+3
-0
tree-control-vo.ts
...ore/runtime/control-vo/tree-control-vo/tree-control-vo.ts
+26
-0
tree-node-rs-vo.ts
...ore/runtime/control-vo/tree-control-vo/tree-node-rs-vo.ts
+52
-0
tree-node-vo.ts
...c/core/runtime/control-vo/tree-control-vo/tree-node-vo.ts
+269
-0
index.ts
...r7/app_{{apps}}/src/core/service/control-service/index.ts
+2
-1
tree-service.ts
...{{apps}}/src/core/service/control-service/tree-service.ts
+618
-0
util.ts
...in/resources/templ/r7/app_{{apps}}/src/core/utils/util.ts
+10
-0
{{pages@DETREEEXPVIEW}}-config.ts.hbs
...ges@DETREEEXPVIEW}}/{{pages@DETREEEXPVIEW}}-config.ts.hbs
+5
-0
{{pages@DETREEEXPVIEW}}.vue.hbs
...}/{{pages@DETREEEXPVIEW}}/{{pages@DETREEEXPVIEW}}.vue.hbs
+1
-2
{{ctrls@TREEEXPBAR}}-tree-exp-bar-config.ts.hbs
...e-exp-bar/{{ctrls@TREEEXPBAR}}-tree-exp-bar-config.ts.hbs
+16
-0
{{ctrls@TREEEXPBAR}}-tree-exp-bar.vue.hbs
...}}-tree-exp-bar/{{ctrls@TREEEXPBAR}}-tree-exp-bar.vue.hbs
+22
-9
{{ctrls@TREEVIEW}}-tree-config.ts.hbs
...rls@TREEVIEW}}-tree/{{ctrls@TREEVIEW}}-tree-config.ts.hbs
+147
-0
{{ctrls@TREEVIEW}}-tree.vue.hbs
...}/{{ctrls@TREEVIEW}}-tree/{{ctrls@TREEVIEW}}-tree.vue.hbs
+15
-3
未找到文件。
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/modules/views/tree-exp-view/tree-exp-view.ts
浏览文件 @
74e5086e
...
...
@@ -23,9 +23,9 @@ export class TreeExpView extends ExpView {
* @memberof TreeExpView
*/
public
useLoad
(
props
:
TreeExpViewProps
)
{
const
{
viewSubject
}
=
this
.
viewState
;
const
{
viewSubject
,
treeExpBarName
}
=
this
.
viewState
;
onMounted
(()
=>
{
viewSubject
.
next
({
tag
:
'grid'
,
action
:
"load"
,
data
:
{}
})
viewSubject
.
next
({
tag
:
treeExpBarName
,
action
:
"load"
,
data
:
{}
});
})
}
...
...
@@ -37,13 +37,9 @@ export class TreeExpView extends ExpView {
* @memberof TreeExpView
*/
public
moduleInstall
(
props
:
TreeExpViewProps
,
emit
?:
Function
)
{
this
.
emit
=
emit
;
const
superParams
=
super
.
moduleInstall
(
props
,
emit
);
this
.
useLoad
(
props
);
return
{
...
superParams
,
handleCtrlEvent
:
this
.
handleCtrlEvent
.
bind
(
this
),
state
:
this
.
viewState
,
...
superParams
};
}
}
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/modules/widgets/exp-bar-control/exp-bar-control-state.ts
浏览文件 @
74e5086e
import
{
MainControlState
}
from
"@core"
;
import
{
IParam
,
MainControlState
}
from
"@core"
;
/**
* @description 导航栏部件通讯对象
...
...
@@ -6,4 +6,12 @@ import { MainControlState } from "@core";
* @interface ExpBarControlState
* @extends {MainControlState}
*/
export
interface
ExpBarControlState
extends
MainControlState
{
}
\ No newline at end of file
export
interface
ExpBarControlState
extends
MainControlState
{
/**
* @description 选中数据
* @type {IParam}
* @memberof ExpBarControlState
*/
selection
:
IParam
;
}
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/modules/widgets/exp-bar-control/exp-bar-control.ts
浏览文件 @
74e5086e
import
{
MainControl
}
from
"@core"
;
import
{
IActionParam
,
MainControl
}
from
"@core"
;
import
{
ExpBarControlProps
}
from
"./exp-bar-control-prop"
;
import
{
ExpBarControlState
}
from
"./exp-bar-control-state"
;
...
...
@@ -17,11 +17,51 @@ export class ExpBarControl extends MainControl {
public
declare
controlState
:
ExpBarControlState
;
/**
* @description
使用加载功能模块
* @param {
ExpBarControlProps} props 传入的props
* @description
处理部件事件
* @param {
IActionParam} actionParam
* @memberof ExpBarControl
*/
public
useLoad
(
props
:
ExpBarControlProps
)
{
public
handleCtrlEvent
(
actionParam
:
IActionParam
)
{
const
{
tag
,
action
,
data
}
=
actionParam
;
const
{
selection
}
=
this
.
controlState
;
switch
(
action
)
{
case
'selectionchange'
:
this
.
onSelectionChange
(
data
);
break
;
}
}
protected
onSelectionChange
(
data
:
any
[])
{
console
.
log
(
"处理选中事件"
,
data
);
}
public
calcToolbarItemState
(
state
:
boolean
)
{
// TODO 计算工具栏权限
// let _this: any = this;
// const models: any = _this.toolbarModels;
// if (models && models.length > 0) {
// for (const key in models) {
// if (!models.hasOwnProperty(key)) {
// return;
// }
// const _item = models[key];
// if (_item.uiaction && (Object.is(_item.uiaction.actionTarget, 'SINGLEKEY') || Object.is(_item.uiaction.actionTarget, 'MULTIKEY'))) {
// _item.disabled = state;
// }
// _item.visabled = true;
// if (_item.noprivdisplaymode && _item.noprivdisplaymode === 6) {
// _item.visabled = false;
// }
// }
// this.calcNavigationToolbarState();
// }
}
public
calcNavigationToolbarState
()
{
let
_this
:
any
=
this
;
if
(
_this
.
toolbarModels
)
{
// ViewTool.calcActionItemAuthState({}, this.toolbarModels, this.appUIService);
}
}
/**
...
...
@@ -36,6 +76,7 @@ export class ExpBarControl extends MainControl {
return
{
...
superParams
,
state
:
this
.
controlState
,
handleCtrlEvent
:
this
.
handleCtrlEvent
.
bind
(
this
)
};
}
}
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/modules/widgets/tree-control/tree-control-prop.ts
浏览文件 @
74e5086e
import
{
MainControlProps
}
from
"@core"
;
import
{
IParam
,
MainControlProps
}
from
"@core"
;
/**
* @description 树部件props
...
...
@@ -6,4 +6,32 @@ import { MainControlProps } from "@core";
* @interface TreeControlProps
* @extends {MainControlProps}
*/
export
interface
TreeControlProps
extends
MainControlProps
{}
\ No newline at end of file
export
interface
TreeControlProps
extends
MainControlProps
{
/**
* @description 是否只处理子节点
* @type {boolean}
* @memberof TreeControlProps
*/
isBranchAvailable
:
boolean
;
/**
* @description 是否多选
* @type {boolean}
* @memberof TreeControlProps
*/
multiple
:
boolean
;
/**
* @description 选中数据
* @type {IParam[]}
* @memberof TreeControlProps
*/
selectedData
:
IParam
[];
/**
* @description 是否默认选中第一项数据
* @type {boolean}
* @memberof TreeControlProps
*/
selectFirstDefault
:
boolean
;
}
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/modules/widgets/tree-control/tree-control.ts
浏览文件 @
74e5086e
import
{
MainControl
}
from
"@core"
;
import
{
toRef
}
from
"vue"
;
import
{
deepCopy
,
deepObjectMerge
,
IActionParam
,
MainControl
}
from
"@core"
;
import
{
TreeControlProps
}
from
"./tree-control-prop"
;
import
{
TreeControlState
}
from
"./tree-control-state"
;
...
...
@@ -16,6 +17,59 @@ export class TreeControl extends MainControl {
*/
public
declare
controlState
:
TreeControlState
;
/**
* @description 根据props调整设置部件state
* @param {TreeControlProps} props 传入的props
* @memberof TreeControl
*/
public
setState
(
props
:
TreeControlProps
):
void
{
super
.
setState
(
props
);
this
.
controlState
.
isBranchAvailable
=
toRef
(
props
,
'isBranchAvailable'
)
as
any
;
}
/**
* @description 树节点选中
* @param {string} nodeId
* @param \{{ nativeEvent: MouseEvent, node: any, selected: boolean }} e
* @memberof TreeControl
*/
public
treeNodeSelect
(
nodeId
:
string
,
e
:
{
nativeEvent
:
MouseEvent
,
node
:
any
,
selected
:
boolean
})
{
if
(
e
.
node
.
disabled
)
{
e
.
node
.
isCurrent
=
false
;
return
;
}
const
{
isBranchAvailable
,
currentselectedNode
,
multiple
,
selectedNodes
,
controlName
}
=
this
.
controlState
;
if
(
isBranchAvailable
&&
e
.
node
.
leaf
)
{
if
(
currentselectedNode
&&
Object
.
keys
(
currentselectedNode
).
length
>
0
)
{
currentselectedNode
.
value
.
srfchecked
=
0
;
}
e
.
node
.
srfchecked
=
1
;
currentselectedNode
.
value
=
e
.
node
;
if
(
!
multiple
)
{
selectedNodes
.
push
(
currentselectedNode
.
value
);
this
.
emit
(
"ctrlEvent"
,{
tag
:
controlName
,
action
:
'selectionchange'
,
data
:
deepCopy
(
selectedNodes
)
});
}
}
}
/**
* @description 计算节点上下文
* @private
* @param {*} curNode
* @return {*}
* @memberof TreeControl
*/
private
computecurNodeContext
(
curNode
:
any
)
{
const
{
context
}
=
this
.
controlState
;
let
tempContext
:
any
=
{};
if
(
curNode
&&
curNode
.
data
&&
curNode
.
data
.
srfappctx
)
{
tempContext
=
deepCopy
(
curNode
.
data
.
srfappctx
);
}
else
{
tempContext
=
deepCopy
(
context
);
}
return
tempContext
;
}
/**
* @description 使用加载功能模块
* @param {TreeControlProps} props 传入的props
...
...
@@ -24,7 +78,72 @@ export class TreeControl extends MainControl {
*/
public
useLoad
(
props
:
TreeControlProps
)
{
const
{
viewSubject
,
controlName
}
=
this
.
controlState
;
const
load
=
async
(
opt
:
any
=
{})
=>
{
const
load
=
async
(
node
:
any
,
isFirst
:
boolean
=
false
)
=>
{
if
(
node
?.
dataRef
?.
children
)
{
return
null
;
}
const
{
controlService
,
data
,
viewParams
,
srfnodefilter
}
=
this
.
controlState
;
let
tempViewParams
:
any
=
deepCopy
(
viewParams
);
let
curNode
:
any
=
{};
curNode
=
deepObjectMerge
(
curNode
,
node
);
const
params
:
any
=
{
srfnodeid
:
node
.
dataRef
&&
node
.
dataRef
.
id
?
node
.
dataRef
.
id
:
'#'
,
srfnodefilter
:
srfnodefilter
,
parentData
:
curNode
.
dataRef
?.
curData
}
let
tempContext
:
any
=
this
.
computecurNodeContext
(
curNode
);
if
(
curNode
.
dataRef
&&
curNode
.
dataRef
.
sefparentdename
)
{
Object
.
assign
(
tempContext
,
{
srfparentdename
:
curNode
.
dataRef
.
srfparentdename
});
Object
.
assign
(
tempViewParams
,
{
srfparentdename
:
curNode
.
dataRef
.
srfparentdename
});
}
if
(
curNode
.
dataRef
&&
curNode
.
dataRef
.
srfparentdemapname
)
{
Object
.
assign
(
tempContext
,
{
srfparentdemapname
:
curNode
.
dataRef
.
srfparentdemapname
});
Object
.
assign
(
tempViewParams
,
{
srfparentdemapname
:
curNode
.
dataRef
.
srfparentdemapname
});
}
if
(
curNode
.
dataRef
&&
curNode
.
dataRef
.
srfparentkey
)
{
Object
.
assign
(
tempContext
,
{
srfparentkey
:
curNode
.
dataRef
.
srfparentkey
});
Object
.
assign
(
tempViewParams
,
{
srfparentkey
:
curNode
.
dataRef
.
srfparentkey
});
}
Object
.
assign
(
params
,
{
viewParams
:
tempViewParams
});
try
{
const
response
=
await
controlService
.
getNodes
(
tempContext
,
params
);
if
(
!
response
||
response
.
status
!==
200
)
{
return
null
;
}
const
items
=
response
.
data
;
// TODO 展开
// this.formatExpanded(items);
// this.formatAppendCaption(items);
const
isRoot
=
Object
.
is
(
node
.
level
,
0
);
if
(
isFirst
)
{
data
.
splice
(
0
,
data
.
length
);
items
.
forEach
((
item
:
any
)
=>
{
data
.
push
(
item
);
});
}
else
{
node
.
dataRef
.
children
=
items
;
}
const
isSelectedAll
=
node
.
checked
;
// TODO 默认选中
// this.setDefaultSelection(items, isRoot, isSelectedAll);
this
.
emit
(
"ctrlEvent"
,{
tag
:
controlName
,
action
:
"load"
,
data
:
items
});
}
catch
(
error
)
{
console
.
error
(
error
);
}
}
// 订阅viewSubject,监听load行为
if
(
viewSubject
)
{
let
subscription
=
viewSubject
.
subscribe
(({
tag
,
action
,
data
}:
IActionParam
)
=>
{
if
(
Object
.
is
(
controlName
,
tag
)
&&
Object
.
is
(
"load"
,
action
))
{
load
(
data
,
true
);
}
})
// 部件卸载时退订viewSubject
onUnmounted
(()
=>
{
subscription
.
unsubscribe
();
})
}
return
{
load
...
...
@@ -44,6 +163,7 @@ export class TreeControl extends MainControl {
return
{
...
superParams
,
state
:
this
.
controlState
,
treeNodeSelect
:
this
.
treeNodeSelect
.
bind
(
this
),
load
};
}
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/modules/widgets/tree-exp-bar-control/tree-exp-bar-control.ts
浏览文件 @
74e5086e
import
{
deepCopy
,
deepObjectMerge
,
ExpBarControl
,
IParam
}
from
"@core"
;
import
{
deepCopy
,
ExpBarControl
,
IActionParam
,
IParam
,
UIUtil
}
from
"@core"
;
import
{
TreeExpBarControlProps
}
from
"./tree-exp-bar-control-prop"
;
import
{
TreeExpBarControlState
}
from
"./tree-exp-bar-control-state"
;
...
...
@@ -16,23 +16,90 @@ export class TreeExpBarControl extends ExpBarControl {
*/
public
declare
controlState
:
TreeExpBarControlState
;
/**
* @description 选中数据
* @private
* @type {IParam}
* @memberof TreeExpBarControl
*/
private
selection
:
IParam
=
{};
protected
onSelectionChange
(
args
:
any
[])
{
if
(
args
.
length
==
0
)
{
this
.
calcToolbarItemState
(
true
);
return
;
}
const
arg
:
any
=
args
[
0
];
if
(
!
arg
.
id
)
{
this
.
calcToolbarItemState
(
true
);
return
;
}
const
nodeType
=
arg
.
id
.
split
(
';'
)[
0
];
// const refView: any = this.get
const
refView
=
this
.
getExpItemView
({
nodeType
:
nodeType
});
// TODO 选择视图面板支持
if
(
refView
)
{
const
{
selection
}
=
this
.
controlState
;
const
{
tempContext
,
tempViewParams
}
=
this
.
computeNavParams
(
arg
);
// 置空
Object
.
assign
(
selection
,
{});
Object
.
assign
(
selection
,
{
viewName
:
refView
.
viewName
,
context
:
tempContext
,
viewParams
:
tempViewParams
});
this
.
calcToolbarItemState
(
false
);
}
else
{
this
.
calcToolbarItemState
(
true
);
}
}
private
computecurNodeContext
(
curNode
:
any
)
{
const
{
context
}
=
this
.
controlState
;
let
tempContext
:
any
=
{};
if
(
curNode
&&
curNode
.
data
&&
curNode
.
data
.
srfappctx
)
{
tempContext
=
deepCopy
(
curNode
.
data
.
srfappctx
);
protected
getExpItemView
(
arg
:
any
=
{}):
IParam
|
null
{
const
expMode
:
string
=
`EXPITEM:
${
arg
.
nodeType
}
`
;
const
{
viewRefs
}
=
this
.
controlState
;
if
(
viewRefs
&&
viewRefs
.
length
>
0
)
{
const
viewRef
=
viewRefs
.
find
((
_viewRef
:
any
)
=>
_viewRef
.
name
==
expMode
);
return
viewRef
?
deepCopy
(
viewRef
)
:
null
;
}
else
{
tempContext
=
deepCopy
(
context
)
;
return
null
;
}
return
tempContext
;
}
protected
computeNavParams
(
arg
:
any
):
{
tempContext
:
any
,
tempViewParams
:
any
}
{
const
tempContext
:
any
=
{};
const
tempViewParams
:
any
=
{};
const
{
counter
,
context
}
=
this
.
controlState
;
if
(
arg
&&
arg
.
navfilter
)
{
Object
.
defineProperty
(
tempViewParams
,
arg
.
navfilter
,
{
value
:
arg
.
srfkey
,
writable
:
true
,
enumerable
:
true
,
configurable
:
true
})
Object
.
assign
(
tempContext
,
{
srfcounter
:
counter
});
}
Object
.
assign
(
tempContext
,
deepCopy
(
context
));
if
(
arg
.
srfappctx
)
{
Object
.
assign
(
tempContext
,
deepCopy
(
arg
.
srfappctx
));
}
if
(
arg
.
srfparentdename
)
{
Object
.
assign
(
tempContext
,
{
srfparentdename
:
arg
.
srfparentdename
});
}
if
(
arg
.
srfparentdemapname
)
{
Object
.
assign
(
tempContext
,
{
srfparentdemapname
:
arg
.
srfparentdemapname
});
}
if
(
arg
.
srfparentkey
)
{
Object
.
assign
(
tempContext
,
{
srfparentkey
:
arg
.
srfparentkey
});
}
// 计算导航上下文
if
(
arg
&&
arg
.
navigateContext
&&
Object
.
keys
(
arg
.
navigateContext
).
length
>
0
)
{
let
tempData
:
any
=
arg
.
curData
?
arg
.
curData
:
{};
Object
.
assign
(
tempData
,
arg
);
let
_context
=
UIUtil
.
computedNavData
(
tempData
,
tempContext
,
tempViewParams
,
arg
.
navigateContext
);
Object
.
assign
(
tempContext
,
_context
);
}
// 计算导航参数
if
(
arg
&&
arg
.
navigateParams
&&
Object
.
keys
(
arg
.
navigateParams
).
length
>
0
)
{
let
tempData
:
any
=
arg
.
curData
?
arg
.
curData
:
{};
Object
.
assign
(
tempData
,
arg
);
let
_params
=
UIUtil
.
computedNavData
(
tempData
,
tempContext
,
tempViewParams
,
arg
.
navigateParams
);
Object
.
assign
(
tempViewParams
,
_params
);
counter
.
value
+=
1
;
Object
.
assign
(
tempContext
,
{
srfcounter
:
counter
.
value
});
}
return
{
tempContext
,
tempViewParams
};
}
/**
...
...
@@ -41,26 +108,17 @@ export class TreeExpBarControl extends ExpBarControl {
* @memberof TreeExpBarControl
*/
public
useLoad
(
props
:
TreeExpBarControlProps
)
{
const
load
=
async
(
node
:
IParam
)
=>
{
console
.
log
(
1111
,
node
);
if
(
node
.
dataRef
.
children
)
{
return
null
;
}
const
{
controlService
,
context
,
viewParams
,
srfnodefilter
}
=
this
.
controlState
;
let
tempViewParams
:
any
=
deepCopy
(
viewParams
);
let
curNode
:
any
=
{};
curNode
=
deepObjectMerge
(
curNode
,
node
);
const
params
:
any
=
{
srfnodeid
:
node
.
data
&&
node
.
data
.
id
?
node
.
data
.
id
:
'#'
,
srfnodefilter
:
srfnodefilter
,
parentData
:
curNode
.
data
?.
curData
}
let
tempContext
:
any
=
this
.
computecurNodeContext
(
curNode
);
}
return
{
load
const
{
viewSubject
,
controlName
,
xDataControlName
}
=
this
.
controlState
;
if
(
viewSubject
)
{
let
subscription
=
viewSubject
.
subscribe
(({
tag
,
action
,
data
}:
IActionParam
)
=>
{
if
(
Object
.
is
(
controlName
,
tag
))
{
viewSubject
.
next
({
tag
:
xDataControlName
,
action
:
action
,
data
:
data
})
}
})
// 部件卸载时退订viewSubject
onUnmounted
(()
=>
{
subscription
.
unsubscribe
();
})
}
}
...
...
@@ -73,11 +131,9 @@ export class TreeExpBarControl extends ExpBarControl {
*/
public
moduleInstall
(
props
:
TreeExpBarControlProps
,
emit
?:
Function
)
{
const
superParams
=
super
.
moduleInstall
(
props
,
emit
);
const
{
load
}
=
this
.
useLoad
(
props
);
this
.
useLoad
(
props
);
return
{
...
superParams
,
selection
:
this
.
selection
,
load
};
}
}
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/runtime/control-vo/index.ts
浏览文件 @
74e5086e
export
*
from
'./control-vo-base'
\ No newline at end of file
export
*
from
'./control-vo-base'
export
*
from
'./tree-control-vo'
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/runtime/control-vo/tree-control-vo/index.ts
0 → 100644
浏览文件 @
74e5086e
export
*
from
'./tree-control-vo'
;
export
*
from
'./tree-node-rs-vo'
;
export
*
from
'./tree-node-vo'
;
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/runtime/control-vo/tree-control-vo/tree-control-vo.ts
0 → 100644
浏览文件 @
74e5086e
import
{
TreeNodeRSVO
}
from
"."
;
import
{
TreeNodeVO
}
from
"./tree-node-vo"
;
export
interface
TreeControlVO
{
/**
* @description 显示根
* @type {boolean}
* @memberof TreeControlVO
*/
rootVisible
:
boolean
;
/**
* @description 树节点
* @type {TreeNodeVO[]}
* @memberof TreeControlVO
*/
treeNodes
:
TreeNodeVO
[];
/**
* @description
* @type {TreeNodeRSVO[]}
* @memberof TreeControlVO
*/
treeNodeRSs
:
TreeNodeRSVO
[];
}
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/runtime/control-vo/tree-control-vo/tree-node-rs-vo.ts
0 → 100644
浏览文件 @
74e5086e
import
{
IParam
}
from
"@core"
;
export
interface
TreeNodeRSVO
{
/**
* @description 下级节点对象
* @type {IParam}
* @memberof TreeNodeRSVO
*/
childDeTreeNode
?:
IParam
;
/**
* @description 父值过滤项
* @type {string}
* @memberof TreeNodeRSVO
*/
parentFilter
?:
string
;
/**
* @description 父值关系
* @type {IParam}
* @memberof TreeNodeRSVO
*/
parentPSDER1N
?:
IParam
;
/**
* @description 父关系连接属性
* @type {IParam}
* @memberof TreeNodeRSVO
*/
parentPSAppDEField
?:
IParam
;
/**
* @description 上级节点对象
* @type {IParam}
* @memberof TreeNodeRSVO
*/
parentPSDETreeNode
?:
IParam
;
/**
* @description 父值级别 {1:上一级、 2:上两级、 3:上三级 }
* @type {(number | 1 | 2 | 3)}
* @memberof TreeNodeRSVO
*/
parentValueLevel
:
number
|
1
|
2
|
3
;
/**
* @description 搜索模式 {1:有搜索时启用、 2:无搜索时启用、 3:全部启用 }
* @type {(number | 1 | 2 | 3)}
* @memberof TreeNodeRSVO
*/
searchMode
:
number
|
1
|
2
|
3
;
}
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/runtime/control-vo/tree-control-vo/tree-node-vo.ts
0 → 100644
浏览文件 @
74e5086e
import
{
IParam
}
from
"@core"
export
interface
TreeNodeVO
{
/**
* @description 允许拖到节点
* @type {boolean}
* @memberof TreeNodeVO
*/
allowDrag
:
boolean
,
/**
* @description 允许拖入节点
* @type {boolean}
* @memberof TreeNodeVO
*/
allowDrop
:
boolean
,
/**
* @description 允许编辑节点文本
* @type {boolean}
* @memberof TreeNodeVO
*/
allowEditText
:
boolean
,
/**
* @description 允许节点排序
* @type {boolean}
* @memberof TreeNodeVO
*/
allowOrder
:
boolean
,
/**
* @description 应用实体标识
* @type {string}
* @memberof TreeNodeVO
*/
appDataEntity
?:
IParam
,
/**
* @description 应用实体结果集对象
* @type {IParam}
* @memberof TreeNodeVO
*/
appDeDataSet
?:
IParam
;
/**
* @description 附加父节点标识
* @type {boolean}
* @memberof TreeNodeVO
*/
appendPNodeId
:
boolean
,
/**
* @description 代码表
* @type {IParam}
* @memberof TreeNodeVO
*/
codeList
?:
IParam
,
/**
* @description 计数器标识
* @type {string}
* @memberof TreeNodeVO
*/
counterId
:
string
,
/**
* @description 计数器模式 {0:默认、 1:0 值时隐藏 }
* @type {number}
* @memberof TreeNodeVO
*/
counterMode
:
number
,
/**
* @description 节点样式表
* @type {string}
* @memberof TreeNodeVO
*/
cssName
?:
string
,
/**
* @description 树节点数据项集合
* @type {*}
* @memberof TreeNodeVO
*/
deTreeNodeDataItems
?:
any
[]
|
null
;
/**
* @description 禁止选择
* @type {boolean}
* @memberof TreeNodeVO
*/
disableSelect
:
boolean
,
/**
* @description 支持选中
* @type {boolean}
* @memberof TreeNodeVO
*/
enableCheck
:
boolean
,
/**
* @description 支持快速搜索
* @type {boolean}
* @memberof TreeNodeVO
*/
enableQuickSearch
:
boolean
,
/**
* @description 仅展开首节点
* @type {boolean}
* @memberof TreeNodeVO
*/
expandFirstOnly
:
boolean
,
/**
* @description 默认展开
* @type {boolean}
* @memberof TreeNodeVO
*/
expanded
:
boolean
,
/**
* @description 是否有子节点
* @type {(boolean | null)}
* @memberof TreeNodeVO
*/
hasPSDETreeNodeRSs
:
boolean
|
null
;
/**
* @description 叶节点标识值应用实体属性
* @type {IParam}
* @memberof TreeNodeVO
*/
leafFlagPSAppDEField
?:
IParam
;
/**
* @description 节点标识值应用实体属性(DE 节点)
* @type {IParam}
* @memberof TreeNodeVO
*/
idPSAppDEField
?:
IParam
;
/**
* @description 节点标识
* @type {string}
* @memberof TreeNodeVO
*/
id
:
string
;
/**
* @description 节点图标值应用实体属性
* @type {IParam}
* @memberof TreeNodeVO
*/
iconPSAppDEField
?:
IParam
;
/**
* @description 图片样式
* @type {string}
* @memberof TreeNodeVO
*/
iconcls
?:
string
,
/**
* @description 图片路径
* @type {string}
* @memberof TreeNodeVO
*/
icon
?:
string
,
/**
* @description 节点过滤属性
* @type {string}
* @memberof TreeNodeVO
*/
navFilter
:
string
,
/**
* @description 导航视图
* @type {IParam}
* @memberof TreeNodeVO
*/
navView
?:
IParam
,
/**
* @description 节点标识
* @type {string}
* @memberof TreeNodeVO
*/
nodeType
:
string
,
/**
* @description 节点值(STATIC 节点)
* @type {rootNode}
* @memberof TreeNodeVO
*/
nodeValue
?:
string
,
/**
* @description 根节点
* @type {boolean}
* @memberof TreeNodeVO
*/
rootNode
:
boolean
,
/**
* @description 仅选择首节点
* @type {boolean}
* @memberof TreeNodeVO
*/
selectFirstOnly
:
boolean
,
/**
* @description 默认选择
* @type {boolean}
* @memberof TreeNodeVO
*/
selected
:
boolean
,
/**
* @description 排序方向
* @type {string}
* @memberof TreeNodeVO
*/
sortDir
?:
string
;
/**
* @description 节点排序值应用实体属性
* @type {IParam}
* @memberof TreeNodeVO
*/
sortPSAppDEField
?:
IParam
;
/**
* @description 节点文本格式化
* @type {string}
* @memberof TreeNodeVO
*/
textFormat
?:
string
;
/**
* @description 节点文本值属性对象
* @type {IParam}
* @memberof TreeNodeVO
*/
textPSAppDEField
?:
IParam
;
/**
* @description 文本
* @type {string}
* @memberof TreeNodeVO
*/
text
?:
string
,
/**
* @description 提示信息
* @type {string}
* @memberof TreeNodeVO
*/
tooltip
?:
string
,
/**
* @description 节点类型
* @type {string}
* @memberof TreeNodeVO
*/
treeNodeType
:
'STATIC'
|
'DE'
|
'CODELIST'
|
string
,
}
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/service/control-service/index.ts
浏览文件 @
74e5086e
export
*
from
'./control-service-base'
export
*
from
'./edit-form-service'
export
*
from
'./grid-service'
\ No newline at end of file
export
*
from
'./grid-service'
export
*
from
'./tree-service'
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/service/control-service/tree-service.ts
0 → 100644
浏览文件 @
74e5086e
import
{
ControlServiceBase
,
ControlVOBase
,
deepCopy
,
IContext
,
IParam
,
isEmpty
,
TreeNodeRSVO
,
TreeNodeVO
}
from
"@core"
;
/**
* @description 树部件服务
* @export
* @class TreeService
* @extends {ControlServiceBase<T>}
* @template T
*/
export
class
TreeService
<
T
extends
ControlVOBase
>
extends
ControlServiceBase
<
T
>
{
/**
* @description 节点分隔符号
* @type {string}
* @memberof TreeService
*/
public
TREENODE_SEPARATOR
:
string
=
';'
;
/**
* @description 获取节点
* @param {IContext} [context={}] 应用上下文
* @param {IParam} [data={}] 参数
* @param {boolean} [isloading]
* @memberof TreeService
*/
async
getNodes
(
context
:
IContext
=
{},
data
:
IParam
=
{},
isloading
?:
boolean
)
{
let
{
srfparentkey
,
srfcat
,
srfnodeid
,
srfnodefilter
,
query
}
=
data
;
srfnodefilter
=
query
?
query
:
srfnodefilter
;
let
list
:
any
[]
=
[];
let
filter
:
any
=
{};
const
treeVO
=
this
.
newControlVO
({});
const
{
treeNodes
,
rootVisible
}
=
treeVO
;
// 根节点
const
rootNode
=
treeNodes
.
find
((
node
:
IParam
)
=>
{
return
node
.
rootNode
;
});
// 处理是否显示根节点
if
(
!
srfnodeid
||
Object
.
is
(
srfnodeid
,
'#'
))
{
if
(
rootVisible
)
{
await
this
.
fillNodeData
(
rootNode
,
context
,
filter
,
list
);
return
Promise
.
resolve
({
status
:
200
,
data
:
list
});
}
else
{
srfnodeid
=
rootNode
?.
nodeType
;
}
}
let
strTreeNodeId
:
string
=
srfnodeid
;
let
strRealNodeId
:
string
=
''
;
let
bRootSelect
:
boolean
=
false
;
let
strNodeType
:
string
;
let
strRootSelectNode
:
string
=
''
;
if
(
Object
.
is
(
strTreeNodeId
,
rootNode
?.
nodeType
))
{
strNodeType
=
rootNode
?.
nodeType
;
if
(
srfparentkey
)
{
strRealNodeId
=
srfparentkey
;
}
}
else
{
let
nPos
=
strTreeNodeId
.
indexOf
(
this
.
TREENODE_SEPARATOR
);
if
(
nPos
===
-
1
)
{
return
Promise
.
reject
({
status
:
500
,
data
:
{
title
:
'失败'
,
message
:
`树节点
${
strTreeNodeId
}
标识无效`
},
});
}
strNodeType
=
strTreeNodeId
.
substring
(
0
,
nPos
);
strRealNodeId
=
strTreeNodeId
.
substring
(
nPos
+
1
);
}
// 处理过滤参数
Object
.
assign
(
filter
,
{
srfparentkey
:
srfparentkey
,
srfcat
:
srfcat
,
srfnodefilter
:
srfnodefilter
,
strRealNodeId
:
strRealNodeId
,
srfnodeid
:
srfnodeid
,
strNodeType
:
strNodeType
,
viewparams
:
deepCopy
(
data
).
viewparams
,
srfparentdata
:
deepCopy
(
data
).
parentData
});
// 分解节点标识
let
nodeid
:
string
[]
=
strRealNodeId
.
split
(
this
.
TREENODE_SEPARATOR
);
for
(
let
i
=
0
;
i
<
nodeid
.
length
;
i
++
)
{
switch
(
i
)
{
case
0
:
Object
.
assign
(
filter
,
{
nodeid
:
nodeid
[
0
]
});
break
;
case
1
:
Object
.
assign
(
filter
,
{
nodeid2
:
nodeid
[
1
]
});
break
;
case
2
:
Object
.
assign
(
filter
,
{
nodeid3
:
nodeid
[
2
]
});
break
;
case
3
:
Object
.
assign
(
filter
,
{
nodeid4
:
nodeid
[
3
]
});
break
;
default
:
break
;
}
}
// 根据节点标识填充节点
const
nodeJson
=
treeNodes
.
find
((
_node
:
TreeNodeVO
)
=>
{
return
_node
.
nodeType
==
strNodeType
;
});
if
(
nodeJson
)
{
await
this
.
fillChildNodes
(
nodeJson
,
context
,
filter
,
list
);
return
Promise
.
resolve
({
status
:
200
,
data
:
list
});
}
else
{
return
Promise
.
resolve
({
status
:
500
,
data
:
{
title
:
'失败'
,
message
:
`树节点
${
strTreeNodeId
}
标识无效`
}
});
}
}
private
async
fillChildNodes
(
nodeJson
:
TreeNodeVO
,
context
:
any
=
{},
filter
:
any
,
list
:
any
[]):
Promise
<
any
>
{
// 过滤出父节点是该节点的节点关系集合
const
treeVO
=
this
.
newControlVO
({});
const
{
treeNodes
,
treeNodeRSs
}
=
treeVO
;
if
(
treeNodeRSs
.
length
>
0
)
{
let
nodeRSs
=
treeNodeRSs
.
filter
((
nodeRS
:
TreeNodeRSVO
)
=>
{
if
(
nodeRS
.
parentPSDETreeNode
?.
id
!==
nodeJson
.
id
)
{
return
false
;
}
// 搜索模式 1 有搜索时启用, 2 无搜索时启用, 3 全部启用
switch
(
nodeRS
.
searchMode
)
{
case
1
:
return
!
isEmpty
(
filter
.
srfnodefilter
);
case
2
:
return
isEmpty
(
filter
.
srfnodefilter
);
case
3
:
return
true
;
default
:
return
false
;
}
});
// 填充对应节点关系的子节点
if
(
nodeRSs
&&
nodeRSs
.
length
>
0
)
{
for
(
let
i
=
0
,
len
=
nodeRSs
.
length
;
i
<
len
;
i
++
)
{
let
rsNavContext
:
any
=
this
.
getNavContext
(
nodeRSs
[
i
]);
let
rsNavParams
:
any
=
this
.
getNavParams
(
nodeRSs
[
i
]);
let
rsParams
:
any
=
this
.
getParams
(
nodeRSs
[
i
]);
// 根据节点标识填充节点
let
treeNode
:
any
=
treeNodes
.
find
((
_node
:
TreeNodeVO
)
=>
{
return
nodeRSs
[
i
].
childDeTreeNode
?.
id
==
_node
.
id
;
});
if
(
treeNode
)
{
await
this
.
fillNodeData
(
treeNode
,
context
,
filter
,
list
,
rsNavContext
,
rsNavParams
,
rsParams
);
}
}
}
}
}
fillNodeData
(
node
:
TreeNodeVO
,
context
:
IContext
=
{},
filter
:
any
,
list
:
IParam
[],
rsNavContext
?:
IParam
,
rsNavParams
?:
IParam
,
rsParams
?:
IParam
):
Promise
<
any
>
{
context
=
this
.
handleResNavContext
(
context
,
filter
,
rsNavContext
);
filter
=
this
.
handleResNavParams
(
context
,
filter
,
rsNavParams
,
rsParams
);
return
new
Promise
((
resolve
:
any
,
reject
:
any
)
=>
{
// 静态节点
if
(
node
.
treeNodeType
==
'STATIC'
)
{
// 快速搜索过滤
if
(
node
.
enableQuickSearch
&&
filter
.
srfnodefilter
&&
!
Object
.
is
(
filter
.
srfnodefilter
,
""
)
&&
node
.
text
?.
toUpperCase
().
indexOf
(
filter
.
srfnodefilter
.
toUpperCase
())
==
-
1
)
{
resolve
(
list
);
return
;
}
const
treeNode
:
any
=
{
text
:
node
.
text
,
tooltip
:
node
.
tooltip
,
cssName
:
node
.
cssName
,
nodeType
:
node
.
treeNodeType
,
isUseLangRes
:
false
,
allowDrag
:
node
.
allowDrag
,
allowDrop
:
node
.
allowDrop
,
allowEditText
:
node
.
allowEditText
,
allowOrder
:
node
.
allowOrder
,
srfappctx
:
context
,
srfmajortext
:
node
.
text
,
enableckeck
:
node
.
enableCheck
,
disabled
:
node
.
disableSelect
,
expanded
:
node
.
expanded
||
filter
.
isAutoExpand
,
leaf
:
!
node
.
hasPSDETreeNodeRSs
,
selected
:
node
.
selected
,
navfilter
:
node
.
navFilter
,
// TODO 导航参数
// navgateContext: node.navgateContext,
// navgateParams: node.navgateParams
};
// 删除无用属性
let
strNodeId
:
string
=
node
.
nodeType
;
if
(
isEmpty
(
node
.
nodeValue
))
{
Object
.
assign
(
treeNode
,
{
srfkey
:
node
.
nodeValue
});
strNodeId
+=
this
.
TREENODE_SEPARATOR
+
node
.
nodeValue
;
if
(
node
.
appendPNodeId
)
{
strNodeId
+=
this
.
TREENODE_SEPARATOR
+
filter
.
strRealNodeId
;
}
}
else
{
// 没有指定节点值,直接使用父节点值
Object
.
assign
(
treeNode
,
{
srfkey
:
filter
.
strRealNodeId
});
strNodeId
+=
this
.
TREENODE_SEPARATOR
+
filter
.
strRealNodeId
;
}
Object
.
assign
(
treeNode
,
{
id
:
strNodeId
});
Object
.
assign
(
treeNode
,
{
nodeid
:
treeNode
.
srfkey
,
nodeid2
:
filter
.
strRealNodeId
});
list
.
push
(
treeNode
);
resolve
(
list
);
}
else
if
(
node
.
treeNodeType
==
'CODELIST'
)
{
// 代码表节点
const
codeListItems
:
any
[]
=
[];
// TODO 待补充代码表服务
}
else
if
(
node
.
treeNodeType
==
'DE'
&&
node
.
appDataEntity
)
{
// 实体节点
let
bFirst
:
boolean
=
true
;
let
searchFilter
:
any
=
{};
const
treeVO
=
this
.
newControlVO
({});
const
{
treeNodeRSs
,
treeNodes
}
=
treeVO
;
if
(
treeNodeRSs
&&
treeNodeRSs
.
length
>
0
)
{
treeNodeRSs
.
forEach
((
noders
:
TreeNodeRSVO
)
=>
{
if
(
noders
.
childDeTreeNode
?.
id
==
node
.
id
)
{
const
pickupField
:
string
=
noders
.
parentFilter
?
noders
.
parentFilter
.
toLowerCase
()
:
noders
.
parentPSDER1N
&&
noders
.
parentPSAppDEField
?
noders
.
parentPSAppDEField
.
name
?.
toLowerCase
()
:
''
;
if
(
pickupField
&&
pickupField
!==
''
)
{
const
tempNode
=
treeNodes
.
find
((
_node
:
TreeNodeVO
)
=>
{
return
noders
.
parentPSDETreeNode
?.
id
==
_node
.
id
;
});
if
(
tempNode
&&
Object
.
is
(
filter
.
strNodeType
,
tempNode
.
nodeType
))
{
Object
.
assign
(
searchFilter
,
{
[
`n_
${
pickupField
}
_eq`
]:
filter
[
`nodeid
${
noders
.
parentValueLevel
>
1
?
noders
.
parentValueLevel
:
""
}
`
]
})
}
}
}
})
}
Object
.
assign
(
searchFilter
,
{
total
:
false
});
if
(
node
.
enableQuickSearch
)
{
Object
.
assign
(
searchFilter
,
{
query
:
filter
.
srfnodefilter
});
}
try
{
this
.
searchNodeData
(
node
,
context
,
searchFilter
,
filter
).
then
((
records
:
any
)
=>
{
console
.
log
(
222
,
"实体级"
,
records
);
if
(
records
&&
records
.
length
)
{
records
.
forEach
((
entity
:
any
)
=>
{
let
treeNode
:
any
=
{};
let
strId
:
string
=
''
;
const
deCodeName
:
string
=
node
.
appDataEntity
?.
codeName
;
if
(
node
.
idPSAppDEField
&&
node
.
idPSAppDEField
.
codeName
)
{
strId
=
entity
[
node
.
idPSAppDEField
.
codeName
.
toLowerCase
()];
}
else
{
strId
=
entity
[
node
.
appDataEntity
?.
keyField
?.
toLowerCase
()];
}
// 设置实体主信息属性
let
strText
:
string
=
''
;
if
(
node
.
textPSAppDEField
?.
codeName
)
{
const
codeName
=
node
.
textPSAppDEField
.
codeName
.
toLowerCase
();
Object
.
assign
(
treeNode
,
{
nodeTextField
:
codeName
});
strText
=
entity
[
codeName
];
}
else
{
strText
=
entity
[
node
.
appDataEntity
?.
majorField
.
toLowerCase
()];
}
Object
.
assign
(
treeNode
,
{
srfparentdename
:
deCodeName
,
srfparentdemapname
:
node
.
appDataEntity
?.
deName
,
srfparentkey
:
strId
});
let
tempContext
=
deepCopy
(
context
);
Object
.
assign
(
tempContext
,
{
srfparentdename
:
deCodeName
,
srfparentdemapname
:
node
.
appDataEntity
?.
deName
,
srfparentkey
:
strId
});
Object
.
assign
(
treeNode
,
{
srfappctx
:
tempContext
,
[
deCodeName
.
toLowerCase
()]:
strId
,
srfkey
:
strId
,
text
:
strText
,
srfmajortext
:
strText
});
let
strNodeId
:
string
=
node
.
nodeType
;
strNodeId
+=
this
.
TREENODE_SEPARATOR
+
strId
;
if
(
node
.
appendPNodeId
)
{
strNodeId
+=
this
.
TREENODE_SEPARATOR
+
filter
.
realnodeid
;
}
Object
.
assign
(
treeNode
,
{
id
:
strNodeId
});
if
(
node
.
iconPSAppDEField
?.
codeName
)
{
Object
.
assign
(
treeNode
,
{
icon
:
entity
[
node
.
iconPSAppDEField
.
codeName
.
toLowerCase
()]
});
}
else
if
(
node
.
iconcls
)
{
Object
.
assign
(
treeNode
,
{
iconcls
:
node
.
iconcls
});
}
else
if
(
node
.
icon
)
{
Object
.
assign
(
treeNode
,
{
icon
:
node
.
icon
});
}
if
(
node
.
enableCheck
)
{
Object
.
assign
(
treeNode
,
{
enablecheck
:
true
});
}
if
(
node
.
disableSelect
)
{
Object
.
assign
(
treeNode
,
{
disabled
:
true
});
}
if
(
node
.
allowDrag
)
{
Object
.
assign
(
treeNode
,
{
allowDrag
:
true
});
}
if
(
node
.
allowDrop
)
{
Object
.
assign
(
treeNode
,
{
allowDrop
:
true
});
}
if
(
node
.
allowEditText
)
{
Object
.
assign
(
treeNode
,
{
allowEditText
:
true
});
}
if
(
node
.
allowOrder
)
{
Object
.
assign
(
treeNode
,
{
allowOrder
:
true
});
}
if
(
node
.
cssName
)
{
Object
.
assign
(
treeNode
,
{
cssName
:
node
.
cssName
});
}
if
(
node
.
expanded
)
{
Object
.
assign
(
treeNode
,
{
expanded
:
node
.
expandFirstOnly
?
bFirst
:
true
});
}
else
{
Object
.
assign
(
treeNode
,
{
expanded
:
filter
.
isAutoExpand
});
}
if
(
node
.
textFormat
)
{
Object
.
assign
(
treeNode
,
{
textFormat
:
node
.
textFormat
});
}
Object
.
assign
(
treeNode
,
{
leaf
:
!
node
.
hasPSDETreeNodeRSs
});
if
(
node
.
leafFlagPSAppDEField
?.
codeName
)
{
const
leafFlag
=
entity
[
node
.
leafFlagPSAppDEField
.
codeName
.
toLowerCase
()];
if
(
leafFlag
!=
null
&&
leafFlag
!=
undefined
)
{
let
strLeafFlag
:
string
=
leafFlag
.
toString
().
toLowerCase
();
if
(
Object
.
is
(
strLeafFlag
,
'1'
)
||
Object
.
is
(
strLeafFlag
,
'true'
))
{
Object
.
assign
(
treeNode
,
{
leaf
:
true
});
}
else
{
Object
.
assign
(
treeNode
,
{
leaf
:
false
});
}
}
}
const
nodeDataItems
:
any
[]
=
node
.
deTreeNodeDataItems
||
[];
if
(
nodeDataItems
.
length
>
0
)
{
nodeDataItems
.
forEach
((
item
:
any
)
=>
{
// TODO 节点数据项
})
}
Object
.
assign
(
treeNode
,
{
selected
:
node
.
selected
});
if
(
node
.
navFilter
)
{
Object
.
assign
(
treeNode
,
{
navfilter
:
node
.
navFilter
});
}
Object
.
assign
(
treeNode
,
{
curData
:
entity
});
// TODO 导航上下文 导航参数
if
(
node
.
counterId
)
{
Object
.
assign
(
treeNode
,
{
counterId
:
node
.
counterId
});
}
// 为1时计数器不显示0值
if
(
node
.
counterMode
)
{
Object
.
assign
(
treeNode
,
{
counterMode
:
node
.
counterMode
});
}
Object
.
assign
(
treeNode
,
{
nodeid
:
treeNode
.
srfkey
});
Object
.
assign
(
treeNode
,
{
nodeid2
:
filter
.
strRealNodeId
});
Object
.
assign
(
treeNode
,
{
nodeType
:
node
.
nodeType
,
appEntityName
:
deCodeName
});
list
.
push
(
treeNode
);
resolve
(
list
);
bFirst
=
false
;
});
}
else
{
resolve
(
list
);
}
});
}
catch
(
error
:
any
)
{
console
.
error
(
error
);
}
}
else
{
resolve
(
list
);
}
});
}
/**
* @description 获取查询集合
* @private
* @param {TreeNodeVO} node 树节点VO对象
* @param {IContext} [context={}] 上下文
* @param {*} searchFilter 搜索过滤参数
* @param {*} filter 过滤参数
* @return {*} {Promise<any>}
* @memberof TreeService
*/
private
async
searchNodeData
(
node
:
TreeNodeVO
,
context
:
IContext
=
{},
searchFilter
:
any
,
filter
:
any
):
Promise
<
any
>
{
if
(
filter
.
viewParams
)
{
Object
.
assign
(
searchFilter
,
filter
.
viewParams
);
}
if
(
!
searchFilter
.
page
)
{
Object
.
assign
(
searchFilter
,
{
page
:
0
});
}
if
(
!
searchFilter
.
size
)
{
Object
.
assign
(
searchFilter
,
{
size
:
1000
});
}
if
(
context
&&
context
.
srfparentdename
)
{
Object
.
assign
(
searchFilter
,
{
srfparentdename
:
deepCopy
(
context
).
srfparentdename
});
}
if
(
context
&&
context
.
srfparentkey
)
{
Object
.
assign
(
searchFilter
,
{
srfparentkey
:
deepCopy
(
context
).
srfparentkey
});
// TODO 识别环境参数 enableIssue
// const Environment = AppServiceBase.getInstance().getAppEnvironment();
// if (Environment.enableIssue) {
// Object.assign(searchFilter, { nodeid: Util.deepCopy(context).srfparentkey });
// }
}
if
(
node
.
sortPSAppDEField
?.
codeName
)
{
Object
.
assign
(
searchFilter
,
{
sort
:
`
${
node
.
sortPSAppDEField
.
codeName
.
toLowerCase
()}
,
${
node
.
sortDir
?
node
.
sortDir
:
'asc'
}
`
});
}
let
list
:
any
=
[];
if
(
node
.
appDataEntity
)
{
const
dataSet
=
node
.
appDeDataSet
?.
codeName
;
const
appEntityService
=
await
App
.
getDataService
(
node
.
appDataEntity
.
codeName
.
toLowerCase
(),
context
);
if
(
appEntityService
&&
appEntityService
[
dataSet
]
instanceof
Function
)
{
try
{
const
response
:
any
=
await
appEntityService
[
dataSet
](
context
,
searchFilter
,
false
);
if
(
!
response
.
status
||
response
.
status
!==
200
)
{
console
.
error
(
`查询
${
dataSet
}
数据集异常!`
);
return
[];
}
const
data
:
any
=
response
.
data
;
if
(
Object
.
keys
(
data
).
length
>
0
)
{
list
=
deepCopy
(
data
);
return
list
;
}
else
{
return
[];
}
}
catch
(
error
)
{
console
.
error
(
`查询
${
dataSet
}
数据集异常!`
);
return
[];
}
}
}
else
{
return
[];
}
}
public
handleResNavContext
(
context
:
any
,
filter
:
any
,
resNavContext
:
any
)
{
if
(
resNavContext
&&
Object
.
keys
(
resNavContext
).
length
>
0
)
{
let
tempContextData
:
any
=
deepCopy
(
context
);
let
tempViewParams
:
any
=
{};
if
(
filter
&&
filter
.
viewparams
)
{
tempViewParams
=
filter
.
viewparams
;
}
Object
.
keys
(
resNavContext
).
forEach
((
item
:
any
)
=>
{
let
curDataObj
:
any
=
resNavContext
[
item
];
this
.
handleCustomDataLogic
(
context
,
tempViewParams
,
curDataObj
,
tempContextData
,
item
,
filter
?.
srfparentdata
);
});
return
tempContextData
;
}
else
{
return
context
;
}
}
/**
* @description 处理关系导航参数
* @param context 应用上下文
* @param filter 参数
* @param resNavParams 节点关系导航参数
* @param resParams 节点关系参数
* @memberof TreeService
*/
public
handleResNavParams
(
context
:
any
,
filter
:
any
,
resNavParams
:
any
,
resParams
:
any
)
{
if
((
resNavParams
&&
Object
.
keys
(
resNavParams
).
length
>
0
)
||
(
resParams
&&
Object
.
keys
(
resParams
).
length
>
0
))
{
let
tempViewParamData
:
any
=
{};
let
tempViewParams
:
any
=
{};
if
(
filter
&&
filter
.
viewparams
)
{
tempViewParams
=
filter
.
viewparams
;
tempViewParamData
=
deepCopy
(
filter
.
viewparams
);
}
if
(
Object
.
keys
(
resNavParams
).
length
>
0
)
{
Object
.
keys
(
resNavParams
).
forEach
((
item
:
any
)
=>
{
let
curDataObj
:
any
=
resNavParams
[
item
];
this
.
handleCustomDataLogic
(
context
,
tempViewParams
,
curDataObj
,
tempViewParamData
,
item
,
filter
?.
srfparentdata
);
});
}
if
(
Object
.
keys
(
resParams
).
length
>
0
)
{
Object
.
keys
(
resParams
).
forEach
((
item
:
any
)
=>
{
let
curDataObj
:
any
=
resParams
[
item
];
tempViewParamData
[
item
.
toLowerCase
()]
=
curDataObj
.
value
;
});
}
Object
.
assign
(
filter
,
{
viewparams
:
tempViewParamData
});
return
filter
;
}
else
{
return
filter
;
}
}
/**
* @description 处理自定义节点关系导航数据
* @param context 应用上下文
* @param viewparams 参数
* @param curNavData 节点关系导航参数对象
* @param tempData 返回数据
* @param item 节点关系导航参数键值
* @param parentData 父值
* @memberof TreeService
*/
public
handleCustomDataLogic
(
context
:
any
,
viewparams
:
any
,
curNavData
:
any
,
tempData
:
any
,
item
:
string
,
parentData
?:
any
)
{
// 直接值直接赋值
if
(
curNavData
.
isRawValue
)
{
if
(
isEmpty
(
curNavData
.
value
))
{
Object
.
defineProperty
(
tempData
,
item
.
toLowerCase
(),
{
value
:
null
,
writable
:
true
,
enumerable
:
true
,
configurable
:
true
,
});
}
else
{
Object
.
defineProperty
(
tempData
,
item
.
toLowerCase
(),
{
value
:
curNavData
.
value
,
writable
:
true
,
enumerable
:
true
,
configurable
:
true
,
});
}
}
else
{
// 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null
if
(
parentData
&&
parentData
[
curNavData
.
value
.
toLowerCase
()]
!=
null
)
{
Object
.
defineProperty
(
tempData
,
item
.
toLowerCase
(),
{
value
:
parentData
[
curNavData
.
value
.
toLowerCase
()],
writable
:
true
,
enumerable
:
true
,
configurable
:
true
,
});
}
else
if
(
context
[
curNavData
.
value
.
toLowerCase
()]
!=
null
)
{
Object
.
defineProperty
(
tempData
,
item
.
toLowerCase
(),
{
value
:
context
[
curNavData
.
value
.
toLowerCase
()],
writable
:
true
,
enumerable
:
true
,
configurable
:
true
,
});
}
else
{
if
(
viewparams
[
curNavData
.
value
.
toLowerCase
()]
!=
null
)
{
Object
.
defineProperty
(
tempData
,
item
.
toLowerCase
(),
{
value
:
viewparams
[
curNavData
.
value
.
toLowerCase
()],
writable
:
true
,
enumerable
:
true
,
configurable
:
true
,
});
}
else
{
Object
.
defineProperty
(
tempData
,
item
.
toLowerCase
(),
{
value
:
null
,
writable
:
true
,
enumerable
:
true
,
configurable
:
true
,
});
}
}
}
}
/**
* 获取树节点关系导航上下文
*
* @param noders 节点
* @memberof AppTreeService
*/
public
getNavContext
(
noders
:
TreeNodeRSVO
)
{
let
context
:
any
=
{};
// let navcontext: any = noders.getPSNavigateContexts();
// if (navcontext?.length > 0) {
// navcontext.forEach((item: IPSNavigateContext) => {
// context[item?.key] = {
// isRawValue: item?.rawValue,
// value: item.value
// }
// })
// }
return
context
;
}
/**
* 获取树节点关系导航参数
*
* @param noders 节点
* @memberof AppTreeService
*/
public
getNavParams
(
noders
:
TreeNodeRSVO
)
{
let
params
:
any
=
{};
// let navparams: any = noders.getPSNavigateParams();
// if (navparams?.length > 0) {
// navparams.forEach((item: IPSNavigateParam) => {
// params[item?.key] = {
// isRawValue: item?.rawValue,
// value: item.value
// }
// })
// }
return
params
;
}
/**
* 获取树节点关系参数
*
* @param noders 节点
* @memberof AppTreeService
*/
public
getParams
(
noders
:
TreeNodeRSVO
)
{
let
params
:
any
=
{};
// let reparams: any = noders?.getPSDETreeNodeRSParams();
// if (reparams?.length > 0) {
// reparams.forEach((item: IPSDETreeNodeRSParam) => {
// params[item?.key] = {
// value: item.value
// };
// })
// }
return
params
;
}
}
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/utils/util.ts
浏览文件 @
74e5086e
...
...
@@ -67,6 +67,16 @@ export function isExist(arg: any): boolean{
return
arg
!==
undefined
&&
arg
!==
null
&&
arg
===
arg
;
}
/**
* @description 是否为空
* @export
* @param {*} value
* @return {*} {boolean}
*/
export
function
isEmpty
(
value
:
any
):
boolean
{
return
typeof
value
===
'undefined'
||
value
===
''
||
value
===
null
||
value
!==
value
;
}
/**
* @description 除undefined,null,NaN,空字符串以外都为true
* @export
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/views/{{appModules}}/{{pages@DETREEEXPVIEW}}/{{pages@DETREEEXPVIEW}}-config.ts.hbs
浏览文件 @
74e5086e
export const ViewConfig = {
{{#
each
page
.
ctrls
as
|
ctrl
|
}}
{{#if
(
eq
ctrl
.
controlType
"TREEEXPBAR"
)
}}
treeExpBarName: '
{{
ctrl
.
name
}}
',
{{/if}}
{{/
each
}}
{{>
@macro
/
front-end
/
views
/
config
/
view-base-config
.
hbs
}}
};
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/views/{{appModules}}/{{pages@DETREEEXPVIEW}}/{{pages@DETREEEXPVIEW}}.vue.hbs
浏览文件 @
74e5086e
...
...
@@ -25,7 +25,7 @@ interface ViewEmit {
const
emit
=
defineEmits
<
ViewEmit
>
();
// 安装功能模块
const
{
state
}
=
new
TreeExpView
(
ViewConfig
).
moduleInstall
(
props
,
emit
);
const
{
state
,
handleCtrlEvent
,
handleToolbarEvent
}
=
new
TreeExpView
(
ViewConfig
).
moduleInstall
(
props
,
emit
);
</script>
<template>
...
...
@@ -48,7 +48,6 @@ const { state } = new TreeExpView(ViewConfig).moduleInstall(props, emit);
:context=
"state.context"
:showBusyIndicator=
"true"
:viewParams=
"state.viewParams"
:controlAction=
"state.controlsAction.
{{
name
}}
"
:viewSubject=
"state.viewSubject"
@
ctrlEvent=
"handleCtrlEvent"
></
{{
codeName
}}
TreeExpBar>
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/widgets/{{appEntities}}/{{ctrls@TREEEXPBAR}}-tree-exp-bar/{{ctrls@TREEEXPBAR}}-tree-exp-bar-config.ts.hbs
浏览文件 @
74e5086e
export const CtrlConfig = {
controlCodeName: '
{{
ctrl
.
codeName
}}
',
controlName: '
{{
ctrl
.
name
}}
',
counter: 0,
xDataControlName: '
{{
ctrl
.
xDataControlName
}}
',
selection: {},
viewRefs: [
{{#
each
ctrl
.
psAppViewRefs
as
|
viewRef
|
}}
{
name: '
{{
viewRef
.
name
}}
',
{{#if
viewRef
.
refPSAppView
}}
viewName: '
{{
viewRef
.
refPSAppView
.
name
}}
',
{{#if
viewRef
.
refPSAppView
.
psAppDataEntity
}}
deKeyField: '
{{
viewRef
.
refPSAppView
.
psAppDataEntity
.
codeName
}}
',
{{/if}}
{{/if}}
},
{{/
each
}}
]
};
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/widgets/{{appEntities}}/{{ctrls@TREEEXPBAR}}-tree-exp-bar/{{ctrls@TREEEXPBAR}}-tree-exp-bar.vue.hbs
浏览文件 @
74e5086e
...
...
@@ -7,6 +7,11 @@ import { CtrlConfig } from './{{spinalCase ctrl.codeName}}-tree-exp-bar-config';
import
{
{{
codeName
}}
Tree
}
from
'@widgets/
{{
spinalCase
appEntity
.
codeName
}}
/
{{
spinalCase
codeName
}}
-tree'
;
{{/
eq
}}
{{/
ctrl
.
ctrls
}}
{{#
each
ctrl
.
psAppViewRefs
as
|
viewRef
|
}}
{{#if
viewRef
.
refPSAppView
}}
import
{{
viewRef
.
refPSAppView
.
name
}}
from
'@views/
{{
spinalCase
viewRef
.
refPSAppView
.
psAppModule
.
codeName
}}
/
{{
spinalCase
viewRef
.
refPSAppView
.
codeName
}}
'
;
{{/if}}
{{/
each
}}
interface
Props
{
context
:
IContext
;
...
...
@@ -30,7 +35,7 @@ interface CtrlEmit {
const
emit
=
defineEmits
<
CtrlEmit
>
();
// 安装功能模块,提供状态和能力方法
const
{
state
,
selection
}
=
new
TreeExpBarControl
(
CtrlConfig
).
moduleInstall
(
props
,
emit
);
const
{
state
,
handleCtrlEvent
}
=
new
TreeExpBarControl
(
CtrlConfig
).
moduleInstall
(
props
,
emit
);
</script>
<template>
...
...
@@ -40,19 +45,27 @@ const { state, selection } = new TreeExpBarControl(CtrlConfig).moduleInstall(pro
<a-layout-sider>
{{#
ctrl
.
ctrls
}}
{{#
eq
controlType
"TREEVIEW"
}}
<
{{
codeName
}}
Tree>
</
{{
codeName
}}
Tree>
<
{{
codeName
}}
Tree
:context=
"state.context"
:viewParams=
"state.viewParams"
:viewSubject=
"state.viewSubject"
:isBranchAvailable=
"true"
@
ctrlEvent=
"handleCtrlEvent"
></
{{
codeName
}}
Tree>
{{/
eq
}}
{{/
ctrl
.
ctrls
}}
</a-layout-sider>
<a-layout>
<component
v-if=
"selection.view && !Object.is(this.selection.view.viewname, '')"
:is=
"selection.view.viewname"
{{#
each
ctrl
.
psAppViewRefs
as
|
viewRef
|
}}
{{#if
viewRef
.
refPSAppView
}}
<
{{
viewRef
.
refPSAppView
.
name
}}
v-if
="
state
.
selection
.
viewName
&&
state
.
selection
.
viewName =
==
'
{{
viewRef
.
refPSAppView
.
name
}}
'"
:viewDefaultUsage=
"false"
:viewdata=
"JSON.stringify(selection.context)"
:viewParam=
"JSON.stringify(selection.viewParam)"
>
</component>
:viewdata=
"JSON.stringify(state.selection.context)"
:viewParams=
"JSON.stringify(state.selection.viewParams)"
>
</
{{
viewRef
.
refPSAppView
.
name
}}
>
{{/if}}
{{/
each
}}
</a-layout>
</a-layout>
</template>
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/widgets/{{appEntities}}/{{ctrls@TREEVIEW}}-tree/{{ctrls@TREEVIEW}}-tree-config.ts.hbs
浏览文件 @
74e5086e
import { ControlVOBase, TreeControlVO, TreeNodeVO, TreeService } from "@core";
import {
{{
pascalCase
ctrl
.
psAppDataEntity
.
codeName
}}
Service } from '@api/
{{
spinalCase
ctrl
.
psAppDataEntity
.
codeName
}}
/
{{
spinalCase
ctrl
.
psAppDataEntity
.
codeName
}}
-service';
export class ControlVO extends ControlVOBase implements TreeControlVO {
get rootVisible(): boolean {
return
{{
ctrl
.
rootVisible
}}
;
}
get treeNodes(): TreeNodeVO[] {
return [
{{#
each
ctrl
.
psDETreeNodes
as
|
treeNode
|
}}
{
allowDrag:
{{
treeNode
.
allowDrag
}}
,
allowDrop:
{{
treeNode
.
allowDrop
}}
,
allowEditText:
{{
treeNode
.
allowEditText
}}
,
allowOrder:
{{
treeNode
.
allowOrder
}}
,
{{#if
treeNode
.
psAppDataEntity
}}
appDataEntity: {
codeName: '
{{
treeNode
.
psAppDataEntity
.
codeName
}}
',
{{#
each
treeNode
.
psAppDataEntity
.
allPSAppDEFields
as
|
field
|
}}
{{#if
field
.
keyField
}}
keyField: '
{{
field
.
codeName
}}
',
{{/if}}
{{#if
field
.
majorField
}}
majorField: '
{{
field
.
majorField
}}
',
{{/if}}
{{/
each
}}
},
{{/if}}
{{#if
treeNode
.
psAppDEDataSet
}}
appDeDataSet: { codeName: '
{{
treeNode
.
psAppDEDataSet
.
codeName
}}
' },
{{/if}}
appendPNodeId:
{{
treeNode
.
appendPNodeId
}}
,
{{#if
treeNode
.
psCodeList
}}
codeList: {
codeName: '
{{
treeNode
.
psCodeList
.
codeName
}}
',
type: '
{{
treeNode
.
psCodeList
.
codeListType
}}
'
},
{{/if}}
counterId: '
{{
treeNode
.
counterId
}}
',
counterMode:
{{
treeNode
.
counterMode
}}
,
{{#if
treeNode
.
psSysCss
}}
cssName: '
{{
treeNode
.
psSysCss
.
cssName
}}
'
{{/if}}
{{#if
treeNode
.
psDETreeNodeDataItems
}}
deTreeNodeDataItems: [
customCode:
{{
dataItem
.
customCode
}}
,
{{#
each
treeNode
.
psDETreeNodeDataItems
as
|
dataItem
|
}}
{{#if
dataItem
.
psAppDEField
}}
fieldCodeName: '
{{
dataItem
.
psAppDEField
.
codeName
}}
',
{{/if}}
name: '
{{
dataItem
.
name
}}
',
scriptCode: `
{{
dataItem
.
scriptCode
}}
`
{{/
each
}}
],
{{/if}}
disableSelect:
{{
treeNode
.
disableSelect
}}
,
enableCheck:
{{
treeNode
.
enableCheck
}}
,
enableQuickSearch:
{{
treeNode
.
enableQuickSearch
}}
,
expandFirstOnly:
{{
treeNode
.
expandFirstOnly
}}
,
expanded:
{{
treeNode
.
expanded
}}
,
hasPSDETreeNodeRSs:
{{
treeNode
.
hasPSDETreeNodeRSs
}}
,
{{#if
treeNode
.
leafFlagPSAppDEField
}}
leafFlagPSAppDEField: { codeName: '
{{
treeNode
.
leafFlagPSAppDEField
.
codeName
}}
' },
{{/if}}
{{#if
treeNode
.
idPSAppDEField
}}
idPSAppDEField: { codeName: '
{{
treeNode
.
idPSAppDEField
.
codeName
}}
' },
{{/if}}
{{#if
treeNode
.
iconPSAppDEField
}}
iconPSAppDEField: { codeName: '
{{
treeNode
.
iconPSAppDEField
.
codeName
}}
' },
{{/if}}
{{#if
treeNode
.
psSysImage
}}
{{#if
treeNode
.
psSysImage
.
cssClass
}}
iconcls: '
{{
treeNode
.
psSysImage
.
cssClass
}}
',
{{else
if
(
treeNode
.
psSysImage
.
imagePath
)
}}
icon: '
{{
treeNode
.
psSysImage
.
imagePath
}}
',
{{/if}}
{{/if}}
id: '
{{
treeNode
.
id
}}
',
navFilter: '
{{
treeNode
.
navFilter
}}
',
{{#if
treeNode
.
navPSAppView
}}
navView: {
viewName: '
{{
treeNode
.
navPSAppView
.
codeName
}}
'
},
{{/if}}
nodeType: '
{{
treeNode
.
nodeType
}}
',
rootNode:
{{
treeNode
.
rootNode
}}
,
selectFirstOnly:
{{
treeNode
.
selectFirstOnly
}}
,
selected:
{{
treeNode
.
selected
}}
,
{{#if
treeNode
.
sortDir
}}
sortDir: '
{{
treeNode
.
sortDir
}}
',
{{/if}}
{{#if
treeNode
.
sortPSAppDEField
}}
sortPSAppDEField: { codeName: '
{{
treeNode
.
sortPSAppDEField
.
codeName
}}
' },
{{/if}}
{{#if
treeNode
.
textFormat
}}
textFormat: '
{{
treeNode
.
textFormat
}}
',
{{/if}}
{{#if
treeNode
.
textPSAppDEField
}}
textPSAppDEField: { codeName: '
{{
treeNode
.
textPSAppDEField
.
codeName
}}
' },
{{/if}}
{{#if
treeNode
.
text
}}
text: '
{{
treeNode
.
text
}}
',
{{/if}}
{{#if
treeNode
.
tooltip
}}
tooltip: '
{{
treeNode
.
tooltip
}}
',
{{/if}}
treeNodeType: '
{{
treeNode
.
treeNodeType
}}
',
},
{{/
each
}}
];
}
get treeNodeRSs() {
return [
{{#
each
ctrl
.
psDETreeNodeRSs
as
|
treeNodeRS
|
}}
{
{{#if
treeNodeRS
.
childPSDETreeNode
}}
childDeTreeNode: {
id: '
{{
treeNodeRS
.
childPSDETreeNode
.
id
}}
'
},
{{/if}}
{{#if
treeNodeRS
.
parentFilter
}}
parentFilter: '
{{
treeNodeRS
.
parentFilter
}}
',
{{/if}}
{{#if
treeNodeRS
.
parentPSDER1N
}}
parentPSDER1N: { codeName: '
{{
treeNodeRS
.
parentPSDER1N
.
codeName
}}
' },
{{/if}}
{{#if
treeNodeRS
.
parentPSAppDEField
}}
parentPSAppDEField: { codeName: '
{{
treeNodeRS
.
parentPSAppDEField
.
codeName
}}
' },
{{/if}}
{{#if
treeNodeRS
.
parentPSDETreeNode
}}
parentPSDETreeNode: { id: '
{{
treeNodeRS
.
parentPSDETreeNode
.
id
}}
' },
{{/if}}
parentValueLevel:
{{#if
treeNodeRS
.
parentValueLevel
}}{{
treeNodeRS
.
parentValueLevel
}}{{else}}
null
{{/if}}
,
searchMode:
{{
treeNodeRS
.
searchMode
}}
},
{{/
each
}}
];
}
}
export const CtrlConfig = {
controlCodeName: '
{{
ctrl
.
codeName
}}
',
controlName: '
{{
ctrl
.
name
}}
',
controlService: new TreeService
<ControlVO>
(ControlVO, new
{{
pascalCase
ctrl
.
psAppDataEntity
.
codeName
}}
Service() ),
currentselectedNode: {},
data: [],
selectedNodes: []
};
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/widgets/{{appEntities}}/{{ctrls@TREEVIEW}}-tree/{{ctrls@TREEVIEW}}-tree.vue.hbs
浏览文件 @
74e5086e
...
...
@@ -8,6 +8,7 @@ interface Props {
multiple
:
boolean
;
selectedData
:
IParam
[];
selectFirstDefault
:
boolean
;
isBranchAvailable
:
boolean
;
viewParams
?:
IParam
;
controlAction
:
ControlAction
;
showBusyIndicator
?:
boolean
;
...
...
@@ -18,6 +19,7 @@ const props = withDefaults(defineProps<Props>(), {
viewSubject
:
()
=>
new
Subject
<
IActionParam
>
(),
showBusyIndicator
:
true
,
selectFirstDefault
:
false
,
isBranchAvailable
:
false
})
// emit声明
...
...
@@ -26,11 +28,21 @@ interface CtrlEmit {
}
const
emit
=
defineEmits
<
CtrlEmit
>
();
// 安装功能模块,提供状态和能力方法
const
{
state
,
load
}
=
new
TreeControl
(
CtrlConfig
).
moduleInstall
(
props
,
emit
);
const
{
state
,
load
,
treeNodeSelect
}
=
new
TreeControl
(
CtrlConfig
).
moduleInstall
(
props
,
emit
);
</script>
// TODO 树节点待支持图标和自定义绘制
<template>
<a-tree
class=
"ibiz-tree
{{#if
ctrl
.
psSysCss
}}
{{
ctrl
.
psSysCss
.
cssName
}}{{/if}}
"
:tree-data=
"state.data"
>
</a-tree>
:tree-data=
"state.data"
:load-data=
"load"
:fieldNames=
"{ title: 'text', key: 'id' }"
@
select=
"treeNodeSelect"
>
<template
#
title=
"{ text, id }"
>
<div
class=
"ibiz-tree-node"
>
<span
class=
"tree-node__title"
>
\{{ text }}
</span>
</div>
</template>
</a-tree>
</template>
\ No newline at end of file
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录