Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Chatopera OpenSource
/
ferry_web
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
6a83e652
authored
Apr 21, 2021
by
YuleiLan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 添加显示校验功能。
parent
b3dce974
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
205 additions
and
19 deletions
src/components/VueFormMaking/components/GenerateFormItem.vue
src/components/VueFormMaking/components/WidgetConfig.vue
src/components/VueFormMaking/components/componentsConfig.js
src/components/VueFormMaking/lang/zh-CN.js
src/components/VueFormMaking/components/GenerateFormItem.vue
View file @
6a83e652
<
template
>
<el-form-item
v-if=
"showStatus"
:label-width=
"isLabel===false||!widget.options.labelWidthStatus?'0px': widgetLabelWidth + 'px'"
:label=
"isLabel===false||widget.type==='divider' || !widget.options.labelWidthStatus?'':widget.name"
:prop=
"widget.model"
...
...
@@ -337,6 +338,7 @@ export default {
props
:
[
'widget'
,
'models'
,
'rules'
,
'remote'
,
'data'
,
'disabled'
,
'preview'
,
'isLabel'
,
'subformIndex'
,
'subformModel'
],
data
()
{
return
{
showStatus
:
true
,
widgetLabelWidth
:
''
,
dataModel
:
this
.
subformIndex
===
undefined
?
this
.
models
[
this
.
widget
.
model
]:
...
...
@@ -378,6 +380,7 @@ export default {
}
}
delete
this
.
models
.
status
this
.
handleDisplayVerifiy
()
}
}
},
...
...
@@ -412,10 +415,37 @@ export default {
}
else
{
this
.
widgetLabelWidth
=
this
.
data
.
config
.
labelWidth
}
this
.
handleDisplayVerifiy
()
},
methods
:
{
fileList
(
files
)
{
this
.
dataModel
=
files
},
handleDisplayVerifiy
()
{
if
(
Object
.
keys
(
this
.
widget
.
options
).
indexOf
(
'displayVerifiy'
)
>=
0
)
{
if
(
this
.
widget
.
options
.
displayVerifiy
.
type
!==
'hide'
)
{
var
c
=
0
for
(
var
v
of
this
.
widget
.
options
.
displayVerifiy
.
list
)
{
if
(
this
.
models
[
v
.
model
].
toString
()
===
v
.
value
)
{
c
++
}
}
if
(
this
.
widget
.
options
.
displayVerifiy
.
type
===
'and'
)
{
if
(
c
!==
this
.
widget
.
options
.
displayVerifiy
.
list
.
length
)
{
this
.
showStatus
=
false
}
else
{
this
.
showStatus
=
true
}
}
else
if
(
this
.
widget
.
options
.
displayVerifiy
.
type
===
'or'
)
{
if
(
c
===
0
)
{
this
.
showStatus
=
false
}
else
{
this
.
showStatus
=
true
}
}
}
}
}
}
}
...
...
src/components/VueFormMaking/components/WidgetConfig.vue
View file @
6a83e652
...
...
@@ -476,6 +476,24 @@
</div>
</el-form-item>
</
template
>
<el-form-item
v-if=
"Object.keys(data.options).indexOf('displayVerifiy')>=0"
:label=
"$t('fm.config.widget.displayVerifiy')"
>
<el-radio-group
v-model=
"data.options.displayVerifiy.type"
>
<el-radio
label=
"hide"
>
不校验
</el-radio>
<el-radio
label=
"and"
>
与
</el-radio>
<el-radio
label=
"or"
>
或
</el-radio>
</el-radio-group>
<div
v-if=
"data.options.displayVerifiy.type !== 'hide'"
>
<
template
v-for=
"(item, index) in data.options.displayVerifiy.list"
>
<div
:key=
"item.model"
>
<el-input
v-model=
"item.model"
size=
"mini"
:placeholder=
"$t('fm.config.widget.displayVerifiyPlaceholderModel')"
/>
<el-input
v-model=
"item.value"
size=
"mini"
:placeholder=
"$t('fm.config.widget.displayVerifiyPlaceholderValue')"
/>
<el-button
v-if=
"index > 0"
type=
"text"
icon=
"el-icon-remove-outline"
@
click=
"delDisplayVerifiy(index)"
>
删 除
</el-button>
<hr
v-if=
"data.options.displayVerifiy.list.length > 1"
style=
"background-color: #dcdfe6; border:none; height:1px;"
>
</div>
</
template
>
<el-button
type=
"text"
icon=
"el-icon-circle-plus-outline"
@
click=
"addDisplayVerifiy"
>
新 增
</el-button>
</div>
</el-form-item>
</el-form>
<el-dialog
title=
"提示"
...
...
@@ -589,6 +607,15 @@ export default {
this
.
handleInitHeaders
()
},
methods
:
{
addDisplayVerifiy
()
{
this
.
data
.
options
.
displayVerifiy
.
list
.
push
({
model
:
(
new
Date
()).
valueOf
(),
value
:
'字段值'
})
},
delDisplayVerifiy
(
index
)
{
this
.
data
.
options
.
displayVerifiy
.
list
.
splice
(
index
,
1
)
},
// 级联选择器
handleAddCascaderTopDialog
()
{
this
.
selectTreeData
=
"top"
...
...
src/components/VueFormMaking/components/componentsConfig.js
View file @
6a83e652
...
...
@@ -13,7 +13,14 @@ export const basicComponents = [
showPassword
:
false
,
labelWidth
:
100
,
labelWidthDisabled
:
false
,
labelWidthStatus
:
true
labelWidthStatus
:
true
,
displayVerifiy
:
{
type
:
'hide'
,
list
:
[{
model
:
'字段标识'
,
value
:
'字段值'
}]
}
}
},
{
...
...
@@ -28,7 +35,14 @@ export const basicComponents = [
placeholder
:
''
,
labelWidth
:
100
,
labelWidthDisabled
:
false
,
labelWidthStatus
:
true
labelWidthStatus
:
true
,
displayVerifiy
:
{
type
:
'hide'
,
list
:
[{
model
:
'字段标识'
,
value
:
'字段值'
}]
}
}
},
{
...
...
@@ -45,7 +59,14 @@ export const basicComponents = [
controlsPosition
:
''
,
labelWidth
:
100
,
labelWidthDisabled
:
false
,
labelWidthStatus
:
true
labelWidthStatus
:
true
,
displayVerifiy
:
{
type
:
'hide'
,
list
:
[{
model
:
'字段标识'
,
value
:
'字段值'
}]
}
}
},
{
...
...
@@ -81,7 +102,14 @@ export const basicComponents = [
disabled
:
false
,
labelWidth
:
100
,
labelWidthDisabled
:
false
,
labelWidthStatus
:
true
labelWidthStatus
:
true
,
displayVerifiy
:
{
type
:
'hide'
,
list
:
[{
model
:
'字段标识'
,
value
:
'字段值'
}]
}
}
},
{
...
...
@@ -114,7 +142,14 @@ export const basicComponents = [
disabled
:
false
,
labelWidth
:
100
,
labelWidthDisabled
:
false
,
labelWidthStatus
:
true
labelWidthStatus
:
true
,
displayVerifiy
:
{
type
:
'hide'
,
list
:
[{
model
:
'字段标识'
,
value
:
'字段值'
}]
}
}
},
{
...
...
@@ -172,7 +207,14 @@ export const basicComponents = [
required
:
false
,
labelWidth
:
100
,
labelWidthDisabled
:
false
,
labelWidthStatus
:
true
labelWidthStatus
:
true
,
displayVerifiy
:
{
type
:
'hide'
,
list
:
[{
model
:
'字段标识'
,
value
:
'字段值'
}]
}
}
},
{
...
...
@@ -185,7 +227,14 @@ export const basicComponents = [
required
:
false
,
labelWidth
:
100
,
labelWidthDisabled
:
false
,
labelWidthStatus
:
true
labelWidthStatus
:
true
,
displayVerifiy
:
{
type
:
'hide'
,
list
:
[{
model
:
'字段标识'
,
value
:
'字段值'
}]
}
}
},
{
...
...
@@ -220,7 +269,14 @@ export const basicComponents = [
remoteFunc
:
''
,
labelWidth
:
100
,
labelWidthDisabled
:
false
,
labelWidthStatus
:
true
labelWidthStatus
:
true
,
displayVerifiy
:
{
type
:
'hide'
,
list
:
[{
model
:
'字段标识'
,
value
:
'字段值'
}]
}
}
},
{
...
...
@@ -232,7 +288,14 @@ export const basicComponents = [
disabled
:
false
,
labelWidth
:
100
,
labelWidthDisabled
:
false
,
labelWidthStatus
:
true
labelWidthStatus
:
true
,
displayVerifiy
:
{
type
:
'hide'
,
list
:
[{
model
:
'字段标识'
,
value
:
'字段值'
}]
}
}
},
{
...
...
@@ -250,7 +313,14 @@ export const basicComponents = [
width
:
''
,
labelWidth
:
100
,
labelWidthDisabled
:
false
,
labelWidthStatus
:
true
labelWidthStatus
:
true
,
displayVerifiy
:
{
type
:
'hide'
,
list
:
[{
model
:
'字段标识'
,
value
:
'字段值'
}]
}
}
},
{
...
...
@@ -265,7 +335,14 @@ export const basicComponents = [
labelWidthStatus
:
true
,
customClass
:
''
,
labelWidth
:
100
,
labelWidthDisabled
:
false
labelWidthDisabled
:
false
,
displayVerifiy
:
{
type
:
'hide'
,
list
:
[{
model
:
'字段标识'
,
value
:
'字段值'
}]
}
}
}
]
...
...
@@ -278,7 +355,14 @@ export const advanceComponents = [
defaultType
:
'String'
,
labelWidth
:
100
,
labelWidthDisabled
:
false
,
labelWidthStatus
:
true
labelWidthStatus
:
true
,
displayVerifiy
:
{
type
:
'hide'
,
list
:
[{
model
:
'字段标识'
,
value
:
'字段值'
}]
}
}
},
{
...
...
@@ -304,7 +388,14 @@ export const advanceComponents = [
action
:
'https://jsonplaceholder.typicode.com/photos/'
,
labelWidth
:
100
,
labelWidthDisabled
:
false
,
labelWidthStatus
:
true
labelWidthStatus
:
true
,
displayVerifiy
:
{
type
:
'hide'
,
list
:
[{
model
:
'字段标识'
,
value
:
'字段值'
}]
}
}
},
{
...
...
@@ -324,7 +415,14 @@ export const advanceComponents = [
action
:
'http://ipaddress:port/api/v1/public/uploadFile'
,
labelWidth
:
100
,
labelWidthDisabled
:
false
,
labelWidthStatus
:
true
labelWidthStatus
:
true
,
displayVerifiy
:
{
type
:
'hide'
,
list
:
[{
model
:
'字段标识'
,
value
:
'字段值'
}]
}
}
},
{
...
...
@@ -335,7 +433,14 @@ export const advanceComponents = [
width
:
''
,
labelWidth
:
100
,
labelWidthDisabled
:
false
,
labelWidthStatus
:
true
labelWidthStatus
:
true
,
displayVerifiy
:
{
type
:
'hide'
,
list
:
[{
model
:
'字段标识'
,
value
:
'字段值'
}]
}
}
},
{
...
...
@@ -380,7 +485,14 @@ export const advanceComponents = [
remoteFunc
:
''
,
labelWidth
:
100
,
labelWidthDisabled
:
false
,
labelWidthStatus
:
true
labelWidthStatus
:
true
,
displayVerifiy
:
{
type
:
'hide'
,
list
:
[{
model
:
'字段标识'
,
value
:
'字段值'
}]
}
}
},
{
...
...
@@ -399,7 +511,14 @@ export const advanceComponents = [
align
:
'top'
,
labelWidth
:
100
,
labelWidthDisabled
:
false
,
labelWidthStatus
:
true
labelWidthStatus
:
true
,
displayVerifiy
:
{
type
:
'hide'
,
list
:
[{
model
:
'字段标识'
,
value
:
'字段值'
}]
}
}
}
]
...
...
@@ -434,7 +553,14 @@ export const layoutComponents = [
font_weight
:
'500'
,
// 粗体
font_family
:
''
,
// 字体属性
direction
:
'horizontal'
,
// horizontal / vertical 设置分割线方向
content_position
:
'center'
// left / right / center 设置分割线文案的位置
content_position
:
'center'
,
// left / right / center 设置分割线文案的位置
displayVerifiy
:
{
type
:
'hide'
,
list
:
[{
model
:
'字段标识'
,
value
:
'字段值'
}]
}
}
}
]
src/components/VueFormMaking/lang/zh-CN.js
View file @
6a83e652
...
...
@@ -177,7 +177,10 @@ export default {
validatorRequired
:
'必须填写'
,
validatorType
:
'格式不正确'
,
validatorPattern
:
'格式不匹配'
,
showAllLevels
:
'完整路径'
showAllLevels
:
'完整路径'
,
displayVerifiy
:
'显示校验'
,
displayVerifiyPlaceholderModel
:
'请输入字段标识'
,
displayVerifiyPlaceholderValue
:
'请输入字段值'
}
},
upload
:
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment