Commit 07b9a9ac by zhaochengxiang

路径

parent 798dbf0d
...@@ -360,35 +360,44 @@ const ModelTable = (props) => { ...@@ -360,35 +360,44 @@ const ModelTable = (props) => {
useEffect(() => { useEffect(() => {
if (tableWidth) { if (tableWidth) {
let newColumns = [...cols], newIncludePathColumns = [...cols]; let newColumns = [], newIncludePathColumns = [];
newIncludePathColumns.splice(3, 0, pathColumn);
if ((modelId||'') !== '') { if ((modelId||'') !== '') {
newColumns = cols.filter(item => item.dataIndex!=='key'); newColumns = cols.filter(item => item.dataIndex!=='key');
} }
newColumns.forEach((column, index) => { cols.forEach((column, index) => {
if (!column.width) { const newColumn = {...column};
const rowWidth = (newColumns.reduce((preVal, col) => (col.width?col.width:0) + preVal, 0)) + 50; if (!newColumn.width) {
const rowWidth = (cols.reduce((preVal, col) => (col.width?col.width:0) + preVal, 0)) + 50;
if (tableWidth > rowWidth) { if (tableWidth > rowWidth) {
column.width = (tableWidth-rowWidth)>200?(tableWidth-rowWidth):200; newColumn.width = (tableWidth-rowWidth)>200?(tableWidth-rowWidth):200;
} else { } else {
column.width = 200; newColumn.width = 200;
} }
} }
newColumns.push(newColumn);
}); });
newIncludePathColumns.forEach((column, index) => { const includePathCols = [...cols];
if (!column.width) {
const rowWidth = (newIncludePathColumns.reduce((preVal, col) => (col.width?col.width:0) + preVal, 0)) + 50; includePathCols.splice(3, 0, pathColumn);
includePathCols.forEach((column, index) => {
const newColumn = {...column};
if (!newColumn.width) {
const rowWidth = (includePathCols.reduce((preVal, col) => (col.width?col.width:0) + preVal, 0)) + 50;
if (tableWidth > rowWidth) { if (tableWidth > rowWidth) {
column.width = (tableWidth-rowWidth)>200?(tableWidth-rowWidth):200; newColumn.width = (tableWidth-rowWidth)>200?(tableWidth-rowWidth):200;
} else { } else {
column.width = 200; newColumn.width = 200;
} }
} }
newIncludePathColumns.push(newColumn);
}); });
setColumns(newColumns); setColumns(newColumns);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment