fix(视图): 表格开启序号后拖拽无法保存序号的列宽
This commit is contained in:
parent
d3f30edf5d
commit
2096069a58
@ -17,7 +17,6 @@ import { formatterItem, valueFormatter } from '@/views/chart/chart/formatter'
|
||||
import { handleTableEmptyStrategy, hexColorToRGBA } from '@/views/chart/chart/util'
|
||||
import { maxBy, minBy, find } from 'lodash-es'
|
||||
import TableTooltip from '@/views/chart/components/table/TableTooltip.vue'
|
||||
import Vue from 'vue'
|
||||
|
||||
class SortTooltip extends BaseTooltip {
|
||||
vueCom
|
||||
|
||||
@ -567,13 +567,18 @@ export default {
|
||||
}
|
||||
const fieldId = resizeColumn.info.meta.field
|
||||
const size = JSON.parse(this.chart.customAttr).size
|
||||
size.tableFieldWidth?.forEach(item => {
|
||||
if (item.fieldId === fieldId) {
|
||||
const containerWidth = document.getElementById(this.chartId).offsetWidth
|
||||
item.width = (resizeColumn.info.resizedWidth / containerWidth * 100).toFixed(2)
|
||||
}
|
||||
})
|
||||
bus.$emit('set-table-column-width', size.tableFieldWidth)
|
||||
const containerWidth = document.getElementById(this.chartId).offsetWidth
|
||||
const column = size.tableFieldWidth?.find(i => i.fieldId === fieldId)
|
||||
let tableWidth
|
||||
const width = parseFloat((resizeColumn.info.resizedWidth / containerWidth * 100).toFixed(2))
|
||||
if (column) {
|
||||
column.width = width
|
||||
tableWidth = [...size.tableFieldWidth]
|
||||
} else {
|
||||
const tmp = { fieldId, width }
|
||||
tableWidth = size.tableFieldWidth?.length ? [...size.tableFieldWidth, tmp] : [tmp]
|
||||
}
|
||||
bus.$emit('set-table-column-width', tableWidth)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1848,7 +1848,7 @@ export default {
|
||||
} else {
|
||||
if (!this.sizeForm.tableFieldWidth?.length) {
|
||||
this.sizeForm.tableFieldWidth = []
|
||||
const defaultWidth = (100 / allAxis.length).toFixed(2)
|
||||
const defaultWidth = parseFloat((100 / allAxis.length).toFixed(2))
|
||||
allAxis.forEach(item => {
|
||||
this.sizeForm.tableFieldWidth.push({
|
||||
fieldId: item.dataeaseName,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user