feat(仪表板): 编辑仪表板出现数据异常时,给出详细的明确的报错信息

#12745
This commit is contained in:
ulleo 2024-11-25 16:56:35 +08:00
parent 5b5dbb95c2
commit 03bce59153
5 changed files with 45 additions and 7 deletions

View File

@ -31,6 +31,7 @@ import jakarta.servlet.http.HttpServletResponse;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
@ -89,7 +90,7 @@ public class ChartDataServer implements ChartDataApi {
return chartDataManage.calcData(chartViewDTO);
}
} catch (Exception e) {
DEException.throwException(ResultCode.DATA_IS_WRONG.code(), e.getMessage());
DEException.throwException(ResultCode.DATA_IS_WRONG.code(), e.getMessage() + "\n\n" + ExceptionUtils.getStackTrace(e));
}
return null;
}

View File

@ -1476,7 +1476,8 @@ export default {
chartName: 'New Chart',
chart_show_error: 'Cannot display normally',
chart_error_tips:
'Abnormal data acquisition, if you have any questions, please contact the administrator',
'Abnormal data acquisition, if you have any questions, please contact the administrator, ',
chart_show_error_info: 'click to show error info',
title_cannot_empty: 'Title cannot be empty',
table_title_height: 'Header row height',
table_item_height: 'Table row height',

View File

@ -1086,7 +1086,7 @@ export default {
primary_key_change: '主鍵不能改變:',
api_field_not_empty: '欄位不能為空',
success_copy: '複製成功',
primary_key_length: '键必须设置长: ',
primary_key_length: '鍵必須設置長: ',
valid: '有效',
invalid: '無效',
api_step_1: '連結API',
@ -1138,7 +1138,7 @@ export default {
set_key: '設為主鍵',
field_rename: '重命名',
select_type: '選擇資料來源類型',
length: '字段',
length: '字段',
sync_table: '同步指定表',
req_completed: '請求成功',
sync_rate: '更新頻率',
@ -1438,7 +1438,8 @@ export default {
date_split: 'yyyy/MM/dd',
chartName: '新建圖表',
chart_show_error: '無法正常顯示',
chart_error_tips: '取得資料異常如有疑問請聯絡管理員',
chart_error_tips: '取得資料異常如有疑問請聯絡管理員',
chart_show_error_info: '查看異常原因',
title_cannot_empty: '標題不能為空',
table_title_height: '表頭行高',
table_item_height: '表格行高',

View File

@ -1440,7 +1440,8 @@ export default {
date_split: 'yyyy/MM/dd',
chartName: '新建图表',
chart_show_error: '无法正常显示',
chart_error_tips: '获取数据异常如有疑问请联系管理员',
chart_error_tips: '获取数据异常如有疑问请联系管理员',
chart_show_error_info: '查看异常原因',
title_cannot_empty: '标题不能为空',
table_title_height: '表头行高',
table_item_height: '表格行高',

View File

@ -1,5 +1,6 @@
<script lang="tsx" setup>
import { useI18n } from '@/hooks/web/useI18n'
import { ref } from 'vue'
const { t } = useI18n()
@ -10,11 +11,38 @@ const props = defineProps({
default: ''
}
})
const dialogVisible = ref(false)
function showInfo() {
dialogVisible.value = true
}
</script>
<template>
<div class="canvas-content error-info">
<span>[{{ t('chart.chart_error_tips') }}]</span>
<span
>[{{ t('chart.chart_error_tips')
}}<a style="color: #0969da; cursor: pointer" @click="showInfo">{{
t('chart.chart_show_error_info')
}}</a
>]</span
>
<el-dialog
:append-to-body="true"
v-model="dialogVisible"
width="80%"
:close-on-click-modal="false"
center
>
<el-main style="height: 400px">
<span style="white-space: pre-line" v-html="errMsg"></span>
</el-main>
<template #footer>
<span class="m-dialog-footer">
<el-button @click="dialogVisible = false">{{ t('commons.close') }}</el-button>
</span>
</template>
</el-dialog>
</div>
</template>
@ -30,4 +58,10 @@ const props = defineProps({
height: 100%;
flex-direction: column;
}
.m-dialog-footer {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
</style>