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>
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 { storeToRefs } from 'pinia'
interface SelectConfig {
@ -9,12 +9,21 @@ interface SelectConfig {
hideConditionSwitching: boolean
conditionValueOperatorS: string
conditionValueS: string
placeholder: string
defaultConditionValueOperatorF: string
defaultConditionValueF: string
defaultConditionValueOperatorS: string
defaultConditionValueS: string
conditionType: number
}
const placeholder: Ref = inject('placeholder')
const placeholderText = computed(() => {
if (placeholder.value.placeholderShow) {
return props.config.placeholder
}
return ' '
})
const operators = [
{
@ -103,6 +112,7 @@ const lineWidth = computed(() => {
</el-select>
<el-input
:style="selectStyle"
:placeholder="placeholderText"
@blur="handleValueChange"
class="condition-value-input"
v-model="config.conditionValueF"
@ -125,6 +135,7 @@ const lineWidth = computed(() => {
<el-input
:style="selectStyle"
@blur="handleValueChange"
:placeholder="placeholderText"
class="condition-value-input"
v-model="config.conditionValueS"
/>

View File

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