Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibizlab-generator
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibizlab-generator
提交
d4900644
提交
d4900644
编写于
2月 22, 2022
作者:
LUCIFER-ZHU
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update:更新复合表单项相关组件
上级
b306abd2
变更
4
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
433 行增加
和
4 行删除
+433
-4
form-item.hbs
...mpl/r7/@macro/front-end/widgets/form-detail/form-item.hbs
+77
-4
app-date-range.vue
.../r7/app_{{apps}}/src/components/common/app-date-range.vue
+93
-0
app-number-range.vue
...7/app_{{apps}}/src/components/common/app-number-range.vue
+104
-0
app-range-editor.vue
...7/app_{{apps}}/src/components/common/app-range-editor.vue
+159
-0
未找到文件。
modules/ibizlab-generator-core/src/main/resources/templ/r7/@macro/front-end/widgets/form-detail/form-item.hbs
浏览文件 @
d4900644
...
...
@@ -25,10 +25,83 @@
style=
"
{{#if
item
.
width
}}
width:
{{
item
.
width
}}
px;
{{/if}}{{#if
item
.
height
}}
height:
{{
item
.
height
}}
px;
{{/if}}
"
{{/if}}
>
{{#if
item
.
psEditor
}}
{{#if
item
.
compositeItem
}}
{{#if
(
or
(
eq
item
.
psEditor
.
editorType
'DATERANGE'
)
(
eq
item
.
psEditor
.
editorType
'DATERANGE_NOTIME'
))
}}
<AppDateRange
:refFormItem=
"
{{#if
item
.
psDEFormItems
}}
{{
~#
each
item
.
psDEFormItems
as
|
formItem
|
~
}}
{{#if
@first
}}
[
{{/
if
~
}}
'
{{
formItem
.
name
}}
'
{{#
unless
@last
}}
,
{{/
unless
}}
{{
~#
if
@last
}}
]
{{/
if
~
}}
{{/
each
}}
{{else}}
[]
{{/if}}
"
name=
"
{{
item
.
codeName
}}
"
:value=
"state.data.
{{
item
.
psEditor
.
name
}}
"
:activeData=
"state.data"
editorType=
"
{{
item
.
psEditor
.
editorType
}}
"
:disabled=
"state.detailsModel.
{{
item
.
codeName
}}
.disabled"
{{#if
item
.
psEditor
.
editorParams
.
TIMEFMT
}}
format=
"
{{
item
.
psEditor
.
editorParams
.
TIMEFMT
}}
"
{{/if}}
@
editorEvent=
"onEditorEvent"
>
</AppDateRange>
{{else
if
(
eq
item
.
psEditor
.
editorType
'NUMBERRANGE'
)
}}
<AppNumberRange
:refFormItem=
"
{{#if
item
.
psDEFormItems
}}
{{
~#
each
item
.
psDEFormItems
as
|
formItem
|
~
}}
{{#if
@first
}}
[
{{/
if
~
}}
'
{{
formItem
.
name
}}
'
{{#
unless
@last
}}
,
{{/
unless
}}
{{
~#
if
@last
}}
]
{{/
if
~
}}
{{/
each
}}
{{else}}
[]
{{/if}}
"
name=
"
{{
item
.
codeName
}}
"
:value=
"state.data.
{{
item
.
psEditor
.
name
}}
"
:activeData=
"state.data"
editorType=
"
{{
item
.
psEditor
.
editorType
}}
"
:disabled=
"state.detailsModel.
{{
item
.
codeName
}}
.disabled"
{{#if
item
.
psEditor
.
editorParams
.
TIMEFMT
}}
format=
"
{{
item
.
psEditor
.
editorParams
.
TIMEFMT
}}
"
{{/if}}
@
editorEvent=
"onEditorEvent"
>
</AppNumberRange>
{{else}}
<AppRangeEditor
:refFormItem=
"
{{#if
item
.
psDEFormItems
}}
{{
~#
each
item
.
psDEFormItems
as
|
formItem
|
~
}}
{{#if
@first
}}
[
{{/
if
~
}}
'
{{
formItem
.
name
}}
'
{{#
unless
@last
}}
,
{{/
unless
}}
{{
~#
if
@last
}}
]
{{/
if
~
}}
{{/
each
}}
{{else}}
[]
{{/if}}
"
name=
"
{{
item
.
codeName
}}
"
:value=
"state.data.
{{
item
.
psEditor
.
name
}}
"
:activeData=
"state.data"
editorType=
"
{{
item
.
psEditor
.
editorType
}}
"
:disabled=
"state.detailsModel.
{{
item
.
codeName
}}
.disabled"
{{#if
item
.
psEditor
.
editorParams
.
TIMEFMT
}}
format=
"
{{
item
.
psEditor
.
editorParams
.
TIMEFMT
}}
"
{{/if}}
@
editorEvent=
"onEditorEvent"
>
</AppRangeEditor>
{{/if}}
{{else}}
{{#if
item
.
psEditor
}}
<div
class=
"form-editor-container"
style=
"
{{#if
item
.
psEditor
.
editorWidth
}}
width:
{{
item
.
psEditor
.
editorWidth
}}
px;
{{/if}}{{#if
item
.
psEditor
.
editorHeight
}}
height:
{{
item
.
psEditor
.
editorHeight
}}
px
{{/if}}
"
>
{{>
@macro
/
front-end
/
editors
/
include-editor
.
hbs
type
=
item
.
psEditor
.
editorType
item
=
item
ctrlType
=
"form"
}}
</div>
{{/if}}
{{/if}}
</AppFormItem>
{{/
neq
}}
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/components/common/app-date-range.vue
0 → 100644
浏览文件 @
d4900644
<
script
setup
lang=
"ts"
>
import
{
IActionParam
,
IParam
}
from
'@core'
;
import
{
debounceTime
,
distinctUntilChanged
,
Subject
}
from
'rxjs'
;
interface
AppDateRangeProps
{
refFormItem
:
any
;
name
:
string
;
value
:
IParam
;
activeData
:
IParam
;
editorType
:
string
;
disabled
:
boolean
;
format
?:
any
;
}
const
props
=
withDefaults
(
defineProps
<
AppDateRangeProps
>
(),
{});
// 抛出事件集合
interface
EmitEvents
{
(
name
:
'editorEvent'
,
value
:
IActionParam
):
void
;
}
// 抛出事件
const
emit
=
defineEmits
<
EmitEvents
>
();
/**
* 处理值格式
*
* @readonly
* @memberof AppDateRange
*/
const
valFormat
=
computed
(()
=>
{
if
(
props
.
format
)
{
return
props
.
format
.
replace
(
'YYYY'
,
'yyyy'
).
replace
(
'DD'
,
'dd'
);
}
else
{
return
''
}
});
/**
* 处理时间格式
*
* @readonly
* @memberof AppDateRange
*/
const
datetype
=
computed
(()
=>
{
return
Object
.
is
(
props
.
editorType
,
'DATERANGE'
)
?
'date'
:
'time'
;
});
/**
* 获取值
*
* @param {string} name
* @returns
* @memberof AppDateRange
*/
const
curdate
=
computed
({
get
:
()
=>
{
let
value
:
any
[]
=
[];
props
.
refFormItem
.
forEach
((
foritem
:
any
)
=>
{
if
(
props
.
activeData
[
foritem
])
{
value
.
push
(
props
.
activeData
[
foritem
]);
}
})
return
value
;
},
set
:
(
dates
:
any
)
=>
{
if
(
dates
)
{
dates
.
forEach
((
date
:
any
,
index
:
number
)
=>
{
emit
(
'editorEvent'
,
{
tag
:
props
.
refFormItem
[
index
],
action
:
'valueChange'
,
data
:
date
});
});
}
else
{
props
.
refFormItem
.
forEach
((
foritem
:
any
)
=>
{
emit
(
'editorEvent'
,
{
tag
:
foritem
,
action
:
'valueChange'
,
data
:
null
});
})
}
}
})
</
script
>
<
template
>
<div
class=
"app-date-range"
>
<a-range-picker
v-model=
'curdate'
:picker=
"datetype"
:format=
"valFormat"
:disabled=
"disabled"
:readonly=
"readonly"
separator=
"至"
>
</a-range-picker>
</div>
</
template
>
<
style
lang=
"scss"
>
</
style
>
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/components/common/app-number-range.vue
0 → 100644
浏览文件 @
d4900644
<
script
setup
lang=
"ts"
>
import
{
IActionParam
,
IParam
}
from
'@core'
;
interface
AppNumberRangeProps
{
refFormItem
:
any
;
name
:
string
;
value
:
IParam
;
activeData
:
IParam
;
editorType
:
string
;
disabled
:
boolean
;
precision
?:
number
;
}
const
props
=
withDefaults
(
defineProps
<
AppNumberRangeProps
>
(),
{
precision
:
0
,
});
// 抛出事件集合
interface
EmitEvents
{
(
name
:
'editorEvent'
,
value
:
IActionParam
):
void
;
}
// 抛出事件
const
emit
=
defineEmits
<
EmitEvents
>
();
/**
* 值改变
*
* @param {string} name
* @param {*} value
* @memberof AppNumberRange
*/
const
onValueChange
=
(
$event
:
any
,
index
:
number
)
=>
{
let
value
;
value
=
$event
;
if
(
props
.
refFormItem
?.
length
==
2
)
{
emit
(
'editorEvent'
,
{
tag
:
props
.
refFormItem
[
index
],
action
:
'valueChange'
,
data
:
value
});
}
};
/**
* 最小值
*
* @memberof AppNumberRange
*/
let
minValue
:
any
=
null
;
/**
* 最大值
*
* @memberof AppNumberRange
*/
let
maxValue
:
any
=
null
;
/**
* Vue生命周期onMounted
*/
onMounted
(()
=>
{
if
(
props
.
refFormItem
?.
length
==
2
)
{
if
(
props
.
activeData
[
props
.
refFormItem
[
0
]])
{
minValue
=
parseFloat
(
props
.
activeData
[
props
.
refFormItem
[
0
]]);
}
if
(
props
.
activeData
[
props
.
refFormItem
[
1
]])
{
maxValue
=
parseFloat
(
props
.
activeData
[
props
.
refFormItem
[
1
]]);
}
}
});
</
script
>
<
template
>
<div
class=
"app-number-range"
>
<a-input-number
:max=
"!maxValue && maxValue != 0 ? Infinity : maxValue - 1"
v-model=
"minValue"
:disabled=
"disabled"
:precision=
"precision"
@
change=
"(value) =>
{onValueChange(value, 0)}"
>
</a-input-number>
<div
class=
"range-separator"
>
~
</div>
<a-input-number
:min=
"minValue + 1"
v-model=
"maxValue"
:disabled=
"disabled"
:precision=
"precision"
@
change=
"(value) =>
{onValueChange(value, 1)}"
>
</a-input-number>
</div>
</
template
>
<
style
lang=
"scss"
>
.app-number-range
{
width
:
100%
;
display
:
flex
;
.range-separator
{
width
:
30px
;
font-size
:
33px
;
padding
:
0
5px
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
}
}
</
style
>
\ No newline at end of file
modules/ibizlab-generator-core/src/main/resources/templ/r7/app_{{apps}}/src/components/common/app-range-editor.vue
0 → 100644
浏览文件 @
d4900644
<
script
setup
lang=
"ts"
>
import
{
IActionParam
,
IParam
}
from
'@core'
;
import
{
debounceTime
,
distinctUntilChanged
,
Subject
}
from
'rxjs'
;
interface
AppRangeEditorProps
{
refFormItem
:
any
;
name
:
string
;
value
:
IParam
;
activeData
:
IParam
;
editorType
:
string
;
disabled
:
boolean
;
format
?:
any
;
}
const
props
=
withDefaults
(
defineProps
<
AppRangeEditorProps
>
(),
{});
// 抛出事件集合
interface
EmitEvents
{
(
name
:
'editorEvent'
,
value
:
IActionParam
):
void
;
}
// 抛出事件
const
emit
=
defineEmits
<
EmitEvents
>
();
/**
* 值变化时间
*
* @private
* @type {Subject<any>}
* @memberof AppRangeEditor
*/
const
inputDataChang
:
Subject
<
any
>
=
new
Subject
();
/**
* 处理值格式
*
* @readonly
* @memberof AppRangeEditor
*/
const
valFormat
=
computed
(()
=>
{
if
(
props
.
format
)
{
return
props
.
format
.
replace
(
'YYYY'
,
'yyyy'
).
replace
(
'DD'
,
'dd'
);
}
});
/**
* 获取值
*
* @param {string} name
* @returns
* @memberof AppRangeEditor
*/
const
getValue
=
(
name
:
string
)
=>
{
return
props
.
activeData
[
name
];
};
/**
* 值改变
*
* @param {string} name
* @param {*} value
* @memberof AppRangeEditor
*/
const
onValueChange
=
(
name
:
string
,
$event
:
any
)
=>
{
let
value
;
if
(
Object
.
is
(
props
.
editorType
,
'DATEPICKEREX'
)
||
Object
.
is
(
props
.
editorType
,
'DATEPICKEREX_NOTIME'
)
||
Object
.
is
(
props
.
editorType
,
'DATEPICKER'
)
)
{
value
=
$event
;
}
else
if
(
props
.
editorType
.
startsWith
(
'DATEPICKEREX'
))
{
value
=
$event
;
}
else
if
(
Object
.
is
(
props
.
editorType
,
'NUMBER'
))
{
value
=
$event
;
}
else
{
value
=
$event
.
target
.
value
;
}
emit
(
'editorEvent'
,
{
tag
:
name
,
action
:
'valueChange'
,
data
:
value
});
};
/**
* Vue生命周期beforeMount
*/
onBeforeMount
(()
=>
{
inputDataChang
.
pipe
(
debounceTime
(
500
),
distinctUntilChanged
()).
subscribe
((
data
:
any
)
=>
{
emit
(
'editorEvent'
,
{
tag
:
data
.
name
,
action
:
'valueChange'
,
data
:
data
.
value
});
});
});
</
script
>
<
template
>
<div
class=
"app-range-editor"
>
<template
v-for=
"(item, index) in refFormItem"
>
<span
v-if=
"index > 0"
class=
"editor-space"
:key=
"index+10"
>
~
</span>
<a-date-picker
:key=
"index"
v-if=
"Object.is(editorType, 'DATEPICKEREX') || Object.is(editorType, 'DATEPICKEREX_NOTIME') || Object.is(editorType, 'DATEPICKER')"
picker=
"date"
:format=
"valFormat"
placeholder=
"请选择时间..."
:value=
"activeData[item]"
:disabled=
"disabled"
:inputReadOnly=
"readonly"
@
change=
"(value,type)=>
{onValueChange(item,value)}"
>
</a-date-picker>
<a-time-picker
:key=
"index+1"
v-else-if=
"editorType.startsWith('DATEPICKEREX')"
:format=
"valFormat"
placeholder=
"请选择时间..."
:value=
"activeData[item]"
:disabled=
"disabled"
:inputReadOnly=
"readonly"
@
change=
"(value)=>
{onValueChange(item,value)}"
>
</a-time-picker>
<a-input-number
:key=
"index+2"
v-else-if=
"Object.is(editorType, 'NUMBER')"
:value=
"activeData[item]"
:disabled=
"disabled"
placeholder=
"请输入..."
@
change=
"(value)=>
{onValueChange(item,value)}"
>
</a-input-number>
<AppSpan
:key=
"index+3"
v-else-if=
"Object.is(editorType, 'SPAN')"
:value=
"activeData[item]"
:disabled=
"disabled"
>
</AppSpan>
<a-input
:key=
"index+4"
v-else
:value=
"getValue(item)"
:disabled=
"disabled"
placeholder=
"请输入..."
@
change=
"(value)=>
{onValueChange(item,value)}"
>
</a-input>
</
template
>
</div>
</template>
<
style
lang=
"scss"
>
.app-range-editor
{
display
:
flex
;
.editor-space
{
padding
:
0
5px
;
font-size
:
15px
;
}
}
</
style
>
\ No newline at end of file
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录