Commit 07b9a9ac by zhaochengxiang

路径

parent 798dbf0d
......@@ -360,35 +360,44 @@ const ModelTable = (props) => {
useEffect(() => {
if (tableWidth) {
let newColumns = [...cols], newIncludePathColumns = [...cols];
newIncludePathColumns.splice(3, 0, pathColumn);
let newColumns = [], newIncludePathColumns = [];
if ((modelId||'') !== '') {
newColumns = cols.filter(item => item.dataIndex!=='key');
}
newColumns.forEach((column, index) => {
if (!column.width) {
const rowWidth = (newColumns.reduce((preVal, col) => (col.width?col.width:0) + preVal, 0)) + 50;
cols.forEach((column, index) => {
const newColumn = {...column};
if (!newColumn.width) {
const rowWidth = (cols.reduce((preVal, col) => (col.width?col.width:0) + preVal, 0)) + 50;
if (tableWidth > rowWidth) {
column.width = (tableWidth-rowWidth)>200?(tableWidth-rowWidth):200;
newColumn.width = (tableWidth-rowWidth)>200?(tableWidth-rowWidth):200;
} else {
column.width = 200;
newColumn.width = 200;
}
}
newColumns.push(newColumn);
});
newIncludePathColumns.forEach((column, index) => {
if (!column.width) {
const rowWidth = (newIncludePathColumns.reduce((preVal, col) => (col.width?col.width:0) + preVal, 0)) + 50;
const includePathCols = [...cols];
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) {
column.width = (tableWidth-rowWidth)>200?(tableWidth-rowWidth):200;
newColumn.width = (tableWidth-rowWidth)>200?(tableWidth-rowWidth):200;
} else {
column.width = 200;
newColumn.width = 200;
}
}
newIncludePathColumns.push(newColumn);
});
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