forked from github/dataease
fix(查询组件): 过滤组件动态默认值自定义开始和结束时间出现图表
This commit is contained in:
parent
067f3b73aa
commit
dd281a5a46
@ -537,6 +537,7 @@ const boxWidth = computed(() => {
|
||||
|
||||
const queryData = () => {
|
||||
let requiredName = ''
|
||||
let numName = ''
|
||||
const emitterList = (element.value.propValue || []).reduce((pre, next) => {
|
||||
if (next.required) {
|
||||
if (!next.defaultValueCheck) {
|
||||
@ -569,6 +570,13 @@ const queryData = () => {
|
||||
}
|
||||
|
||||
if (next.displayType === '22') {
|
||||
if (
|
||||
!isNaN(next.numValueEnd) &&
|
||||
!isNaN(next.numValueStart) &&
|
||||
next.numValueEnd < next.numValueStart
|
||||
) {
|
||||
numName = next.name
|
||||
}
|
||||
if (
|
||||
[next.numValueEnd, next.numValueStart].filter(itx => ![null, undefined, ''].includes(itx))
|
||||
.length === 1
|
||||
@ -587,6 +595,11 @@ const queryData = () => {
|
||||
ElMessage.error(`【${requiredName}】${t('v_query.before_querying')}`)
|
||||
return
|
||||
}
|
||||
|
||||
if (!!numName) {
|
||||
ElMessage.error(`【${numName}】数值区间最大值必须大于最小值`)
|
||||
return
|
||||
}
|
||||
if (!emitterList.length) return
|
||||
dvMainStore.setFirstLoadMap([...new Set([...emitterList, ...firstLoadMap.value])])
|
||||
emitterList.forEach(ele => {
|
||||
|
@ -69,7 +69,7 @@ const relativeToCurrentTypeList = computed(() => {
|
||||
}
|
||||
return [
|
||||
{
|
||||
label: t('chart.chart'),
|
||||
label: t('dynamic_time.year'),
|
||||
value: 'year'
|
||||
},
|
||||
{
|
||||
|
@ -2,6 +2,7 @@
|
||||
import { toRefs, onBeforeMount, type PropType, type Ref, inject, computed, nextTick } from 'vue'
|
||||
interface SelectConfig {
|
||||
id: string
|
||||
defaultValueCheck: boolean
|
||||
defaultNumValueEnd: number
|
||||
numValueEnd: number
|
||||
numValueStart: number
|
||||
@ -26,7 +27,8 @@ const props = defineProps({
|
||||
defaultNumValueEnd: '',
|
||||
defaultNumValueStart: '',
|
||||
numValueEnd: '',
|
||||
numValueStart: ''
|
||||
numValueStart: '',
|
||||
defaultValueCheck: false
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -38,6 +40,7 @@ const props = defineProps({
|
||||
|
||||
const { config } = toRefs(props)
|
||||
const setParams = () => {
|
||||
if (!config.value.defaultValueCheck) return
|
||||
const { defaultNumValueEnd, defaultNumValueStart } = config.value
|
||||
config.value.numValueEnd = defaultNumValueEnd
|
||||
config.value.numValueStart = defaultNumValueStart
|
||||
|
@ -1153,6 +1153,24 @@ const validate = () => {
|
||||
ElMessage.error(t('v_query.be_linked_first'))
|
||||
return true
|
||||
}
|
||||
|
||||
if (ele.displayType === '22' && ele.defaultValueCheck) {
|
||||
if (
|
||||
(ele.defaultNumValueEnd !== 0 && !ele.defaultNumValueEnd) ||
|
||||
(ele.defaultNumValueStart !== 0 && !ele.defaultNumValueStart)
|
||||
) {
|
||||
ElMessage.error(t('v_query.cannot_be_empty_de'))
|
||||
return true
|
||||
}
|
||||
if (
|
||||
!isNaN(ele.defaultNumValueEnd) &&
|
||||
!isNaN(ele.defaultNumValueStart) &&
|
||||
ele.defaultNumValueEnd < ele.defaultNumValueStart
|
||||
) {
|
||||
ElMessage.error('数值区间最大值必须大于最小值')
|
||||
return true
|
||||
}
|
||||
}
|
||||
let displayTypeField = null
|
||||
let errorTips = t('v_query.cannot_be_performed')
|
||||
let hasParameterTimeArrType = 0
|
||||
@ -2983,7 +3001,7 @@ defineExpose({
|
||||
<el-radio-group class="larger-radio" v-model="curComponent.conditionType">
|
||||
<el-radio :label="0">{{ t('v_query.single_condition') }}</el-radio>
|
||||
<el-radio :label="1" :disabled="!!curComponent.parameters.length">{{
|
||||
t('v_query.single_condition')
|
||||
t('v_query.with_condition')
|
||||
}}</el-radio>
|
||||
<el-radio :label="2" :disabled="!!curComponent.parameters.length">{{
|
||||
t('v_query.or_condition')
|
||||
|
Loading…
Reference in New Issue
Block a user