Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibizlab-generator
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibizlab-generator
提交
fceaed54
提交
fceaed54
编写于
2月 28, 2022
作者:
Mosher
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update:更新
1、新增代码表类型树节点支持 2、新增树节点自定义图标、自定义标题支持 3、增加部件计数器支持 4、删除多余输出语句
上级
f774df1d
变更
9
展开全部
显示空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
359 行增加
和
102 行删除
+359
-102
app-toolbar.vue
...mpl/r7/app_{{apps}}/src/components/common/app-toolbar.vue
+0
-1
i-app.ts
...ces/templ/r7/app_{{apps}}/src/core/interface/app/i-app.ts
+12
-1
control-base.ts
...s}}/src/core/modules/widgets/control-base/control-base.ts
+24
-1
tree-control.ts
...s}}/src/core/modules/widgets/tree-control/tree-control.ts
+29
-4
tree-service.ts
...{{apps}}/src/core/service/control-service/tree-service.ts
+171
-87
app-tree.scss
...ces/templ/r7/app_{{apps}}/src/style/widgets/app-tree.scss
+12
-0
index.scss
...ources/templ/r7/app_{{apps}}/src/style/widgets/index.scss
+2
-1
{{ctrls@TREEVIEW}}-tree-state.ts.hbs
...trls@TREEVIEW}}-tree/{{ctrls@TREEVIEW}}-tree-state.ts.hbs
+21
-1
{{ctrls@TREEVIEW}}-tree.vue.hbs
...}/{{ctrls@TREEVIEW}}-tree/{{ctrls@TREEVIEW}}-tree.vue.hbs
+88
-6
未找到文件。
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/components/common/app-toolbar.vue
浏览文件 @
fceaed54
...
...
@@ -39,7 +39,6 @@ const itemClick = (item: IParam) => {
};
const
hasCounter
=
(
item
:
any
)
=>
{
console
.
log
(
item
.
counterId
,
props
.
counterData
);
if
(
item
.
counterId
&&
props
.
counterData
&&
props
.
counterData
.
hasOwnProperty
(
item
.
counterId
))
{
return
true
;
}
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/interface/app/i-app.ts
浏览文件 @
fceaed54
import
{
IParam
,
ViewDetail
}
from
"../common"
;
import
{
IAppActionService
,
IAppAuthService
,
IAppCodeListService
,
IAppFuncService
,
IAppNotificationService
,
IOpenViewService
}
from
"../service"
;
import
{
IAppActionService
,
IAppAuthService
,
IAppCodeListService
,
IApp
CounterService
,
IApp
FuncService
,
IAppNotificationService
,
IOpenViewService
}
from
"../service"
;
/**
...
...
@@ -67,6 +67,17 @@ export interface IApp {
*/
getCodeListService
():
IAppCodeListService
;
/**
* 获取计数器服务
*
* @param {IParam} counterRef 计数器引用
* @param {IParam} [context] 上下文
* @param {IParam} [viewParams] 视图参数
* @return {*} {IAppCounterService}
* @memberof IApp
*/
getCounterService
(
counterRef
:
IParam
,
context
?:
IParam
,
viewParams
?:
IParam
):
IAppCounterService
;
/**
* 获取UI服务
*
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/modules/widgets/control-base/control-base.ts
浏览文件 @
fceaed54
import
{
ControlPropsBase
,
ControlStateBase
,
IActionParam
,
IParam
,
UIBase
}
from
'@core'
;
import
{
ControlPropsBase
,
ControlStateBase
,
IActionParam
,
I
AppCounterService
,
I
Param
,
UIBase
}
from
'@core'
;
/**
* @description 部件基类
...
...
@@ -67,6 +67,26 @@ export class ControlBase {
this
.
state
.
viewParams
=
viewParams
;
}
/**
* @description 使用计数器服务模块
* @memberof ControlBase
*/
public
useCounterService
()
{
const
{
appCounterRef
,
context
,
viewParams
}
=
this
.
state
;
const
{
counterService
}
=
toRefs
(
this
.
state
);
if
(
appCounterRef
)
{
const
_counterService
=
App
.
getCounterService
(
appCounterRef
,
context
,
viewParams
);
_counterService
.
execute
().
then
(()
=>
{
counterService
.
value
=
_counterService
;
});
}
onUnmounted
(()
=>
{
if
(
counterService
&&
counterService
.
value
)
{
counterService
.
value
.
destory
();
}
});
}
/**
* 获取当前激活数据
*
...
...
@@ -101,7 +121,10 @@ export class ControlBase {
*/
public
moduleInstall
()
{
this
.
setState
();
// 处理导航参数
this
.
useControlContextParams
();
// 使用计数器服务
this
.
useCounterService
();
return
{
state
:
this
.
state
,
name
:
this
.
state
.
controlName
,
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/modules/widgets/tree-control/tree-control.ts
浏览文件 @
fceaed54
...
...
@@ -256,6 +256,23 @@ export class TreeControl extends MDControl {
}
}
}
// 默认选中
const
defualtSelect
=
items
.
find
((
item
:
any
)
=>
item
.
selected
);
if
(
defualtSelect
)
{
if
(
isMultiple
&&
selectedNodes
.
findIndex
((
node
:
any
)
=>
node
.
id
===
defualtSelect
.
id
)
===
-
1
)
{
selectedNodes
.
push
(
deepCopy
(
defualtSelect
));
// 设置选中样式
selectedKeys
.
push
(
defualtSelect
.
id
);
}
else
if
(
!
isMultiple
)
{
selectedNodes
.
splice
(
0
,
selectedNodes
.
length
);
currentSelectedNode
.
value
=
deepCopy
(
defualtSelect
);
selectedNodes
.
push
(
currentSelectedNode
.
value
);
// 设置选中样式
selectedKeys
.
splice
(
0
,
selectedKeys
.
length
);
selectedKeys
.
push
(
defualtSelect
.
id
);
}
this
.
emit
(
"ctrlEvent"
,
{
tag
:
this
.
props
.
name
,
action
:
"selectionchange"
,
data
:
selectedNodes
});
}
// 回显已选数据
if
(
echoSelectedNodes
&&
echoSelectedNodes
.
length
>
0
)
{
const
checkedNodes
=
items
.
filter
((
item
:
IParam
)
=>
{
...
...
@@ -263,6 +280,7 @@ export class TreeControl extends MDControl {
if
(
Object
.
is
(
item
.
srfkey
,
val
.
srfkey
)
&&
Object
.
is
(
item
.
srfmajortext
,
val
.
srfmajortext
))
{
val
.
used
=
true
;
selectedNodes
.
push
(
val
);
selectedKeys
.
push
(
val
.
id
);
this
.
emit
(
"ctrlEvent"
,
{
tag
:
this
.
props
.
name
,
action
:
"selectionchange"
,
data
:
selectedNodes
});
return
true
;
}
...
...
@@ -273,14 +291,18 @@ export class TreeControl extends MDControl {
echoSelectedNodes
=
echoSelectedNodes
.
filter
((
item
:
any
)
=>
!
item
.
used
);
if
(
!
isSelectedAll
)
{
if
(
isMultiple
)
{
selectedNodes
.
push
([...
checkedNodes
]);
// selectedNodes = selectedNodes.concat(checkedNodes);
// TODO 设置选中树节点
checkedNodes
.
push
((
node
:
any
)
=>
{
selectedNodes
.
push
(
node
);
selectedKeys
.
push
(
node
.
id
);
});
}
else
{
// TODO 设置选中树节点高亮
currentSelectedNode
.
value
=
deepCopy
(
checkedNodes
[
0
]);
selectedNodes
.
splice
(
0
,
selectedNodes
.
length
);
selectedNodes
.
push
(
currentSelectedNode
.
value
);
// 设置选中样式
selectedKeys
.
splice
(
0
,
selectedKeys
.
length
);
selectedKeys
.
push
(
currentSelectedNode
.
value
.
id
);
}
}
}
...
...
@@ -288,7 +310,10 @@ export class TreeControl extends MDControl {
// 父节点选中树,选中所有子节点
if
(
isSelectedAll
)
{
const
leafNodes
=
items
.
filter
((
item
:
any
)
=>
item
.
isLeaf
);
selectedNodes
=
selectedNodes
.
concat
(
leafNodes
);
leafNodes
.
forEach
((
node
:
any
)
=>
{
selectedNodes
.
push
(
node
);
selectedKeys
.
push
(
node
.
id
);
});
this
.
emit
(
"ctrlEvent"
,
{
tag
:
this
.
props
.
name
,
action
:
'selectionchange'
,
data
:
selectedNodes
});
}
}
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/service/control-service/tree-service.ts
浏览文件 @
fceaed54
此差异已折叠。
点击以展开。
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/style/widgets/app-tree.scss
0 → 100644
浏览文件 @
fceaed54
.app-tree
{
// 设置徽标高度
.node__text-badge
{
height
:
16px
;
}
// 设置节点徽标位置
.ant-badge-count
{
height
:
16px
;
line-height
:
16px
;
transform
:
translate
(
40px
,
-1px
);
}
}
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/style/widgets/index.scss
浏览文件 @
fceaed54
...
...
@@ -7,3 +7,4 @@
@use
'./app-tab-view-panel.scss'
;
@use
'./app-portlet.scss'
;
@use
'./app-grid.scss'
;
@use
'./app-tree.scss'
;
\ 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-state.ts.hbs
浏览文件 @
fceaed54
...
...
@@ -38,13 +38,14 @@ export class ControlVO extends ControlVOBase implements TreeControlVO {
{{#if
treeNode
.
psAppCodeList
}}
codeList: {
codeName: '
{{
treeNode
.
psAppCodeList
.
codeName
}}
',
tag: '
{{
treeNode
.
psAppCodeList
.
codeListTag
}}
',
type: '
{{
treeNode
.
psAppCodeList
.
codeListType
}}
'
},
{{/if}}
counterId: '
{{
treeNode
.
counterId
}}
',
counterMode:
{{
treeNode
.
counterMode
}}
,
{{#if
treeNode
.
psSysCss
}}
cssName: '
{{
treeNode
.
psSysCss
.
cssName
}}
'
cssName: '
{{
treeNode
.
psSysCss
.
cssName
}}
'
,
{{/if}}
{{#if
treeNode
.
psDETreeNodeDataItems
}}
deTreeNodeDataItems: [
...
...
@@ -184,11 +185,30 @@ export class ControlVO extends ControlVOBase implements TreeControlVO {
}
export const ctrlState = {
appEntityCodeName: '
{{
ctrl
.
appEntity
.
codeName
}}
',
appDeCodeName:'
{{
ctrl
.
appEntity
.
codeName
}}
',
appDeLogicName: '
{{
ctrl
.
appEntity
.
logicName
}}
',
appDeKeyFieldName: '
{{#if
ctrl
.
appEntity
.
keyPSAppDEField
}}{{
ctrl
.
appEntity
.
keyPSAppDEField
.
codeName
}}{{/if}}
',
appDeMajorFieldName: '
{{#if
ctrl
.
appEntity
.
majorPSAppDEField
}}{{
ctrl
.
appEntity
.
majorPSAppDEField
.
codeName
}}{{/if}}
',
{{#
and
ctrl
.
psAppCounterRef
ctrl
.
psAppCounterRef
.
psAppCounter
}}
appCounterRef: {
{{#
with
ctrl
.
psAppCounterRef
.
psAppCounter
as
|
counter
|
}}
id: '
{{
ctrl
.
psAppCounterRef
.
id
}}
',
getAction: '
{{
counter
.
getPSAppDEAction
.
codeName
}}
',
timer:
{{#if
counter
.
timer
}}{{
counter
.
timer
}}{{else}}
6000
{{/if}}
,
{{#if
counter
.
psAppDataEntity
}}
deCodeName: '
{{
lowerCase
counter
.
psAppDataEntity
.
codeName
}}
'
{{/if}}
{{/
with
}}
},
counterService: ref(null),
{{/
and
}}
controlCodeName: '
{{
ctrl
.
codeName
}}
',
controlName: '
{{
ctrl
.
name
}}
',
controlService: new TreeService
<ControlVO>
(ControlVO, new
{{
pascalCase
ctrl
.
psAppDataEntity
.
codeName
}}
Service() ),
currentSelectedNode: {},
data: [],
outputIconDefault:
{{#
eq
ctrl
.
outputIconDefault
false
}}
false
{{else}}
true
{{/
eq
}}
,
echoSelectedNodes: [],
expandedKeys: [],
selectedKeys: [],
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/widgets/{{appEntities}}/{{ctrls@TREEVIEW}}-tree/{{ctrls@TREEVIEW}}-tree.vue.hbs
浏览文件 @
fceaed54
<script
setup
lang=
"ts"
>
import
{
Subject
}
from
'rxjs'
;
import
{
IActionParam
,
IParam
,
ControlAction
,
TreeControl
,
IContext
}
from
'@core'
;
import
{
FileTextOutlined
}
from
'@ant-design/icons-vue'
;
import
{
ctrlState
}
from
'./
{{
spinalCase
ctrl
.
codeName
}}
-tree-state'
;
interface
Props
{
...
...
@@ -29,14 +30,39 @@ interface CtrlEmit {
}
const
emit
=
defineEmits
<
CtrlEmit
>
();
// 获取自定义图标
const
getCustomIcon
=
(
scriptCode
:
any
)
=>
{
let
icon
:
string
=
''
;
const
code
=
scriptCode
.
replace
(
new
RegExp
(
'return'
,
'g'
),
`icon =`
);
eval
(
code
);
return
icon
;
}
// 获取自定义文本
const
getCustomText
=
(
scriptCode
:
any
)
=>
{
let
text
:
string
=
''
;
const
code
=
scriptCode
.
replace
(
new
RegExp
(
'return'
,
'g'
),
`text =`
);
eval
(
code
);
return
text
;
}
// 安装功能模块,提供状态和能力方法
const
{
name
,
state
,
load
,
treeNodeSelect
}
=
new
TreeControl
(
ctrlState
,
props
,
emit
).
moduleInstall
();
{{#
and
ctrl
.
psAppCounterRef
ctrl
.
psAppCounterRef
.
psAppCounter
}}
// 获取计数器数据
const
counterData
=
computed
(()
=>
{
const
{
counterService
}
=
state
;
if
(
counterService
)
{
return
counterService
.
data
;
}
return
{};
})
{{/
and
}}
// 暴露内部状态及能力
defineExpose
({
name
,
state
});
</script>
// TODO 树节点待支持图标和自定义绘制
<template>
<a-tree
class=
"app-tree
{{#if
ctrl
.
psSysCss
}}
{{
ctrl
.
psSysCss
.
cssName
}}{{/if}}
"
...
...
@@ -46,13 +72,69 @@ defineExpose({ name, state });
:fieldNames=
"{ title: 'text', key: 'id' }"
:checkable=
"state.isMultiple"
:multiple=
"state.isMultiple"
show-icon
v-model:expandedKeys=
"state.expandedKeys"
v-model:selectedKeys=
"state.selectedKeys"
@
select=
"treeNodeSelect"
>
<template
#
title=
"{ text, id }"
>
<div
class=
"app-tree-node"
>
<span
class=
"tree-node__title"
>
\{{ text }}
</span>
</div>
<template
#
icon=
"node"
>
<span
class=
"app-tree-node__icon"
>
<template
v-if=
"node.iconCustomCode && node.iconScriptCode"
>
<span
:domPropsInnerHtml=
"getCustomIcon(node.iconScriptCode)"
></span>
</template>
<template
v-else-if=
"node.iconcls"
>
<i
:class=
"node.iconcls"
></i>
</template>
<template
v-else-if=
"node.icon"
>
<img
:src=
"node.icon"
style=
'width:14px;height:14px;vertical-align: bottom;'
/>
</template>
<template
v-else-if=
"state.outputIconDefault"
>
<FileTextOutlined
/>
</template>
</span>
</template>
<template
#
title=
"node"
>
{{#if
(
and
ctrl
.
psAppCounterRef
ctrl
.
psAppCounterRef
.
psAppCounter
)
}}
<span
:class=
"['app-tree-node__text', node.cssName]"
:title=
"node.tooltip ? node.tooltip : node.text"
>
<a-badge
v-if=
"node.counterId && counterData.hasOwnProperty(node.counterId)"
class=
"node__text-badge"
:count=
"counterData[node.counterId]"
>
<template
v-if=
"node.textCustomCode && node.textScriptCode"
>
<span
:domPropsInnerHtml=
"getCustomText(node.textScriptCode)"
></span>
</template>
<template
v-else-if=
"node.html"
>
<span
:domPropsInnerHtml=
"node.html"
></span>
</template>
<template
v-else
>
<span>
\{{node.text}}
</span>
</template>
</a-badge>
<template
v-else
>
<template
v-if=
"node.textCustomCode && node.textScriptCode"
>
<span
:domPropsInnerHtml=
"getCustomText(node.textScriptCode)"
></span>
</template>
<template
v-else-if=
"node.html"
>
<span
:domPropsInnerHtml=
"node.html"
></span>
</template>
<template
v-else
>
<span>
\{{node.text}}
</span>
</template>
</template>
</span>
{{else}}
<span
:class=
"['app-tree-node__text', node.cssName]"
:title=
"node.tooltip ? node.tooltip : node.text"
>
<template
v-if=
"node.textCustomCode && node.textScriptCode"
>
<span
:domPropsInnerHtml=
"getCustomText(node.textScriptCode)"
></span>
</template>
<template
v-else-if=
"node.html"
>
<span
:domPropsInnerHtml=
"node.html"
></span>
</template>
<template
v-else
>
<span>
\{{node.text}}
</span>
</template>
</span>
{{/if}}
</template>
</a-tree>
</template>
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录