Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibizlab-generator
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibizlab-generator
提交
b7922fe4
提交
b7922fe4
编写于
12月 29, 2021
作者:
Shine-zwj
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update:更新表格
上级
51193462
变更
8
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
109 行增加
和
24 行删除
+109
-24
grid-column.hbs
...ain/resources/templ/r7/@macro/grid-detail/grid-column.hbs
+1
-1
main-view.ts
...apps}}/src/ibiz-core/modules/views/main-view/main-view.ts
+8
-1
control-base.ts
...rc/ibiz-core/modules/widgets/control-base/control-base.ts
+8
-0
grid-control-state.ts
...z-core/modules/widgets/grid-control/grid-control-state.ts
+14
-0
grid-control.ts
...rc/ibiz-core/modules/widgets/grid-control/grid-control.ts
+39
-13
{{pages@DEGRIDVIEW}}.vue.hbs
...dules}}/{{pages@DEGRIDVIEW}}/{{pages@DEGRIDVIEW}}.vue.hbs
+2
-2
{{ctrls@GRID}}-grid-config.ts.hbs
...s}}/{{ctrls@GRID}}-grid/{{ctrls@GRID}}-grid-config.ts.hbs
+2
-0
{{ctrls@GRID}}-grid.vue.hbs
...ntities}}/{{ctrls@GRID}}-grid/{{ctrls@GRID}}-grid.vue.hbs
+35
-7
未找到文件。
modules/ibizlab-generator-core/src/main/resources/templ/r7/@macro/grid-detail/grid-column.hbs
浏览文件 @
b7922fe4
...
...
@@ -7,7 +7,7 @@
{{#
each
ctrl
.
psDEGridEditItems
as
|
editColumn
|
}}
{{#
eq
editColumn
.
codeName
(
item
.
codeName
)
}}
{{#if
item
.
psEditor
}}
{{>
(
lookup
.
'item.psEditor.editorType'
)
item
=
item
}}
{{>
(
lookup
.
'item.psEditor.editorType'
)
item
=
item
ctrlType
=
"grid"
}}
{{/if}}
{{/
eq
}}
{{/
each
}}
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/ibiz-core/modules/views/main-view/main-view.ts
浏览文件 @
b7922fe4
...
...
@@ -44,6 +44,12 @@ export class MainView extends ViewBase {
//todo
}
public
handleCtrlEvent
(
actionParam
:
IActionParam
)
{
const
{
tag
,
action
,
data
}
=
actionParam
;
// TODO
console
.
log
(
tag
,
action
,
data
);
}
/**
* 安装部件所有功能模块的方法
* @param props 传入的Props
...
...
@@ -58,7 +64,8 @@ export class MainView extends ViewBase {
return
{
...
superParams
,
state
:
this
.
viewState
,
handleToolbarEvent
:
this
.
handleToolbarEvent
,
handleToolbarEvent
:
this
.
handleToolbarEvent
.
bind
(
this
),
handleCtrlEvent
:
this
.
handleCtrlEvent
.
bind
(
this
),
};
}
}
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/ibiz-core/modules/widgets/control-base/control-base.ts
浏览文件 @
b7922fe4
...
...
@@ -29,6 +29,13 @@ export class ControlBase {
*/
public
route
:
RouteLocationNormalizedLoaded
=
useRoute
();
/**
* @description 事件
* @type {*}
* @memberof ControlBase
*/
public
emit
:
any
;
/**
* Creates an instance of ControlBase.
* @param {*} options 配置参数
...
...
@@ -75,6 +82,7 @@ export class ControlBase {
* @memberof ControlBase
*/
public
moduleInstall
(
props
:
ControlPropsBase
,
emit
?:
Function
)
{
this
.
emit
=
emit
?.
bind
(
this
);
this
.
setState
(
props
);
this
.
useControlContextParams
(
props
);
return
{
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/ibiz-core/modules/widgets/grid-control/grid-control-state.ts
浏览文件 @
b7922fe4
...
...
@@ -64,6 +64,13 @@ export interface GridControlState extends MainControlState {
*/
selectedData
:
IParam
[];
/**
* @description 选中行keys
* @type {string[]}
* @memberof GridControlState
*/
selectedRowKeys
:
string
[];
/**
* @description 是否默认选中第一条数据
* @type {boolean}
...
...
@@ -71,6 +78,13 @@ export interface GridControlState extends MainControlState {
*/
selectFirstDefault
:
boolean
;
/**
* @description 当前页
* @type {number}
* @memberof GridControlState
*/
current
:
number
;
/**
* @description 分页大小
* @type {number}
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/ibiz-core/modules/widgets/grid-control/grid-control.ts
浏览文件 @
b7922fe4
...
...
@@ -259,13 +259,18 @@ export class GridControl extends MainControl {
const
{
aggMode
}
=
this
.
controlState
;
if
(
!
Object
.
is
(
aggMode
,
"NONE"
))
{
const
dataAggRef
=
toRef
(
this
.
controlState
,
"dataAgg"
);
let
aggData
:
IParam
[];
const
currentRef
=
toRef
(
this
.
controlState
,
"current"
);
const
pageSizeRef
=
toRef
(
this
.
controlState
,
"pageSize"
);
let
aggData
:
IParam
[]
=
[];
if
(
Object
.
is
(
aggMode
,
"PAGE"
))
{
const
dataRef
=
toRef
(
this
.
controlState
,
"items"
);
aggData
=
[...
dataRef
.
value
];
}
else
if
(
Object
.
is
(
aggMode
,
"ALL"
))
{
aggData
=
await
this
.
remoteAgg
();
}
const
start
:
number
=
(
currentRef
.
value
-
1
)
*
pageSizeRef
.
value
>
0
?
(
currentRef
.
value
-
1
)
*
pageSizeRef
.
value
-
1
:
0
;
const
end
:
number
=
currentRef
.
value
*
pageSizeRef
.
value
-
1
;
aggData
=
aggData
.
slice
(
start
,
end
);
const
columnsModelRef
=
toRef
(
this
.
controlState
,
"columnsModel"
);
const
columnsModel
:
IParam
[]
=
[];
columnsModelRef
.
value
.
forEach
((
column
:
IParam
)
=>
{
...
...
@@ -281,6 +286,33 @@ export class GridControl extends MainControl {
}
}
/**
* @description 处理默认选中
* @memberof GridControl
*/
public
handleDefaultSelect
()
{
const
{
selectedData
,
selectFirstDefault
,
controlName
}
=
this
.
controlState
;
if
(
selectedData
?.
length
>
0
)
{
const
selectedRowKeys
:
string
[]
=
[];
const
selectedRowKeysRef
=
toRef
(
this
.
controlState
,
"selectedRowKeys"
);
selectedData
.
forEach
((
selected
:
IParam
)
=>
{
if
(
selected
.
srfkey
)
{
selectedRowKeys
.
push
(
selected
.
srfkey
);
}
});
selectedRowKeysRef
.
value
=
selectedRowKeys
;
}
else
if
(
selectFirstDefault
)
{
const
dataRef
=
toRef
(
this
.
controlState
,
"items"
);
if
(
dataRef
.
value
[
0
])
{
this
.
emit
(
"ctrlEvent"
,
{
tag
:
controlName
,
action
:
"selectionChange"
,
data
:
[
deepCopy
(
dataRef
.
value
[
0
])],
});
}
}
}
/**
* @description 使用加载功能模块
* @param {GridControlProps} props 传入的props
...
...
@@ -294,7 +326,7 @@ export class GridControl extends MainControl {
const
loadAction
=
this
.
controlState
.
controlAction
.
loadAction
;
const
{
controlService
,
context
,
viewParams
,
showBusyIndicator
,
noSort
,
minorSortDir
,
minorSortPSDEF
,
enablePagingBar
,
pageSize
enablePagingBar
}
=
this
.
controlState
;
const
dataRef
=
toRef
(
this
.
controlState
,
"items"
);
const
paginationRef
=
toRef
(
this
.
controlState
,
"pagination"
);
...
...
@@ -307,11 +339,9 @@ export class GridControl extends MainControl {
Object
.
assign
(
_viewParams
,
{
sort
:
`
${
minorSortPSDEF
}
,
${
minorSortDir
}
`
});
}
if
(
enablePagingBar
)
{
if
(
opt
.
current
&&
opt
.
pageSize
)
{
Object
.
assign
(
_viewParams
,
{
page
:
opt
.
current
-
1
,
size
:
opt
.
pageSize
});
}
else
{
Object
.
assign
(
_viewParams
,
{
page
:
0
,
size
:
pageSize
});
}
const
currentRef
=
toRef
(
this
.
controlState
,
"current"
);
const
pageSizeRef
=
toRef
(
this
.
controlState
,
"pageSize"
);
Object
.
assign
(
_viewParams
,
{
page
:
currentRef
.
value
-
1
,
size
:
pageSizeRef
.
value
});
}
// const response = await controlService.get(loadAction, _context, {viewParams: _viewParams}, showBusyIndicator );
// if (!response.status || response.status !== 200) {
...
...
@@ -334,6 +364,7 @@ export class GridControl extends MainControl {
paginationRef
.
value
[
"total"
]
=
100
;
}
this
.
calcGridAuthState
();
this
.
handleDefaultSelect
();
this
.
handleGridGroup
();
this
.
handleDataAgg
();
}
catch
(
error
)
{
...
...
@@ -387,16 +418,11 @@ export class GridControl extends MainControl {
const
superParams
=
super
.
moduleInstall
(
props
,
emit
);
const
{
load
}
=
this
.
useLoad
(
props
);
const
handleEditorEvent
=
this
.
handleEditorEvent
.
bind
(
this
);
this
.
handleEditorEvent
=
(
rowIndex
:
number
,
actionParam
:
IActionParam
)
=>
{
handleEditorEvent
(
rowIndex
,
actionParam
)
}
return
{
...
superParams
,
state
:
this
.
controlState
,
load
,
handleEditorEvent
:
this
.
handleEditorEvent
,
handleEditorEvent
:
this
.
handleEditorEvent
.
bind
(
this
)
,
};
}
}
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/page/{{appModules}}/{{pages@DEGRIDVIEW}}/{{pages@DEGRIDVIEW}}.vue.hbs
浏览文件 @
b7922fe4
...
...
@@ -29,7 +29,7 @@ interface ViewEmit {
const
emit
=
defineEmits
<
ViewEmit
>
();
// 安装功能模块,提供状态和能力方法
const
{
state
}
=
new
GridView
(
ViewConfig
).
moduleInstall
(
props
);
const
{
state
,
handleCtrlEvent
}
=
new
GridView
(
ViewConfig
).
moduleInstall
(
props
);
</script>
...
...
@@ -45,13 +45,13 @@ const { state } = new GridView(ViewConfig).moduleInstall(props);
{{#
eq
controlType
"GRID"
}}
<
{{
codeName
}}
Grid
:context=
"state.context"
:multiple=
"false"
:rowEditState=
"state.rowEditState"
:rowActiveMode=
"state.gridRowActiveMode"
:showBusyIndicator=
"true"
:viewParams=
"state.viewParams"
:controlAction=
"state.controlsAction"
:viewSubject=
"state.viewSubject"
@
ctrlEvent=
"handleCtrlEvent"
></
{{
codeName
}}
Grid>
{{/
eq
}}
{{/
page
.
ctrls
}}
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/widgets/{{appEntities}}/{{ctrls@GRID}}-grid/{{ctrls@GRID}}-grid-config.ts.hbs
浏览文件 @
b7922fe4
...
...
@@ -5,6 +5,7 @@ export const CtrlConfig = {
controlName: "
{{
ctrl
.
name
}}
",
items: [],
dataAgg: [],
selectedRowKeys: [],
aggMode: "
{{
ctrl
.
aggMode
}}
",
{{#if
(
eq
ctrl
.
aggMode
'ALL'
)
}}
aggEntity: "
{{
ctrl
.
aggPSAppDataEntity
.
codeName
}}
",
...
...
@@ -29,6 +30,7 @@ export const CtrlConfig = {
{{/if}}
{{#if
ctrl
.
enablePagingBar
}}
enablePagingBar: true,
current: 1,
pageSize:
{{#if
ctrl
.
pagingSize
}}{{
ctrl
.
pagingSize
}}{{else}}
20
{{/if}}
,
pagination: {
position: ['bottomRight'],
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/widgets/{{appEntities}}/{{ctrls@GRID}}-grid/{{ctrls@GRID}}-grid.vue.hbs
浏览文件 @
b7922fe4
...
...
@@ -2,7 +2,7 @@
<script
setup
lang=
"ts"
>
import
{
Subject
}
from
'rxjs'
;
import
{
CtrlConfig
}
from
'./
{{
spinalCase
ctrl
.
codeName
}}
-grid-config'
;
import
{
GridControl
,
IActionParam
,
IParam
,
ControlAction
}
from
'@ibiz-core'
;
import
{
GridControl
,
IActionParam
,
IParam
,
ControlAction
,
deepCopy
}
from
'@ibiz-core'
;
interface
Props
{
context
:
IParam
;
...
...
@@ -32,7 +32,7 @@ interface CtrlEmit {
}
const
emit
=
defineEmits
<
CtrlEmit
>
();
// 安装功能模块,提供状态和能力方法
const
{
state
,
handleEditorEvent
}
=
new
GridControl
(
CtrlConfig
).
moduleInstall
(
props
);
const
{
state
,
load
,
handleEditorEvent
}
=
new
GridControl
(
CtrlConfig
).
moduleInstall
(
props
);
// 表格滚动条配置
const
gridScrollOption
=
computed
(()
=>
{
return
{
...
...
@@ -49,14 +49,40 @@ const rowKey = (record: IParam) => {
const
rowClassName
=
(
record
:
IParam
,
index
:
number
)
=>
{
return
index
%
2
===
1
?
"table-striped"
:
null
;
}
// 表格行选中
const
customRow
=
(
record
:
IParam
,
index
:
number
)
=>
{
return
{
onClick
:
()
=>
{
state
.
selectedRowKeys
=
[
record
.
srfkey
];
if
(
!
record
.
groupRow
)
{
emit
(
"ctrlEvent"
,{
tag
:
state
.
controlName
,
action
:
"selectionChange"
,
data
:
[
deepCopy
(
record
)]
})
if
(
Object
.
is
(
props
.
rowActiveMode
,
1
))
{
emit
(
"ctrlEvent"
,{
tag
:
state
.
controlName
,
action
:
"rowClick"
,
data
:
[
deepCopy
(
record
)]
})
}
}
},
onDblclick
:
()
=>
{
if
(
!
record
.
groupRow
&&
Object
.
is
(
props
.
rowActiveMode
,
2
))
{
emit
(
"ctrlEvent"
,{
tag
:
state
.
controlName
,
action
:
"rowDbClick"
,
data
:
[
deepCopy
(
record
)]
})
}
}
};
}
// 表格选择功能配置
const
rowSelectionOption
=
computed
(()
=>
{
return
{
fixed
:
true
,
columnWidth
:
{{#
neq
ctrl
.
aggMode
'NONE'
}}
90
{{else}}
50
{{/
neq
}}
,
selectedRowKeys
:
state
.
selectedRowKeys
,
checkStrictly
:
props
.
multiple
?
false
:
true
,
onChange
:
(
selectedRowKeys
:
string
[],
selectedRows
:
IParam
[])
=>
{
console
.
log
(
`selectedRowKeys:
${
selectedRowKeys
}
`
,
'selectedRows: '
,
selectedRows
);
state
.
selectedRowKeys
=
selectedRowKeys
;
const
selection
:
IParam
[]
=
[];
selectedRows
.
forEach
((
select
:
IParam
)
=>
{
if
(
!
select
.
groupRow
)
{
selection
.
push
(
select
);
}
})
emit
(
"ctrlEvent"
,{
tag
:
state
.
controlName
,
action
:
"selectionChange"
,
data
:
selection
})
},
};
});
...
...
@@ -67,8 +93,9 @@ const handleResizeColumn = (width: number, column: IParam) => {
// 处理表格变化(分页,过滤,排序)
const
handleChange
=
(
pagination
:
IParam
,
filters
:
IParam
,
sorter
:
IParam
,
data
:
IParam
)
=>
{
const
{
current
,
pageSize
}
=
pagination
;
const
{
currentDataSource
}
=
data
;
console
.
log
(
pagination
,
filters
,
sorter
,
currentDataSource
);
state
.
current
=
current
;
state
.
pageSize
=
pageSize
;
load
();
}
</script>
<template>
...
...
@@ -84,6 +111,7 @@ const handleChange = (pagination: IParam, filters: IParam, sorter: IParam, data:
:row-selection=
"rowSelectionOption"
:columns=
"state.columnsModel"
:pagination=
"state.pagination"
:customRow=
"customRow"
:rowClassName=
"rowClassName"
@
change=
"handleChange"
@
resizeColumn=
"handleResizeColumn"
>
...
...
@@ -99,7 +127,7 @@ const handleChange = (pagination: IParam, filters: IParam, sorter: IParam, data:
{{!-- 快速工具栏 --}}
</div>
</template>
<template
#
bodyCell=
"{ column, text, record }"
>
<template
#
bodyCell=
"{ column, text, record
, index
}"
>
{{#
each
ctrl
.
psDEGridColumns
as
|
column
|
}}
{{>
(
lookup
'COLUMN'
)
item
=
column
ctrl
=
ctrl
}}
{{/
each
}}
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录