From 66a8c07776d34b3bf72bc4e13f224a2a9961355c Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Fri, 23 Aug 2024 15:51:06 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat(=E6=95=B0=E6=8D=AE=E5=A4=A7=E5=B1=8F):?= =?UTF-8?q?=20=E5=A4=A7=E5=B1=8F=E7=9A=84=E5=9B=BE=E7=89=87=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E6=94=AF=E6=8C=81=E8=83=8C=E6=99=AF=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=20#11582?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/core-frontend/src/custom-component/common/CommonAttr.vue | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/core/core-frontend/src/custom-component/common/CommonAttr.vue b/core/core-frontend/src/custom-component/common/CommonAttr.vue index 10187f4042..ad5de576e3 100644 --- a/core/core-frontend/src/custom-component/common/CommonAttr.vue +++ b/core/core-frontend/src/custom-component/common/CommonAttr.vue @@ -117,9 +117,7 @@ const backgroundCustomShow = computed(() => { return ( dashboardActive.value || (!dashboardActive.value && - !['CanvasBoard', 'CanvasIcon', 'Picture', 'CircleShape', 'RectShape'].includes( - element.value.component - )) + !['CanvasBoard', 'CanvasIcon', 'CircleShape', 'RectShape'].includes(element.value.component)) ) }) onMounted(() => { From 10455d1f5c27baad5aa3a49a615f5edcc5fb8dad Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Fri, 23 Aug 2024 16:50:10 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat(=E4=BB=AA=E8=A1=A8=E6=9D=BF=E3=80=81?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=A4=A7=E5=B1=8F):=20=E5=AF=8C=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E5=9B=BE=E8=A1=A8=E7=A9=BA=E5=80=BC=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rich-text/DeRichTextView.vue | 12 ++++++++- .../src/models/chart/chart-senior.d.ts | 4 +++ .../editor-senior/components/FunctionCfg.vue | 27 +++++++++++++++---- .../chart/components/editor/util/chart.ts | 1 + .../js/panel/charts/others/rich-text.ts | 10 +++++-- 5 files changed, 46 insertions(+), 8 deletions(-) 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 f3389843f9..0db2085076 100644 --- a/core/core-frontend/src/custom-component/rich-text/DeRichTextView.vue +++ b/core/core-frontend/src/custom-component/rich-text/DeRichTextView.vue @@ -104,6 +104,7 @@ const props = defineProps({ const { element, editMode, active, disabled, showPosition } = toRefs(props) const state = reactive({ + emptyValue: '-', data: null, viewDataInfo: null, totalItems: 0, @@ -229,7 +230,7 @@ const assignment = content => { if (dataRowFiledName.value.includes(itm)) { const ele = itm.slice(1, -1) let value = dataRowNameSelect.value[ele] !== undefined ? dataRowNameSelect.value[ele] : null - let targetValue = !!value ? value : '-' + let targetValue = !!value ? value : state.emptyValue if (thresholdStyleInfo && thresholdStyleInfo[ele]) { const thresholdStyle = thresholdStyleInfo[ele] targetValue = `${targetValue}` @@ -362,8 +363,16 @@ const editCursor = () => { }, 100) } +const updateEmptyValue = view => { + state.emptyValue = + view?.senior?.functionCfg?.emptyDataStrategy === 'custom' + ? view.senior.functionCfg.emptyDataCustomValue || '' + : '-' +} + const calcData = (view: Chart, callback) => { isError.value = false + updateEmptyValue(view) if (view.tableId || view['dataFrom'] === 'template') { const v = JSON.parse(JSON.stringify(view)) getData(v) @@ -483,6 +492,7 @@ const initCurFields = chartDetails => { // 初始化此处不必刷新 const renderChart = viewInfo => { //do renderView + updateEmptyValue(viewInfo) initCurFieldsChange() eventBus.emit('initCurFields-' + element.value.id) } diff --git a/core/core-frontend/src/models/chart/chart-senior.d.ts b/core/core-frontend/src/models/chart/chart-senior.d.ts index d8f1cdf73c..a86f4f6138 100644 --- a/core/core-frontend/src/models/chart/chart-senior.d.ts +++ b/core/core-frontend/src/models/chart/chart-senior.d.ts @@ -56,6 +56,10 @@ declare interface ChartFunctionCfg { * 空值处理 */ emptyDataStrategy: string + /** + * 自定义值 + */ + emptyDataCustomValue: string /** * 空值字段控制 */ diff --git a/core/core-frontend/src/views/chart/components/editor/editor-senior/components/FunctionCfg.vue b/core/core-frontend/src/views/chart/components/editor/editor-senior/components/FunctionCfg.vue index 461431d608..b7287d9d45 100644 --- a/core/core-frontend/src/views/chart/components/editor/editor-senior/components/FunctionCfg.vue +++ b/core/core-frontend/src/views/chart/components/editor/editor-senior/components/FunctionCfg.vue @@ -60,6 +60,10 @@ const showIgnoreOption = computed(() => { ) }) +const isRichText = computed(() => { + return equalsAny(props.chart.type, 'rich-text') +}) + const showEmptyDataFieldCtrl = computed(() => { return ( showProperty('emptyDataStrategy') && @@ -188,14 +192,27 @@ onMounted(() => { @change="changeFunctionCfg" > - {{ t('chart.break_line') }} - - {{ t('chart.set_zero') }} - - {{ t('chart.ignore_data') }} + {{ isRichText ? '置为"-"' : t('chart.break_line') }} + 自定义 + + + +