From 747ac6c9f0d6386262ef785221f164677de89be1 Mon Sep 17 00:00:00 2001 From: ulleo Date: Tue, 4 Jun 2024 14:57:58 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=9B=BE=E8=A1=A8):=20=E6=98=8E=E7=BB=86?= =?UTF-8?q?=E8=A1=A8=E7=9A=84=E5=88=86=E9=A1=B5=EF=BC=8C=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E8=BE=93=E5=85=A5=E8=B7=B3=E8=BD=AC?= =?UTF-8?q?=E5=88=B0=E5=A4=9A=E5=B0=91=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #9672 --- core/core-frontend/src/locales/zh-CN.ts | 3 + .../src/models/chart/chart-attr.d.ts | 4 + .../components/BasicStyleSelector.vue | 96 +++++++++++-------- .../chart/components/editor/util/chart.ts | 1 + .../views/components/ChartComponentS2.vue | 32 ++++++- 5 files changed, 93 insertions(+), 43 deletions(-) diff --git a/core/core-frontend/src/locales/zh-CN.ts b/core/core-frontend/src/locales/zh-CN.ts index 6fc6b5d082..a97f81f0f6 100644 --- a/core/core-frontend/src/locales/zh-CN.ts +++ b/core/core-frontend/src/locales/zh-CN.ts @@ -939,6 +939,9 @@ export default { table_align_center: '居中', table_align_right: '右对齐', table_scroll_bar_color: '滚动条颜色', + table_pager_style: '分页器风格', + page_pager_simple: '精简', + page_pager_general: '常规', draw_back: '收回', senior: '高级', senior_cfg: '高级设置', diff --git a/core/core-frontend/src/models/chart/chart-attr.d.ts b/core/core-frontend/src/models/chart/chart-attr.d.ts index 7642d59876..3e5d0c3c86 100644 --- a/core/core-frontend/src/models/chart/chart-attr.d.ts +++ b/core/core-frontend/src/models/chart/chart-attr.d.ts @@ -92,6 +92,10 @@ declare interface ChartBasicStyle { * 表格分页模式 */ tablePageMode: 'page' | 'pull' + /** + * 表格分页器风格 + */ + tablePageStyle: 'simple' | 'general' /** * 表格分页大小 */ diff --git a/core/core-frontend/src/views/chart/components/editor/editor-style/components/BasicStyleSelector.vue b/core/core-frontend/src/views/chart/components/editor/editor-style/components/BasicStyleSelector.vue index 61031225da..2d640677e7 100644 --- a/core/core-frontend/src/views/chart/components/editor/editor-style/components/BasicStyleSelector.vue +++ b/core/core-frontend/src/views/chart/components/editor/editor-style/components/BasicStyleSelector.vue @@ -718,49 +718,61 @@ onMounted(() => { - - - - - - - - - - + - - - - - - - + {{ t('chart.page_mode_page') }} + {{ t('chart.page_mode_pull') }} + + + + + {{ t('chart.page_pager_simple') }} + {{ t('chart.page_pager_general') }} + + + + + + + + diff --git a/core/core-frontend/src/views/chart/components/editor/util/chart.ts b/core/core-frontend/src/views/chart/components/editor/util/chart.ts index e88526cd0a..b943a032b5 100644 --- a/core/core-frontend/src/views/chart/components/editor/util/chart.ts +++ b/core/core-frontend/src/views/chart/components/editor/util/chart.ts @@ -1401,6 +1401,7 @@ export const DEFAULT_BASIC_STYLE: ChartBasicStyle = { tableColumnWidth: 100, tableFieldWidth: [], tablePageMode: 'page', + tablePageStyle: 'simple', tablePageSize: 20, gaugeStyle: 'default', colorScheme: 'default', diff --git a/core/core-frontend/src/views/chart/components/views/components/ChartComponentS2.vue b/core/core-frontend/src/views/chart/components/views/components/ChartComponentS2.vue index 24108dcdf4..5ed0625529 100644 --- a/core/core-frontend/src/views/chart/components/views/components/ChartComponentS2.vue +++ b/core/core-frontend/src/views/chart/components/views/components/ChartComponentS2.vue @@ -90,7 +90,9 @@ const state = reactive({ currentPage: 1 }, totalItems: 0, - showPage: false + showPage: false, + pageStyle: 'simple', + currentPageSize: 0 }) // 图表数据不用全响应式 let chartData = shallowRef>({ @@ -182,6 +184,12 @@ const setupPage = (chart: ChartObj, resetPageInfo?: boolean) => { if (resetPageInfo) { state.pageInfo.currentPage = 1 } + state.pageStyle = customAttr.basicStyle.tablePageStyle + if (state.pageStyle === 'general') { + if (state.currentPageSize == 0) { + state.currentPageSize = pageInfo.pageSize + } + } } const initScroll = () => { @@ -242,6 +250,16 @@ const handleCurrentChange = pageNum => { const chart = { ...view.value, chartExtRequest: extReq } calcData(chart, null, false) } + +const handlePageSizeChange = pageSize => { + let extReq = { pageSize: pageSize } + if (chartExtRequest.value) { + extReq = { ...extReq, ...chartExtRequest.value } + } + const chart = { ...view.value, chartExtRequest: extReq } + calcData(chart, null, false) +} + const pointClickTrans = () => { if (embeddedCallBack.value === 'yes') { trackClick('pointClick') @@ -457,6 +475,7 @@ const tabStyle = computed(() => [
共{{ state.pageInfo.total }}条
[ :total="state.pageInfo.total" @update:current-page="handleCurrentChange" /> +