级联选择组件增加showAllLevels属性及属性编辑器。

master
vdpAdmin 2022-09-09 14:34:54 +08:00
parent 665342ebf8
commit a7c4ab7d8b
8 changed files with 34 additions and 3 deletions

View File

@ -7,6 +7,7 @@
:size="field.options.size"
:clearable="field.options.clearable"
:filterable="field.options.filterable"
:show-all-levels="showFullPath"
:props="{ checkStrictly: field.options.checkStrictly, multiple: field.options.multiple, expandTrigger: 'hover' }"
@visible-change="hideDropDownOnClick" @expand-change="hideDropDownOnClick"
:placeholder="field.options.placeholder || i18nt('render.hint.selectPlaceholder')"
@ -64,6 +65,9 @@
}
},
computed: {
showFullPath() {
return (this.field.options.showAllLevels === undefined) || !!this.field.options.showAllLevels
},
},
beforeCreate() {

View File

@ -0,0 +1,23 @@
<template>
<el-form-item :label="i18nt('designer.setting.showAllLevels')">
<el-switch v-model="optionModel.showAllLevels"></el-switch>
</el-form-item>
</template>
<script>
import i18n from "@/utils/i18n"
export default {
name: "showAllLevels-editor",
mixins: [i18n],
props: {
designer: Object,
selectedWidget: Object,
optionModel: Object,
},
}
</script>
<style scoped>
</style>

View File

@ -42,6 +42,7 @@ const COMMON_PROPERTIES = {
'remote' : 'remote-editor',
'automaticDropdown' : 'automaticDropdown-editor',
'checkStrictly' : 'checkStrictly-editor',
'showAllLevels' : 'showAllLevels-editor',
'multiple' : 'multiple-editor',
'multipleLimit' : 'multipleLimit-editor',
'contentPosition' : 'contentPosition-editor',

View File

@ -883,6 +883,7 @@ export const advancedFields = [
filterable: false,
multiple: false,
checkStrictly: false, //可选择任意一级选项,默认不开启
showAllLevels: true, //显示完整路径
optionItems: [
{label: 'select 1', value: 1, children: [{label: 'child 1', value: 11}]},
{label: 'select 2', value: 2},

View File

@ -209,6 +209,7 @@ export default {
multiple: 'Multiple',
multipleLimit: 'Multiple Limit',
checkStrictly: 'Any Level Selectable',
showAllLevels: 'Show All Levels',
contentPosition: 'Content Position',
plain: 'Plain',
round: 'Round',

View File

@ -209,6 +209,7 @@ export default {
multiple: '选项可多选',
multipleLimit: '多选数量限制',
checkStrictly: '任意级节点可选',
showAllLevels: '显示完整路径',
contentPosition: '文字位置',
plain: '朴素按钮',
round: '圆角按钮',

View File

@ -2,7 +2,7 @@ import {isEmptyStr, isNull} from "./util";
export const getRegExp = function (validatorName) {
const commonRegExp = {
number: '/^\\d+(\\.\\d+)?$/',
number: '/^[-]?\\d+(\\.\\d+)?$/',
letter: '/^[A-Za-z]+$/',
letterAndNumber: '/^[A-Za-z0-9]+$/',
mobilePhone: '/^[1][3-9][0-9]{9}$/',

View File

@ -46,7 +46,7 @@ export const genVue3JS = function (formConfig, widgetList) {
const instance = getCurrentInstance()
const submitForm = () => {
instance.ctx.$refs['vForm'].validate(valid => {
instance.proxy.$refs['vForm'].validate(valid => {
if (!valid) return
//TODO: 提交表单
@ -54,7 +54,7 @@ export const genVue3JS = function (formConfig, widgetList) {
}
const resetForm = () => {
instance.ctx.$refs['vForm'].resetFields()
instance.proxy.$refs['vForm'].resetFields()
}
return {