fix(视图): 修复表格序号错误

修复表格序号未按照实际数据排序
https://www.tapd.cn/55578866/bugtrace/bugs/view/1155578866001019105
This commit is contained in:
wisonic-s 2022-10-31 19:12:30 +08:00
parent 549ae4859b
commit 78cc8130be
14 changed files with 60 additions and 18 deletions

View File

@ -788,9 +788,7 @@ public class ChartViewService {
ChartExtFilterRequest drillFilter = new ChartExtFilterRequest();
drillFilter.setFieldId(dto.getId());
drillFilter.setValue(new ArrayList<String>() {{
add(dto.getValue());
}});
drillFilter.setValue(Collections.singletonList(dto.getValue()));
drillFilter.setOperator("in");
drillFilter.setDatasetTableField(datasetTableField);
extFilterList.add(drillFilter);

View File

@ -202,6 +202,10 @@ public class ChartDataBuild {
chartDimensionDTO.setValue(row[k]);
dimensionList.add(chartDimensionDTO);
}
ChartDimensionDTO chartDimensionDTO = new ChartDimensionDTO();
chartDimensionDTO.setId(extStack.get(0).getId());
chartDimensionDTO.setValue(row[xAxis.size()]);
dimensionList.add(chartDimensionDTO);
axisChartDataDTO.setDimensionList(dimensionList);
if (CollectionUtils.isNotEmpty(yAxis)) {
@ -1054,6 +1058,10 @@ public class ChartDataBuild {
chartDimensionDTO.setValue(row[j]);
dimensionList.add(chartDimensionDTO);
}
ChartDimensionDTO chartDimensionDTO = new ChartDimensionDTO();
chartDimensionDTO.setId(extStack.get(0).getId());
chartDimensionDTO.setValue(row[xAxis.size()]);
dimensionList.add(chartDimensionDTO);
axisChartDataDTO.setDimensionList(dimensionList);
if (CollectionUtils.isNotEmpty(yAxis)) {

View File

@ -1434,7 +1434,8 @@ export default {
reserve_two: '2',
proportion: 'Proportion',
label_content: 'Label Content',
percent: 'Percent'
percent: 'Percent',
table_index_desc: 'Index Header Name'
},
dataset: {
parse_filed: 'Parse Field',

View File

@ -1434,7 +1434,8 @@ export default {
reserve_two: '两位',
proportion: '佔比',
label_content: '標籤展示',
percent: '占比'
percent: '占比',
table_index_desc: '表頭名稱'
},
dataset: {
parse_filed: '解析字段',

View File

@ -1433,7 +1433,8 @@ export default {
reserve_two: '两位',
proportion: '占比',
label_content: '标签展示',
percent: '占比'
percent: '占比',
table_index_desc: '表头名称'
},
dataset: {
parse_filed: '解析字段',

View File

@ -230,6 +230,9 @@ export function getLabel(chart) {
}
}
res = contentItems.join(' ')
} else if (equalsAny(chart.type, 'pie-rose', 'pie-donut-rose')) {
const quotaValue = valueFormatter(param.value, formatterCfg)
res = [param.field, quotaValue].join(' ')
} else {
res = valueFormatter(param.value, formatterCfg)
}

View File

@ -168,6 +168,7 @@ export function getCustomTheme(chart) {
theme.rowCell.text.textAlign = i_a
theme.rowCell.measureText.fontSize = parseInt(s.tableItemFontSize)
theme.rowCell.measureText.textAlign = i_a
theme.rowCell.seriesNumberWidth = parseInt(s.tableColumnWidth)
theme.colCell.bolderText.fontSize = parseInt(s.tableTitleFontSize)
theme.colCell.bolderText.textAlign = h_a

View File

@ -1,10 +1,10 @@
import { TableSheet, S2Event, PivotSheet } from '@antv/s2'
import { TableSheet, S2Event, PivotSheet, DataCell } from '@antv/s2'
import { getCustomTheme, getSize } from '@/views/chart/chart/common/common_table'
import { DEFAULT_COLOR_CASE, DEFAULT_TOTAL } from '@/views/chart/chart/chart'
import { formatterItem, valueFormatter } from '@/views/chart/chart/formatter'
import { hexColorToRGBA } from '@/views/chart/chart/util'
import Vue from 'vue'
export function baseTableInfo(s2, container, chart, action, tableData) {
export function baseTableInfo(s2, container, chart, action, tableData, pageInfo) {
const containerDom = document.getElementById(container)
// fields
@ -132,9 +132,19 @@ export function baseTableInfo(s2, container, chart, action, tableData) {
if (s2Options.showSeriesNumber) {
s2Options.colCell = (node) => {
if (node.colIndex === 0) {
node.label = customAttr.size.indexLabel
if (!customAttr.size.indexLabel) {
node.label = ' '
} else {
node.label = customAttr.size.indexLabel
}
}
}
s2Options.dataCell = (viewMeta) => {
if (viewMeta.colIndex === 0) {
viewMeta.fieldValue = (pageInfo.pageSize * (pageInfo.page - 1)) + viewMeta.rowIndex + 1
}
return new DataCell(viewMeta, viewMeta?.spreadsheet)
}
}
// 开始渲染
@ -270,7 +280,11 @@ export function baseTableNormal(s2, container, chart, action, tableData) {
if (s2Options.showSeriesNumber) {
s2Options.colCell = (node) => {
if (node.colIndex === 0) {
node.label = customAttr.size.indexLabel
if (!customAttr.size.indexLabel) {
node.label = ' '
} else {
node.label = customAttr.size.indexLabel
}
}
}
}

View File

@ -291,7 +291,7 @@ export default {
}
}
if (chart.type === 'table-info') {
this.myChart = baseTableInfo(this.myChart, this.chartId, chart, this.antVAction, this.tableData)
this.myChart = baseTableInfo(this.myChart, this.chartId, chart, this.antVAction, this.tableData, this.currentPage)
} else if (chart.type === 'table-normal') {
this.myChart = baseTableNormal(this.myChart, this.chartId, chart, this.antVAction, this.tableData)
} else if (chart.type === 'table-pivot') {
@ -522,7 +522,7 @@ export default {
ele.filter = []
}
})
if (view.type === 'table-pivot' || view.type === 'bar-group') {
if (view.type === 'table-pivot' || view.type.includes('bar-group')) {
view.xaxisExt.forEach(function(ele) {
if (!ele.dateStyle || ele.dateStyle === '') {
ele.dateStyle = 'y_M_d'

View File

@ -387,6 +387,7 @@
<el-form-item
v-show="showProperty('tableIndexLabel') && sizeForm.showIndex"
label-width="100px"
:label="$t('chart.table_index_desc')"
class="form-item"
>
<el-input
@ -1061,7 +1062,9 @@ export default {
this.sizeForm.tablePageSize = this.sizeForm.tablePageSize ? this.sizeForm.tablePageSize : DEFAULT_SIZE.tablePageSize
this.sizeForm.showIndex = this.sizeForm.showIndex ? this.sizeForm.showIndex : DEFAULT_SIZE.showIndex
this.sizeForm.indexLabel = this.sizeForm.indexLabel ? this.sizeForm.indexLabel : DEFAULT_SIZE.indexLabel
if (this.sizeForm.indexLabel === null || this.sizeForm.indexLabel === undefined) {
this.sizeForm.indexLabel = DEFAULT_SIZE.indexLabel
}
this.sizeForm.quotaFontFamily = this.sizeForm.quotaFontFamily ? this.sizeForm.quotaFontFamily : DEFAULT_SIZE.quotaFontFamily
this.sizeForm.quotaFontIsBolder = this.sizeForm.quotaFontIsBolder ? this.sizeForm.quotaFontIsBolder : DEFAULT_SIZE.quotaFontIsBolder

View File

@ -376,6 +376,7 @@
<el-form-item
v-show="showProperty('tableIndexLabel') && sizeForm.showIndex"
label-width="100px"
:label="$t('chart.table_index_desc')"
class="form-item"
>
<el-input
@ -1355,7 +1356,9 @@ export default {
this.sizeForm.tableItemAlign = this.sizeForm.tableItemAlign ? this.sizeForm.tableItemAlign : DEFAULT_SIZE.tableItemAlign
this.sizeForm.showIndex = this.sizeForm.showIndex ? this.sizeForm.showIndex : DEFAULT_SIZE.showIndex
this.sizeForm.indexLabel = this.sizeForm.indexLabel ? this.sizeForm.indexLabel : DEFAULT_SIZE.indexLabel
if (this.sizeForm.indexLabel === null || this.sizeForm.indexLabel === undefined) {
this.sizeForm.indexLabel = DEFAULT_SIZE.indexLabel
}
this.sizeForm.gaugeTickCount = this.sizeForm.gaugeTickCount ? this.sizeForm.gaugeTickCount : DEFAULT_SIZE.gaugeTickCount

View File

@ -23,6 +23,7 @@
:class="chart.id"
:show-summary="showSummary"
:summary-method="summaryMethod"
:index-config="{seqMethod}"
>
<ux-table-column
type="index"
@ -294,7 +295,11 @@ export default {
break
}
}
this.indexLabel = customAttr.size.indexLabel
if (!customAttr.size.indexLabel) {
this.indexLabel = ' '
} else {
this.indexLabel = customAttr.size.indexLabel
}
}
this.table_item_class_stripe = JSON.parse(JSON.stringify(this.table_item_class))
//
@ -380,7 +385,11 @@ export default {
// ()
return [means]
},
seqMethod({ rowIndex, column }) {
if (column?.type === 'index') {
return (this.currentPage.pageSize * (this.currentPage.page - 1)) + rowIndex + 1
}
},
chartResize() {
//
this.calcHeightDelay()

View File

@ -1043,7 +1043,7 @@ export default {
attr.label.position = 'outer'
}
if (type === 'pie-donut') {
attr.size.pieInnerRadius = Math.round(attr.size.pieOuterRadius * 0.7)
attr.size.pieInnerRadius = Math.round(attr.size.pieOuterRadius * 0.75)
}
if (type === 'pie-donut-rose') {
attr.size.pieInnerRadius = Math.round(attr.size.pieOuterRadius * 0.5)

View File

@ -3092,7 +3092,7 @@ export default {
customAttr.label.position = 'outer'
}
if (type === 'pie-donut') {
customAttr.size.pieInnerRadius = Math.round(customAttr.size.pieOuterRadius * 0.7)
customAttr.size.pieInnerRadius = Math.round(customAttr.size.pieOuterRadius * 0.75)
}
if (type === 'pie-donut-rose') {
customAttr.size.pieInnerRadius = Math.round(customAttr.size.pieOuterRadius * 0.5)