Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibizlab-generator
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibizlab-generator
提交
b306abd2
提交
b306abd2
编写于
2月 22, 2022
作者:
Mosher
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update:更新
上级
f1b77f76
变更
8
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
108 行增加
和
9 行删除
+108
-9
main-view.ts
...pp_{{apps}}/src/core/modules/views/main-view/main-view.ts
+15
-0
form-control.ts
...s}}/src/core/modules/widgets/form-control/form-control.ts
+8
-5
grid-control.ts
...s}}/src/core/modules/widgets/grid-control/grid-control.ts
+24
-1
md-control.ts
...{apps}}/src/core/modules/widgets/md-control/md-control.ts
+34
-1
verify.ts
...sources/templ/r7/app_{{apps}}/src/core/utils/ui/verify.ts
+20
-0
{{ctrls@FORM}}-form-state.ts.hbs
...es}}/{{ctrls@FORM}}-form/{{ctrls@FORM}}-form-state.ts.hbs
+3
-0
{{ctrls@GRID}}-grid-state.ts.hbs
...es}}/{{ctrls@GRID}}-grid/{{ctrls@GRID}}-grid-state.ts.hbs
+2
-0
{{ctrls@GRID}}-grid.vue.hbs
...ntities}}/{{ctrls@GRID}}-grid/{{ctrls@GRID}}-grid.vue.hbs
+2
-2
未找到文件。
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/modules/views/main-view/main-view.ts
浏览文件 @
b306abd2
...
...
@@ -185,6 +185,21 @@ export class MainView extends ViewBase {
});
}
/**
* @description 处理部件事件
* @param {IActionParam} actionParam
* @memberof MainView
*/
public
onCtrlEvent
(
actionParam
:
IActionParam
)
{
super
.
onCtrlEvent
(
actionParam
);
const
{
tag
,
action
,
data
}
=
actionParam
;
if
(
tag
===
this
.
state
.
xDataControlName
)
{
if
(
action
===
'save'
)
{
this
.
emit
(
'onViewEvent'
,
{
tag
:
this
.
state
.
viewName
,
action
:
'viewsave'
,
data
:
data
});
}
}
}
/**
* @description 安装视图所有功能模块的方法
*
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/modules/widgets/form-control/form-control.ts
浏览文件 @
b306abd2
...
...
@@ -518,7 +518,7 @@ export class FormControl extends MainControl {
* @protected
* @param [opt={}]
*/
protected
async
save
(
opt
:
any
=
{})
{
}
protected
async
save
(
opt
:
any
=
{}
,
showResultInfo
:
boolean
=
true
,
isStateNext
:
boolean
=
true
)
{
}
/**
* @description 使用加载功能模块
...
...
@@ -534,7 +534,7 @@ export class FormControl extends MainControl {
* @param [opt={}]
* @return {*}
*/
const
save
=
async
(
opt
:
any
=
{})
=>
{
const
save
=
async
(
opt
:
any
=
{}
,
showResultInfo
:
boolean
=
true
,
isStateNext
:
boolean
=
true
)
=>
{
try
{
// 获取需要的状态变量
const
{
controlService
,
context
,
viewParams
,
showBusyIndicator
,
data
,
formSubject
}
=
this
.
state
;
...
...
@@ -548,6 +548,8 @@ export class FormControl extends MainControl {
const
arg
:
any
=
{
...
opt
};
Object
.
assign
(
arg
,
data
.
getDo
());
Object
.
assign
(
arg
,
_viewParams
);
if
(
isStateNext
&&
this
.
state
.
drCount
>
0
)
{
}
// 拷贝模式
if
(
_viewParams
&&
_viewParams
.
copyMode
)
{
data
.
srfuf
=
'0'
;
...
...
@@ -630,7 +632,7 @@ export class FormControl extends MainControl {
const
remove
=
async
(
opt
:
any
=
{})
=>
{
try
{
// 获取需要的状态变量
const
{
controlService
,
context
,
viewParams
,
showBusyIndicator
}
=
this
.
state
;
const
{
controlService
,
context
,
viewParams
,
showBusyIndicator
,
formSubject
}
=
this
.
state
;
// 判断实体行为
const
removeAction
=
this
.
state
.
controlAction
.
removeAction
;
...
...
@@ -652,9 +654,10 @@ export class FormControl extends MainControl {
if
(
!
response
.
status
||
response
.
status
!==
200
)
{
return
;
}
// 请求后处理
this
.
state
.
data
=
response
.
data
;
// this.state.data = response.data;
formSubject
.
next
({
type
:
'remove'
,
data
:
response
.
data
});
// TODO 中心服务通知全局刷新
}
catch
(
error
)
{
// TODO 错误异常处理
console
.
log
(
error
);
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/modules/widgets/grid-control/grid-control.ts
浏览文件 @
b306abd2
...
...
@@ -17,6 +17,14 @@ export class GridControl extends MDControl {
*/
public
declare
state
:
GridControlState
;
/**
* @description 表单组件引用(用于校验值规则)
* @private
* @type {*}
* @memberof GridControl
*/
private
formRef
:
any
;
/**
* @description
* @param {GridControlProps} props
...
...
@@ -153,6 +161,10 @@ export class GridControl extends MDControl {
this
.
load
({
sort
:
`
${
sorter
.
field
}
,
${
sorter
.
order
==
'descend'
?
'desc'
:
'asc'
}
`
});
}
}
const
useFormRef
=
()
=>
{
this
.
formRef
=
ref
(
null
);
return
this
.
formRef
;
}
return
{
useScrollOption
,
useRowKey
,
...
...
@@ -162,7 +174,8 @@ export class GridControl extends MDControl {
useRowSelectionOption
,
onResizeColumn
,
onGridChange
,
onExpandedRowsChange
onExpandedRowsChange
,
formRef
:
useFormRef
()
}
}
...
...
@@ -778,6 +791,16 @@ export class GridControl extends MDControl {
}
}
/**
* @description 校验值规则
* @protected
* @return {*} {Promise<boolean>}
* @memberof GridControl
*/
protected
async
validateAll
():
Promise
<
boolean
>
{
return
true
;
}
/**
* @description 安装部件所有功能模块的方法
* @return {*}
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/modules/widgets/md-control/md-control.ts
浏览文件 @
b306abd2
...
...
@@ -137,7 +137,10 @@ export class MDControl extends MainControl {
try
{
const
{
controlService
,
context
,
viewParams
,
showBusyIndicator
,
items
,
controlAction
}
=
this
.
state
;
this
.
setUpdateDefault
();
// TODO 值规则校验处理
if
(
!
(
await
this
.
validateAll
()))
{
this
.
showErrorMessages
();
return
;
}
for
(
const
item
of
items
)
{
const
{
updateAction
,
createAction
}
=
controlAction
;
const
saveAction
:
any
=
...
...
@@ -619,6 +622,36 @@ export class MDControl extends MainControl {
return
this
.
state
.
selectedData
;
}
/**
* @description 校验值规则
* @protected
* @memberof MDControl
*/
protected
async
validateAll
():
Promise
<
boolean
>
{
// 各部件重写此方法完成校验逻辑
return
true
;
}
/**
* @description 展示错误信息
* @private
* @memberof MDControl
*/
private
showErrorMessages
()
{
const
errorMessage
=
this
.
state
.
errorMessage
;
if
(
errorMessage
&&
errorMessage
.
length
)
{
const
getMessage
=
()
=>
{
const
messages
:
any
[]
=
[];
errorMessage
.
forEach
((
message
:
string
)
=>
{
messages
.
push
(
h
(
'p'
,
{},
message
));
});
return
messages
;
}
const
content
=
h
(
'div'
,
{
class
:
'error-messages'
,
style
:
{
'display'
:
'flex'
,
'flex-direction'
:
'column'
}
},
getMessage
());
App
.
getNotificationService
().
error
({
message
:
'值规则错误'
,
description
:
content
});
}
}
/**
* @description 安装部件所有功能模块的方法
* @return {*}
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/utils/ui/verify.ts
浏览文件 @
b306abd2
import
Schema
from
'async-validator'
;
import
{
isEmpty
,
isExistAndNotEmpty
}
from
"@core"
;
/**
...
...
@@ -710,4 +711,23 @@ export class Verify {
// }
return
rules
;
}
/**
* 校验项规则
*
* @static
* @param {string} property
* @param {*} data
* @param {*} rules
* @return {*}
* @memberof Verify
*/
public
static
validateItem
(
property
:
string
,
data
:
any
,
rules
:
any
)
{
// 1.获取数值和规则
const
rule
=
rules
[
property
];
// 2.创建校验规则
const
schema
=
new
Schema
({
[
property
]:
rule
});
// 校验返回Promise
return
schema
.
validate
(
data
);
}
}
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/widgets/{{appEntities}}/{{ctrls@FORM}}-form/{{ctrls@FORM}}-form-state.ts.hbs
浏览文件 @
b306abd2
...
...
@@ -57,7 +57,10 @@ export const ctrlState = {
appDeKeyFieldName: '
{{#if
ctrl
.
appEntity
.
keyPSAppDEField
}}{{
ctrl
.
appEntity
.
keyPSAppDEField
.
codeName
}}{{/if}}
',
appDeMajorFieldName: '
{{#if
ctrl
.
appEntity
.
majorPSAppDEField
}}{{
ctrl
.
appEntity
.
majorPSAppDEField
.
codeName
}}{{/if}}
',
enableAutoSave:
{{
ctrl
.
enableAutoSave
}}
,
// 错误信息
errorMessage: [],
// 关系界面计数器
drCount: 0,
// 新建默认值
createDefaultItems: [
{{#
each
ctrl
.
psDEFormItems
as
|
formItem
|
}}
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/widgets/{{appEntities}}/{{ctrls@GRID}}-grid/{{ctrls@GRID}}-grid-state.ts.hbs
浏览文件 @
b306abd2
...
...
@@ -54,6 +54,8 @@ export const ctrlState = {
{{/if}}
{{/
each
}}
],
// 错误信息
errorMessages: [],
{{#if
(
and
ctrl
.
psDEDataExport
ctrl
.
psDEDataExport
.
psDEDataExportItems
)
}}
// 数据导出
exportItems: [
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/widgets/{{appEntities}}/{{ctrls@GRID}}-grid/{{ctrls@GRID}}-grid.vue.hbs
浏览文件 @
b306abd2
...
...
@@ -40,7 +40,7 @@ const emit = defineEmits<CtrlEmit>();
// 安装功能模块,提供状态和能力
const
{
name
,
state
,
useCustom
,
onEditorEvent
,
onToolbarEvent
,
onActionColEvent
,
newRow
,
remove
,
save
,
load
,
refresh
,
getData
,
exportExcel
}
=
new
GridControl
(
ctrlState
,
props
,
emit
).
moduleInstall
();
const
{
useScrollOption
,
useRowKey
,
useRowClassName
,
useCustomRow
,
useRowSelectionOption
,
onResizeColumn
,
onGridChange
,
useExpandedRowKeys
,
onExpandedRowsChange
}
=
useCustom
;
const
{
useScrollOption
,
useRowKey
,
useRowClassName
,
useCustomRow
,
useRowSelectionOption
,
onResizeColumn
,
onGridChange
,
useExpandedRowKeys
,
onExpandedRowsChange
,
formRef
}
=
useCustom
;
{{#if
ctrl
.
batchToolBarItems
}}
const
renderBatchToolbar
=
(
total
:
number
,
range
:
IParam
[])
=>
{
return
(
...
...
@@ -62,7 +62,7 @@ const renderBatchToolbar = (total: number, range: IParam[]) => {
defineExpose
({
name
,
state
,
newRow
,
remove
,
save
,
load
,
refresh
,
getData
,
exportExcel
});
</script>
<template>
<a-form
name=
"
{{
ctrl
.
name
}}
"
class=
"app-grid-form"
>
<a-form
name=
"
{{
ctrl
.
name
}}
"
class=
"app-grid-form"
ref=
"formRef"
>
<a-table
bordered
sticky
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录