fix(查询组件): 切换查询组件时,提示词选中的查询条件名称未清空

This commit is contained in:
dataeaseShu 2024-10-08 11:31:04 +08:00
parent 4fdf29bac3
commit 705ad0b06b
2 changed files with 50 additions and 29 deletions

View File

@ -1,5 +1,5 @@
<script lang="ts" setup> <script lang="ts" setup>
import { toRefs, onBeforeMount, type PropType, inject, computed, nextTick } from 'vue' import { toRefs, onBeforeMount, type PropType, type Ref, inject, computed, nextTick } from 'vue'
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain' import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
import { storeToRefs } from 'pinia' import { storeToRefs } from 'pinia'
interface SelectConfig { interface SelectConfig {
@ -9,12 +9,21 @@ interface SelectConfig {
hideConditionSwitching: boolean hideConditionSwitching: boolean
conditionValueOperatorS: string conditionValueOperatorS: string
conditionValueS: string conditionValueS: string
placeholder: string
defaultConditionValueOperatorF: string defaultConditionValueOperatorF: string
defaultConditionValueF: string defaultConditionValueF: string
defaultConditionValueOperatorS: string defaultConditionValueOperatorS: string
defaultConditionValueS: string defaultConditionValueS: string
conditionType: number conditionType: number
} }
const placeholder: Ref = inject('placeholder')
const placeholderText = computed(() => {
if (placeholder.value.placeholderShow) {
return props.config.placeholder
}
return ' '
})
const operators = [ const operators = [
{ {
@ -103,6 +112,7 @@ const lineWidth = computed(() => {
</el-select> </el-select>
<el-input <el-input
:style="selectStyle" :style="selectStyle"
:placeholder="placeholderText"
@blur="handleValueChange" @blur="handleValueChange"
class="condition-value-input" class="condition-value-input"
v-model="config.conditionValueF" v-model="config.conditionValueF"
@ -125,6 +135,7 @@ const lineWidth = computed(() => {
<el-input <el-input
:style="selectStyle" :style="selectStyle"
@blur="handleValueChange" @blur="handleValueChange"
:placeholder="placeholderText"
class="condition-value-input" class="condition-value-input"
v-model="config.conditionValueS" v-model="config.conditionValueS"
/> />

View File

@ -61,6 +61,13 @@ watch(
} }
) )
watch(
() => props.element.id,
() => {
initParams()
}
)
const currentPlaceholder = ref() const currentPlaceholder = ref()
const currentSearch = ref({ const currentSearch = ref({
placeholder: '' placeholder: ''
@ -141,36 +148,39 @@ const checkItalic = type => {
chart.value.customStyle.component[type] = chart.value.customStyle.component[type] ? '' : 'italic' chart.value.customStyle.component[type] = chart.value.customStyle.component[type] ? '' : 'italic'
} }
const { chart, commonBackgroundPop } = toRefs(props) const { chart, commonBackgroundPop } = toRefs(props)
if (!chart.value.customStyle.component.hasOwnProperty('labelShow')) { const initParams = () => {
chart.value.customStyle.component = { if (!chart.value.customStyle.component.hasOwnProperty('labelShow')) {
...chart.value.customStyle.component, chart.value.customStyle.component = {
labelShow: true, ...chart.value.customStyle.component,
fontWeight: '', labelShow: true,
fontStyle: '', fontWeight: '',
fontSize: '14', fontStyle: '',
fontSizeBtn: '14', fontSize: '14',
fontWeightBtn: '', fontSizeBtn: '14',
fontStyleBtn: '', fontWeightBtn: '',
queryConditionWidth: 227, fontStyleBtn: '',
nameboxSpacing: 8, queryConditionWidth: 227,
queryConditionSpacing: 16, nameboxSpacing: 8,
labelColorBtn: '#ffffff', queryConditionSpacing: 16,
btnColor: '#3370ff' labelColorBtn: '#ffffff',
btnColor: '#3370ff'
}
}
if (!chart.value.customStyle.component.hasOwnProperty('placeholderShow')) {
chart.value.customStyle.component = {
...chart.value.customStyle.component,
placeholderShow: true,
placeholderSize: 14
}
}
if (props.element.propValue.length) {
currentPlaceholder.value = props.element.propValue[0].id
handleCurrentPlaceholder(props.element.propValue[0].id)
} }
} }
initParams()
if (!chart.value.customStyle.component.hasOwnProperty('placeholderShow')) {
chart.value.customStyle.component = {
...chart.value.customStyle.component,
placeholderShow: true,
placeholderSize: 14
}
}
if (props.element.propValue.length) {
currentPlaceholder.value = props.element.propValue[0].id
handleCurrentPlaceholder(props.element.propValue[0].id)
}
</script> </script>
<template> <template>