From 80dbdcc049b9730adfa94212ab84389424fcdc4b Mon Sep 17 00:00:00 2001
From: wangjiahao <1522128093@qq.com>
Date: Mon, 24 Jun 2024 15:42:00 +0800
Subject: [PATCH] =?UTF-8?q?refactor(=E6=95=B0=E6=8D=AE=E5=A4=A7=E5=B1=8F?=
=?UTF-8?q?=E3=80=81=E4=BB=AA=E8=A1=A8=E6=9D=BF):=20=E8=BF=87=E6=BB=A4?=
=?UTF-8?q?=E7=BB=84=E4=BB=B6=E4=BC=98=E5=8C=96=EF=BC=8C=E6=8A=BD=E5=8F=96?=
=?UTF-8?q?=E9=BB=98=E8=AE=A4=E9=80=89=E9=A1=B9=E8=AE=BE=E7=BD=AE=E7=AD=89?=
=?UTF-8?q?=E5=85=AC=E5=85=B1=E7=BB=84=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../v-query/ConditionDefaultConfiguration.vue | 705 ++++++++++++++++++
.../v-query/QueryConditionConfiguration.vue | 315 +-------
2 files changed, 714 insertions(+), 306 deletions(-)
create mode 100644 core/core-frontend/src/custom-component/v-query/ConditionDefaultConfiguration.vue
diff --git a/core/core-frontend/src/custom-component/v-query/ConditionDefaultConfiguration.vue b/core/core-frontend/src/custom-component/v-query/ConditionDefaultConfiguration.vue
new file mode 100644
index 0000000000..00dba34bfc
--- /dev/null
+++ b/core/core-frontend/src/custom-component/v-query/ConditionDefaultConfiguration.vue
@@ -0,0 +1,705 @@
+getLastStart
+
+
+
+
+
设置默认值
+
+
+
+
{{ curComponent.conditionType === 1 ? '与' : '或' }}
+
+
+
+
+
+
+
+
+
+
+
选项类型
+
+ multipleChange(val as boolean, true)"
+ v-model="multiple"
+ >
+ {{ t('visualization.single_choice') }}
+ {{ t('visualization.multiple_choice') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 设置
+
+
+
+
+ 已配置
+
+
+
+
+
+
+
+
+
+
+ 固定时间
+ 动态时间
+
+
+
+
+
+
+
+
+
开始时间
+
+
+
+
+
+
+
+
+
+
+
+
+
结束时间
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/core/core-frontend/src/custom-component/v-query/QueryConditionConfiguration.vue b/core/core-frontend/src/custom-component/v-query/QueryConditionConfiguration.vue
index 8074a95152..79bf179229 100644
--- a/core/core-frontend/src/custom-component/v-query/QueryConditionConfiguration.vue
+++ b/core/core-frontend/src/custom-component/v-query/QueryConditionConfiguration.vue
@@ -34,11 +34,12 @@ import draggable from 'vuedraggable'
import RangeFilterTime from './RangeFilterTime.vue'
import type { ManipulateType } from 'dayjs'
import dayjs from 'dayjs'
+import ConditionDefaultConfiguration from '@/custom-component/v-query/ConditionDefaultConfiguration.vue'
const { t } = useI18n()
const dvMainStore = dvMainStoreWithOut()
const { componentData, canvasViewInfo } = storeToRefs(dvMainStore)
-
+const defaultConfigurationRef = ref(null)
interface DatasetField {
type?: string
innerType?: string
@@ -146,11 +147,6 @@ const { queryElement } = toRefs(props)
const getDetype = (id, arr) => {
return arr.flat().find(ele => ele.id === id)?.deType
}
-const visiblePopover = ref(false)
-const handleVisiblePopover = ev => {
- ev.stopPropagation()
- visiblePopover.value = !visiblePopover.value
-}
const showConfiguration = computed(() => {
if (!curComponent.value) return false
if (!curComponent.value.checkedFields?.length) return false
@@ -315,7 +311,7 @@ const timeParameterList = computed(() => {
})
const cancelClick = () => {
- visiblePopover.value = false
+ handleDialogClick()
dialogVisible.value = false
}
@@ -353,24 +349,7 @@ const handleValueSourceChange = () => {
}
const multipleChange = (val: boolean, isMultipleChange = false) => {
- if (isMultipleChange) {
- curComponent.value.defaultValue = val ? [] : undefined
- }
- const { defaultValue } = curComponent.value
- if (Array.isArray(defaultValue)) {
- curComponent.value.selectValue = val ? defaultValue : undefined
- } else {
- curComponent.value.selectValue = val
- ? defaultValue !== undefined
- ? [defaultValue]
- : []
- : defaultValue
- }
- if (curComponent.value.field.deType === 1) {
- curComponent.value.multiple = val
- return
- }
- curComponent.value.multiple = val
+ defaultConfigurationRef.value?.multipleChange(val, isMultipleChange)
}
const isInRange = (ele, startWindowTime, timeStamp) => {
@@ -675,7 +654,6 @@ const handleBeforeClose = () => {
inputCom.value?.single?.handleClickOutside?.()
handleDialogClick()
dialogVisible.value = false
- visiblePopover.value = false
}
const confirmClick = () => {
@@ -683,7 +661,6 @@ const confirmClick = () => {
inputCom.value?.mult?.handleClickOutside?.()
inputCom.value?.single?.handleClickOutside?.()
handleDialogClick()
- visiblePopover.value = false
dialogVisible.value = false
conditions.value.forEach(ele => {
curComponent.value = ele
@@ -941,7 +918,7 @@ const showError = computed(() => {
return (optionValueSource === 1 && !field.id) || (optionValueSource === 2 && !valueSource.length)
})
const handleDialogClick = () => {
- visiblePopover.value = false
+ defaultConfigurationRef.value?.handleDialogClick()
}
const operators = [
@@ -1752,284 +1729,10 @@ defineExpose({
-
-
设置默认值
-
-
-
-
{{
- curComponent.conditionType === 1 ? '与' : '或'
- }}
-
-
-
-
-
-
-
-
-
-
-
选项类型
-
- multipleChange(val as boolean, true)"
- v-model="multiple"
- >
- {{ t('visualization.single_choice') }}
- {{ t('visualization.multiple_choice') }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 设置
-
-
-
-
- 已配置
-
-
-
-
-
-
-
-
-
-
- 固定时间
- 动态时间
-
-
-
-
-
-
-
-
-
开始时间
-
-
-
-
-
-
-
-
-
-
-
-
-
结束时间
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+