From b6aaad0296992611e80c7799a39cd7091e54ad69 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=8E=8B=E5=98=89=E8=B1=AA?=
<42510293+ziyujiahao@users.noreply.github.com>
Date: Tue, 6 Jan 2026 15:29:24 +0800
Subject: [PATCH] =?UTF-8?q?feat(=E6=95=B0=E6=8D=AE=E5=A4=A7=E5=B1=8F?=
=?UTF-8?q?=E3=80=81=E6=95=B0=E6=8D=AE=E5=A4=A7=E5=B1=8F):=20=E5=A4=96?=
=?UTF-8?q?=E9=83=A8=E5=8F=82=E6=95=B0=E5=85=B3=E8=81=94=E6=9F=A5=E8=AF=A2?=
=?UTF-8?q?=E7=BB=84=E4=BB=B6=EF=BC=8C=E6=94=AF=E6=8C=81=E6=8E=A7=E5=88=B6?=
=?UTF-8?q?=E6=A0=91=E5=BD=A2=E7=BB=84=E4=BB=B6=E9=80=89=E9=A1=B9=E8=BF=87?=
=?UTF-8?q?=E6=BB=A4=20(#17749)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../visualization/OuterParamsSet.vue | 25 ++++++++++++-
.../src/custom-component/v-query/Tree.vue | 37 ++++++++++++++++++-
core/core-frontend/src/locales/en.ts | 4 ++
core/core-frontend/src/locales/tw.ts | 4 ++
core/core-frontend/src/locales/zh-CN.ts | 4 ++
5 files changed, 71 insertions(+), 3 deletions(-)
diff --git a/core/core-frontend/src/components/visualization/OuterParamsSet.vue b/core/core-frontend/src/components/visualization/OuterParamsSet.vue
index 5b0eed8590..08667461f9 100644
--- a/core/core-frontend/src/components/visualization/OuterParamsSet.vue
+++ b/core/core-frontend/src/components/visualization/OuterParamsSet.vue
@@ -90,7 +90,22 @@
{{ t('visualization.filter_component') }}
- {{ t('visualization.outer_params_type') }}
+
+ {{ t('visualization.outer_params_type') }}
+
+
+
+ {{ t('visualization.outer_params_type_tips1') }}
+ {{ t('visualization.outer_params_type_tips2') }}
+
+
+
+
+
+
+
{{ t('visualization.connection_condition') }}
@@ -377,6 +392,7 @@ const { t } = useI18n()
const curEditDataId = ref(null)
const snapshotStore = snapshotStoreWithOut()
import icon_info_outlined from '@/assets/svg/icon_info_outlined.svg'
+import dvInfoSvg from '@/assets/svg/dv-info.svg'
const state = reactive({
filterExpand: true,
@@ -1154,6 +1170,13 @@ defineExpose({
margin-right: -80px;
}
+.hint-icon-type {
+ cursor: pointer;
+ font-size: 14px;
+ color: #646a73;
+ display: inline-block;
+}
+
.hint-icon {
cursor: pointer;
font-size: 14px;
diff --git a/core/core-frontend/src/custom-component/v-query/Tree.vue b/core/core-frontend/src/custom-component/v-query/Tree.vue
index 28bc1293ac..e68c9727ae 100644
--- a/core/core-frontend/src/custom-component/v-query/Tree.vue
+++ b/core/core-frontend/src/custom-component/v-query/Tree.vue
@@ -39,6 +39,7 @@ interface SelectConfig {
}
defaultValueCheck: boolean
multiple: boolean
+ optionFilter: []
}
const customStyle: any = inject('$custom-style-filter')
@@ -56,7 +57,8 @@ const props = defineProps({
defaultValueCheck: false,
multiple: false,
checkedFieldsMap: {},
- treeFieldList: []
+ treeFieldList: [],
+ optionFilter: []
}
}
},
@@ -320,7 +322,7 @@ const getTreeOption = debounce(() => {
filter: getCascadeFieldId()
})
.then(res => {
- treeOptionList.value = dfs(res)
+ treeOptionList.value = filterTree(dfs(res), config.value.optionFilter)
if (fromSelect) {
fromTreeSelectConfirm.value = true
if (multiple.value && Array.isArray(treeValue.value) && treeValue.value.length) {
@@ -393,6 +395,37 @@ const tagColor = computed(() => {
.mix(new colorTree('ffffff'), new colorTree(hexColor.substr(1)), { value: 20 })
.toRGB()
})
+
+const filterTree = (treeData, filterIds) => {
+ if (!filterIds || filterIds.length === 0) {
+ return treeData
+ }
+ const filterIdSet = new Set(filterIds)
+ // 递归处理每个节点
+ const recursionFilter = node => {
+ const newNode = { ...node }
+
+ // 2. 处理子节点:有子节点才过滤,无子节点直接返回当前节点
+ if (newNode.children && Array.isArray(newNode.children) && newNode.children.length > 0) {
+ // 筛选出当前节点的子节点中,id在过滤清单里的「命中子节点」
+ const hitChildren = newNode.children.filter(child => filterIdSet.has(child.id))
+
+ if (hitChildren.length > 0) {
+ // 规则1:当前层级有命中的子节点 → 只保留命中的,递归过滤其子节点
+ newNode.children = hitChildren.map(child => recursionFilter(child))
+ } else {
+ // 规则2:当前层级无命中的子节点 → 完整保留所有子节点,子节点也不做过滤
+ newNode.children = [...newNode.children]
+ }
+ }
+ return newNode
+ }
+
+ // 根节点过滤:只保留根节点id在过滤清单中的节点,再递归处理子节点
+ return treeData
+ .filter(rootNode => filterIdSet.has(rootNode.id))
+ .map(node => recursionFilter(node))
+}
diff --git a/core/core-frontend/src/locales/en.ts b/core/core-frontend/src/locales/en.ts
index d1a0137392..fa7940cfc9 100644
--- a/core/core-frontend/src/locales/en.ts
+++ b/core/core-frontend/src/locales/en.ts
@@ -2945,6 +2945,10 @@ export default {
column_name: 'Field name'
},
visualization: {
+ outer_params_type_tips1:
+ "When the type is 'filter', it only applies to text dropdown, text tree, and number dropdown. For text tree filtering format, separate multiple levels with '-de-'",
+ outer_params_type_tips2:
+ '["Level1","Level1-de-Level2_1","Level2-de-Level2_1","Level1-de-Level2_1-de-Level3_1","Level2"]',
outer_params_type: 'Type',
outer_params_type_self: 'Assignment',
outer_params_type_filter: 'Filter',
diff --git a/core/core-frontend/src/locales/tw.ts b/core/core-frontend/src/locales/tw.ts
index 0ba0f9747a..7075ae038d 100644
--- a/core/core-frontend/src/locales/tw.ts
+++ b/core/core-frontend/src/locales/tw.ts
@@ -2864,6 +2864,10 @@ export default {
column_name: '欄位名稱'
},
visualization: {
+ outer_params_type_tips1:
+ "類型為過濾時僅對文字下拉、文字樹、數字下拉有效。文字樹的過濾格式中,多級之間使用 '-de-' 分隔",
+ outer_params_type_tips2:
+ '["Level1","Level1-de-Level2_1","Level2-de-Level2_1","Level1-de-Level2_1-de-Level3_1","Level2"]',
outer_params_type: '類型',
outer_params_type_self: '賦值',
outer_params_type_filter: '過濾',
diff --git a/core/core-frontend/src/locales/zh-CN.ts b/core/core-frontend/src/locales/zh-CN.ts
index 6c6192039b..b5d2a2423d 100644
--- a/core/core-frontend/src/locales/zh-CN.ts
+++ b/core/core-frontend/src/locales/zh-CN.ts
@@ -2870,6 +2870,10 @@ export default {
column_name: '字段名称'
},
visualization: {
+ outer_params_type_tips1:
+ "类型为过滤时仅对文本下拉、文本树、数字下拉,文本树的过滤格式多级之间使用'-de-' 隔离",
+ outer_params_type_tips2:
+ '["Level1","Level1-de-Level2_1","Level2-de-Level2_1","Level1-de-Level2_1-de-Level3_1","Level2"]',
outer_params_type: '类型',
outer_params_type_self: '赋值',
outer_params_type_filter: '过滤',