From 110d30547ce08abd044dad9d170c7c0b480d264a Mon Sep 17 00:00:00 2001 From: junjun Date: Thu, 22 Dec 2022 17:56:26 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E8=A7=86=E5=9B=BE):=20=E9=80=8F=E8=A7=86?= =?UTF-8?q?=E8=A1=A8=E5=A2=9E=E5=8A=A0=E8=A1=A8=E5=A4=B4=E8=A1=8C=E5=88=97?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/chart/chart/table/table-info.js | 4 +++- .../src/views/chart/components/ChartComponentS2.vue | 12 +++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/frontend/src/views/chart/chart/table/table-info.js b/frontend/src/views/chart/chart/table/table-info.js index 46dabf1ed4..b469f88edb 100644 --- a/frontend/src/views/chart/chart/table/table-info.js +++ b/frontend/src/views/chart/chart/table/table-info.js @@ -301,7 +301,7 @@ export function baseTableNormal(s2, container, chart, action, tableData) { return s2 } -export function baseTablePivot(s2, container, chart, action, tableData) { +export function baseTablePivot(s2, container, chart, action, headerAction, tableData) { const containerDom = document.getElementById(container) // row and column @@ -476,6 +476,8 @@ export function baseTablePivot(s2, container, chart, action, tableData) { // click s2.on(S2Event.DATA_CELL_CLICK, action) + s2.on(S2Event.ROW_CELL_CLICK, headerAction) + s2.on(S2Event.COL_CELL_CLICK, headerAction) // theme const customTheme = getCustomTheme(chart) diff --git a/frontend/src/views/chart/components/ChartComponentS2.vue b/frontend/src/views/chart/components/ChartComponentS2.vue index ce21906be8..d982174c58 100644 --- a/frontend/src/views/chart/components/ChartComponentS2.vue +++ b/frontend/src/views/chart/components/ChartComponentS2.vue @@ -308,7 +308,7 @@ export default { } else if (chart.type === 'table-normal') { this.myChart = baseTableNormal(this.myChart, this.chartId, chart, this.antVAction, this.tableData) } else if (chart.type === 'table-pivot') { - this.myChart = baseTablePivot(this.myChart, this.chartId, chart, this.antVAction, this.tableData) + this.myChart = baseTablePivot(this.myChart, this.chartId, chart, this.antVAction, this.tableHeaderClick, this.tableData) } else { if (this.myChart) { this.antVRenderStatus = false @@ -368,6 +368,16 @@ export default { this.$refs.viewTrack.trackButtonClick() } }, + tableHeaderClick(param) { + const cell = this.myChart.getCell(param.target) + const meta = cell.getMeta() + const rowData = meta.query + // rowData is a object,do something + // { + // city:"绍兴市", + // province:"浙江省" + // } + }, setBackGroundBorder() { if (this.chart.customStyle) { const customStyle = JSON.parse(this.chart.customStyle)