Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibizlab-generator
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibizlab-generator
提交
3c609cf3
提交
3c609cf3
编写于
3月 18, 2022
作者:
Mosher
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update:更新
上级
0e167c54
变更
8
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
160 行增加
和
41 行删除
+160
-41
mpickup-view.ts
...pps}}/src/core/modules/views/mpickup-view/mpickup-view.ts
+93
-12
pickup-view.ts
...{apps}}/src/core/modules/views/pickup-view/pickup-view.ts
+25
-1
pickup-view-panel-control-state.ts
...kup-view-panel-control/pickup-view-panel-control-state.ts
+7
-0
pickup-view-panel-control.ts
...ts/pickup-view-panel-control/pickup-view-panel-control.ts
+24
-24
{{pages@DEMPICKUPVIEW}}-state.ts.hbs
...ages@DEMPICKUPVIEW}}/{{pages@DEMPICKUPVIEW}}-state.ts.hbs
+1
-0
{{pages@DEMPICKUPVIEW}}.vue.hbs
...}/{{pages@DEMPICKUPVIEW}}/{{pages@DEMPICKUPVIEW}}.vue.hbs
+8
-3
{{ctrls@PICKUPVIEWPANEL}}-pickup-view-panel-state.ts.hbs
.../{{ctrls@PICKUPVIEWPANEL}}-pickup-view-panel-state.ts.hbs
+1
-0
{{ctrls@PICKUPVIEWPANEL}}-pickup-view-panel.vue.hbs
...panel/{{ctrls@PICKUPVIEWPANEL}}-pickup-view-panel.vue.hbs
+1
-1
未找到文件。
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/modules/views/mpickup-view/mpickup-view.ts
浏览文件 @
3c609cf3
...
...
@@ -24,31 +24,112 @@ export class MPickupView extends PickupView {
*/
public
declare
props
:
MPickupViewProps
;
public
onMoveRight
()
{
/**
* 初始化选中数据
*
* @protected
* @memberof MPickupView
*/
protected
initSelectedData
()
{
const
{
viewParams
}
=
this
.
state
;
const
{
selectedData
,
selections
}
=
toRefs
(
this
.
state
);
const
selected
:
IParam
=
viewParams
?.
selectedData
?.[
0
]
||
{};
const
keys
=
selected
.
srfkey
?.
split
(
','
)
||
[];
const
texts
=
selected
.
srfmajortext
?.
split
(
','
)
||
[];
if
(
keys
.
length
&&
texts
.
length
)
{
keys
.
forEach
((
key
:
string
,
index
:
number
)
=>
{
selectedData
.
value
.
push
({
srfkey
:
key
,
srfmajortext
:
texts
[
index
]
});
});
}
selections
.
value
=
[...
selectedData
.
value
];
}
/**
* 将选中数据移动到右侧
*
* @protected
* @memberof MPickupView
*/
protected
onMoveRight
()
{
const
{
selections
,
selectedData
}
=
toRefs
(
this
.
state
);
selections
.
value
=
selectedData
.
value
;
}
public
onMoveLeft
()
{
const
{
selections
}
=
toRefs
(
this
.
state
);
const
index
=
selections
.
value
.
findIndex
((
selection
:
any
)
=>
Object
.
is
(
this
.
select
.
srfkey
,
selection
.
srfkey
));
if
(
index
!==
-
1
)
{
selections
.
value
.
splice
(
index
,
1
);
/**
* 移动到左侧
*
* @protected
* @memberof MPickupView
*/
protected
onMoveLeft
()
{
const
{
selections
,
rightPanelSelections
}
=
toRefs
(
this
.
state
);
if
(
rightPanelSelections
.
value
&&
rightPanelSelections
.
value
.
length
)
{
rightPanelSelections
.
value
.
forEach
((
pickItem
:
IParam
)
=>
{
const
index
=
selections
.
value
.
findIndex
((
select
:
IParam
)
=>
select
.
srfkey
===
pickItem
.
srfkey
);
if
(
index
!==
-
1
)
{
selections
.
value
.
splice
(
index
,
1
);
}
});
}
}
public
onAllMoveRight
()
{
//todo
/**
* 全部移到右侧(选中)
*
* @protected
* @memberof MPickupView
*/
protected
onAllMoveRight
()
{
if
(
this
.
xDataControl
&&
this
.
xDataControl
.
state
)
{
const
items
=
this
.
xDataControl
.
state
.
items
||
[];
const
{
selections
,
selectedData
}
=
toRefs
(
this
.
state
);
selectedData
.
value
=
[...
items
];
selections
.
value
=
[...
items
];
}
}
public
onAllMoveLeft
()
{
const
{
selections
,
selectedData
}
=
toRefs
(
this
.
state
);
/**
* 全部移到左侧(取消选中)
*
* @protected
* @memberof MPickupView
*/
protected
onAllMoveLeft
()
{
const
{
selections
}
=
toRefs
(
this
.
state
);
selections
.
value
=
[];
selectedData
.
value
=
[];
}
/**
* 右侧面板项点击
*
* @protected
* @param {IParam} item
* @param {MouseEvent} event
* @memberof MPickupView
*/
protected
onRightPanelClick
(
item
:
IParam
,
event
:
MouseEvent
)
{
console
.
log
(
"选中右侧面板数据"
,
item
,
event
);
const
{
rightPanelSelections
}
=
toRefs
(
this
.
state
);
}
/**
* 确认
*
* @memberof MPickupView
*/
public
onConfirm
():
void
{
const
{
selections
}
=
this
.
state
;
const
data
:
IParam
[]
=
[];
if
(
selections
&&
selections
.
length
)
{
let
srfkey
:
string
=
''
;
let
srfmajortext
:
string
=
''
;
selections
.
forEach
((
select
:
IParam
,
index
:
number
)
=>
{
srfkey
+=
`
${
select
.
srfkey
}${
index
!==
selections
.
length
-
1
?
','
:
''
}
`
;
srfmajortext
+=
`
${
select
.
srfmajortext
}${
index
!==
selections
.
length
-
1
?
','
:
''
}
`
;
});
data
.
push
({
srfkey
:
srfkey
,
srfmajortext
:
srfmajortext
});
}
this
.
emit
(
'viewEvent'
,
{
tag
:
this
.
state
.
viewName
,
action
:
'viewDataChange'
,
data
:
data
});
this
.
emit
(
'viewEvent'
,
{
tag
:
this
.
state
.
viewName
,
action
:
'viewClose'
,
data
:
null
});
}
/**
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/modules/views/pickup-view/pickup-view.ts
浏览文件 @
3c609cf3
import
{
IActionParam
}
from
"@core"
;
import
{
IParam
}
from
"@core/interface"
;
import
{
MainView
}
from
"../main-view"
;
import
{
PickupViewProps
}
from
"./pickup-view-prop"
;
import
{
PickupViewState
}
from
"./pickup-view-state"
;
...
...
@@ -25,6 +26,14 @@ export class PickupView extends MainView {
*/
public
declare
props
:
PickupViewProps
;
/**
* 选择视图面板引用
*
* @type {IParam}
* @memberof PickupView
*/
public
declare
pickupViewPanel
:
IParam
;
/**
* 使用视图初始化模块
*
...
...
@@ -32,8 +41,22 @@ export class PickupView extends MainView {
*/
public
useViewInit
()
{
super
.
useViewInit
();
this
.
pickupViewPanel
=
ref
(
null
);
this
.
initSelectedData
();
onMounted
(()
=>
{
this
.
xDataControl
=
unref
(
this
.
pickupViewPanel
);
});
}
/**
* 初始化选中数据
*
* @protected
* @memberof PickupView
*/
protected
initSelectedData
()
{
const
{
viewParams
}
=
this
.
state
;
this
.
state
.
selectedData
=
ref
(
viewParams
.
selectedData
)
||
ref
([]);
this
.
state
.
selectedData
=
viewParams
?.
selectedData
?
ref
(
viewParams
.
selectedData
)
:
ref
([]);
}
/**
...
...
@@ -79,6 +102,7 @@ export class PickupView extends MainView {
const
superParams
=
super
.
moduleInstall
();
return
{
...
superParams
,
pickupViewPanel
:
this
.
pickupViewPanel
,
onCancel
:
this
.
onCancel
.
bind
(
this
),
onConfirm
:
this
.
onConfirm
.
bind
(
this
)
};
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/modules/widgets/pickup-view-panel-control/pickup-view-panel-control-state.ts
浏览文件 @
3c609cf3
...
...
@@ -28,4 +28,11 @@ export interface PickupViewPanelControlState extends MainControlState {
* @memberof PickupViewPanelControlState
*/
selectedData
:
IParam
[];
/**
* @description 多数据视图数据集合
* @type {IParam[]}
* @memberof PickupViewPanelControlState
*/
items
:
IParam
[];
}
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/core/modules/widgets/pickup-view-panel-control/pickup-view-panel-control.ts
浏览文件 @
3c609cf3
...
...
@@ -18,28 +18,6 @@ export class PickupViewPanelControl extends MainControl {
*/
public
declare
state
:
PickupViewPanelControlState
;
/**
* @description
* @param {PickupViewPanelControlProps} props
* @memberof PickupViewPanelControl
*/
public
useLoad
(
props
:
PickupViewPanelControlProps
)
{
const
{
viewSubject
,
controlName
,
context
,
viewParams
}
=
this
.
state
;
// 订阅viewSubject,监听load行为
if
(
viewSubject
)
{
let
subscription
=
viewSubject
.
subscribe
(({
tag
,
action
,
data
}:
IActionParam
)
=>
{
if
(
Object
.
is
(
controlName
,
tag
)
&&
Object
.
is
(
"load"
,
action
))
{
viewSubject
.
next
({
tag
:
tag
,
action
:
"load"
,
data
:
data
});
}
})
// 部件卸载时退订viewSubject
onUnmounted
(()
=>
{
subscription
.
unsubscribe
();
})
}
}
/**
* 部件事件
*
...
...
@@ -52,6 +30,9 @@ export class PickupViewPanelControl extends MainControl {
if
(
Object
.
is
(
"selectionChange"
,
action
))
{
this
.
handleSelectionChange
(
data
);
}
if
(
Object
.
is
(
"viewLoad"
,
action
))
{
this
.
handleViewLoad
(
data
);
}
}
/**
...
...
@@ -66,7 +47,7 @@ export class PickupViewPanelControl extends MainControl {
if
(
items
&&
items
.
length
)
{
const
{
appDeKeyFieldName
,
appDeMajorFieldName
}
=
this
.
state
;
const
_items
:
IParam
[]
=
[];
items
.
forEach
((
item
:
IParam
,
index
:
number
)
=>
{
items
.
forEach
((
item
:
IParam
)
=>
{
_items
.
push
({
srfkey
:
item
.
srfkey
?
item
.
srfkey
:
item
[
appDeKeyFieldName
.
toLowerCase
()],
srfmajortext
:
item
.
srfmajortext
?
item
.
srfmajortext
:
item
[
appDeMajorFieldName
.
toLowerCase
()]
...
...
@@ -78,6 +59,26 @@ export class PickupViewPanelControl extends MainControl {
this
.
emit
(
"onCtrlEvent"
,
{
tag
:
this
.
props
.
name
,
action
:
'selectionChange'
,
data
:
[]
});
}
/**
* 处理视图加载完成事件
*
* @private
* @param {IParam[]} [data=[]]
* @memberof PickupViewPanelControl
*/
private
handleViewLoad
(
data
:
IParam
[]
=
[])
{
const
{
items
}
=
toRefs
(
this
.
state
);
const
{
appDeKeyFieldName
,
appDeMajorFieldName
}
=
this
.
state
;
const
_items
:
IParam
[]
=
[];
data
.
forEach
((
item
:
any
)
=>
{
_items
.
push
({
srfkey
:
item
.
srfkey
?
item
.
srfkey
:
item
[
appDeKeyFieldName
.
toLowerCase
()],
srfmajortext
:
item
.
srfmajortext
?
item
.
srfmajortext
:
item
[
appDeMajorFieldName
.
toLowerCase
()]
});
});
items
.
value
=
[...
_items
];
}
/**
* @description 安装部件所有功能模块的方法
* @return {*}
...
...
@@ -87,7 +88,6 @@ export class PickupViewPanelControl extends MainControl {
const
superParams
=
super
.
moduleInstall
();
return
{
...
superParams
,
load
:
this
.
useLoad
.
bind
(
this
),
onViewEvent
:
this
.
onViewEvent
.
bind
(
this
)
};
}
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/views/{{appModules}}/{{pages@DEMPICKUPVIEW}}/{{pages@DEMPICKUPVIEW}}-state.ts.hbs
浏览文件 @
3c609cf3
export const viewState = {
// 实际选中数据
selections: [],
selectedData: [],
// 右侧面板选中数据
rightPanelSelections: [],
{{>
@macro
/
front-end
/
views
/
view-base-config
.
hbs
}}
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/views/{{appModules}}/{{pages@DEMPICKUPVIEW}}/{{pages@DEMPICKUPVIEW}}.vue.hbs
浏览文件 @
3c609cf3
...
...
@@ -30,7 +30,7 @@ const emit = defineEmits<ViewEmit>();
// 安装功能模块,提供状态和能力方法
const
mpickupView
=
new
MPickupView
(
viewState
,
props
,
emit
).
moduleInstall
();
const
{
state
,
onCancel
,
onConfirm
,
onCtrlEvent
,
onMoveRight
,
onMoveLeft
,
onAllMoveRight
,
onAllMoveLeft
,
onRightPanelClick
}
=
mpickupView
;
const
{
state
,
pickupViewPanel
,
onCancel
,
onConfirm
,
onCtrlEvent
,
onMoveRight
,
onMoveLeft
,
onAllMoveRight
,
onAllMoveLeft
,
onRightPanelClick
}
=
mpickupView
;
</script>
<template>
...
...
@@ -55,6 +55,7 @@ const { state, onCancel, onConfirm, onCtrlEvent, onMoveRight, onMoveLeft, onAllM
{{#
eq
controlType
"PICKUPVIEWPANEL"
}}
<
{{
codeName
}}
PickupViewPanel
name=
"
{{
name
}}
"
ref=
"pickupViewPanel"
:context=
"state.context"
:rowEditState=
"state.rowEditState"
:rowActiveMode=
"state.gridRowActiveMode"
...
...
@@ -79,8 +80,12 @@ const { state, onCancel, onConfirm, onCtrlEvent, onMoveRight, onMoveLeft, onAllM
</a-space>
</a-col>
<a-col
:span=
"5"
class=
"split__right"
>
<div
v-for=
"(item, index) in state.selections"
:key=
"index"
class=
"selection-item"
@
click=
"(event) => onRightPanelClick(item, event)"
>
<span
class=
"text"
>
\{{item.srfmajortext}}
</span>
<div
v-for=
"(item, index) in state.selections"
:key=
"index"
:class=
"['picker-item', state.rightPanelSelections.includes((panel) => panel.srfkey === item.srfkey)]"
@
click=
"(event) => onRightPanelClick(item, event)"
>
<span
class=
"text"
>
\{{item.srfmajortext}}
</span>
</div>
</a-col>
</a-row>
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/widgets/{{appEntities}}/{{ctrls@PICKUPVIEWPANEL}}-pickup-view-panel/{{ctrls@PICKUPVIEWPANEL}}-pickup-view-panel-state.ts.hbs
浏览文件 @
3c609cf3
...
...
@@ -8,4 +8,5 @@ export const ctrlState = {
controlName: '
{{
ctrl
.
name
}}
',
selectedData: [],
data: {},
items: []
};
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/widgets/{{appEntities}}/{{ctrls@PICKUPVIEWPANEL}}-pickup-view-panel/{{ctrls@PICKUPVIEWPANEL}}-pickup-view-panel.vue.hbs
浏览文件 @
3c609cf3
...
...
@@ -40,7 +40,7 @@ const emit = defineEmits <CtrlEmit> ();
const
{
name
,
state
,
onViewEvent
}
=
new
PickupViewPanelControl
(
ctrlState
,
props
,
emit
).
moduleInstall
();
// 暴露内部状态及能力
defineExpose
({
name
,
state
});
defineExpose
({
name
,
state
});
</script>
<template>
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录