From 68ab76784bf6c80cf8fbd6db3faed16cfac630a6 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: Fri, 24 Apr 2026 15:01:57 +0800
Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=AF=8C=E6=96=87=E6=9C=AC?=
=?UTF-8?q?=E6=9D=A1=E4=BB=B6=E6=A0=B7=E5=BC=8F=E6=94=AF=E6=8C=81=E8=87=AA?=
=?UTF-8?q?=E5=AE=9A=E4=B9=89=E5=AD=97=E6=AE=B5=20#18298=20(#18325)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../picture-group/Component.vue | 2 +-
.../rich-text/DeRichTextView.vue | 40 +++++++++++++------
.../components/dialog/TableThresholdEdit.vue | 24 +++++++----
.../js/panel/common/common_table.ts | 22 ++++++++--
4 files changed, 64 insertions(+), 24 deletions(-)
diff --git a/core/core-frontend/src/custom-component/picture-group/Component.vue b/core/core-frontend/src/custom-component/picture-group/Component.vue
index d079064179..8fe9c9944c 100644
--- a/core/core-frontend/src/custom-component/picture-group/Component.vue
+++ b/core/core-frontend/src/custom-component/picture-group/Component.vue
@@ -214,7 +214,7 @@ const conditionAdaptor = (chart: Chart) => {
defaultValueColor,
field,
'url'
- )
+ ).color
if (checkResult) {
state.showUrl = checkResult
}
diff --git a/core/core-frontend/src/custom-component/rich-text/DeRichTextView.vue b/core/core-frontend/src/custom-component/rich-text/DeRichTextView.vue
index 885be34fb4..e0c0add4ec 100644
--- a/core/core-frontend/src/custom-component/rich-text/DeRichTextView.vue
+++ b/core/core-frontend/src/custom-component/rich-text/DeRichTextView.vue
@@ -711,6 +711,18 @@ const conditionAdaptor = (chart: Chart) => {
if (!threshold.enable) {
return
}
+
+ const idNameMapping = {}
+ if (chart.xAxis && Array.isArray(chart.xAxis)) {
+ chart.xAxis.forEach(item => {
+ idNameMapping[item.id] = item.name
+ })
+ }
+ if (chart.yAxis && Array.isArray(chart.yAxis)) {
+ chart.yAxis.forEach(item => {
+ idNameMapping[item.id] = item.name
+ })
+ }
const res = {}
const conditions = threshold.tableThreshold ?? []
if (conditions?.length > 0) {
@@ -718,19 +730,21 @@ const conditionAdaptor = (chart: Chart) => {
const field = conditions[i]
let defaultValueColor = 'none'
let defaultBgColor = 'none'
- res[field.field.name] = {
- color: mappingColorCustom(
- dataRowNameSelectSource.value[field.field.name],
- defaultValueColor,
- field,
- 'color'
- ),
- backgroundColor: mappingColorCustom(
- dataRowNameSelectSource.value[field.field.name],
- defaultBgColor,
- field,
- 'backgroundColor'
- )
+ const colorCondition = mappingColorCustom(
+ dataRowNameSelectSource.value[field.field.name],
+ defaultValueColor,
+ field,
+ 'color'
+ )
+ const backgroundColorCondition = mappingColorCustom(
+ dataRowNameSelectSource.value[field.field.name],
+ defaultBgColor,
+ field,
+ 'backgroundColor'
+ )
+ res[idNameMapping[colorCondition.targetFieldId] || field.field.name] = {
+ color: colorCondition.color,
+ backgroundColor: backgroundColorCondition.color
}
}
}
diff --git a/core/core-frontend/src/views/chart/components/editor/editor-senior/components/dialog/TableThresholdEdit.vue b/core/core-frontend/src/views/chart/components/editor/editor-senior/components/dialog/TableThresholdEdit.vue
index 2f0383edda..f9e160cd07 100644
--- a/core/core-frontend/src/views/chart/components/editor/editor-senior/components/dialog/TableThresholdEdit.vue
+++ b/core/core-frontend/src/views/chart/components/editor/editor-senior/components/dialog/TableThresholdEdit.vue
@@ -2,7 +2,7 @@
import icon_info_filled from '@/assets/svg/icon_info_filled.svg'
import icon_deleteTrash_outlined from '@/assets/svg/icon_delete-trash_outlined.svg'
import icon_add_outlined from '@/assets/svg/icon_add_outlined.svg'
-import { PropType, reactive } from 'vue'
+import { computed, PropType, reactive } from 'vue'
import { useI18n } from '@/hooks/web/useI18n'
import { COLOR_PANEL } from '../../../util/chart'
import { fieldType } from '@/utils/attr'
@@ -12,6 +12,7 @@ import {
transDateFormat,
transDatePickerType
} from '@/views/chart/components/editor/util/DateFormatUtil'
+import { TableThreshold } from '@/models/chart/chart-senior'
const { t } = useI18n()
@@ -203,11 +204,20 @@ const valueOptions = [
]
const predefineColors = COLOR_PANEL
-const targetOptions = [
- { label: t('chart.self'), value: 'self' },
- { label: t('chart.total_row'), value: 'total_row' },
- { label: t('chart.custom'), value: 'custom' }
-]
+const targetOptions = computed(() => {
+ if (props.chart.type === 'rich-text') {
+ return [
+ { label: t('chart.self'), value: 'self' },
+ { label: t('chart.custom'), value: 'custom' }
+ ]
+ } else {
+ return [
+ { label: t('chart.self'), value: 'self' },
+ { label: t('chart.total_row'), value: 'total_row' },
+ { label: t('chart.custom'), value: 'custom' }
+ ]
+ }
+})
const state = reactive({
thresholdArr: [] as TableThreshold[],
@@ -435,7 +445,7 @@ init()