Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
F
formbase
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
shu
formbase
提交
2a9555c9
提交
2a9555c9
编写于
12月 11, 2019
作者:
ibizdev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ibizdev提交
上级
3b6b74b3
变更
3
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
274 行增加
和
1 行删除
+274
-1
App.vue
app_Default/src/App.vue
+8
-1
main2.vue
app_Default/src/forms/example/main2/main2.vue
+222
-0
example-main2-edit-view.vue
...pmple/example-main2-edit-view/example-main2-edit-view.vue
+44
-0
未找到文件。
app_Default/src/App.vue
浏览文件 @
2a9555c9
...
@@ -17,6 +17,10 @@
...
@@ -17,6 +17,10 @@
<a-icon
type=
"upload"
/>
<a-icon
type=
"upload"
/>
<span>
表单项动态逻辑示例
</span>
<span>
表单项动态逻辑示例
</span>
</a-menu-item>
</a-menu-item>
<a-menu-item
key=
"3"
>
<a-icon
type=
"user"
/>
<span>
DemoForm
</span>
</a-menu-item>
</a-menu>
</a-menu>
</a-layout-sider>
</a-layout-sider>
<a-layout>
<a-layout>
...
@@ -24,6 +28,7 @@
...
@@ -24,6 +28,7 @@
<ExampleEditorType
v-show=
"curSelected == '0'"
/>
<ExampleEditorType
v-show=
"curSelected == '0'"
/>
<ExampleEditView
v-show=
"curSelected == '1'"
/>
<ExampleEditView
v-show=
"curSelected == '1'"
/>
<ExampleDLFEditView
v-show=
"curSelected == '2'"
/>
<ExampleDLFEditView
v-show=
"curSelected == '2'"
/>
<ExampleMain2EditView
v-show=
"curSelected == '3'"
/>
</a-layout-content>
</a-layout-content>
</a-layout>
</a-layout>
</a-layout>
</a-layout>
...
@@ -39,13 +44,15 @@ import AppService from "@service/AppService";
...
@@ -39,13 +44,15 @@ import AppService from "@service/AppService";
import
ExampleEditorType
from
'@pages/exapmple/example-editor-type/example-editor-type.vue'
;
import
ExampleEditorType
from
'@pages/exapmple/example-editor-type/example-editor-type.vue'
;
import
ExampleEditView
from
'@pages/exapmple/example-edit-view/example-edit-view.vue'
;
import
ExampleEditView
from
'@pages/exapmple/example-edit-view/example-edit-view.vue'
;
import
ExampleDLFEditView
from
'@pages/exapmple/example-dlfedit-view/example-dlfedit-view.vue'
;
import
ExampleDLFEditView
from
'@pages/exapmple/example-dlfedit-view/example-dlfedit-view.vue'
;
import
ExampleMain2EditView
from
'@pages/exapmple/example-main2-edit-view/example-main2-edit-view.vue'
;
export
default
{
export
default
{
name
:
"app"
,
name
:
"app"
,
components
:
{
components
:
{
ExampleEditorType
,
ExampleEditorType
,
ExampleEditView
,
ExampleEditView
,
ExampleDLFEditView
ExampleDLFEditView
,
ExampleMain2EditView
},
},
data
()
{
data
()
{
return
{
return
{
...
...
app_Default/src/forms/example/main2/main2.vue
0 → 100644
浏览文件 @
2a9555c9
<
template
>
<div
class=
"app-form"
>
<a-form
class=
""
style=
""
>
<a-row>
<a-tabs
@
change=
"formPageSelected"
>
</a-tabs>
</a-row>
</a-form>
</div>
</
template
>
<
script
>
import
{
FormButtonModel
,
FormDetailModel
,
FormItemModel
,
FormDRUIPartModel
,
FormGroupPanelModel
,
FormIFrameModel
,
FormPageModel
,
FormPartModel
,
FormRowItemModel
,
FormTabPageModel
,
FormTabPanelModel
,
FormUserControlModel
}
from
"@models/index.js"
;
import
Schema
from
"async-validator"
;
import
ComUtil
from
'@utils/ComUtil'
;
import
AppService
from
"@service/AppService"
;
export
default
{
name
:
"Main2form"
,
props
:{
formData
:
Object
},
watch
:
{
'formData'
:
{
handler
:
'onFormDataChanged'
,
immediate
:
true
,
deep
:
true
}
},
data
()
{
return
{
/**
* 当前语言
*
*/
local
:
""
,
/**
* 激活分组
*
*/
activeGroup
:[],
/**
* 激活分组
*
*/
data
:{
srfupdatedate
:
null
,
srforikey
:
null
,
srfkey
:
null
,
srfmajortext
:
null
,
srftempmode
:
null
,
srfuf
:
null
,
srfdeid
:
null
,
srfsourcekey
:
null
,
exampleid
:
null
,
},
/**
* 表单模型
*
*/
detailsModel
:{
form
:
new
FormTabPanelModel
({
caption
:
'form'
,
detailType
:
'TABPANEL'
,
name
:
'form'
,
visible
:
true
,
isShowCaption
:
true
,
form
:
this
,
tabPages
:
[]
}),
},
/**
* 代码表模型
*
*/
codelistModel
:{
},
/**
* 表单值规则
*
*/
formRules
:{
},
/**
* 默认值规则
*
*/
rules
:{
}
};
},
created
(){
this
.
initForm
();
this
.
initlangu
();
},
methods
:
{
/**
* 初始化表单
*
*/
initForm
(){
if
(
Object
.
keys
(
this
.
data
).
length
>
0
){
Object
.
keys
(
this
.
data
).
forEach
((
item
)
=>
{
this
.
formItemChange
(
item
,
this
.
data
[
item
],
true
);
})
}
},
/**
* 初始化语言
*
*/
initlangu
(){
if
(
Object
.
is
(
window
.
localStorage
.
getItem
(
"curLang"
),
"zh"
))
{
this
.
local
=
"zh_CN"
;
}
else
{
this
.
local
=
"en_GB"
;
}
AppService
.
getInstance
().
subject
.
subscribe
(
res
=>
{
if
(
Object
.
is
(
res
,
"zh"
))
{
this
.
local
=
"zh_CN"
;
}
else
{
this
.
local
=
"en_GB"
;
}
});
},
/**
* 分页选中
*
*/
formPageSelected
(
key
){
console
.
log
(
"表单选中了"
+
key
);
},
/**
* 按钮点击事件
*
*/
button_click
(
$event
,
caption
){
this
.
$message
.
success
(
"点击了"
+
caption
);
},
/**
* 表单项值变化
*
*/
formItemChange
(
name
,
value
,
isFirst
){
this
.
formLogic
(
name
,
value
);
if
(
!
isFirst
){
this
.
validateItem
(
name
,
value
);
this
.
$emit
(
'formItemChange'
,{
name
:
name
,
value
:
value
});
}
},
/**
* 校验单个表单项
* @param item
* @param value
*/
validateItem
(
item
,
value
)
{
// 做校验
// 1.获取数值和规则
const
rule
=
this
.
rules
[
item
];
// 2.创建校验规则
const
schema
=
new
Schema
({
[
item
]:
rule
})
// 校验返回Promise
return
schema
.
validate
({
[
item
]:
value
},
undefined
,
errors
=>
{
if
(
errors
)
{
// 有错
this
.
detailsModel
[
item
].
setError
(
errors
[
0
].
message
);
}
else
{
this
.
detailsModel
[
item
].
setError
(
''
);
}
})
},
/**
* 校验表单
*
* @memberof Main
*/
validateForm
(
callback
)
{
let
tasks
;
if
(
Object
.
keys
(
this
.
data
).
length
>
0
)
{
tasks
=
Object
.
keys
(
this
.
data
).
map
((
item
)
=>
{
this
.
validateItem
(
item
,
this
.
data
[
item
]);
})
}
Promise
.
all
(
tasks
)
.
then
(()
=>
callback
(
true
))
.
catch
(()
=>
callback
(
false
))
},
/**
* 表单逻辑
*
*/
formLogic
(
name
,
newVal
,
oldVal
)
{
},
onFormDataChanged
(
val
,
oldVal
){
if
(
val
&&
val
!==
oldVal
){
Object
.
keys
(
this
.
data
).
forEach
(
item
=>
{
this
.
data
[
item
]
=
null
;
})
Object
.
assign
(
this
.
data
,
val
);
}
}
}
}
</
script
>
<
style
scoped
>
</
style
>
app_Default/src/pages/exapmple/example-main2-edit-view/example-main2-edit-view.vue
0 → 100644
浏览文件 @
2a9555c9
<
template
>
<div>
<Main2form
:formData=
"formData"
@
formItemChange=
"formItemChange"
></Main2form></div>
</
template
>
<
script
>
import
Main2form
from
'@forms/example/main2/main2.vue'
;
export
default
{
name
:
"ExampleMain2EditView"
,
components
:
{
Main2form
},
data
(){
return
{
formData
:{
"bookname"
:
"test1"
,
"input"
:
"文本test"
,
"label"
:
"标签test"
,
"group1"
:
"书籍基本信息test"
,
"formpage1"
:
"基本信息test"
,
"createman"
:
"建立人test"
,
"createdate"
:
"建立时间test"
,
"updateman"
:
"更新人test"
,
"updatedate"
:
"更新时间test"
,
"group2"
:
"操作信息test"
,
"formpage2"
:
"其它test"
}
}
},
methods
:{
formItemChange
(
value
){
console
.
log
(
value
);
}
}
}
</
script
>
<
style
scoped
>
</
style
>
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录