feat(视图): 部分数据源不支持直连分页,使用前端分页

This commit is contained in:
junjun 2022-11-25 16:31:26 +08:00
parent c86c94a372
commit 1308aa1d73
5 changed files with 8 additions and 4 deletions

View File

@ -45,4 +45,5 @@ public class ChartViewDTO extends ChartViewWithBLOBs {
private long totalPage;
private long totalItems;
private int datasetMode;
private String datasetType;
}

View File

@ -302,6 +302,7 @@ public class ChartViewService {
DatasetTable datasetTable = dataSetTableService.get(view.getTableId());
if (ObjectUtils.isNotEmpty(datasetTable)) {
view.setDatasetMode(datasetTable.getMode());
view.setDatasetType(datasetTable.getType());
}
// 如果是从仪表板获取视图数据则仪表板的查询模式查询结果的数量覆盖视图对应的属性
if (CommonConstants.VIEW_RESULT_MODE.CUSTOM.equals(request.getResultMode())) {

View File

@ -1107,3 +1107,5 @@ export const CHART_FONT_LETTER_SPACE = [
{ name: '9px', value: '9' },
{ name: '10px', value: '10' }
]
export const NOT_SUPPORT_PAGE_DATASET = ['kylin', 'sqlServer', 'es', 'presto']

View File

@ -92,7 +92,7 @@ import ViewTrackBar from '@/components/canvas/components/editor/ViewTrackBar'
import { getRemark, hexColorToRGBA } from '@/views/chart/chart/util'
import { baseTableInfo, baseTableNormal, baseTablePivot } from '@/views/chart/chart/table/table-info'
import TitleRemark from '@/views/chart/view/TitleRemark'
import { DEFAULT_TITLE_STYLE } from '@/views/chart/chart/chart'
import { DEFAULT_TITLE_STYLE, NOT_SUPPORT_PAGE_DATASET } from '@/views/chart/chart/chart'
import ChartTitleUpdate from './ChartTitleUpdate.vue'
import { mapState } from 'vuex'
@ -234,7 +234,7 @@ export default {
const attr = JSON.parse(this.chart.customAttr)
this.currentPage.pageSize = parseInt(attr.size.tablePageSize ? attr.size.tablePageSize : 20)
data = JSON.parse(JSON.stringify(this.chart.data.tableRow))
if (this.chart.datasetMode === 0) {
if (this.chart.datasetMode === 0 && !NOT_SUPPORT_PAGE_DATASET.includes(this.chart.datasetType)) {
if (this.chart.type === 'table-info' && (attr.size.tablePageMode === 'page' || !attr.size.tablePageMode) && this.chart.totalItems > this.currentPage.pageSize) {
this.currentPage.show = this.chart.totalItems
this.showPage = true

View File

@ -79,7 +79,7 @@
<script>
import { hexColorToRGBA } from '../../chart/util'
import eventBus from '@/components/canvas/utils/eventBus'
import { DEFAULT_COLOR_CASE, DEFAULT_SIZE } from '@/views/chart/chart/chart'
import { DEFAULT_COLOR_CASE, DEFAULT_SIZE, NOT_SUPPORT_PAGE_DATASET } from '@/views/chart/chart/chart'
import { mapState } from 'vuex'
export default {
@ -238,7 +238,7 @@ export default {
}
data = JSON.parse(JSON.stringify(this.chart.data.tableRow))
if (this.chart.datasetMode === 0) {
if (this.chart.datasetMode === 0 && !NOT_SUPPORT_PAGE_DATASET.includes(this.chart.datasetType)) {
if (this.chart.type === 'table-info' && (attr.size.tablePageMode === 'page' || !attr.size.tablePageMode) && this.chart.totalItems > this.currentPage.pageSize) {
this.currentPage.show = this.chart.totalItems
this.showPage = true