forked from github/dataease
Merge pull request #8269 from dataease/pr@dev-v2@fix_table_index_column_width
fix(视图): 表格开启序号后拖拽无法保存序号的列宽
This commit is contained in:
commit
8ba43c8835
@ -70,7 +70,7 @@ declare interface ChartBasicStyle {
|
|||||||
/**
|
/**
|
||||||
* 字段名称
|
* 字段名称
|
||||||
*/
|
*/
|
||||||
name: string
|
name?: string
|
||||||
/**
|
/**
|
||||||
* 字段宽度占比
|
* 字段宽度占比
|
||||||
*/
|
*/
|
||||||
|
@ -302,15 +302,20 @@ const resizeAction = resizeColumn => {
|
|||||||
if (showPosition.value !== 'canvas') {
|
if (showPosition.value !== 'canvas') {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const fieldId = resizeColumn.info.meta.field
|
const fieldId: string = resizeColumn.info.meta.field
|
||||||
const { basicStyle } = view.value.customAttr
|
const { basicStyle } = view.value.customAttr
|
||||||
const containerWidth = document.getElementById(containerId).offsetWidth
|
const containerWidth = document.getElementById(containerId).offsetWidth
|
||||||
basicStyle.tableFieldWidth?.forEach(item => {
|
const column = basicStyle.tableFieldWidth?.find(i => i.fieldId === fieldId)
|
||||||
if (item.fieldId === fieldId) {
|
let tableWidth: ChartBasicStyle['tableFieldWidth']
|
||||||
item.width = parseFloat(((resizeColumn.info.resizedWidth / containerWidth) * 100).toFixed(2))
|
const width = parseFloat(((resizeColumn.info.resizedWidth / containerWidth) * 100).toFixed(2))
|
||||||
}
|
if (column) {
|
||||||
})
|
column.width = width
|
||||||
emitter.emit('set-table-column-width', basicStyle.tableFieldWidth)
|
tableWidth = [...basicStyle.tableFieldWidth]
|
||||||
|
} else {
|
||||||
|
const tmp = { fieldId, width }
|
||||||
|
tableWidth = basicStyle.tableFieldWidth?.length ? [...basicStyle.tableFieldWidth, tmp] : [tmp]
|
||||||
|
}
|
||||||
|
emitter.emit('set-table-column-width', tableWidth)
|
||||||
}
|
}
|
||||||
defineExpose({
|
defineExpose({
|
||||||
calcData,
|
calcData,
|
||||||
|
Loading…
Reference in New Issue
Block a user