Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibizlab-generator
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibizlab-generator
提交
5e586c16
提交
5e586c16
编写于
3月 04, 2022
作者:
Mosher
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update:支持列表界面行为和选中效果
上级
e88f8b54
变更
4
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
73 行增加
和
7 行删除
+73
-7
list-control.ts
...s}}/src/core/modules/widgets/list-control/list-control.ts
+61
-3
app-list.scss
...ces/templ/r7/app_{{apps}}/src/style/widgets/app-list.scss
+4
-0
{{ctrls@LIST}}-list-state.ts.hbs
...es}}/{{ctrls@LIST}}-list/{{ctrls@LIST}}-list-state.ts.hbs
+2
-1
{{ctrls@LIST}}-list.vue.hbs
...ntities}}/{{ctrls@LIST}}-list/{{ctrls@LIST}}-list.vue.hbs
+6
-3
未找到文件。
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/modules/widgets/list-control/list-control.ts
浏览文件 @
5e586c16
...
@@ -12,12 +12,69 @@ export class ListControl extends MDControl {
...
@@ -12,12 +12,69 @@ export class ListControl extends MDControl {
/**
/**
* @description 触发界面行为
* @description 触发界面行为
* @protected
* @protected
* @param {IParam} item 列表数据
* @param {IParam} action 界面行为
* @param {IParam} action 界面行为
* @param {MouseEvent} event 鼠标源事件
* @param {MouseEvent} event 鼠标源事件
* @memberof ListControl
* @memberof ListControl
*/
*/
protected
onUIAction
(
action
:
IParam
,
event
:
MouseEvent
)
{
protected
onUIAction
(
item
:
IParam
,
action
:
IParam
,
event
:
MouseEvent
)
{
console
.
log
(
action
,
event
);
if
(
!
item
||
!
action
)
{
console
.
warn
(
"行为执行参数不足"
);
return
;
}
const
inputParam
=
{
context
:
this
.
state
.
context
,
viewParams
:
this
.
state
.
viewParams
,
data
:
[
item
],
event
:
event
,
actionEnvironment
:
this
};
// 执行行为
App
.
getAppActionService
().
execute
(
action
,
inputParam
);
}
/**
* @description 使用自定义模块
* @protected
* @return {*}
* @memberof ListControl
*/
protected
useCustom
()
{
/**
* 列表项选中
* @param item
* @param event
*/
const
onListItemSelected
=
(
item
:
IParam
,
event
:
MouseEvent
)
=>
{
const
{
isMultiple
}
=
this
.
state
;
const
{
selectedData
}
=
toRefs
(
this
.
state
);
const
index
=
selectedData
.
value
.
findIndex
((
selection
:
any
)
=>
selection
.
srfkey
===
item
.
srfkey
);
// 存在选中则删除
if
(
index
!==
-
1
)
{
selectedData
.
value
.
splice
(
index
,
1
);
}
else
{
// 单选清空已选中
if
(
!
isMultiple
)
{
selectedData
.
value
.
splice
(
index
,
selectedData
.
value
.
length
);
}
selectedData
.
value
.
push
(
item
);
}
this
.
emit
(
'ctrlEvent'
,
{
tag
:
this
.
props
.
name
,
action
:
'selectionchange'
,
data
:
selectedData
});
}
/**
* 是否选中
* @param item 列表项
* @returns
*/
const
isSelected
=
(
item
:
IParam
):
boolean
=>
{
const
{
selectedData
}
=
toRefs
(
this
.
state
);
return
selectedData
.
value
.
findIndex
((
selection
:
any
)
=>
selection
.
srfkey
===
item
.
srfkey
)
!==
-
1
;
}
return
{
onListItemSelected
:
onListItemSelected
.
bind
(
this
),
isSelected
:
isSelected
.
bind
(
this
)
}
}
}
/**
/**
...
@@ -29,7 +86,8 @@ export class ListControl extends MDControl {
...
@@ -29,7 +86,8 @@ export class ListControl extends MDControl {
const
superParams
=
super
.
moduleInstall
();
const
superParams
=
super
.
moduleInstall
();
return
{
return
{
...
superParams
,
...
superParams
,
onUIAction
:
this
.
onUIAction
.
bind
(
this
)
onUIAction
:
this
.
onUIAction
.
bind
(
this
),
useCustom
:
this
.
useCustom
()
}
}
}
}
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/style/widgets/app-list.scss
浏览文件 @
5e586c16
...
@@ -13,4 +13,8 @@
...
@@ -13,4 +13,8 @@
color
:
#d2d2d2
;
color
:
#d2d2d2
;
cursor
:
no-drop
;
cursor
:
no-drop
;
}
}
.app-list-item
:hover
,
.app-list-item__selection
{
background-color
:
#dcf4ff
;
}
}
}
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/widgets/{{appEntities}}/{{ctrls@LIST}}-list/{{ctrls@LIST}}-list-state.ts.hbs
浏览文件 @
5e586c16
...
@@ -57,7 +57,8 @@ export const ctrlState = {
...
@@ -57,7 +57,8 @@ export const ctrlState = {
mdCtrlPaging: {
mdCtrlPaging: {
enablePagingBar: true,
enablePagingBar: true,
current: 1,
current: 1,
pageSize:
{{#if
ctrl
.
pagingSize
}}{{
ctrl
.
pagingSize
}}{{else}}
20
{{/if}}
pageSize:
{{#if
ctrl
.
pagingSize
}}{{
ctrl
.
pagingSize
}}{{else}}
20
{{/if}}
,
pagination: {}
},
},
// 界面行为
// 界面行为
uIActions: {
uIActions: {
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/widgets/{{appEntities}}/{{ctrls@LIST}}-list/{{ctrls@LIST}}-list.vue.hbs
浏览文件 @
5e586c16
...
@@ -35,7 +35,8 @@ interface CtrlEmit {
...
@@ -35,7 +35,8 @@ interface CtrlEmit {
const
emit
=
defineEmits
<
CtrlEmit
>
();
const
emit
=
defineEmits
<
CtrlEmit
>
();
// 安装功能模块,提供状态和能力
// 安装功能模块,提供状态和能力
const
{
name
,
state
,
onUIAction
,
newRow
,
remove
,
save
,
load
,
refresh
,
getData
,
xDataCtrl
,
exportExcel
}
=
new
ListControl
(
ctrlState
,
props
,
emit
).
moduleInstall
();
const
{
name
,
state
,
onUIAction
,
newRow
,
remove
,
save
,
load
,
refresh
,
getData
,
xDataCtrl
,
exportExcel
,
useCustom
}
=
new
ListControl
(
ctrlState
,
props
,
emit
).
moduleInstall
();
const
{
onListItemSelected
,
isSelected
}
=
useCustom
;
// 暴露内部状态及能力
// 暴露内部状态及能力
defineExpose
({
name
,
state
,
newRow
,
remove
,
save
,
load
,
refresh
,
getData
,
exportExcel
});
defineExpose
({
name
,
state
,
newRow
,
remove
,
save
,
load
,
refresh
,
getData
,
exportExcel
});
...
@@ -47,7 +48,9 @@ defineExpose({ name, state, newRow, remove, save, load, refresh, getData, export
...
@@ -47,7 +48,9 @@ defineExpose({ name, state, newRow, remove, save, load, refresh, getData, export
item-layout=
"horizontal"
item-layout=
"horizontal"
:data-source=
"state.items"
>
:data-source=
"state.items"
>
<template
#
renderItem=
"{ item }"
>
<template
#
renderItem=
"{ item }"
>
<a-list-item
class=
"app-list-item"
>
<a-list-item
:class=
"['app-list-item', isSelected(item) ? 'app-list-item__selection' : '']"
@
click=
"(event) => onListItemSelected(item, event)"
>
<a-list-item-meta
<a-list-item-meta
:description=
"item.srfdescription"
>
:description=
"item.srfdescription"
>
<template
#
title
>
<template
#
title
>
...
@@ -64,7 +67,7 @@ defineExpose({ name, state, newRow, remove, save, load, refresh, getData, export
...
@@ -64,7 +67,7 @@ defineExpose({ name, state, newRow, remove, save, load, refresh, getData, export
v-if=
"action.visible"
v-if=
"action.visible"
:class=
"['list-item__action', action.disabled ? 'disabled' : '']"
:class=
"['list-item__action', action.disabled ? 'disabled' : '']"
:title=
"action.tooltip ? action.tooltip : action.caption"
:title=
"action.tooltip ? action.tooltip : action.caption"
@
click
=
"(event) => onUIAction(
action, event)"
>
@
click
.
stop=
"(event) => onUIAction(item,
action, event)"
>
<template
v-if=
"action.showIcon"
>
<template
v-if=
"action.showIcon"
>
<i
v-if=
"action.cssClass"
:class=
"action.cssClass"
/>
<i
v-if=
"action.cssClass"
:class=
"action.cssClass"
/>
<img
v-if=
"action.imagePath"
:src=
"action.imagePath"
/>
<img
v-if=
"action.imagePath"
:src=
"action.imagePath"
/>
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录