mirror of
https://github.com/dataease/dataease.git
synced 2025-02-24 19:42:56 +08:00
feat(查询组件): 查询组件 placeholder 内容支持设置 #11881
This commit is contained in:
parent
eb92ff2737
commit
41125192fb
@ -63,6 +63,8 @@ const canEdit = ref(false)
|
|||||||
const queryConfig = ref()
|
const queryConfig = ref()
|
||||||
const defaultStyle = {
|
const defaultStyle = {
|
||||||
border: '',
|
border: '',
|
||||||
|
placeholder: '请选择',
|
||||||
|
placeholderShow: true,
|
||||||
background: '',
|
background: '',
|
||||||
text: '',
|
text: '',
|
||||||
layout: 'horizontal',
|
layout: 'horizontal',
|
||||||
@ -151,7 +153,6 @@ const setCustomStyle = val => {
|
|||||||
layout,
|
layout,
|
||||||
titleShow,
|
titleShow,
|
||||||
titleColor,
|
titleColor,
|
||||||
textColorShow,
|
|
||||||
title,
|
title,
|
||||||
fontSize,
|
fontSize,
|
||||||
fontWeight,
|
fontWeight,
|
||||||
@ -164,12 +165,16 @@ const setCustomStyle = val => {
|
|||||||
queryConditionSpacing,
|
queryConditionSpacing,
|
||||||
labelColorBtn,
|
labelColorBtn,
|
||||||
btnColor,
|
btnColor,
|
||||||
|
placeholder,
|
||||||
|
placeholderShow,
|
||||||
labelShow
|
labelShow
|
||||||
} = val
|
} = val
|
||||||
customStyle.background = bgColorShow ? bgColor || '' : ''
|
customStyle.background = bgColorShow ? bgColor || '' : ''
|
||||||
customStyle.border = borderShow ? borderColor || '' : ''
|
customStyle.border = borderShow ? borderColor || '' : ''
|
||||||
customStyle.btnList = [...btnList]
|
customStyle.btnList = [...btnList]
|
||||||
customStyle.layout = layout
|
customStyle.layout = layout
|
||||||
|
customStyle.placeholderShow = placeholderShow ?? true
|
||||||
|
customStyle.placeholder = placeholder ?? '请选择'
|
||||||
customStyle.titleShow = titleShow
|
customStyle.titleShow = titleShow
|
||||||
customStyle.titleColor = titleColor
|
customStyle.titleColor = titleColor
|
||||||
customStyle.labelColor = labelShow ? labelColor || '' : ''
|
customStyle.labelColor = labelShow ? labelColor || '' : ''
|
||||||
@ -177,7 +182,7 @@ const setCustomStyle = val => {
|
|||||||
customStyle.fontWeight = labelShow ? fontWeight || '' : ''
|
customStyle.fontWeight = labelShow ? fontWeight || '' : ''
|
||||||
customStyle.fontStyle = labelShow ? fontStyle || '' : ''
|
customStyle.fontStyle = labelShow ? fontStyle || '' : ''
|
||||||
customStyle.title = title
|
customStyle.title = title
|
||||||
customStyle.text = textColorShow ? text || '' : ''
|
customStyle.text = customStyle.placeholderShow ? text || '' : ''
|
||||||
customStyle.titleLayout = titleLayout
|
customStyle.titleLayout = titleLayout
|
||||||
customStyle.fontSizeBtn = fontSizeBtn || '14'
|
customStyle.fontSizeBtn = fontSizeBtn || '14'
|
||||||
customStyle.fontWeightBtn = fontWeightBtn
|
customStyle.fontWeightBtn = fontWeightBtn
|
||||||
@ -292,6 +297,13 @@ const getCascadeList = () => {
|
|||||||
return props.element.cascade
|
return props.element.cascade
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getPlaceholder = computed(() => {
|
||||||
|
return {
|
||||||
|
placeholder: customStyle.placeholder,
|
||||||
|
placeholderShow: customStyle.placeholderShow
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
const isConfirmSearch = id => {
|
const isConfirmSearch = id => {
|
||||||
if (componentWithSure.value) return
|
if (componentWithSure.value) return
|
||||||
queryDataForId(id)
|
queryDataForId(id)
|
||||||
@ -303,6 +315,7 @@ provide('release-unmount-select', releaseSelect)
|
|||||||
provide('query-data-for-id', queryDataForId)
|
provide('query-data-for-id', queryDataForId)
|
||||||
provide('com-width', getQueryConditionWidth)
|
provide('com-width', getQueryConditionWidth)
|
||||||
provide('cascade-list', getCascadeList)
|
provide('cascade-list', getCascadeList)
|
||||||
|
provide('placeholder', getPlaceholder)
|
||||||
|
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
emitter.off(`addQueryCriteria${element.value.id}`)
|
emitter.off(`addQueryCriteria${element.value.id}`)
|
||||||
|
@ -73,6 +73,7 @@ const loading = ref(false)
|
|||||||
const multiple = ref(false)
|
const multiple = ref(false)
|
||||||
const options = shallowRef([])
|
const options = shallowRef([])
|
||||||
const unMountSelect: Ref = inject('unmount-select')
|
const unMountSelect: Ref = inject('unmount-select')
|
||||||
|
const placeholder: Ref = inject('placeholder')
|
||||||
const releaseSelect = inject('release-unmount-select', Function, true)
|
const releaseSelect = inject('release-unmount-select', Function, true)
|
||||||
const queryDataForId = inject('query-data-for-id', Function, true)
|
const queryDataForId = inject('query-data-for-id', Function, true)
|
||||||
const isConfirmSearch = inject('is-confirm-search', Function, true)
|
const isConfirmSearch = inject('is-confirm-search', Function, true)
|
||||||
@ -80,6 +81,12 @@ const queryConditionWidth = inject('com-width', Function, true)
|
|||||||
const cascadeList = inject('cascade-list', Function, true)
|
const cascadeList = inject('cascade-list', Function, true)
|
||||||
const setCascadeDefault = inject('set-cascade-default', Function, true)
|
const setCascadeDefault = inject('set-cascade-default', Function, true)
|
||||||
|
|
||||||
|
const placeholderText = computed(() => {
|
||||||
|
if (placeholder.value.placeholderShow) {
|
||||||
|
return placeholder.value.placeholder
|
||||||
|
}
|
||||||
|
return ' '
|
||||||
|
})
|
||||||
const cascade = computed(() => {
|
const cascade = computed(() => {
|
||||||
return cascadeList() || []
|
return cascadeList() || []
|
||||||
})
|
})
|
||||||
@ -583,6 +590,7 @@ defineExpose({
|
|||||||
key="multiple"
|
key="multiple"
|
||||||
ref="mult"
|
ref="mult"
|
||||||
v-model="selectValue"
|
v-model="selectValue"
|
||||||
|
:placeholder="placeholderText"
|
||||||
v-loading="loading"
|
v-loading="loading"
|
||||||
filterable
|
filterable
|
||||||
@change="handleValueChange"
|
@change="handleValueChange"
|
||||||
@ -604,6 +612,7 @@ defineExpose({
|
|||||||
v-else
|
v-else
|
||||||
v-model="selectValue"
|
v-model="selectValue"
|
||||||
key="single"
|
key="single"
|
||||||
|
:placeholder="placeholderText"
|
||||||
v-loading="loading"
|
v-loading="loading"
|
||||||
@change="handleValueChange"
|
@change="handleValueChange"
|
||||||
clearable
|
clearable
|
||||||
|
@ -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, Ref, type PropType, 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 {
|
||||||
@ -51,6 +51,14 @@ const props = defineProps({
|
|||||||
default: false
|
default: false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const placeholder: Ref = inject('placeholder')
|
||||||
|
const placeholderText = computed(() => {
|
||||||
|
if (placeholder.value.placeholderShow) {
|
||||||
|
return placeholder.value.placeholder
|
||||||
|
}
|
||||||
|
return ' '
|
||||||
|
})
|
||||||
const { config } = toRefs(props)
|
const { config } = toRefs(props)
|
||||||
const setParams = () => {
|
const setParams = () => {
|
||||||
const {
|
const {
|
||||||
@ -103,6 +111,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.conditionValueF"
|
v-model="config.conditionValueF"
|
||||||
/>
|
/>
|
||||||
@ -124,6 +133,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"
|
||||||
/>
|
/>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { toRefs, PropType, ref, onBeforeMount, watch, nextTick, computed, inject } from 'vue'
|
import { toRefs, PropType, ref, Ref, onBeforeMount, watch, nextTick, computed, inject } from 'vue'
|
||||||
import { type DatePickType } from 'element-plus-secondary'
|
import { type DatePickType } from 'element-plus-secondary'
|
||||||
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
|
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
|
||||||
import type { ManipulateType } from 'dayjs'
|
import type { ManipulateType } from 'dayjs'
|
||||||
@ -62,6 +62,13 @@ const props = defineProps({
|
|||||||
default: false
|
default: false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
const placeholder: Ref = inject('placeholder')
|
||||||
|
const placeholderText = computed(() => {
|
||||||
|
if (placeholder.value.placeholderShow) {
|
||||||
|
return placeholder.value.placeholder
|
||||||
|
}
|
||||||
|
return ' '
|
||||||
|
})
|
||||||
const selectValue = ref()
|
const selectValue = ref()
|
||||||
const multiple = ref(false)
|
const multiple = ref(false)
|
||||||
const dvMainStore = dvMainStoreWithOut()
|
const dvMainStore = dvMainStoreWithOut()
|
||||||
@ -413,8 +420,8 @@ const formatDate = computed(() => {
|
|||||||
"
|
"
|
||||||
@change="handleValueChange"
|
@change="handleValueChange"
|
||||||
:range-separator="$t('cron.to')"
|
:range-separator="$t('cron.to')"
|
||||||
:start-placeholder="$t('datasource.start_time')"
|
:start-placeholder="placeholderText"
|
||||||
:end-placeholder="$t('datasource.end_time')"
|
:end-placeholder="placeholderText"
|
||||||
/>
|
/>
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-else
|
v-else
|
||||||
@ -422,7 +429,7 @@ const formatDate = computed(() => {
|
|||||||
:type="config.timeGranularity"
|
:type="config.timeGranularity"
|
||||||
@change="handleValueChange"
|
@change="handleValueChange"
|
||||||
:style="selectStyle"
|
:style="selectStyle"
|
||||||
:placeholder="$t('commons.date.select_date_time')"
|
:placeholder="placeholderText"
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
v-if="dvMainStore.mobileInPc"
|
v-if="dvMainStore.mobileInPc"
|
||||||
|
@ -8,6 +8,7 @@ import {
|
|||||||
onMounted,
|
onMounted,
|
||||||
computed,
|
computed,
|
||||||
inject,
|
inject,
|
||||||
|
Ref,
|
||||||
shallowRef
|
shallowRef
|
||||||
} from 'vue'
|
} from 'vue'
|
||||||
import { cloneDeep, debounce } from 'lodash-es'
|
import { cloneDeep, debounce } from 'lodash-es'
|
||||||
@ -53,6 +54,14 @@ const props = defineProps({
|
|||||||
default: false
|
default: false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const placeholder: Ref = inject('placeholder')
|
||||||
|
const placeholderText = computed(() => {
|
||||||
|
if (placeholder.value.placeholderShow) {
|
||||||
|
return placeholder.value.placeholder
|
||||||
|
}
|
||||||
|
return ' '
|
||||||
|
})
|
||||||
const { config } = toRefs(props)
|
const { config } = toRefs(props)
|
||||||
|
|
||||||
const multiple = ref(false)
|
const multiple = ref(false)
|
||||||
@ -231,6 +240,7 @@ const selectStyle = computed(() => {
|
|||||||
:render-after-expand="false"
|
:render-after-expand="false"
|
||||||
show-checkbox
|
show-checkbox
|
||||||
showBtn
|
showBtn
|
||||||
|
:placeholder="placeholderText"
|
||||||
collapse-tags
|
collapse-tags
|
||||||
:showWholePath="showWholePath"
|
:showWholePath="showWholePath"
|
||||||
collapse-tags-tooltip
|
collapse-tags-tooltip
|
||||||
@ -245,6 +255,7 @@ const selectStyle = computed(() => {
|
|||||||
:data="treeOptionList"
|
:data="treeOptionList"
|
||||||
check-strictly
|
check-strictly
|
||||||
clearable
|
clearable
|
||||||
|
:placeholder="placeholderText"
|
||||||
:render-after-expand="false"
|
:render-after-expand="false"
|
||||||
v-else-if="!multiple && !loading"
|
v-else-if="!multiple && !loading"
|
||||||
key="singleTree"
|
key="singleTree"
|
||||||
@ -256,6 +267,7 @@ const selectStyle = computed(() => {
|
|||||||
v-model="fakeValue"
|
v-model="fakeValue"
|
||||||
v-loading="loading"
|
v-loading="loading"
|
||||||
:data="[]"
|
:data="[]"
|
||||||
|
:placeholder="placeholderText"
|
||||||
:render-after-expand="false"
|
:render-after-expand="false"
|
||||||
v-else
|
v-else
|
||||||
key="fakeTree"
|
key="fakeTree"
|
||||||
|
@ -482,6 +482,8 @@ export const dvMainStore = defineStore('dataVisualization', {
|
|||||||
fontStyleBtn: '',
|
fontStyleBtn: '',
|
||||||
queryConditionWidth: 227,
|
queryConditionWidth: 227,
|
||||||
nameboxSpacing: 8,
|
nameboxSpacing: 8,
|
||||||
|
placeholder: '请选择',
|
||||||
|
placeholderShow: true,
|
||||||
queryConditionSpacing: 16,
|
queryConditionSpacing: 16,
|
||||||
labelColorBtn: '#ffffff',
|
labelColorBtn: '#ffffff',
|
||||||
btnColor: '#3370ff'
|
btnColor: '#3370ff'
|
||||||
|
@ -69,6 +69,14 @@ if (!chart.value.customStyle.component.hasOwnProperty('labelShow')) {
|
|||||||
btnColor: '#3370ff'
|
btnColor: '#3370ff'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!chart.value.customStyle.component.hasOwnProperty('placeholderShow')) {
|
||||||
|
chart.value.customStyle.component = {
|
||||||
|
...chart.value.customStyle.component,
|
||||||
|
placeholderShow: true,
|
||||||
|
placeholder: '请选择'
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -166,12 +174,25 @@ if (!chart.value.customStyle.component.hasOwnProperty('labelShow')) {
|
|||||||
<el-checkbox
|
<el-checkbox
|
||||||
:effect="themes"
|
:effect="themes"
|
||||||
size="small"
|
size="small"
|
||||||
v-model="chart.customStyle.component.textColorShow"
|
v-model="chart.customStyle.component.placeholderShow"
|
||||||
>
|
>
|
||||||
提示文字颜色
|
提示词
|
||||||
</el-checkbox>
|
</el-checkbox>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item
|
<el-form-item
|
||||||
|
label="提示词"
|
||||||
|
class="form-item"
|
||||||
|
style="padding-left: 20px"
|
||||||
|
:class="'form-item-' + themes"
|
||||||
|
>
|
||||||
|
<el-input
|
||||||
|
:effect="themes"
|
||||||
|
:disabled="!chart.customStyle.component.placeholderShow"
|
||||||
|
v-model.lazy="chart.customStyle.component.placeholder"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item
|
||||||
|
label="提示词颜色"
|
||||||
class="form-item"
|
class="form-item"
|
||||||
style="padding-left: 20px"
|
style="padding-left: 20px"
|
||||||
:class="'form-item-' + themes"
|
:class="'form-item-' + themes"
|
||||||
@ -181,7 +202,7 @@ if (!chart.value.customStyle.component.hasOwnProperty('labelShow')) {
|
|||||||
:trigger-width="108"
|
:trigger-width="108"
|
||||||
is-custom
|
is-custom
|
||||||
v-model="chart.customStyle.component.text"
|
v-model="chart.customStyle.component.text"
|
||||||
:disabled="!chart.customStyle.component.textColorShow"
|
:disabled="!chart.customStyle.component.placeholderShow"
|
||||||
:predefine="predefineColors"
|
:predefine="predefineColors"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
Loading…
Reference in New Issue
Block a user