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

View File

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

View File

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