fix(查询组件): 数值区间开启必填项并添加默认参数依然提示异常

This commit is contained in:
dataeaseShu 2024-10-22 17:56:18 +08:00
parent 0b15cb9980
commit b66c5fefc2
3 changed files with 30 additions and 2 deletions

View File

@ -274,6 +274,13 @@ const queryDataForId = id => {
? next.name ? next.name
: '' : ''
} }
} else if (next.displayType === '22') {
if (
(next.numValueStart !== 0 && !next.numValueStart) ||
(next.numValueEnd !== 0 && !next.numValueEnd)
) {
requiredName = next.name
}
} else if ( } else if (
(Array.isArray(next.selectValue) && !next.selectValue.length) || (Array.isArray(next.selectValue) && !next.selectValue.length) ||
(next.selectValue !== 0 && !next.selectValue) (next.selectValue !== 0 && !next.selectValue)
@ -512,6 +519,13 @@ const queryData = () => {
? next.name ? next.name
: '' : ''
} }
} else if (next.displayType === '22') {
if (
(next.numValueEnd !== 0 && !next.numValueEnd) ||
(next.numValueStart !== 0 && !next.numValueStart)
) {
requiredName = next.name
}
} else if ( } else if (
(Array.isArray(next.selectValue) && !next.selectValue.length) || (Array.isArray(next.selectValue) && !next.selectValue.length) ||
(next.selectValue !== 0 && !next.selectValue) (next.selectValue !== 0 && !next.selectValue)

View File

@ -1253,6 +1253,17 @@ const validate = () => {
return true return true
} }
if (ele.displayType === '22') {
if (
(ele.defaultNumValueEnd !== 0 && !ele.defaultNumValueEnd) ||
(ele.defaultNumValueStart !== 0 && !ele.defaultNumValueStart)
) {
ElMessage.error('查询条件为必填项,默认值不能为空')
return true
}
return false
}
if ( if (
(Array.isArray(ele.defaultValue) && !ele.defaultValue.length) || (Array.isArray(ele.defaultValue) && !ele.defaultValue.length) ||
(ele.defaultValue !== 0 && !ele.defaultValue) (ele.defaultValue !== 0 && !ele.defaultValue)

View File

@ -59,7 +59,7 @@ const props = defineProps({
const placeholder: Ref = inject('placeholder') const placeholder: Ref = inject('placeholder')
const placeholderText = computed(() => { const placeholderText = computed(() => {
if (placeholder.value.placeholderShow) { if (placeholder.value.placeholderShow) {
return props.config.placeholder return ['', undefined].includes(props.config.placeholder) ? ' ' : props.config.placeholder
} }
return ' ' return ' '
}) })
@ -186,7 +186,8 @@ watch(
) )
let cacheId = '' let cacheId = ''
let treeOptionList = shallowRef([]) let treeOptionList = shallowRef([])
const filterMethod = (value, data) =>
(data.label ?? '').toLowerCase().includes((value ?? '').toLowerCase())
const dfs = arr => { const dfs = arr => {
return (arr || []).map(ele => { return (arr || []).map(ele => {
let children = [] let children = []
@ -243,6 +244,7 @@ const selectStyle = computed(() => {
showBtn showBtn
:placeholder="placeholderText" :placeholder="placeholderText"
collapse-tags collapse-tags
:filter-node-method="filterMethod"
:showWholePath="showWholePath" :showWholePath="showWholePath"
collapse-tags-tooltip collapse-tags-tooltip
key="multipleTree" key="multipleTree"
@ -256,6 +258,7 @@ const selectStyle = computed(() => {
:data="treeOptionList" :data="treeOptionList"
check-strictly check-strictly
clearable clearable
:filter-node-method="filterMethod"
:placeholder="placeholderText" :placeholder="placeholderText"
:render-after-expand="false" :render-after-expand="false"
v-else-if="!multiple && !loading" v-else-if="!multiple && !loading"