Merge pull request #9167 from dataease/pr@dev-v2_bug_fix

fix(仪表板): 修复查询组件,没有进行数据过滤的问题
This commit is contained in:
dataeaseShu 2024-04-17 16:01:54 +08:00 committed by GitHub
commit 03fd52e329
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 42 additions and 13 deletions

View File

@ -297,6 +297,11 @@ const resetData = () => {
next.defaultValue = next.multiple || +next.displayType === 7 ? [] : undefined
}
next.selectValue = Array.isArray(next.defaultValue) ? [...next.defaultValue] : next.defaultValue
if (next.optionValueSource === 1 && next.defaultMapValue?.length) {
next.mapValue = Array.isArray(next.defaultMapValue)
? [...next.defaultMapValue]
: next.defaultMapValue
}
const keyList = Object.entries(next.checkedFieldsMap)
.filter(ele => next.checkedFields.includes(ele[0]))
.filter(ele => !!ele[1])
@ -309,6 +314,9 @@ const resetData = () => {
const clearData = () => {
;(list.value || []).reduce((pre, next) => {
next.selectValue = next.multiple || +next.displayType === 7 ? [] : undefined
if (next.optionValueSource === 1 && next.defaultMapValue?.length) {
next.mapValue = next.multiple ? [] : undefined
}
const keyList = Object.entries(next.checkedFieldsMap)
.filter(ele => next.checkedFields.includes(ele[0]))
.filter(ele => !!ele[1])

View File

@ -545,6 +545,7 @@ const validate = () => {
const handleBeforeClose = () => {
inputCom.value?.mult?.handleClickOutside?.()
inputCom.value?.single?.handleClickOutside?.()
handleDialogClick()
dialogVisible.value = false
visiblePopover.value = false
@ -553,6 +554,8 @@ const handleBeforeClose = () => {
const confirmClick = () => {
if (validate()) return
inputCom.value?.mult?.handleClickOutside?.()
inputCom.value?.single?.handleClickOutside?.()
handleDialogClick()
visiblePopover.value = false
dialogVisible.value = false
conditions.value.forEach(ele => {
@ -782,7 +785,7 @@ const handleDialogClick = () => {
const operators = [
{
label: '精匹配',
label: '精匹配',
value: 'eq'
},
{
@ -1570,7 +1573,6 @@ defineExpose({
</el-select>
<el-input
class="condition-value-input"
size="small"
v-model="curComponent.defaultConditionValueF"
/>
<div class="bottom-line"></div>
@ -1594,7 +1596,6 @@ defineExpose({
</el-select>
<el-input
class="condition-value-input"
size="small"
v-model="curComponent.defaultConditionValueS"
/>
<div class="bottom-line next-line"></div>
@ -2220,7 +2221,7 @@ defineExpose({
.value {
width: 321px;
.condition-type {
margin-top: 8px;
margin-top: 3px !important;
display: flex;
position: relative;
.ed-input__wrapper {
@ -2272,7 +2273,7 @@ defineExpose({
opacity: 0.3;
position: absolute;
right: 5px;
bottom: 5px;
bottom: 3px;
width: 220px;
z-index: 10;

View File

@ -303,6 +303,7 @@ watch(
watch(
[() => config.value.checkedFields, () => config.value.checkedFieldsMap],
() => {
if (!props.isConfig) return
debounceOptions(config.value.optionValueSource)
},
{
@ -385,6 +386,7 @@ const selectStyle = computed(() => {
})
const mult = ref()
const single = ref()
onBeforeMount(() => {
init()
@ -392,7 +394,8 @@ onBeforeMount(() => {
defineExpose({
displayTypeChange,
mult
mult,
single
})
</script>
@ -425,6 +428,7 @@ defineExpose({
v-loading="loading"
@change="handleValueChange"
clearable
ref="single"
:style="selectStyle"
filterable
radio

View File

@ -14,7 +14,7 @@ interface SelectConfig {
const operators = [
{
label: '精匹配',
label: '精匹配',
value: 'eq'
},
{
@ -143,7 +143,7 @@ onBeforeMount(() => {
opacity: 0.3;
position: absolute;
right: 5px;
bottom: 5px;
bottom: 3px;
width: 195px;
z-index: 10;

View File

@ -84,9 +84,10 @@ const getValueByDefaultValueCheckOrFirstLoad = (
multiple: boolean,
defaultMapValue: any,
optionValueSource: number,
mapValue: any
mapValue: any,
displayType: string
) => {
if (optionValueSource === 1) {
if (optionValueSource === 1 && defaultMapValue?.length && ![1, 7].includes(+displayType)) {
if (firstLoad) {
return defaultValueCheck ? defaultMapValue : multiple ? [] : ''
}
@ -181,7 +182,7 @@ export const searchQuery = (queryComponentList, filter, curComponentId, firstLoa
item.checkedFields.includes(curComponentId) &&
item.checkedFieldsMap[curComponentId]
) {
let selectValue = ''
let selectValue
const {
selectValue: value,
timeGranularityMultiple,
@ -210,6 +211,14 @@ export const searchQuery = (queryComponentList, filter, curComponentId, firstLoa
multiple
} = item
console.log(
'displayType',
timeType === 'dynamic',
[1, 7].includes(+displayType),
firstLoad,
curComponentId
)
if (timeType === 'dynamic' && [1, 7].includes(+displayType) && firstLoad) {
if (+displayType === 1) {
selectValue = getDynamicRange(item)
@ -249,6 +258,7 @@ export const searchQuery = (queryComponentList, filter, curComponentId, firstLoa
)
item.defaultValue = [startTime, endTime]
item.selectValue = [startTime, endTime]
selectValue = [startTime, endTime]
}
} else if (displayType === '8') {
selectValue = getResult(
@ -268,7 +278,8 @@ export const searchQuery = (queryComponentList, filter, curComponentId, firstLoa
multiple,
defaultMapValue,
optionValueSource,
mapValue
mapValue,
displayType
)
}
if (

View File

@ -120,7 +120,9 @@ const handleChange = () => {
<template>
<el-popover
popper-class="menu-more_popper_one"
:popper-class="
options.length === 6 ? 'menu-more_popper_one menu-more_popper_six' : 'menu-more_popper_one'
"
:persistent="false"
ref="popover"
placement="right"
@ -173,6 +175,9 @@ const handleChange = () => {
</style>
<style lang="less">
.menu-more_popper_six > :first-child > :first-child > :first-child {
height: 210px;
}
.menu-more_popper_one {
padding: 0 !important;
background: transparent !important;