Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibizlab-generator
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibizlab-generator
提交
8844bf0c
提交
8844bf0c
编写于
1月 04, 2022
作者:
Shine-zwj
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update:更新表格
上级
ebf085ef
变更
4
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
101 行增加
和
155 行删除
+101
-155
grid-control-state.ts
...z-core/modules/widgets/grid-control/grid-control-state.ts
+13
-75
grid-control.ts
...rc/ibiz-core/modules/widgets/grid-control/grid-control.ts
+50
-40
{{ctrls@GRID}}-grid-config.ts.hbs
...s}}/{{ctrls@GRID}}-grid/{{ctrls@GRID}}-grid-config.ts.hbs
+35
-37
{{ctrls@GRID}}-grid.vue.hbs
...ntities}}/{{ctrls@GRID}}-grid/{{ctrls@GRID}}-grid.vue.hbs
+3
-3
未找到文件。
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/ibiz-core/modules/widgets/grid-control/grid-control-state.ts
浏览文件 @
8844bf0c
...
...
@@ -13,7 +13,7 @@ export interface GridControlState extends MainControlState {
* @type {IParam[]}
* @memberof GridControlState
*/
items
:
IParam
[];
data
:
IParam
[];
/**
* @description 表格列模型
...
...
@@ -34,7 +34,7 @@ export interface GridControlState extends MainControlState {
* @type {IParam}
* @memberof GridControlState
*/
rules
:
IParam
;
rules
:
IParam
[]
;
/**
* @description 是否多选
...
...
@@ -79,93 +79,31 @@ export interface GridControlState extends MainControlState {
selectFirstDefault
:
boolean
;
/**
* @description 当前页
* @type {number}
* @memberof GridControlState
*/
current
:
number
;
/**
* @description 分页大小
* @type {number}
* @memberof GridControlState
*/
pageSize
:
number
;
/**
* @description 是否启用分页
* @type {boolean}
* @memberof GridControlState
*/
enablePagingBar
:
boolean
;
/**
* @description 数据聚合
* @description 表格聚合
* @type {IParam}
* @memberof GridControlState
*/
dataAgg
:
string
[];
/**
* @description 聚合模式
* @type {string}
* @memberof GridControlState
*/
aggMode
:
string
;
/**
* @description 聚合实体
* @type {string}
* @memberof GridControlState
*/
aggEntity
:
string
,
/**
* @description 聚合数据集
* @type {string}
* @memberof GridControlState
*/
aggDataSet
:
string
,
/**
* @description 分组模式
* @type {string}
* @memberof GridControlState
*/
groupMode
:
string
;
/**
* @description 分组属性
* @type {string}
* @memberof GridControlState
*/
groupField
:
string
;
gridAgg
:
IParam
;
/**
* @description
分组代码表
* @type {
*
}
* @description
表格分组
* @type {
IParam
}
* @memberof GridControlState
*/
gr
oupCodeList
:
any
;
gr
idGroup
:
IParam
;
/**
* @description
禁用
排序
* @type {
boolean
}
* @description
表格
排序
* @type {
IParam
}
* @memberof GridControlState
*/
noSort
:
boolean
;
gridSort
:
IParam
;
/**
* @description
排序方向
* @type {
string
}
* @description
表格分页
* @type {
IParam
}
* @memberof GridControlState
*/
minorSortDir
:
string
;
gridPaging
:
IParam
/**
* @description 排序属性
* @type {string}
* @memberof GridControlState
*/
minorSortPSDEF
:
string
;
}
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/ibiz-core/modules/widgets/grid-control/grid-control.ts
浏览文件 @
8844bf0c
...
...
@@ -38,10 +38,10 @@ export class GridControl extends MainControl {
* @memberof GridControl
*/
public
gridDataChange
(
rowIndex
:
number
,
name
:
string
,
value
:
any
){
if
(
this
.
controlState
.
items
[
rowIndex
][
name
]
!==
value
)
{
this
.
controlState
.
items
[
rowIndex
][
name
]
=
value
;
if
(
!
this
.
controlState
.
items
[
rowIndex
][
"rowDataState"
])
{
this
.
controlState
.
items
[
rowIndex
][
"rowDataState"
]
=
"update"
;
if
(
this
.
controlState
.
data
[
rowIndex
][
name
]
!==
value
)
{
this
.
controlState
.
data
[
rowIndex
][
name
]
=
value
;
if
(
!
this
.
controlState
.
data
[
rowIndex
][
"rowDataState"
])
{
this
.
controlState
.
data
[
rowIndex
][
"rowDataState"
]
=
"update"
;
}
}
}
...
...
@@ -82,8 +82,9 @@ export class GridControl extends MainControl {
* @memberof GridControl
*/
public
autoGroup
()
{
const
{
groupField
}
=
this
.
controlState
;
const
dataRef
=
toRef
(
this
.
controlState
,
"items"
);
const
{
gridGroup
}
=
this
.
controlState
;
const
{
groupField
}
=
gridGroup
;
const
dataRef
=
toRef
(
this
.
controlState
,
"data"
);
let
autoGroup
:
string
[]
=
[];
dataRef
.
value
.
forEach
((
item
:
IParam
)
=>
{
if
(
item
.
hasOwnProperty
(
groupField
))
{
...
...
@@ -117,8 +118,9 @@ export class GridControl extends MainControl {
* @memberof GridControl
*/
public
async
codeListGroup
()
{
const
{
groupField
}
=
this
.
controlState
;
const
dataRef
=
toRef
(
this
.
controlState
,
"items"
);
const
{
gridGroup
}
=
this
.
controlState
;
const
{
groupField
}
=
gridGroup
;
const
dataRef
=
toRef
(
this
.
controlState
,
"data"
);
// TODO 代码表数据
let
codeListGroup
:
IParam
[]
=
[];
if
(
codeListGroup
.
length
>
0
)
{
...
...
@@ -161,7 +163,7 @@ export class GridControl extends MainControl {
* @memberof GridControl
*/
public
calcGridAuthState
()
{
const
dataRef
=
toRef
(
this
.
controlState
,
"
items
"
);
const
dataRef
=
toRef
(
this
.
controlState
,
"
data
"
);
const
columnsModelRef
=
toRef
(
this
.
controlState
,
"columnsModel"
);
let
columnModel
=
this
.
getGridColumn
(
columnsModelRef
.
value
,
"UAGRIDCOLUMN"
);
if
(
columnModel
)
{
...
...
@@ -208,8 +210,9 @@ export class GridControl extends MainControl {
* @memberof GridControl
*/
public
handleGridGroup
()
{
const
{
groupMode
,
groupField
}
=
this
.
controlState
;
if
(
groupField
&&
!
Object
.
is
(
groupMode
,
"NONE"
))
{
const
{
gridGroup
}
=
this
.
controlState
;
const
{
enableGroup
,
groupField
,
groupMode
}
=
gridGroup
;
if
(
enableGroup
&&
groupField
&&
!
Object
.
is
(
groupMode
,
"NONE"
))
{
if
(
Object
.
is
(
groupMode
,
"AUTO"
))
{
this
.
autoGroup
();
}
else
if
(
Object
.
is
(
groupMode
,
"CODELIST"
))
{
...
...
@@ -224,7 +227,7 @@ export class GridControl extends MainControl {
* @memberof GridControl
*/
public
async
remoteAgg
():
Promise
<
IParam
[]
>
{
const
{
aggEntity
,
aggDataSet
}
=
this
.
controlState
;
const
{
gridAgg
}
=
this
.
controlState
;
const
aggData
:
IParam
[]
=
[];
// TODO 调用服务获取聚合数据
return
aggData
;
...
...
@@ -280,22 +283,32 @@ export class GridControl extends MainControl {
* @memberof GridControl
*/
public
async
handleDataAgg
()
{
const
{
aggMode
,
enablePagingBar
}
=
this
.
controlState
;
const
{
gridPaging
,
gridGroup
}
=
this
.
controlState
;
const
gridAggRef
=
toRef
(
this
.
controlState
,
"gridAgg"
);
let
{
aggMode
,
aggData
}
=
gridAggRef
.
value
;
const
{
enableGroup
}
=
gridGroup
;
if
(
!
Object
.
is
(
aggMode
,
"NONE"
))
{
const
dataAggRef
=
toRef
(
this
.
controlState
,
"dataAgg"
);
const
currentRef
=
toRef
(
this
.
controlState
,
"current"
);
const
pageSizeRef
=
toRef
(
this
.
controlState
,
"pageSize"
);
let
aggData
:
IParam
[]
=
[];
const
{
enablePagingBar
,
current
,
pageSize
}
=
gridPaging
;
let
dataAgg
:
IParam
[]
=
[];
if
(
Object
.
is
(
aggMode
,
"PAGE"
))
{
const
dataRef
=
toRef
(
this
.
controlState
,
"
items
"
);
aggData
=
[...
dataRef
.
value
];
const
dataRef
=
toRef
(
this
.
controlState
,
"
data
"
);
dataAgg
=
[...
dataRef
.
value
];
}
else
if
(
Object
.
is
(
aggMode
,
"ALL"
))
{
aggData
=
await
this
.
remoteAgg
();
dataAgg
=
await
this
.
remoteAgg
();
}
if
(
enablePagingBar
)
{
const
start
:
number
=
(
currentRef
.
value
-
1
)
*
pageSizeRef
.
value
>
0
?
(
currentRef
.
value
-
1
)
*
pageSizeRef
.
value
-
1
:
0
;
const
end
:
number
=
currentRef
.
value
*
pageSizeRef
.
value
;
aggData
=
aggData
.
slice
(
start
,
end
);
const
start
:
number
=
(
current
-
1
)
*
pageSize
>
0
?
(
current
-
1
)
*
pageSize
-
1
:
0
;
const
end
:
number
=
current
*
pageSize
;
dataAgg
=
dataAgg
.
slice
(
start
,
end
);
}
if
(
enableGroup
)
{
const
_dataAgg
:
IParam
[]
=
[];
dataAgg
.
forEach
((
item
:
IParam
)
=>
{
item
.
children
?.
forEach
((
child
:
IParam
)
=>
{
_dataAgg
.
push
(
child
);
})
})
dataAgg
=
_dataAgg
;
}
const
columnsModelRef
=
toRef
(
this
.
controlState
,
"columnsModel"
);
const
columnsModel
:
IParam
[]
=
[];
...
...
@@ -304,11 +317,9 @@ export class GridControl extends MainControl {
columnsModel
.
push
(
column
);
}
});
const
dataAgg
:
string
[]
=
[];
columnsModel
.
forEach
((
column
:
IParam
)
=>
{
dataAgg
.
push
(
this
.
getAggValue
(
aggData
,
column
))
aggData
.
push
(
this
.
getAggValue
(
dataAgg
,
column
))
})
dataAggRef
.
value
=
[...
dataAgg
];
}
}
...
...
@@ -328,7 +339,7 @@ export class GridControl extends MainControl {
});
selectedRowKeysRef
.
value
=
selectedRowKeys
;
}
else
if
(
selectFirstDefault
)
{
const
dataRef
=
toRef
(
this
.
controlState
,
"
items
"
);
const
dataRef
=
toRef
(
this
.
controlState
,
"
data
"
);
if
(
dataRef
.
value
[
0
])
{
this
.
emit
(
"ctrlEvent"
,
{
tag
:
controlName
,
...
...
@@ -350,14 +361,15 @@ export class GridControl extends MainControl {
const
load
=
async
(
opt
:
any
=
{})
=>
{
try
{
const
{
controlService
,
context
,
viewParams
,
showBusyIndicator
,
noSort
,
minorSortDir
,
minorSortPSDEF
,
enablePagingBar
,
controlAction
controlService
,
context
,
viewParams
,
showBusyIndicator
,
controlAction
,
gridSort
}
=
this
.
controlState
;
const
dataRef
=
toRef
(
this
.
controlState
,
"
items
"
);
const
paginationRef
=
toRef
(
this
.
controlState
,
"pagination
"
);
const
dataRef
=
toRef
(
this
.
controlState
,
"
data
"
);
const
gridPagingRef
=
toRef
(
this
.
controlState
,
"gridPaging
"
);
if
(
!
controlAction
.
loadAction
){
return
;
}
const
{
noSort
,
minorSortDir
,
minorSortPSDEF
}
=
gridSort
;
let
{
enablePagingBar
,
pagination
,
current
,
pageSize
}
=
gridPagingRef
.
value
;
const
arg
:
any
=
{
...
opt
};
let
_context
=
deepCopy
(
context
?
context
:
{});
let
_viewParams
=
deepCopy
(
viewParams
?
context
:
{});
...
...
@@ -365,9 +377,7 @@ export class GridControl extends MainControl {
Object
.
assign
(
_viewParams
,
{
sort
:
`
${
minorSortPSDEF
}
,
${
minorSortDir
}
`
});
}
if
(
enablePagingBar
)
{
const
currentRef
=
toRef
(
this
.
controlState
,
"current"
);
const
pageSizeRef
=
toRef
(
this
.
controlState
,
"pageSize"
);
Object
.
assign
(
_viewParams
,
{
page
:
currentRef
.
value
-
1
,
size
:
pageSizeRef
.
value
});
Object
.
assign
(
_viewParams
,
{
page
:
current
-
1
,
size
:
pageSize
});
}
Object
.
assign
(
arg
,
{
viewParams
:
_viewParams
});
const
response
=
await
controlService
.
get
(
...
...
@@ -378,7 +388,7 @@ export class GridControl extends MainControl {
if
(
response
.
status
||
response
.
status
==
200
)
{
dataRef
.
value
=
response
.
data
;
if
(
enablePagingBar
)
{
pagination
Ref
.
value
[
'total'
]
=
response
.
total
;
pagination
[
'total'
]
=
response
.
total
;
}
this
.
calcGridAuthState
();
this
.
handleDefaultSelect
();
...
...
@@ -387,7 +397,7 @@ export class GridControl extends MainControl {
}
}
catch
(
error
)
{
// todo 错误异常处理
console
.
error
(
error
)
console
.
log
(
this
.
controlState
.
gridAgg
);
}
}
...
...
@@ -419,10 +429,10 @@ export class GridControl extends MainControl {
const
{
viewSubject
,
controlName
}
=
this
.
controlState
;
const
save
=
async
(
opt
:
any
=
{})
=>
{
try
{
const
{
controlService
,
context
,
viewParams
,
showBusyIndicator
,
items
,
controlAction
}
=
this
.
controlState
;
const
{
controlService
,
context
,
viewParams
,
showBusyIndicator
,
data
,
controlAction
}
=
this
.
controlState
;
// TODO 值规则校验处理
for
(
const
item
of
items
)
{
for
(
const
item
of
data
)
{
const
{
updateAction
,
createAction
}
=
controlAction
;
const
saveAction
:
any
=
item
.
rowDataState
==
"update"
?
updateAction
:
item
.
rowDataState
==
"create"
?
createAction
:
""
;
const
saveFunName
=
item
.
rowDataState
;
...
...
@@ -480,7 +490,7 @@ export class GridControl extends MainControl {
if
(
!
controlAction
.
removeAction
)
{
return
;
}
const
dataRef
=
toRef
(
this
.
controlState
,
"
items
"
);
const
dataRef
=
toRef
(
this
.
controlState
,
"
data
"
);
const
data
:
IParam
[]
=
[];
opt
.
forEach
((
item
:
IParam
,
index
:
number
)
=>
{
if
(
Object
.
is
(
item
.
srfuf
,
"0"
))
{
...
...
@@ -554,7 +564,7 @@ export class GridControl extends MainControl {
if
(
!
controlAction
.
loadDraftAction
)
{
return
;
}
const
dataRef
=
toRef
(
this
.
controlState
,
"
items
"
);
const
dataRef
=
toRef
(
this
.
controlState
,
"
data
"
);
let
_context
=
deepCopy
(
context
);
let
_viewParams
=
deepCopy
(
viewParams
);
const
arg
:
any
=
{...
opt
};
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/widgets/{{appEntities}}/{{ctrls@GRID}}-grid/{{ctrls@GRID}}-grid-config.ts.hbs
浏览文件 @
8844bf0c
...
...
@@ -23,46 +23,44 @@ export const CtrlConfig = {
controlCodeName: "
{{
ctrl
.
codeName
}}
",
controlName: "
{{
ctrl
.
name
}}
",
controlService: new GridService
<ControlVO>
(ControlVO, new
{{
pascalCase
ctrl
.
psAppDataEntity
.
codeName
}}
Service() ),
items: [],
dataAgg: [],
data: [],
selectedRowKeys: [],
aggMode: "
{{
ctrl
.
aggMode
}}
",
{{#if
(
eq
ctrl
.
aggMode
'ALL'
)
}}
aggEntity: "
{{
ctrl
.
aggPSAppDataEntity
.
codeName
}}
",
aggDataSet: "
{{
ctrl
.
aggPSAppDEDataSet
.
codeName
}}
",
{{/if}}
{{#if
ctrl
.
enableGroup
}}
groupMode: "
{{
ctrl
.
groupMode
}}
",
groupField: "
{{
lowerCase
ctrl
.
groupPSAppDEField
.
codeName
}}
",
{{#if
ctrl
.
groupPSCodeList
}}
groupCodeList: {
codeListTag: "
{{
ctrl
.
groupPSCodeList
.
codeName
}}
",
codeListType: "
{{
ctrl
.
groupPSCodeList
.
codeListType
}}
",
gridAgg: {
aggMode: "
{{
ctrl
.
aggMode
}}
",
aggData: [],
{{#if
ctrl
.
aggPSAppDataEntity
}}
aggEntity: "
{{
ctrl
.
aggPSAppDataEntity
.
codeName
}}
",
aggDataSet: "
{{
ctrl
.
aggPSAppDEDataSet
.
codeName
}}
",
{{/if}}
},
gridGroup: {
enableGroup:
{{
ctrl
.
enableGroup
}}
,
groupMode: "
{{
ctrl
.
groupMode
}}
",
groupField: "
{{
lowerCase
ctrl
.
groupPSAppDEField
.
codeName
}}
",
{{#if
ctrl
.
groupPSCodeList
}}
groupCodeList: {
codeListTag: "
{{
ctrl
.
groupPSCodeList
.
codeName
}}
",
codeListType: "
{{
ctrl
.
groupPSCodeList
.
codeListType
}}
",
},
{{/if}}
},
gridSort: {
noSort:
{{
ctrl
.
noSort
}}}
},
minorSortDir: "
{{#if
ctrl
.
minorSortDir
}}{{
ctrl
.
minorSortDir
}}{{/if}}
",
minorSortPSDEF: "
{{
ctrl
.
minorSortPSAppDEField
.
codeName
}}
",
},
{{/if}}
{{/if}}
{{#if
ctrl
.
noSort
}}
noSort: true,
{{else}}
noSort: false,
minorSortDir: "
{{#if
ctrl
.
minorSortDir
}}{{
ctrl
.
minorSortDir
}}{{/if}}
",
minorSortPSDEF: "
{{
ctrl
.
minorSortPSAppDEField
.
codeName
}}
",
{{/if}}
{{#if
ctrl
.
enablePagingBar
}}
enablePagingBar: true,
current: 1,
pageSize:
{{#if
ctrl
.
pagingSize
}}{{
ctrl
.
pagingSize
}}{{else}}
20
{{/if}}
,
pagination: {
position: ['bottomRight'],
defaultPageSize:
{{#if
ctrl
.
pagingSize
}}{{
ctrl
.
pagingSize
}}{{else}}
20
{{/if}}
,
showQuickJumper: true,
showTotal: (total: number, range: IParam[]) => `${range[0]}-${range[1]} of ${total} items`,
pageSizeOptions: ['10','20','50','100'],
gridPaging: {
enablePagingBar:
{{
ctrl
.
enablePagingBar
}}
,
current: 1,
pageSize:
{{#if
ctrl
.
pagingSize
}}{{
ctrl
.
pagingSize
}}{{else}}
20
{{/if}}
,
pagination:
{{#if
ctrl
.
enablePagingBar
}}
{
position: ['bottomRight'],
defaultPageSize:
{{#if
ctrl
.
pagingSize
}}{{
ctrl
.
pagingSize
}}{{else}}
20
{{/if}}
,
showQuickJumper: true,
showTotal: (total: number, range: IParam[]) => `${range[0]}-${range[1]} of ${total} items`,
pageSizeOptions: ['10','20','50','100'],
}
{{else}}
false
{{/if}}
,
},
{{else}}
enablePagingBar: false,
pagination: false,
{{/if}}
uAColumnModel:[
{{#
each
ctrl
.
psDEGridColumns
as
|
column
|
}}
{{>
(
lookup
'UACOLUMNMODEL'
)
item
=
column
}}
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/widgets/{{appEntities}}/{{ctrls@GRID}}-grid/{{ctrls@GRID}}-grid.vue.hbs
浏览文件 @
8844bf0c
...
...
@@ -112,10 +112,10 @@ const handleChange = (pagination: IParam, filters: IParam, sorter: IParam, data:
:showHeader=
"
{{#if
ctrl
.
hideHeader
}}
false
{{else}}
true
{{/if}}
"
:scroll=
"gridScrollOption"
:sortDirections=
"['ascend', 'descend']"
:data-source=
"state.
items
"
:data-source=
"state.
data
"
:row-selection=
"rowSelectionOption"
:columns=
"state.columnsModel"
:pagination=
"state.pagination"
:pagination=
"state.
gridPaging.
pagination"
:customRow=
"customRow"
:rowClassName=
"rowClassName"
@
change=
"handleChange"
...
...
@@ -142,7 +142,7 @@ const handleChange = (pagination: IParam, filters: IParam, sorter: IParam, data:
<a-table-summary>
<a-table-summary-row>
<a-table-summary-cell
align=
"center"
>
数据聚合
</a-table-summary-cell>
<a-table-summary-cell
v-for=
"(item, index) in state.
dataAgg
"
:key=
"index"
>
<a-table-summary-cell
v-for=
"(item, index) in state.
gridAgg.aggData
"
:key=
"index"
>
<span>
\{{item}}
</span>
</a-table-summary-cell>
</a-table-summary-row>
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录