Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibizlab-generator
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibizlab-generator
提交
938ecd72
提交
938ecd72
编写于
2月 23, 2022
作者:
MosYCo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update:更新多数据部件保存错误提示逻辑
上级
d4900644
变更
8
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
68 行增加
和
26 行删除
+68
-26
form-control-state.ts
...c/core/modules/widgets/form-control/form-control-state.ts
+1
-1
form-control.ts
...s}}/src/core/modules/widgets/form-control/form-control.ts
+7
-7
grid-control.ts
...s}}/src/core/modules/widgets/grid-control/grid-control.ts
+37
-11
md-control-state.ts
...}/src/core/modules/widgets/md-control/md-control-state.ts
+9
-2
md-control.ts
...{apps}}/src/core/modules/widgets/md-control/md-control.ts
+4
-3
control-vo-base.ts
...p_{{apps}}/src/core/runtime/control-vo/control-vo-base.ts
+1
-1
{{ctrls@FORM}}-form-state.ts.hbs
...es}}/{{ctrls@FORM}}-form/{{ctrls@FORM}}-form-state.ts.hbs
+1
-1
{{ctrls@GRID}}-grid-state.ts.hbs
...es}}/{{ctrls@GRID}}-grid/{{ctrls@GRID}}-grid-state.ts.hbs
+8
-0
未找到文件。
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/modules/widgets/form-control/form-control-state.ts
浏览文件 @
938ecd72
...
...
@@ -42,7 +42,7 @@ export interface FormControlState extends MainControlState {
* @type {string[]}
* @memberof FormControlState
*/
errorMessage
:
string
[];
errorMessage
s
:
string
[];
/**
* @description 表单通讯对象
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/modules/widgets/form-control/form-control.ts
浏览文件 @
938ecd72
...
...
@@ -827,10 +827,10 @@ export class FormControl extends MainControl {
result
=
false
;
if
(
error
.
errorFields
&&
error
.
errorFields
.
length
)
{
const
{
detailsModel
}
=
this
.
state
;
this
.
state
.
errorMessage
=
[];
this
.
state
.
errorMessage
s
=
[];
error
.
errorFields
.
forEach
((
field
:
IParam
)
=>
{
const
caption
=
detailsModel
[
field
.
name
[
0
]]?.
caption
;
this
.
state
.
errorMessage
.
push
(
`
${
caption
}
:
${
field
.
errors
?.
join
(
'、'
)}
`);
this
.
state
.
errorMessage
s
.
push
(
`
${
caption
}
:
${
field
.
errors
?.
join
(
'、'
)}
`);
});
}
}
...
...
@@ -844,16 +844,16 @@ export class FormControl extends MainControl {
* @memberof FormControl
*/
private showErrorMessage() {
const errorMessage
= this.state.errorMessage
;
if (errorMessage
&& errorMessage
.length) {
const errorMessage
s = this.state.errorMessages
;
if (errorMessage
s && errorMessages
.length) {
const getMessage = () => {
const messages: any[] = [];
errorMessage.forEach((message: string) => {
messages.push(h('
span
', {}, message));
errorMessage
s
.forEach((message: string) => {
messages.push(h('
p
', {}, message));
});
return messages;
}
const content = h('div', { class: 'error-messages'
, style: { 'display': 'flex', 'flex-direction': 'column' }
}, getMessage());
const content = h('div', { class: 'error-messages' }, getMessage());
App.getNotificationService().error({ message: '值规则错误', description: content });
}
}
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/modules/widgets/grid-control/grid-control.ts
浏览文件 @
938ecd72
import
{
DataTypes
,
dateFormat
,
deepCopy
,
GridControlState
,
IActionParam
,
IParam
,
isExistAndNotEmpty
,
MDControl
}
from
"@core"
;
import
{
DataTypes
,
dateFormat
,
deepCopy
,
GridControlState
,
IActionParam
,
IParam
,
isExistAndNotEmpty
,
MDControl
,
Verify
}
from
"@core"
;
import
{
createUUID
}
from
"qx-util"
;
import
schema
,
{
ErrorList
,
FieldErrorList
}
from
'async-validator'
;
import
{
Ref
}
from
"vue"
;
...
...
@@ -175,7 +175,7 @@ export class GridControl extends MDControl {
onResizeColumn
,
onGridChange
,
onExpandedRowsChange
,
formRef
:
useFormRef
()
formRef
:
useFormRef
()
}
}
...
...
@@ -242,21 +242,34 @@ export class GridControl extends MDControl {
* @memberof GridControl
*/
public
validateField
(
name
:
string
,
value
:
any
,
rowIndex
:
number
):
Promise
<
boolean
>
{
return
new
Promise
((
resolve
:
any
,
reject
:
any
)
=>
{
const
{
rules
,
gridEditState
}
=
toRefs
(
this
.
state
);
const
fi
le
Rule
=
rules
.
value
[
name
];
if
(
!
fi
le
Rule
)
{
return
new
Promise
((
resolve
:
any
)
=>
{
const
{
rules
,
gridEditState
,
columnsModel
}
=
toRefs
(
this
.
state
);
const
fi
eld
Rule
=
rules
.
value
[
name
];
if
(
!
fi
eld
Rule
)
{
resolve
(
true
);
return
;
}
const
validator
=
new
schema
({
[
name
]:
fi
le
Rule
});
const
validator
=
new
schema
({
[
name
]:
fi
eld
Rule
});
validator
.
validate
({
[
name
]:
value
},
undefined
,
(
errors
:
ErrorList
,
fields
:
FieldErrorList
)
=>
{
const
error
=
errors
?.
find
((
item
:
any
)
=>
{
return
item
.
field
===
name
;
})
gridEditState
.
value
[
name
][
rowIndex
]
=
error
;
});
if
(
error
)
{
gridEditState
.
value
[
name
][
rowIndex
]
=
error
;
const
caption
=
columnsModel
.
value
.
find
((
model
:
IParam
)
=>
{
return
model
.
dataIndex
===
name
;
})?.
title
;
const
errorMessage
=
`
${
caption
}
:
${
error
.
message
}
`
;
// 多行数据不保存重复错误提示信息
if
(
this
.
state
.
errorMessages
.
findIndex
((
m
:
string
)
=>
Object
.
is
(
m
,
errorMessage
))
===
-
1
)
{
this
.
state
.
errorMessages
.
push
(
errorMessage
);
}
resolve
(
false
);
}
else
{
resolve
(
true
);
}
})
})
})
;
}
/**
...
...
@@ -798,7 +811,20 @@ export class GridControl extends MDControl {
* @memberof GridControl
*/
protected
async
validateAll
():
Promise
<
boolean
>
{
return
true
;
const
{
items
}
=
toRefs
(
this
.
state
);
let
index
:
number
=
0
;
let
validateStatus
:
boolean
=
true
;
for
(
const
item
of
items
.
value
)
{
if
(
item
.
rowDataState
===
'create'
||
item
.
rowDataState
===
'update'
)
{
for
(
const
property
of
item
.
$ownKeys
)
{
if
(
!
await
this
.
validateField
(
property
,
item
[
property
],
index
))
{
validateStatus
=
false
;
}
}
}
index
+=
1
;
}
return
validateStatus
;
}
/**
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/modules/widgets/md-control/md-control-state.ts
浏览文件 @
938ecd72
import
{
ControlVOBase
,
IParam
,
MainControlState
}
from
'@core'
;
import
{
IParam
,
MainControlState
}
from
'@core'
;
/**
* @description 多数据部件状态
...
...
@@ -15,12 +15,19 @@ export interface MDControlState extends MainControlState {
*/
exportItems
?:
IParam
[];
/**
* @description 错误信息
* @type {string[]}
* @memberof MDControlState
*/
errorMessages
:
string
[];
/**
* @description 多数据部件数据
* @type {IParam[]}
* @memberof MDControlState
*/
items
:
ControlVOBase
[];
items
:
IParam
[];
/**
* @description 是否多选
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/modules/widgets/md-control/md-control.ts
浏览文件 @
938ecd72
...
...
@@ -322,6 +322,7 @@ export class MDControl extends MainControl {
isLoading
:
showBusyIndicator
,
});
this
.
setCreateDefault
(
response
.
data
);
response
.
data
.
rowDataState
=
'create'
;
if
(
response
.
status
||
response
.
status
==
200
)
{
items
.
value
.
push
(
response
.
data
);
}
...
...
@@ -638,11 +639,11 @@ export class MDControl extends MainControl {
* @memberof MDControl
*/
private
showErrorMessages
()
{
const
errorMessage
=
this
.
state
.
errorMessage
;
if
(
errorMessage
&&
errorMessage
.
length
)
{
const
errorMessage
s
=
this
.
state
.
errorMessages
;
if
(
errorMessage
s
&&
errorMessages
.
length
)
{
const
getMessage
=
()
=>
{
const
messages
:
any
[]
=
[];
errorMessage
.
forEach
((
message
:
string
)
=>
{
errorMessage
s
.
forEach
((
message
:
string
)
=>
{
messages
.
push
(
h
(
'p'
,
{},
message
));
});
return
messages
;
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/runtime/control-vo/control-vo-base.ts
浏览文件 @
938ecd72
import
{
deepCopy
,
IParam
}
from
'@core'
;
import
{
deepCopy
}
from
'@core'
;
export
class
ControlVOBase
{
/**
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/widgets/{{appEntities}}/{{ctrls@FORM}}-form/{{ctrls@FORM}}-form-state.ts.hbs
浏览文件 @
938ecd72
...
...
@@ -58,7 +58,7 @@ export const ctrlState = {
appDeMajorFieldName: '
{{#if
ctrl
.
appEntity
.
majorPSAppDEField
}}{{
ctrl
.
appEntity
.
majorPSAppDEField
.
codeName
}}{{/if}}
',
enableAutoSave:
{{
ctrl
.
enableAutoSave
}}
,
// 错误信息
errorMessage: [],
errorMessage
s
: [],
// 关系界面计数器
drCount: 0,
// 新建默认值
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/widgets/{{appEntities}}/{{ctrls@GRID}}-grid/{{ctrls@GRID}}-grid-state.ts.hbs
浏览文件 @
938ecd72
...
...
@@ -5,6 +5,14 @@ export class ControlVO extends ControlVOBase {
constructor(data: any){
super(data);
// 表格自持属性
this.$ownKeys =
{{
~#
each
ctrl
.
psDEGridDataItems
as
|
dataItem
|
~
}}
{{#if
@first
}}
[
{{/
if
~
}}
'
{{
lowerCase
dataItem
.
name
}}
'
{{#
unless
@last
}}
,
{{/
unless
}}
{{
~#
if
@last
}}
];
{{/
if
~
}}
{{/
each
}}
}
{{#
each
ctrl
.
psDEGridDataItems
as
|
dataItem
|
}}
{{#if
dataItem
.
psAppDEField
}}
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录