Commit 6a83e652 by YuleiLan

feat: 添加显示校验功能。

parent b3dce974
<template> <template>
<el-form-item <el-form-item
v-if="showStatus"
:label-width="isLabel===false||!widget.options.labelWidthStatus?'0px': widgetLabelWidth + 'px'" :label-width="isLabel===false||!widget.options.labelWidthStatus?'0px': widgetLabelWidth + 'px'"
:label="isLabel===false||widget.type==='divider' || !widget.options.labelWidthStatus?'':widget.name" :label="isLabel===false||widget.type==='divider' || !widget.options.labelWidthStatus?'':widget.name"
:prop="widget.model" :prop="widget.model"
...@@ -337,6 +338,7 @@ export default { ...@@ -337,6 +338,7 @@ export default {
props: ['widget', 'models', 'rules', 'remote', 'data', 'disabled', 'preview', 'isLabel', 'subformIndex', 'subformModel'], props: ['widget', 'models', 'rules', 'remote', 'data', 'disabled', 'preview', 'isLabel', 'subformIndex', 'subformModel'],
data() { data() {
return { return {
showStatus: true,
widgetLabelWidth: '', widgetLabelWidth: '',
dataModel: this.subformIndex===undefined? dataModel: this.subformIndex===undefined?
this.models[this.widget.model]: this.models[this.widget.model]:
...@@ -378,6 +380,7 @@ export default { ...@@ -378,6 +380,7 @@ export default {
} }
} }
delete this.models.status delete this.models.status
this.handleDisplayVerifiy()
} }
} }
}, },
...@@ -412,10 +415,37 @@ export default { ...@@ -412,10 +415,37 @@ export default {
} else { } else {
this.widgetLabelWidth = this.data.config.labelWidth this.widgetLabelWidth = this.data.config.labelWidth
} }
this.handleDisplayVerifiy()
}, },
methods: { methods: {
fileList(files) { fileList(files) {
this.dataModel = 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
}
}
}
}
} }
} }
} }
......
...@@ -476,6 +476,24 @@ ...@@ -476,6 +476,24 @@
</div> </div>
</el-form-item> </el-form-item>
</template> </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-form>
<el-dialog <el-dialog
title="提示" title="提示"
...@@ -589,6 +607,15 @@ export default { ...@@ -589,6 +607,15 @@ export default {
this.handleInitHeaders() this.handleInitHeaders()
}, },
methods: { methods: {
addDisplayVerifiy() {
this.data.options.displayVerifiy.list.push({
model: (new Date()).valueOf(),
value: '字段值'
})
},
delDisplayVerifiy(index) {
this.data.options.displayVerifiy.list.splice(index, 1)
},
// 级联选择器 // 级联选择器
handleAddCascaderTopDialog() { handleAddCascaderTopDialog() {
this.selectTreeData = "top" this.selectTreeData = "top"
......
...@@ -13,7 +13,14 @@ export const basicComponents = [ ...@@ -13,7 +13,14 @@ export const basicComponents = [
showPassword: false, showPassword: false,
labelWidth: 100, labelWidth: 100,
labelWidthDisabled: false, labelWidthDisabled: false,
labelWidthStatus: true labelWidthStatus: true,
displayVerifiy: {
type: 'hide',
list: [{
model: '字段标识',
value: '字段值'
}]
}
} }
}, },
{ {
...@@ -28,7 +35,14 @@ export const basicComponents = [ ...@@ -28,7 +35,14 @@ export const basicComponents = [
placeholder: '', placeholder: '',
labelWidth: 100, labelWidth: 100,
labelWidthDisabled: false, labelWidthDisabled: false,
labelWidthStatus: true labelWidthStatus: true,
displayVerifiy: {
type: 'hide',
list: [{
model: '字段标识',
value: '字段值'
}]
}
} }
}, },
{ {
...@@ -45,7 +59,14 @@ export const basicComponents = [ ...@@ -45,7 +59,14 @@ export const basicComponents = [
controlsPosition: '', controlsPosition: '',
labelWidth: 100, labelWidth: 100,
labelWidthDisabled: false, labelWidthDisabled: false,
labelWidthStatus: true labelWidthStatus: true,
displayVerifiy: {
type: 'hide',
list: [{
model: '字段标识',
value: '字段值'
}]
}
} }
}, },
{ {
...@@ -81,7 +102,14 @@ export const basicComponents = [ ...@@ -81,7 +102,14 @@ export const basicComponents = [
disabled: false, disabled: false,
labelWidth: 100, labelWidth: 100,
labelWidthDisabled: false, labelWidthDisabled: false,
labelWidthStatus: true labelWidthStatus: true,
displayVerifiy: {
type: 'hide',
list: [{
model: '字段标识',
value: '字段值'
}]
}
} }
}, },
{ {
...@@ -114,7 +142,14 @@ export const basicComponents = [ ...@@ -114,7 +142,14 @@ export const basicComponents = [
disabled: false, disabled: false,
labelWidth: 100, labelWidth: 100,
labelWidthDisabled: false, labelWidthDisabled: false,
labelWidthStatus: true labelWidthStatus: true,
displayVerifiy: {
type: 'hide',
list: [{
model: '字段标识',
value: '字段值'
}]
}
} }
}, },
{ {
...@@ -172,7 +207,14 @@ export const basicComponents = [ ...@@ -172,7 +207,14 @@ export const basicComponents = [
required: false, required: false,
labelWidth: 100, labelWidth: 100,
labelWidthDisabled: false, labelWidthDisabled: false,
labelWidthStatus: true labelWidthStatus: true,
displayVerifiy: {
type: 'hide',
list: [{
model: '字段标识',
value: '字段值'
}]
}
} }
}, },
{ {
...@@ -185,7 +227,14 @@ export const basicComponents = [ ...@@ -185,7 +227,14 @@ export const basicComponents = [
required: false, required: false,
labelWidth: 100, labelWidth: 100,
labelWidthDisabled: false, labelWidthDisabled: false,
labelWidthStatus: true labelWidthStatus: true,
displayVerifiy: {
type: 'hide',
list: [{
model: '字段标识',
value: '字段值'
}]
}
} }
}, },
{ {
...@@ -220,7 +269,14 @@ export const basicComponents = [ ...@@ -220,7 +269,14 @@ export const basicComponents = [
remoteFunc: '', remoteFunc: '',
labelWidth: 100, labelWidth: 100,
labelWidthDisabled: false, labelWidthDisabled: false,
labelWidthStatus: true labelWidthStatus: true,
displayVerifiy: {
type: 'hide',
list: [{
model: '字段标识',
value: '字段值'
}]
}
} }
}, },
{ {
...@@ -232,7 +288,14 @@ export const basicComponents = [ ...@@ -232,7 +288,14 @@ export const basicComponents = [
disabled: false, disabled: false,
labelWidth: 100, labelWidth: 100,
labelWidthDisabled: false, labelWidthDisabled: false,
labelWidthStatus: true labelWidthStatus: true,
displayVerifiy: {
type: 'hide',
list: [{
model: '字段标识',
value: '字段值'
}]
}
} }
}, },
{ {
...@@ -250,7 +313,14 @@ export const basicComponents = [ ...@@ -250,7 +313,14 @@ export const basicComponents = [
width: '', width: '',
labelWidth: 100, labelWidth: 100,
labelWidthDisabled: false, labelWidthDisabled: false,
labelWidthStatus: true labelWidthStatus: true,
displayVerifiy: {
type: 'hide',
list: [{
model: '字段标识',
value: '字段值'
}]
}
} }
}, },
{ {
...@@ -265,7 +335,14 @@ export const basicComponents = [ ...@@ -265,7 +335,14 @@ export const basicComponents = [
labelWidthStatus: true, labelWidthStatus: true,
customClass: '', customClass: '',
labelWidth: 100, labelWidth: 100,
labelWidthDisabled: false labelWidthDisabled: false,
displayVerifiy: {
type: 'hide',
list: [{
model: '字段标识',
value: '字段值'
}]
}
} }
} }
] ]
...@@ -278,7 +355,14 @@ export const advanceComponents = [ ...@@ -278,7 +355,14 @@ export const advanceComponents = [
defaultType: 'String', defaultType: 'String',
labelWidth: 100, labelWidth: 100,
labelWidthDisabled: false, labelWidthDisabled: false,
labelWidthStatus: true labelWidthStatus: true,
displayVerifiy: {
type: 'hide',
list: [{
model: '字段标识',
value: '字段值'
}]
}
} }
}, },
{ {
...@@ -304,7 +388,14 @@ export const advanceComponents = [ ...@@ -304,7 +388,14 @@ export const advanceComponents = [
action: 'https://jsonplaceholder.typicode.com/photos/', action: 'https://jsonplaceholder.typicode.com/photos/',
labelWidth: 100, labelWidth: 100,
labelWidthDisabled: false, labelWidthDisabled: false,
labelWidthStatus: true labelWidthStatus: true,
displayVerifiy: {
type: 'hide',
list: [{
model: '字段标识',
value: '字段值'
}]
}
} }
}, },
{ {
...@@ -324,7 +415,14 @@ export const advanceComponents = [ ...@@ -324,7 +415,14 @@ export const advanceComponents = [
action: 'http://ipaddress:port/api/v1/public/uploadFile', action: 'http://ipaddress:port/api/v1/public/uploadFile',
labelWidth: 100, labelWidth: 100,
labelWidthDisabled: false, labelWidthDisabled: false,
labelWidthStatus: true labelWidthStatus: true,
displayVerifiy: {
type: 'hide',
list: [{
model: '字段标识',
value: '字段值'
}]
}
} }
}, },
{ {
...@@ -335,7 +433,14 @@ export const advanceComponents = [ ...@@ -335,7 +433,14 @@ export const advanceComponents = [
width: '', width: '',
labelWidth: 100, labelWidth: 100,
labelWidthDisabled: false, labelWidthDisabled: false,
labelWidthStatus: true labelWidthStatus: true,
displayVerifiy: {
type: 'hide',
list: [{
model: '字段标识',
value: '字段值'
}]
}
} }
}, },
{ {
...@@ -380,7 +485,14 @@ export const advanceComponents = [ ...@@ -380,7 +485,14 @@ export const advanceComponents = [
remoteFunc: '', remoteFunc: '',
labelWidth: 100, labelWidth: 100,
labelWidthDisabled: false, labelWidthDisabled: false,
labelWidthStatus: true labelWidthStatus: true,
displayVerifiy: {
type: 'hide',
list: [{
model: '字段标识',
value: '字段值'
}]
}
} }
}, },
{ {
...@@ -399,7 +511,14 @@ export const advanceComponents = [ ...@@ -399,7 +511,14 @@ export const advanceComponents = [
align: 'top', align: 'top',
labelWidth: 100, labelWidth: 100,
labelWidthDisabled: false, labelWidthDisabled: false,
labelWidthStatus: true labelWidthStatus: true,
displayVerifiy: {
type: 'hide',
list: [{
model: '字段标识',
value: '字段值'
}]
}
} }
} }
] ]
...@@ -434,7 +553,14 @@ export const layoutComponents = [ ...@@ -434,7 +553,14 @@ export const layoutComponents = [
font_weight: '500', // 粗体 font_weight: '500', // 粗体
font_family: '', // 字体属性 font_family: '', // 字体属性
direction: 'horizontal', // horizontal / vertical 设置分割线方向 direction: 'horizontal', // horizontal / vertical 设置分割线方向
content_position: 'center' // left / right / center 设置分割线文案的位置 content_position: 'center', // left / right / center 设置分割线文案的位置
displayVerifiy: {
type: 'hide',
list: [{
model: '字段标识',
value: '字段值'
}]
}
} }
} }
] ]
...@@ -177,7 +177,10 @@ export default { ...@@ -177,7 +177,10 @@ export default {
validatorRequired: '必须填写', validatorRequired: '必须填写',
validatorType: '格式不正确', validatorType: '格式不正确',
validatorPattern: '格式不匹配', validatorPattern: '格式不匹配',
showAllLevels: '完整路径' showAllLevels: '完整路径',
displayVerifiy: '显示校验',
displayVerifiyPlaceholderModel: '请输入字段标识',
displayVerifiyPlaceholderValue: '请输入字段值'
} }
}, },
upload: { upload: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment