From a23a7e0a6201d0f21ea3b981d6621fa81adcc73d Mon Sep 17 00:00:00 2001 From: junjie Date: Wed, 8 Sep 2021 10:59:19 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E8=A7=86=E5=9B=BE):=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=98=8E=E7=BB=86=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../canvas/custom-component/UserView.vue | 2 +- frontend/src/lang/en.js | 4 +- frontend/src/lang/tw.js | 4 +- frontend/src/lang/zh.js | 4 +- .../chart/components/table/TableNormal.vue | 166 ++++++++++++------ frontend/src/views/chart/view/ChartEdit.vue | 2 +- 6 files changed, 119 insertions(+), 63 deletions(-) diff --git a/frontend/src/components/canvas/custom-component/UserView.vue b/frontend/src/components/canvas/custom-component/UserView.vue index c31f829010..ce19cc8b54 100644 --- a/frontend/src/components/canvas/custom-component/UserView.vue +++ b/frontend/src/components/canvas/custom-component/UserView.vue @@ -18,7 +18,7 @@ - +
diff --git a/frontend/src/lang/en.js b/frontend/src/lang/en.js index a9a042fd0a..879e37af21 100644 --- a/frontend/src/lang/en.js +++ b/frontend/src/lang/en.js @@ -860,7 +860,9 @@ export default { drag_block_value_axis_main: 'Main Axis Value', drag_block_value_axis_ext: 'Ext Axis Value', yAxis_main: 'Main Vertical Axis', - yAxis_ext: 'Ext Vertical Axis' + yAxis_ext: 'Ext Vertical Axis', + total: 'Total', + items: 'Items' }, dataset: { sheet_warn: 'There are multiple sheet pages, and the first one is extracted by default', diff --git a/frontend/src/lang/tw.js b/frontend/src/lang/tw.js index 6f055e79d8..26912bcc32 100644 --- a/frontend/src/lang/tw.js +++ b/frontend/src/lang/tw.js @@ -859,7 +859,9 @@ export default { drag_block_value_axis_main: '主軸值', drag_block_value_axis_ext: '副軸值', yAxis_main: '主縱軸', - yAxis_ext: '副縱軸' + yAxis_ext: '副縱軸', + total: '共', + items: '條數據' }, dataset: { sheet_warn: '有多個sheet頁面,默認抽取第一個', diff --git a/frontend/src/lang/zh.js b/frontend/src/lang/zh.js index baaf267438..8e18d12236 100644 --- a/frontend/src/lang/zh.js +++ b/frontend/src/lang/zh.js @@ -859,7 +859,9 @@ export default { drag_block_value_axis_main: '主轴值', drag_block_value_axis_ext: '副轴值', yAxis_main: '主纵轴', - yAxis_ext: '副纵轴' + yAxis_ext: '副纵轴', + total: '共', + items: '条数据' }, dataset: { sheet_warn: '有多个 Sheet 页,默认抽取第一个', diff --git a/frontend/src/views/chart/components/table/TableNormal.vue b/frontend/src/views/chart/components/table/TableNormal.vue index 3dccf80703..06e6f690fa 100644 --- a/frontend/src/views/chart/components/table/TableNormal.vue +++ b/frontend/src/views/chart/components/table/TableNormal.vue @@ -1,44 +1,55 @@ @@ -102,12 +113,12 @@ export default { height: '36px' }, title_show: true, - borderRadius: '0px' - // currentPage: { - // page: 1, - // pageSize: 10, - // show: 0 - // } + borderRadius: '0px', + currentPage: { + page: 1, + pageSize: 10, + show: 0 + } } }, computed: { @@ -153,13 +164,17 @@ export default { if (this.chart.data) { this.fields = JSON.parse(JSON.stringify(this.chart.data.fields)) datas = JSON.parse(JSON.stringify(this.chart.data.tableRow)) - // if (this.chart.data.page) { - // this.currentPage = JSON.parse(JSON.stringify(this.chart.data.page)) - // } + if (this.chart.type === 'table-info') { + // 计算分页 + this.currentPage.show = datas.length + const pageStart = (this.currentPage.page - 1) * this.currentPage.pageSize + const pageEnd = pageStart + this.currentPage.pageSize + datas = datas.slice(pageStart, pageEnd) + } } else { this.fields = [] datas = [] - // this.resetPage() + this.resetPage() } this.$refs.plxTable.reloadData(datas) this.$nextTick(() => { @@ -172,11 +187,19 @@ export default { calcHeightRightNow() { this.$nextTick(() => { if (this.$refs.tableContainer) { + let pageHeight = 0 + if (this.chart.type === 'table-info') { + pageHeight = 36 + } const currentHeight = this.$refs.tableContainer.offsetHeight - const tableMaxHeight = currentHeight - this.$refs.title.offsetHeight - 16 + const tableMaxHeight = currentHeight - this.$refs.title.offsetHeight - 16 - pageHeight let tableHeight if (this.chart.data) { - tableHeight = (this.chart.data.tableRow.length + 2) * 36 + if (this.chart.type === 'table-info') { + tableHeight = (this.currentPage.pageSize + 2) * 36 - pageHeight + } else { + tableHeight = (this.chart.data.tableRow.length + 2) * 36 - pageHeight + } } else { tableHeight = 0 } @@ -301,17 +324,23 @@ export default { this.height = 100 }, - pageChange() { + pageChange(val) { + this.currentPage.pageSize = val + this.init() + }, + pageClick(val) { + this.currentPage.page = val + this.init() + }, + + resetPage() { + this.currentPage = { + page: 1, + pageSize: 10, + show: 0 + } } - - // resetPage() { - // this.currentPage = { - // page: 1, - // pageSize: 10, - // show: 0 - // } - // } } } @@ -324,4 +353,25 @@ export default { max-height: none!important; line-height: normal!important; } + .table-page{ + position: absolute; + bottom: 0; + display: flex; + align-items: center; + justify-content: flex-end; + width: 100%; + overflow: hidden; + } + .page-style{ + margin-right: auto; + } + .total-style{ + flex: 1; + font-size: 12px; + color: #606266; + white-space:nowrap; + } + .page-style >>> .el-input__inner{ + height: 24px; + } diff --git a/frontend/src/views/chart/view/ChartEdit.vue b/frontend/src/views/chart/view/ChartEdit.vue index eb4cf6d252..dc050febd8 100644 --- a/frontend/src/views/chart/view/ChartEdit.vue +++ b/frontend/src/views/chart/view/ChartEdit.vue @@ -77,7 +77,7 @@ @add="moveToQuota" > - +