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(() => { 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') }} + 自定义 + + + +