Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibizlab-generator
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibizlab-generator
提交
76b38363
提交
76b38363
编写于
1月 21, 2022
作者:
WodahsOrez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update: 系统预置界面行为
上级
c183d531
变更
8
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
224 行增加
和
16 行删除
+224
-16
app-sys-action.ts
...p_{{apps}}/src/core/logic/app-ui-action/app-sys-action.ts
+93
-0
main-view.ts
...pp_{{apps}}/src/core/modules/views/main-view/main-view.ts
+7
-2
view-base.ts
...pp_{{apps}}/src/core/modules/views/view-base/view-base.ts
+8
-0
control-base.ts
...s}}/src/core/modules/widgets/control-base/control-base.ts
+9
-1
form-control.ts
...s}}/src/core/modules/widgets/form-control/form-control.ts
+49
-4
grid-control.ts
...s}}/src/core/modules/widgets/grid-control/grid-control.ts
+2
-0
md-control.ts
...{apps}}/src/core/modules/widgets/md-control/md-control.ts
+54
-7
{{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/logic/app-ui-action/app-sys-action.ts
浏览文件 @
76b38363
...
...
@@ -68,6 +68,21 @@ export class AppSysAction {
case
'NewRow'
:
this
.
newRow
(
params
);
break
;
case
'Refresh'
:
this
.
refresh
(
params
);
break
;
case
'Exit'
:
this
.
exit
(
params
);
break
;
case
'SaveAndExit'
:
this
.
saveAndExit
(
params
);
break
;
case
'RemoveAndExit'
:
this
.
removeAndExit
(
params
);
break
;
case
'ToggleFilter'
:
this
.
toggleFilter
(
params
);
break
;
default
:
console
.
log
(
`未支持
${
tag
}
`
);
}
...
...
@@ -188,4 +203,82 @@ export class AppSysAction {
actionEnvironment
.
remove
();
}
}
/**
* 刷新
*
* @param params 界面行为参数对象
* @return {*}
*/
public
static
refresh
(
params
:
IUIActionParams
)
{
const
{
actionEnvironment
}
=
params
;
// 视图里获取多数据部件
if
(
hasFunction
(
actionEnvironment
.
xDataControl
,
"refresh"
)){
actionEnvironment
.
xDataControl
.
refresh
();
}
else
if
(
isExist
(
actionEnvironment
.
refresh
)){
actionEnvironment
.
refresh
();
}
}
/**
* 关闭
*
* @param params 界面行为参数对象
* @return {*}
*/
public
static
exit
(
params
:
IUIActionParams
)
{
const
{
actionEnvironment
}
=
params
;
if
(
isExist
(
actionEnvironment
.
closeView
)){
actionEnvironment
.
refresh
();
}
}
/**
* 保存并关闭
*
* @param params 界面行为参数对象
* @return {*}
*/
public
static
async
saveAndExit
(
params
:
IUIActionParams
)
{
const
{
actionEnvironment
}
=
params
;
// 视图里获取多数据部件
if
(
hasFunction
(
actionEnvironment
.
xDataControl
,
"save"
)){
await
actionEnvironment
.
xDataControl
.
save
();
}
else
if
(
isExist
(
actionEnvironment
.
save
)){
await
actionEnvironment
.
save
();
}
// 关闭视图
this
.
exit
(
params
);
}
/**
* 删除并关闭
*
* @param params 界面行为参数对象
* @return {*}
*/
public
static
async
removeAndExit
(
params
:
IUIActionParams
)
{
const
{
actionEnvironment
}
=
params
;
// 视图里获取多数据部件
if
(
hasFunction
(
actionEnvironment
.
xDataControl
,
"remove"
)){
await
actionEnvironment
.
xDataControl
.
remove
();
}
else
if
(
isExist
(
actionEnvironment
.
remove
)){
await
actionEnvironment
.
remove
();
}
// 关闭视图
this
.
exit
(
params
);
}
/**
* 过滤
*
* @param params 界面行为参数对象
* @return {*}
*/
public
static
toggleFilter
(
params
:
IUIActionParams
)
{
const
{
actionEnvironment
}
=
params
;
if
(
isExist
(
actionEnvironment
.
state
.
expandSearchForm
)){
actionEnvironment
.
state
.
expandSearchForm
=
!
actionEnvironment
.
state
.
expandSearchForm
;
}
}
}
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/modules/views/main-view/main-view.ts
浏览文件 @
76b38363
...
...
@@ -44,7 +44,7 @@ export class MainView extends ViewBase {
const
inputParam
=
{
context
:
this
.
state
.
context
,
viewParams
:
this
.
state
.
viewParams
,
data
:
this
.
xDataControl
?.
value
?.
data
,
data
:
this
.
xDataControl
?.
getData
?.()
,
event
:
data
.
event
,
actionEnvironment
:
this
};
...
...
@@ -58,7 +58,12 @@ export class MainView extends ViewBase {
* @param {IActionParam} actionParam
* @memberof MainView
*/
public
onCtrlEvent
(
actionParam
:
IActionParam
)
{
}
public
onCtrlEvent
(
actionParam
:
IActionParam
)
{
const
{
tag
,
action
,
data
}
=
actionParam
;
if
(
Object
.
is
(
action
,
'closeView'
))
{
this
.
closeView
();
}
}
/**
* @description 安装视图所有功能模块的方法
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/modules/views/view-base/view-base.ts
浏览文件 @
76b38363
...
...
@@ -88,6 +88,14 @@ export class ViewBase {
viewSubject
.
next
({
tag
:
tag
,
action
:
action
,
data
:
data
})
}
/**
* 关闭视图
*
*/
public
closeView
(){
window
.
history
.
go
(
-
1
);
}
/**
* @description 处理视图导航参数
*
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/modules/widgets/control-base/control-base.ts
浏览文件 @
76b38363
...
...
@@ -74,6 +74,14 @@ export class ControlBase {
return
[];
}
/**
* 关闭视图
*
*/
public
closeView
(){
this
.
emit
(
'ctrlEvent'
,
{
tag
:
this
.
props
.
name
,
action
:
'closeView'
,
data
:
undefined
});
}
/**
* @description 安装部件所有功能模块的方法
* @param {ControlPropsBase} props 传入的Props
...
...
@@ -86,7 +94,7 @@ export class ControlBase {
this
.
useControlContextParams
();
return
{
state
:
this
.
state
,
activeData
:
this
.
getData
()
getData
:
this
.
getData
};
}
}
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/modules/widgets/form-control/form-control.ts
浏览文件 @
76b38363
...
...
@@ -358,7 +358,6 @@ export class FormControl extends MainControl {
/**
* @description 使用加载草稿功能模块
* @param {FormControlProps} props 传入的props
* @return {*}
* @memberof FormControl
*/
...
...
@@ -579,11 +578,10 @@ export class FormControl extends MainControl {
/**
* @description 使用加载功能模块
* @param {FormControlProps} props 传入的props
* @return {*}
* @memberof FormControl
*/
public
useRemove
(
props
:
FormControlProps
)
{
public
useRemove
()
{
const
{
viewSubject
,
controlName
}
=
this
.
state
;
/**
...
...
@@ -632,7 +630,7 @@ export class FormControl extends MainControl {
// 订阅viewSubject,监听load行为
if
(
viewSubject
)
{
let
subscription
=
viewSubject
.
subscribe
(({
tag
,
action
,
data
}:
IActionParam
)
=>
{
if
(
Object
.
is
(
controlName
,
tag
)
&&
Object
.
is
(
'
load
'
,
action
))
{
if
(
Object
.
is
(
controlName
,
tag
)
&&
Object
.
is
(
'
remove
'
,
action
))
{
remove
(
data
);
}
});
...
...
@@ -646,6 +644,52 @@ export class FormControl extends MainControl {
return
remove
;
}
/**
* 刷新行为
*
* @protected
* @param [opt={}]
*/
protected
async
refresh
(
opt
:
any
=
{})
{}
/**
* @description 使用刷新功能模块
* @return {*}
* @memberof FormControl
*/
public
useRefresh
()
{
const
{
viewSubject
,
controlName
}
=
this
.
state
;
/**
* 刷新行为
*
* @param [opt={}]
* @return {*}
*/
const
refresh
=
async
(
opt
:
any
=
{})
=>
{
this
.
load
(
opt
);
};
// 在类里绑定能力方法
this
.
refresh
=
refresh
;
// 订阅viewSubject,监听load行为
if
(
viewSubject
)
{
let
subscription
=
viewSubject
.
subscribe
(({
tag
,
action
,
data
}:
IActionParam
)
=>
{
if
(
Object
.
is
(
controlName
,
tag
)
&&
Object
.
is
(
'refresh'
,
action
))
{
refresh
(
data
);
}
});
// 部件卸载时退订viewSubject
onUnmounted
(()
=>
{
subscription
.
unsubscribe
();
});
}
return
refresh
;
}
/**
* @description 处理编辑器事件
* @param {IActionParam} actionParam 行为参数
...
...
@@ -700,6 +744,7 @@ export class FormControl extends MainControl {
load
:
this
.
useLoad
(),
loadDraft
:
this
.
useLoadDraft
(),
save
:
this
.
useSave
(),
refresh
:
this
.
useRefresh
(),
onEditorEvent
:
this
.
onEditorEvent
.
bind
(
this
),
onComponentEvent
:
this
.
onComponentEvent
.
bind
(
this
),
};
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/modules/widgets/grid-control/grid-control.ts
浏览文件 @
76b38363
...
...
@@ -87,6 +87,8 @@ export class GridControl extends MDControl {
selection
.
push
(
select
);
}
})
// 选中赋值
this
.
state
.
selectedData
=
selection
;
this
.
emit
(
"ctrlEvent"
,
{
tag
:
this
.
props
.
name
,
action
:
"selectionChange"
,
data
:
selection
})
},
};
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/modules/widgets/md-control/md-control.ts
浏览文件 @
76b38363
import
{
MDControlState
,
MainControl
,
deepCopy
,
IActionParam
,
IParam
}
from
'@core'
;
import
{
MDControlState
,
MainControl
,
deepCopy
,
IActionParam
,
IParam
,
UIBase
}
from
'@core'
;
/**
* @description 多数据部件
...
...
@@ -24,7 +24,7 @@ export class MDControl extends MainControl {
this
.
state
.
isMultiple
=
toRef
(
this
.
props
,
'isMultiple'
)
as
any
;
this
.
state
.
rowEditState
=
toRef
(
this
.
props
,
'rowEditState'
)
as
any
;
this
.
state
.
rowActiveMode
=
toRef
(
this
.
props
,
'rowActiveMode'
)
as
any
;
this
.
state
.
selectedData
=
to
Ref
(
this
.
props
,
'selectedData'
)
as
any
;
this
.
state
.
selectedData
=
UIBase
.
toOneWay
Ref
(
this
.
props
,
'selectedData'
)
as
any
;
this
.
state
.
selectFirstDefault
=
toRef
(
this
.
props
,
'selectFirstDefault'
)
as
any
;
}
...
...
@@ -67,14 +67,14 @@ export class MDControl extends MainControl {
Object
.
assign
(
arg
,
tempViewParams
);
// 组装视图其他查询参数
this
.
emit
(
"ctrlEvent"
,
{
tag
:
this
.
props
.
name
,
action
:
'beforeload'
,
data
:
arg
});
this
.
emit
(
'ctrlEvent'
,
{
tag
:
this
.
props
.
name
,
action
:
'beforeload'
,
data
:
arg
});
const
response
=
await
controlService
.
search
(
tempContext
,
arg
,
{
action
:
controlAction
.
fetchAction
,
isLoading
:
showBusyIndicator
,
});
if
(
response
.
status
||
response
.
status
==
200
)
{
this
.
state
.
items
=
response
.
data
;
this
.
emit
(
"ctrlEvent"
,
{
tag
:
this
.
props
.
name
,
action
:
'load'
,
data
:
response
.
data
});
this
.
emit
(
'ctrlEvent'
,
{
tag
:
this
.
props
.
name
,
action
:
'load'
,
data
:
response
.
data
});
if
(
enablePagingBar
)
{
this
.
state
.
mdCtrlPaging
.
pagination
[
'total'
]
=
response
.
total
;
}
...
...
@@ -128,6 +128,7 @@ export class MDControl extends MainControl {
const
{
updateAction
,
createAction
}
=
controlAction
;
const
saveAction
:
any
=
item
.
rowDataState
==
'update'
?
updateAction
:
item
.
rowDataState
==
'create'
?
createAction
:
''
;
const
saveFunName
=
item
.
rowDataState
==
'update'
?
'update'
:
'create'
;
if
(
!
saveAction
)
{
return
;
}
...
...
@@ -136,7 +137,7 @@ export class MDControl extends MainControl {
let
_viewParams
=
deepCopy
(
viewParams
);
Object
.
assign
(
arg
,
item
.
getDo
());
Object
.
assign
(
arg
,
{
viewParams
:
_viewParams
});
const
response
=
await
controlService
[
save
Action
](
_context
,
arg
,
{
const
response
=
await
controlService
[
save
FunName
](
_context
,
arg
,
{
action
:
saveAction
,
isLoading
:
showBusyIndicator
,
});
...
...
@@ -306,6 +307,52 @@ export class MDControl extends MainControl {
return
newRow
;
}
/**
* 刷新行为
*
* @protected
* @param [opt={}]
*/
protected
async
refresh
(
opt
:
any
=
{})
{}
/**
* @description 使用刷新功能模块
* @return {*}
* @memberof MDControl
*/
public
useRefresh
()
{
const
{
viewSubject
,
controlName
}
=
this
.
state
;
/**
* 刷新行为
*
* @param [opt={}]
* @return {*}
*/
const
refresh
=
async
(
opt
:
any
=
{})
=>
{
this
.
load
(
opt
);
};
// 在类里绑定能力方法
this
.
refresh
=
refresh
;
// 订阅viewSubject,监听load行为
if
(
viewSubject
)
{
let
subscription
=
viewSubject
.
subscribe
(({
tag
,
action
,
data
}:
IActionParam
)
=>
{
if
(
Object
.
is
(
controlName
,
tag
)
&&
Object
.
is
(
'refresh'
,
action
))
{
refresh
(
data
);
}
});
// 部件卸载时退订viewSubject
onUnmounted
(()
=>
{
subscription
.
unsubscribe
();
});
}
return
refresh
;
}
/**
* 处理数据状态变化(逻辑数据+UI)
*
...
...
@@ -351,8 +398,7 @@ export class MDControl extends MainControl {
* @memberof MDControl
*/
public
getData
():
IParam
[]
{
const
{
selectedData
}
=
this
.
state
;
return
selectedData
;
return
this
.
state
.
selectedData
;
}
/**
...
...
@@ -368,6 +414,7 @@ export class MDControl extends MainControl {
save
:
this
.
useSave
(),
remove
:
this
.
useRemove
(),
newRow
:
this
.
useNewRow
(),
refresh
:
this
.
useRefresh
(),
};
}
}
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/widgets/{{appEntities}}/{{ctrls@GRID}}-grid/{{ctrls@GRID}}-grid.vue.hbs
浏览文件 @
76b38363
...
...
@@ -36,11 +36,11 @@ interface CtrlEmit {
const
emit
=
defineEmits
<
CtrlEmit
>
();
// 安装功能模块,提供状态和能力
const
{
state
,
useCustom
,
onEditorEvent
,
onToolbarEvent
,
newRow
,
remove
,
save
,
load
}
=
new
GridControl
(
ctrlState
,
props
,
emit
).
moduleInstall
();
const
{
state
,
useCustom
,
onEditorEvent
,
onToolbarEvent
,
newRow
,
remove
,
save
,
load
,
refresh
,
getData
}
=
new
GridControl
(
ctrlState
,
props
,
emit
).
moduleInstall
();
const
{
useScrollOption
,
useRowKey
,
useRowClassName
,
useCustomRow
,
useRowSelectionOption
,
onResizeColumn
,
onGridChange
}
=
useCustom
;
// 暴露内部状态及能力
defineExpose
({
state
,
name
:
'
{{
ctrl
.
name
}}
'
,
newRow
,
remove
,
save
,
load
});
defineExpose
({
state
,
name
:
'
{{
ctrl
.
name
}}
'
,
newRow
,
remove
,
save
,
load
,
refresh
,
getData
});
</script>
<template>
<a-table
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录