Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibizlab-generator
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibizlab-generator
提交
7909745b
提交
7909745b
编写于
2月 08, 2022
作者:
Mosher
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update:新增表格新建默认值和更新默认值支持
上级
3a16cf7b
变更
4
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
212 行增加
和
13 行删除
+212
-13
grid-control-state.ts
...c/core/modules/widgets/grid-control/grid-control-state.ts
+14
-0
grid-control.ts
...s}}/src/core/modules/widgets/grid-control/grid-control.ts
+135
-1
md-control.ts
...{apps}}/src/core/modules/widgets/md-control/md-control.ts
+19
-0
{{ctrls@GRID}}-grid-state.ts.hbs
...es}}/{{ctrls@GRID}}-grid/{{ctrls@GRID}}-grid-state.ts.hbs
+44
-12
未找到文件。
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/modules/widgets/grid-control/grid-control-state.ts
浏览文件 @
7909745b
...
...
@@ -15,6 +15,13 @@ export interface GridControlState extends MDControlState {
*/
columnsModel
:
IParam
[];
/**
* @description 新建默认值编辑项
* @type {IParam[]}
* @memberof GridControlState
*/
createDefaultItems
:
IParam
[];
/**
* @description 表格操作列行为模型
* @type {IParam}
...
...
@@ -44,4 +51,11 @@ export interface GridControlState extends MDControlState {
*/
gridAgg
:
IParam
;
/**
* @description 更新默认值编辑项
* @type {IParam[]}
* @memberof GridControlState
*/
updateDefaultItems
:
IParam
[];
}
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/modules/widgets/grid-control/grid-control.ts
浏览文件 @
7909745b
import
{
deepCopy
,
GridControlState
,
IActionParam
,
IParam
,
MDControl
}
from
"@core"
;
import
{
DataTypes
,
dateFormat
,
deepCopy
,
GridControlState
,
IActionParam
,
IParam
,
MDControl
}
from
"@core"
;
import
{
createUUID
}
from
"qx-util"
;
import
schema
,
{
ErrorList
,
FieldErrorList
}
from
'async-validator'
;
/**
...
...
@@ -493,6 +493,140 @@ export class GridControl extends MDControl {
}
}
/**
* 新建默认值
*
* @protected
* @param {IParam} [row={}]
* @memberof GridControl
*/
protected
setCreateDefault
(
row
:
IParam
=
{}):
void
{
const
{
createDefaultItems
,
viewParams
,
context
,
items
}
=
this
.
state
;
if
(
createDefaultItems
.
length
===
0
)
{
return
;
}
createDefaultItems
.
forEach
((
item
:
IParam
)
=>
{
const
{
createDVT
,
createDV
,
property
,
valueFormat
,
fieldType
}
=
item
;
if
(
createDVT
&&
row
.
hasOwnProperty
(
property
))
{
switch
(
createDVT
)
{
case
"CONTEXT"
:
if
(
createDV
)
{
row
[
property
]
=
viewParams
[
createDV
];
}
break
;
case
"SESSION"
:
case
"APPDATA"
:
if
(
createDV
)
{
row
[
property
]
=
context
[
createDV
];
}
break
;
case
"OPERATORNAME"
:
row
[
property
]
=
context
[
"srfusername"
];
break
;
case
"OPERATOR"
:
row
[
property
]
=
context
[
"srfuserid"
];
break
;
case
"CURTIME"
:
row
[
property
]
=
valueFormat
?
dateFormat
(
new
Date
(),
valueFormat
)
:
new
Date
();
break
;
case
"PARAM"
:
if
(
item
.
createDV
)
{
row
[
property
]
=
this
.
computeDefaultValueWithParam
(
"CREATE"
,
item
.
createDV
,
row
);
}
break
;
}
}
else
if
(
createDV
&&
row
.
hasOwnProperty
(
property
))
{
row
[
property
]
=
fieldType
&&
DataTypes
.
isNumber
(
fieldType
)
?
Number
(
createDV
)
:
createDV
;
}
});
}
/**
* 设置更新默认值
*
* @protected
* @return {*} {void}
* @memberof GridControl
*/
protected
setUpdateDefault
():
void
{
const
{
updateDefaultItems
,
viewParams
,
context
,
items
,
controlService
}
=
this
.
state
;
if
(
updateDefaultItems
.
length
===
0
||
items
.
length
===
0
)
{
return
;
}
const
setDefault
=
(
row
:
IParam
=
{})
=>
{
updateDefaultItems
.
forEach
((
item
:
IParam
)
=>
{
const
{
updateDV
,
updateDVT
,
property
,
valueFormat
,
fieldType
}
=
item
;
if
(
updateDVT
&&
row
.
hasOwnProperty
(
property
))
{
switch
(
updateDVT
)
{
case
"CONTEXT"
:
if
(
updateDV
)
{
row
[
property
]
=
viewParams
[
updateDV
];
}
break
;
case
"SESSION"
:
case
"APPDATA"
:
if
(
updateDV
)
{
row
[
property
]
=
context
[
updateDV
];
}
break
;
case
"OPERATORNAME"
:
row
[
property
]
=
context
[
"srfusername"
];
break
;
case
"OPERATOR"
:
row
[
property
]
=
context
[
"srfuserid"
];
break
;
case
"CURTIME"
:
row
[
property
]
=
valueFormat
?
dateFormat
(
new
Date
(),
valueFormat
)
:
new
Date
();
break
;
case
"PARAM"
:
if
(
item
.
createDV
)
{
row
[
property
]
=
this
.
computeDefaultValueWithParam
(
"UPDATE"
,
updateDV
,
row
);
}
break
;
}
}
else
if
(
updateDV
&&
row
.
hasOwnProperty
(
property
))
{
row
[
property
]
=
fieldType
&&
DataTypes
.
isNumber
(
fieldType
)
?
Number
(
updateDV
)
:
updateDV
;
}
});
}
items
.
forEach
((
item
:
IParam
)
=>
{
if
(
item
.
rowDataState
==
'update'
)
{
setDefault
(
item
);
}
});
}
/**
* 计算数据对象类型的默认值
* @private
* @param {('UPDATE' | 'CREATE')} action
* @param {string} param
* @param {IParam} row
* @return {*}
* @memberof GridControl
*/
private
computeDefaultValueWithParam
(
action
:
'UPDATE'
|
'CREATE'
,
param
:
string
,
row
:
IParam
)
{
const
{
controlService
,
appDeKeyFieldName
}
=
this
.
state
;
if
(
Object
.
is
(
action
,
"UPDATE"
))
{
const
nativeData
:
any
=
controlService
.
getCopynativeData
();
if
(
nativeData
&&
(
nativeData
instanceof
Array
)
&&
nativeData
.
length
>
0
)
{
const
targetData
:
any
=
nativeData
.
find
((
item
:
any
)
=>
{
return
item
[
appDeKeyFieldName
.
toLowerCase
()]
===
row
.
srfkey
;
});
if
(
targetData
)
{
return
targetData
[
param
]
?
targetData
[
param
]
:
null
;
}
else
{
return
null
;
}
}
else
{
return
null
;
}
}
else
{
const
remoteData
=
controlService
.
getRemoteCopyData
()[
param
];
return
remoteData
?
remoteData
:
null
;
}
}
/**
* @description 安装部件所有功能模块的方法
* @return {*}
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/modules/widgets/md-control/md-control.ts
浏览文件 @
7909745b
...
...
@@ -131,6 +131,7 @@ export class MDControl extends MainControl {
const
save
=
async
(
opt
:
any
=
{})
=>
{
try
{
const
{
controlService
,
context
,
viewParams
,
showBusyIndicator
,
items
,
controlAction
}
=
this
.
state
;
this
.
setUpdateDefault
();
// TODO 值规则校验处理
for
(
const
item
of
items
)
{
const
{
updateAction
,
createAction
}
=
controlAction
;
...
...
@@ -287,6 +288,7 @@ export class MDControl extends MainControl {
action
:
controlAction
.
loadDraftAction
,
isLoading
:
showBusyIndicator
,
});
this
.
setCreateDefault
(
response
.
data
);
if
(
response
.
status
||
response
.
status
==
200
)
{
items
.
value
=
[...
items
.
value
,
[
response
.
data
]];
}
...
...
@@ -400,6 +402,23 @@ export class MDControl extends MainControl {
*/
protected
codeListGroupData
()
{
}
/**
* 新建默认值
*
* @protected
* @param {IParam} [row={}]
* @memberof MDControl
*/
protected
setCreateDefault
(
row
:
IParam
=
{}):
void
{
}
/**
* 更新默认值
*
* @protected
* @memberof MDControl
*/
protected
setUpdateDefault
():
void
{
}
/**
* 获取当前激活数据
*
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/widgets/{{appEntities}}/{{ctrls@GRID}}-grid/{{ctrls@GRID}}-grid-state.ts.hbs
浏览文件 @
7909745b
...
...
@@ -24,6 +24,22 @@ export const ctrlState = {
controlName: '
{{
ctrl
.
name
}}
',
appEntityCodeName:'
{{
ctrl
.
appEntity
.
codeName
}}
',
controlService: new GridService
<ControlVO>
(ControlVO, new
{{
pascalCase
ctrl
.
psAppDataEntity
.
codeName
}}
Service() ),
// 新建默认值
createDefaultItems: [
{{#
each
ctrl
.
psDEGridEditItems
as
|
editItem
|
}}
{{#if
(
and
editItem
.
codeName
(
or
editItem
.
createDV
editItem
.
createDVT
))
}}
{
createDV: "
{{
editItem
.
createDV
}}
",
createDVT: "
{{
editItem
.
createDVT
}}
",
property: "
{{
lowerCase
editItem
.
codeName
}}
",
{{#if
editItem
.
psAppDEField
}}
valueFormat: "
{{
editItem
.
psAppDEField
.
valueFormat
}}
",
fieldType: "
{{
editItem
.
psAppDEField
.
stdDataType
}}
"
{{/if}}
}
{{#
unless
@last
}}
,
{{/
unless
}}
{{/if}}
{{/
each
}}
],
items: [],
selectedRowKeys: [],
// 多数据部件分组
...
...
@@ -97,6 +113,22 @@ export const ctrlState = {
],
// 是否单选
isSingleSelect:
{{#if
ctrl
.
singleSelect
}}{{
ctrl
.
singleSelect
}}{{else}}
false
{{/if}}
,
// 更新默认值
updateDefaultItems: [
{{#
each
ctrl
.
psDEGridEditItems
as
|
editItem
|
}}
{{#if
(
and
editItem
.
codeName
(
or
editItem
.
updateDV
editItem
.
updateDVT
))
}}
{
updateDV: "
{{
editItem
.
updateDV
}}
",
updateDVT: "
{{
editItem
.
updateDVT
}}
",
property: "
{{
lowerCase
editItem
.
codeName
}}
",
{{#if
editItem
.
psAppDEField
}}
valueFormat: "
{{
editItem
.
psAppDEField
.
valueFormat
}}
",
fieldType: "
{{
editItem
.
psAppDEField
.
stdDataType
}}
"
{{/if}}
}
{{#
unless
@last
}}
,
{{/
unless
}}
{{/if}}
{{/
each
}}
],
rules:{
{{#
each
ctrl
.
psDEGridEditItemVRs
as
|
ruleItem
|
}}
{{#if
(
eq
ruleItem
.
valueRuleType
'SYSVALUERULE'
)
}}
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录