Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibizlab-generator
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibizlab-generator
提交
d02efe19
提交
d02efe19
编写于
12月 29, 2021
作者:
Shine-zwj
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update:更新表格
上级
c8e48f99
变更
5
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
102 行增加
和
61 行删除
+102
-61
grid-column-model.hbs
...sources/templ/r7/@macro/grid-detail/grid-column-model.hbs
+5
-2
grid-column.hbs
...ain/resources/templ/r7/@macro/grid-detail/grid-column.hbs
+8
-8
grid-control.ts
...rc/ibiz-core/modules/widgets/grid-control/grid-control.ts
+78
-49
{{ctrls@GRID}}-grid-config.ts.hbs
...s}}/{{ctrls@GRID}}-grid/{{ctrls@GRID}}-grid-config.ts.hbs
+1
-0
{{ctrls@GRID}}-grid.vue.hbs
...ntities}}/{{ctrls@GRID}}-grid/{{ctrls@GRID}}-grid.vue.hbs
+10
-2
未找到文件。
modules/ibizlab-generator-core/src/main/resources/templ/r7/@macro/grid-detail/grid-column-model.hbs
浏览文件 @
d02efe19
...
...
@@ -2,7 +2,7 @@
title: "
{{
item
.
caption
}}
",
columnType: "
{{
item
.
columnType
}}
",
{{#if
item
.
align
}}
align: "
{{
item
.
align
}}
",
align: "
{{
lowerCase
item
.
align
}}
",
{{/if}}
{{#
neq
lastColumn
true
}}
{{#if
item
.
widthUnit
'PX'
}}
...
...
@@ -19,7 +19,10 @@
{{/
each
}}
],
{{else}}
dataIndex: "
{{
lowerCase
item
.
codeName
}}
",
{{#
eq
item
.
columnType
'UAGRIDCOLUMN'
}}
fixed: "right",
{{/
eq
}}
dataIndex: "
{{#if
item
.
dataItemName
}}{{
lowerCase
item
.
dataItemName
}}{{else}}{{
lowerCase
item
.
codeName
}}{{/if}}
",
ellipsis: true,
enableSort:
{{
item
.
enableSort
}}
,
{{#if
item
.
aggMode
}}
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/@macro/grid-detail/grid-column.hbs
浏览文件 @
d02efe19
{{#
neq
item
.
columnType
'GROUPGRIDCOLUMN'
}}
<div
v-if=
"
column.dataIndex === '
{{
item
.
codeName
}}
'
"
class=
"table-cell"
>
{{#
eq
item
.
columnType
'DEFGRIDCOLUMN'
}}
{{#if
item
.
enableRowEdit
}}
{{#
if
(
neq
item
.
columnType
'GROUPGRIDCOLUMN'
)
}}
<div
v-if=
"
Object.is(column.dataIndex, '
{{
item
.
codeName
}}
')
"
class=
"table-cell"
>
{{#
if
(
eq
item
.
columnType
'DEFGRIDCOLUMN'
)
}}
{{#if
item
.
enableRowEdit
}}
<div
v-if=
"state.rowEditState"
class=
"editor-cell"
>
{{#
each
ctrl
.
psDEGridEditItems
as
|
editColumn
|
}}
{{#
eq
editColumn
.
codeName
(
item
.
codeName
)
}}
...
...
@@ -20,13 +20,13 @@
<span
class=
"text"
>
\{{text}}
</span>
</div>
{{/if}}
{{/
eq
}}
{{#
eq
item
.
columnType
'UAGRIDCOLUMN'
}}
{{/
if
}}
{{#
if
(
eq
item
.
columnType
'UAGRIDCOLUMN'
)
}}
{{!-- <ibizToolbar
:toolbarModel="state.actionModel"
@toolbarEvent="handleToolbarEvent"
:context="state.context"
:viewParams="state.viewParams"/> --}}
{{/
eq
}}
{{/
if
}}
</div>
{{/
neq
}}
{{/
if
}}
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/ibiz-core/modules/widgets/grid-control/grid-control.ts
浏览文件 @
d02efe19
import
{
createUUID
}
from
'qx-util'
;
import
{
calcActionItemAuthState
,
deepCopy
,
GridControlProps
,
GridControlState
,
IActionParam
,
IParam
,
MainControl
}
from
'@ibiz-core'
;
/**
...
...
@@ -22,11 +23,11 @@ export class GridControl extends MainControl {
*/
public
setState
(
props
:
GridControlProps
)
{
super
.
setState
(
props
);
this
.
controlState
.
multiple
=
toRef
(
props
,
'multiple'
)
as
any
;
this
.
controlState
.
rowEditState
=
toRef
(
props
,
'rowEditState'
)
as
any
;
this
.
controlState
.
rowActiveMode
=
toRef
(
props
,
'rowActiveMode'
)
as
any
;
this
.
controlState
.
selectedData
=
toRef
(
props
,
'selectedData'
)
as
any
;
this
.
controlState
.
selectFirstDefault
=
toRef
(
props
,
'selectFirstDefault'
)
as
any
;
this
.
controlState
.
multiple
=
toRef
(
props
,
"multiple"
)
as
any
;
this
.
controlState
.
rowEditState
=
toRef
(
props
,
"rowEditState"
)
as
any
;
this
.
controlState
.
rowActiveMode
=
toRef
(
props
,
"rowActiveMode"
)
as
any
;
this
.
controlState
.
selectedData
=
toRef
(
props
,
"selectedData"
)
as
any
;
this
.
controlState
.
selectFirstDefault
=
toRef
(
props
,
"selectFirstDefault"
)
as
any
;
}
/**
...
...
@@ -61,14 +62,14 @@ export class GridControl extends MainControl {
* @memberof GridControl
*/
public
getGridColumn
(
columns
:
IParam
[],
columnType
:
string
):
any
{
columns
.
forEach
((
column
:
IParam
)
=>
{
for
(
const
column
of
columns
)
{
if
(
Object
.
is
(
column
.
columnType
,
columnType
))
{
return
column
;
return
deepCopy
(
column
)
;
}
if
(
column
.
children
?.
length
>
0
)
{
return
this
.
getGridColumn
(
column
.
children
,
columnType
);
}
}
)
}
}
/**
...
...
@@ -77,7 +78,7 @@ export class GridControl extends MainControl {
*/
public
autoGroup
()
{
const
{
groupField
}
=
this
.
controlState
;
const
dataRef
=
toRef
(
this
.
controlState
,
'items'
);
const
dataRef
=
toRef
(
this
.
controlState
,
"items"
);
let
autoGroup
:
string
[]
=
[];
dataRef
.
value
.
forEach
((
item
:
IParam
)
=>
{
if
(
item
.
hasOwnProperty
(
groupField
))
{
...
...
@@ -86,10 +87,10 @@ export class GridControl extends MainControl {
})
autoGroup
=
[...
new
Set
(
autoGroup
)];
if
(
autoGroup
.
length
>
0
)
{
const
columnsModelRef
=
toRef
(
this
.
controlState
,
'columnsModel'
);
const
groupColumn
=
this
.
getGridColumn
(
columnsModelRef
.
value
,
'GROUP'
);
const
columnsModelRef
=
toRef
(
this
.
controlState
,
"columnsModel"
);
const
groupColumn
=
this
.
getGridColumn
(
columnsModelRef
.
value
,
"GROUP"
);
const
gridData
:
IParam
[]
=
[];
autoGroup
.
forEach
((
group
:
string
)
=>
{
autoGroup
.
forEach
((
group
:
string
,
index
:
number
)
=>
{
const
children
:
IParam
[]
=
[];
dataRef
.
value
.
forEach
((
item
:
IParam
)
=>
{
if
(
Object
.
is
(
group
,
item
[
groupField
]))
{
...
...
@@ -97,6 +98,8 @@ export class GridControl extends MainControl {
}
})
gridData
.
push
({
groupRow
:
true
,
srfkey
:
createUUID
(),
[
groupColumn
.
dataIndex
]:
group
,
children
:
deepCopy
(
children
),
})
...
...
@@ -111,12 +114,12 @@ export class GridControl extends MainControl {
*/
public
async
codeListGroup
()
{
const
{
groupField
}
=
this
.
controlState
;
const
dataRef
=
toRef
(
this
.
controlState
,
'items'
);
const
dataRef
=
toRef
(
this
.
controlState
,
"items"
);
// TODO 代码表数据
let
codeListGroup
:
IParam
[]
=
[];
if
(
codeListGroup
.
length
>
0
)
{
const
columnsModelRef
=
toRef
(
this
.
controlState
,
'columnsModel'
);
const
groupColumn
=
this
.
getGridColumn
(
columnsModelRef
.
value
,
'GROUP'
);
const
columnsModelRef
=
toRef
(
this
.
controlState
,
"columnsModel"
);
const
groupColumn
=
this
.
getGridColumn
(
columnsModelRef
.
value
,
"GROUP"
);
const
gridData
:
IParam
[]
=
[];
const
otherGroup
:
IParam
[]
=
[];
codeListGroup
.
forEach
((
group
:
IParam
)
=>
{
...
...
@@ -127,6 +130,8 @@ export class GridControl extends MainControl {
}
});
gridData
.
push
({
groupRow
:
true
,
srfkey
:
createUUID
(),
[
groupColumn
.
dataIndex
]:
group
.
text
,
children
:
deepCopy
(
children
),
})
...
...
@@ -139,6 +144,8 @@ export class GridControl extends MainControl {
});
if
(
otherGroup
.
length
>
0
)
{
gridData
.
push
({
groupRow
:
true
,
srfkey
:
createUUID
(),
[
groupColumn
.
dataIndex
]:
"其它"
,
children
:
deepCopy
(
otherGroup
),
})
...
...
@@ -152,9 +159,9 @@ export class GridControl extends MainControl {
* @memberof GridControl
*/
public
calcGridAuthState
()
{
const
dataRef
=
toRef
(
this
.
controlState
,
'items'
);
const
columnsModelRef
=
toRef
(
this
.
controlState
,
'columnsModel'
);
let
columnModel
=
this
.
getGridColumn
(
columnsModelRef
.
value
,
'UAGRIDCOLUMN'
);
const
dataRef
=
toRef
(
this
.
controlState
,
"items"
);
const
columnsModelRef
=
toRef
(
this
.
controlState
,
"columnsModel"
);
let
columnModel
=
this
.
getGridColumn
(
columnsModelRef
.
value
,
"UAGRIDCOLUMN"
);
if
(
columnModel
)
{
dataRef
.
value
.
forEach
((
item
:
IParam
)
=>
{
Object
.
assign
(
item
,
{
...
...
@@ -164,18 +171,27 @@ export class GridControl extends MainControl {
}
}
/**
* @description 设置表格合并列
* @memberof GridControl
*/
public
setGridColSpan
()
{
}
/**
* @description 处理表格分组
* @memberof GridControl
*/
public
handleGridGroup
()
{
const
{
groupMode
,
groupField
}
=
this
.
controlState
;
if
(
groupField
)
{
if
(
groupField
&&
!
Object
.
is
(
groupMode
,
"NONE"
)
)
{
if
(
Object
.
is
(
groupMode
,
"AUTO"
))
{
this
.
autoGroup
();
}
else
if
(
Object
.
is
(
groupMode
,
"CODELIST"
))
{
this
.
codeListGroup
();
}
this
.
setGridColSpan
();
}
}
...
...
@@ -198,21 +214,21 @@ export class GridControl extends MainControl {
*/
public
getAggValue
(
aggData
:
IParam
[],
column
:
IParam
):
string
{
switch
(
column
.
aggMode
)
{
case
'NONE'
:
return
''
;
case
'SUM'
:
case
"NONE"
:
return
""
;
case
"SUM"
:
let
sum
:
number
=
0
;
aggData
.
forEach
((
item
:
IParam
)
=>
{
sum
+=
Number
(
item
[
column
.
dataIndex
]
?
item
[
column
.
dataIndex
]
:
0
);
})
return
'SUM:'
+
sum
;
case
'AVG'
:
return
"SUM:"
+
sum
;
case
"AVG"
:
let
sum2
:
number
=
0
;
aggData
.
forEach
((
item
:
IParam
)
=>
{
sum2
+=
Number
(
item
[
column
.
dataIndex
]
?
item
[
column
.
dataIndex
]
:
0
);
})
return
'AVG:'
+
Number
(
sum2
/
(
aggData
.
length
)).
toFixed
(
3
);
case
'MAX'
:
return
"AVG:"
+
Number
(
sum2
/
(
aggData
.
length
)).
toFixed
(
3
);
case
"MAX"
:
let
max
:
number
=
0
;
aggData
.
forEach
((
item
:
IParam
)
=>
{
const
value
:
number
=
Number
(
item
[
column
.
dataIndex
]
?
item
[
column
.
dataIndex
]
:
0
);
...
...
@@ -220,8 +236,8 @@ export class GridControl extends MainControl {
max
=
value
;
}
})
return
'MAX:'
+
max
;
case
'MIN'
:
return
"MAX:"
+
max
;
case
"MIN"
:
let
min
:
number
=
0
;
aggData
.
forEach
((
item
:
IParam
)
=>
{
const
value
:
number
=
Number
(
item
[
column
.
dataIndex
]
?
item
[
column
.
dataIndex
]
:
0
);
...
...
@@ -229,9 +245,9 @@ export class GridControl extends MainControl {
min
=
value
;
}
})
return
'MIN:'
+
min
;
return
"MIN:"
+
min
;
default
:
return
''
;
return
""
;
}
}
...
...
@@ -241,19 +257,19 @@ export class GridControl extends MainControl {
*/
public
async
handleDataAgg
()
{
const
{
aggMode
}
=
this
.
controlState
;
if
(
!
Object
.
is
(
aggMode
,
'NONE'
))
{
const
dataAggRef
=
toRef
(
this
.
controlState
,
'dataAgg'
);
if
(
!
Object
.
is
(
aggMode
,
"NONE"
))
{
const
dataAggRef
=
toRef
(
this
.
controlState
,
"dataAgg"
);
let
aggData
:
IParam
[];
if
(
Object
.
is
(
aggMode
,
'PAGE'
))
{
const
dataRef
=
toRef
(
this
.
controlState
,
'items'
);
if
(
Object
.
is
(
aggMode
,
"PAGE"
))
{
const
dataRef
=
toRef
(
this
.
controlState
,
"items"
);
aggData
=
[...
dataRef
.
value
];
}
else
if
(
Object
.
is
(
aggMode
,
'ALL'
))
{
}
else
if
(
Object
.
is
(
aggMode
,
"ALL"
))
{
aggData
=
await
this
.
remoteAgg
();
}
const
columnsModelRef
=
toRef
(
this
.
controlState
,
'columnsModel'
);
const
columnsModelRef
=
toRef
(
this
.
controlState
,
"columnsModel"
);
const
columnsModel
:
IParam
[]
=
[];
columnsModelRef
.
value
.
forEach
((
column
:
IParam
)
=>
{
if
(
!
Object
.
is
(
column
.
columnType
,
'GROUPGRIDCOLUMN'
))
{
if
(
!
Object
.
is
(
column
.
columnType
,
"GROUPGRIDCOLUMN"
))
{
columnsModel
.
push
(
column
);
}
});
...
...
@@ -280,13 +296,13 @@ export class GridControl extends MainControl {
controlService
,
context
,
viewParams
,
showBusyIndicator
,
noSort
,
minorSortDir
,
minorSortPSDEF
,
enablePagingBar
,
pageSize
}
=
this
.
controlState
;
const
dataRef
=
toRef
(
this
.
controlState
,
'items'
);
const
paginationRef
=
toRef
(
this
.
controlState
,
'pagination'
);
if
(
!
loadAction
){
return
;
}
let
_context
=
deepCopy
(
context
);
let
_viewParams
=
deepCopy
(
viewParams
);
const
dataRef
=
toRef
(
this
.
controlState
,
"items"
);
const
paginationRef
=
toRef
(
this
.
controlState
,
"pagination"
);
//
if(!loadAction){
//
return;
//
}
let
_context
=
deepCopy
(
context
?
context
:
{}
);
let
_viewParams
=
deepCopy
(
viewParams
?
context
:
{}
);
if
(
noSort
&&
minorSortDir
&&
minorSortPSDEF
)
{
Object
.
assign
(
_viewParams
,
{
sort
:
`
${
minorSortPSDEF
}
,
${
minorSortDir
}
`
});
}
...
...
@@ -297,19 +313,32 @@ export class GridControl extends MainControl {
Object
.
assign
(
_viewParams
,
{
page
:
0
,
size
:
pageSize
});
}
}
const
response
=
await
controlService
.
get
(
loadAction
,
_context
,
{
viewParams
:
_viewParams
},
showBusyIndicator
);
if
(
!
response
.
status
||
response
.
status
!==
200
)
{
return
// const response = await controlService.get(loadAction, _context, {viewParams: _viewParams}, showBusyIndicator );
// if (!response.status || response.status !== 200) {
// return
// }
const
data
=
[];
for
(
let
i
=
0
;
i
<
100
;
i
++
)
{
data
.
push
({
group
:
i
%
2
===
1
?
"分组1"
:
"分组2"
,
srfkey
:
i
,
tefsubjecttypename
:
`Edrward
${
i
}
`
,
updatedate
:
32
,
description
:
`London Park no.
${
i
}
`
,
});
}
dataRef
.
value
=
response
.
data
;
dataRef
.
value
=
data
;
// dataRef.value = response.data;
if
(
enablePagingBar
)
{
paginationRef
.
value
[
'total'
]
=
response
.
total
;
// paginationRef.value['total'] = response.total;
paginationRef
.
value
[
"total"
]
=
100
;
}
this
.
calcGridAuthState
();
this
.
handleGridGroup
();
this
.
handleDataAgg
();
}
catch
(
error
)
{
// todo 错误异常处理
console
.
error
(
error
)
}
}
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/widgets/{{appEntities}}/{{ctrls@GRID}}-grid/{{ctrls@GRID}}-grid-config.ts.hbs
浏览文件 @
d02efe19
...
...
@@ -46,6 +46,7 @@ export const CtrlConfig = {
{{#if
ctrl
.
groupPSAppDEField
}}
{
title: "分组",
align: "center",
columnType: "GROUP",
width: 100,
resizable: true,
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/widgets/{{appEntities}}/{{ctrls@GRID}}-grid/{{ctrls@GRID}}-grid.vue.hbs
浏览文件 @
d02efe19
...
...
@@ -37,18 +37,24 @@ const { state, handleEditorEvent } = new GridControl(CtrlConfig).moduleInstall(p
const
gridScrollOption
=
computed
(()
=>
{
return
{
scrollToFirstRowOnChange
:
true
,
x
:
'1
0
0%'
,
x
:
'1
1
0%'
,
y
:
'690px'
,
}
});
// 表格行key
const
rowKey
=
(
record
:
IParam
)
=>
{
return
record
.
srfkey
;
}
// 表格行样式(斑马纹)
const
rowClassName
=
(
record
:
IParam
,
index
:
number
)
=>
{
return
index
%
2
===
1
?
'table-striped'
:
null
;
return
index
%
2
===
1
?
"table-striped"
:
null
;
}
// 表格选择功能配置
const
rowSelectionOption
=
computed
(()
=>
{
return
{
fixed
:
true
,
columnWidth
:
{{#
neq
ctrl
.
aggMode
'NONE'
}}
90
{{else}}
50
{{/
neq
}}
,
checkStrictly
:
props
.
multiple
?
false
:
true
,
onChange
:
(
selectedRowKeys
:
string
[],
selectedRows
:
IParam
[])
=>
{
console
.
log
(
`selectedRowKeys:
${
selectedRowKeys
}
`
,
'selectedRows: '
,
selectedRows
);
},
...
...
@@ -68,7 +74,9 @@ const handleChange = (pagination: IParam, filters: IParam, sorter: IParam, data:
<template>
<a-table
bordered
sticky
class=
"ibiz-grid"
:rowKey=
"rowKey"
:showHeader=
"
{{#if
ctrl
.
hideHeader
}}
false
{{else}}
true
{{/if}}
"
:scroll=
"gridScrollOption"
:sortDirections=
"['ascend', 'descend']"
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录