Commit f6a621e7 authored by 王纵's avatar 王纵

低代码表单校验

parent df2d5daa
......@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com
* @Date: 2024-08-01 09:55:12
* @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-09 18:18:35
* @LastEditTime: 2024-08-09 22:36:54
* @Version: 1.0.0
* @Description: 动态渲染-Lov
* @Copyright: Copyright (c) 2021, Hand-RongJing
......@@ -66,7 +66,7 @@
:key="item[lovConfig.valueField]"
>
<fragment v-if="multiple">
<van-checkbox shape="square" v-model="item._selected" @click="selectData(item)">
<van-checkbox shape="square" v-model="item._selected">
<div class="item-content">
<fragment v-for="(td, index) in lovConfig.tableFields" :key="td.dataIndex">
<span v-if="index < 2">{{item[td.dataIndex]}}</span>
......@@ -137,7 +137,7 @@ export default {
},
multiple: { // 是否多选
type: Boolean,
default: true,
default: false,
},
clearable: {
type: Boolean,
......@@ -206,17 +206,10 @@ export default {
}
}
},
onInput (val) {
this.$emit('input', val);
},
selectData(val) {
if(!this.multiple) {
this.currentValue = val;
this.changeVisible(false);
this.inputValue(this.currentValue);
} else {
val._selected = true;
}
},
// 确定
confirm() {
......
......@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com
* @Date: 2024-08-01 09:55:12
* @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-09 18:20:44
* @LastEditTime: 2024-08-09 22:36:43
* @Version: 1.0.0
* @Description: 动态渲染-Select
* @Copyright: Copyright (c) 2021, Hand-RongJing
......@@ -23,7 +23,7 @@
</van-cell> -->
<van-field
v-model="currentValue.meaning"
v-model="fieldValue"
:disabled="disabled"
:required="required"
:rules="[{ required, message: `请选择${label}` }]"
......@@ -85,7 +85,7 @@ export default {
},
multiple: {
type: Boolean,
default: true
default: false
},
help: {
type: String,
......@@ -114,6 +114,7 @@ export default {
},
data () {
return {
fieldValue: '', // 该变量纯粹用来判断是否有选值,给form校验用
currentValue: this.multiple ? [] : {
meaning: '',
value: ''
......@@ -177,6 +178,7 @@ export default {
this.$set(this.options[index], 'selected', !this.options[index].selected);
},
inputValue(val) {
this.fieldValue = val ? JSON.stringify(val) : '';
this.$emit('input', val);
this.$emit('change', val);
},
......
......@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com
* @Date: 2024-07-29 10:51:56
* @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-09 18:06:06
* @LastEditTime: 2024-08-09 22:40:43
* @Version: 1.0.0
* @Description: 表单渲染
* @Copyright: Copyright (c) 2021, Hand-RongJing
......@@ -45,16 +45,6 @@
@change="fieldChange"
/>
<d-url
v-if="field.validationTypeDisplay === 'UrlField'"
:label="field.description"
:help="field.help"
v-model="fieldsObj[field.columnName]"
:disabled="field.readOnly"
:required="field.required"
@change="fieldChange"
/>
<d-select
v-if="field.validationTypeDisplay === 'Select'"
v-model="fieldsObj[field.columnName]"
......@@ -64,6 +54,7 @@
:disabled="field.readOnly"
:required="field.required"
:clearable="field.clearFlag"
:multiple="field.multiple === 1"
@change="fieldChange"
/>
......@@ -78,6 +69,7 @@
:required="field.required"
:clearable="field.clearFlag"
:cascadesParams="getCascadesParams(field)"
:multiple="field.multiple === 1"
@change="fieldChange"
/>
......@@ -91,6 +83,16 @@
:required="field.required"
:clearable="field.clearFlag"
/>
<d-url
v-if="field.validationTypeDisplay === 'UrlField'"
:label="field.description"
:help="field.help"
v-model="fieldsObj[field.columnName]"
:disabled="field.readOnly"
:required="field.required"
@change="fieldChange"
/>
</fragment>
</van-form>
</fragment>
......
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 to comment