Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
szse
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhaochengxiang
szse
Commits
7b342c03
Commit
7b342c03
authored
Nov 04, 2022
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
路径
parent
07b57f41
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
48 deletions
+43
-48
ModelTable.jsx
src/view/Manage/Model/Component/ModelTable.jsx
+43
-48
No files found.
src/view/Manage/Model/Component/ModelTable.jsx
View file @
7b342c03
...
@@ -179,6 +179,21 @@ const ModelTable = (props) => {
...
@@ -179,6 +179,21 @@ const ModelTable = (props) => {
}
}
},
},
{
{
title
:
'路径'
,
dataIndex
:
'path'
,
width
:
120
,
ellipsis
:
true
,
sorter
:
true
,
sortDirections
:
[
'ascend'
,
'descend'
],
render
:
(
text
,
_
,
__
)
=>
{
return
(
<
Tooltip
title=
{
text
||
''
}
>
<
Text
ellipsis=
{
true
}
>
{
text
||
''
}
</
Text
>
</
Tooltip
>
)
}
},
{
title
:
'状态'
,
title
:
'状态'
,
dataIndex
:
'state'
,
dataIndex
:
'state'
,
width
:
100
,
width
:
100
,
...
@@ -257,24 +272,8 @@ const ModelTable = (props) => {
...
@@ -257,24 +272,8 @@ const ModelTable = (props) => {
},
},
];
];
const
pathColumn
=
{
title
:
'路径'
,
dataIndex
:
'path'
,
width
:
120
,
ellipsis
:
true
,
sorter
:
true
,
sortDirections
:
[
'ascend'
,
'descend'
],
render
:
(
text
,
_
,
__
)
=>
{
return
(
<
Tooltip
title=
{
text
||
''
}
>
<
Text
ellipsis=
{
true
}
>
{
text
||
''
}
</
Text
>
</
Tooltip
>
)
}
};
const
[
columns
,
setColumns
]
=
useState
([]);
const
[
columns
,
setColumns
]
=
useState
([]);
const
[
includePathColumns
,
setIncludePathColumns
]
=
useState
([]);
//
const [ includePathColumns, setIncludePathColumns ] = useState([]);
const
[
pagination
,
setPagination
]
=
useState
(
{
pageNum
:
1
,
pageSize
:
20
}
);
const
[
pagination
,
setPagination
]
=
useState
(
{
pageNum
:
1
,
pageSize
:
20
}
);
const
[
currentItem
,
setCurrentItem
]
=
useState
(
null
);
const
[
currentItem
,
setCurrentItem
]
=
useState
(
null
);
const
{
pageNum
,
pageSize
}
=
pagination
;
const
{
pageNum
,
pageSize
}
=
pagination
;
...
@@ -388,17 +387,17 @@ const ModelTable = (props) => {
...
@@ -388,17 +387,17 @@ const ModelTable = (props) => {
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
tableWidth
>
0
&&
columns
.
length
===
0
)
{
if
(
tableWidth
>
0
&&
columns
.
length
===
0
)
{
let
newColumns
=
[]
,
newIncludePathColumns
=
[]
;
let
newColumns
=
[];
let
excludePath
Cols
=
[...
cols
];
let
new
Cols
=
[...
cols
];
if
((
modelId
||
''
)
!==
''
)
{
if
((
modelId
||
''
)
!==
''
)
{
excludePath
Cols
=
cols
.
filter
(
item
=>
item
.
dataIndex
!==
'key'
);
new
Cols
=
cols
.
filter
(
item
=>
item
.
dataIndex
!==
'key'
);
}
}
excludePath
Cols
.
forEach
((
column
,
index
)
=>
{
new
Cols
.
forEach
((
column
,
index
)
=>
{
const
newColumn
=
{...
column
};
const
newColumn
=
{...
column
};
if
(
!
newColumn
.
width
)
{
if
(
!
newColumn
.
width
)
{
const
rowWidth
=
(
excludePath
Cols
.
reduce
((
preVal
,
col
)
=>
(
col
.
width
?
col
.
width
:
0
)
+
preVal
,
0
))
+
97
;
//展开50 勾选32 滚动条15
const
rowWidth
=
(
new
Cols
.
reduce
((
preVal
,
col
)
=>
(
col
.
width
?
col
.
width
:
0
)
+
preVal
,
0
))
+
97
;
//展开50 勾选32 滚动条15
if
(
tableWidth
-
rowWidth
>
200
)
{
if
(
tableWidth
-
rowWidth
>
200
)
{
newColumn
.
width
=
tableWidth
-
rowWidth
;
newColumn
.
width
=
tableWidth
-
rowWidth
;
...
@@ -410,26 +409,26 @@ const ModelTable = (props) => {
...
@@ -410,26 +409,26 @@ const ModelTable = (props) => {
newColumns
.
push
(
newColumn
);
newColumns
.
push
(
newColumn
);
});
});
const
includePathCols
=
[...
cols
];
//
const includePathCols = [...cols];
includePathCols
.
splice
(
3
,
0
,
pathColumn
);
//
includePathCols.splice(3, 0, pathColumn);
includePathCols
.
forEach
((
column
,
index
)
=>
{
//
includePathCols.forEach((column, index) => {
const
newColumn
=
{...
column
};
//
const newColumn = {...column};
if
(
!
newColumn
.
width
)
{
//
if (!newColumn.width) {
const
rowWidth
=
(
includePathCols
.
reduce
((
preVal
,
col
)
=>
(
col
.
width
?
col
.
width
:
0
)
+
preVal
,
0
))
+
97
;
//
const rowWidth = (includePathCols.reduce((preVal, col) => (col.width?col.width:0) + preVal, 0)) + 97;
if
(
tableWidth
-
rowWidth
>
200
)
{
//
if (tableWidth - rowWidth > 200) {
newColumn
.
width
=
tableWidth
-
rowWidth
;
//
newColumn.width = tableWidth-rowWidth;
}
else
{
//
} else {
newColumn
.
width
=
200
;
//
newColumn.width = 200;
}
//
}
}
//
}
newIncludePathColumns
.
push
(
newColumn
);
//
newIncludePathColumns.push(newColumn);
});
//
});
setColumns
([
...
newColumns
,
<
Column
key=
'auto'
/>]);
setColumns
([
...
newColumns
,
<
Column
key=
'auto'
/>]);
setIncludePathColumns
([
...
newIncludePathColumns
,
<
Column
key=
'auto'
/>]);
//
setIncludePathColumns([ ...newIncludePathColumns, <Column key='auto' />]);
}
}
//eslint-disable-next-line react-hooks/exhaustive-deps
//eslint-disable-next-line react-hooks/exhaustive-deps
},
[
tableWidth
])
},
[
tableWidth
])
...
@@ -583,20 +582,16 @@ const ModelTable = (props) => {
...
@@ -583,20 +582,16 @@ const ModelTable = (props) => {
const
handleResize
=
index
=>
(
e
,
{
size
})
=>
{
const
handleResize
=
index
=>
(
e
,
{
size
})
=>
{
let
nextColumns
=
[...
columns
];
let
nextColumns
=
[...
columns
];
if
((
modelId
||
''
)
===
''
&&
(
view
===
'state'
||
(
keyword
||
''
)
!==
''
))
{
//
if ((modelId||'')==='' && (view==='state'||(keyword||'')!=='')) {
nextColumns
=
[...
includePathColumns
];
//
nextColumns = [...includePathColumns];
}
//
}
nextColumns
[
index
]
=
{
nextColumns
[
index
]
=
{
...
nextColumns
[
index
],
...
nextColumns
[
index
],
width
:
size
.
width
,
width
:
size
.
width
,
};
};
if
((
modelId
||
''
)
===
''
&&
(
view
===
'state'
||
(
keyword
||
''
)
!==
''
))
{
setColumns
(
nextColumns
);
setIncludePathColumns
(
nextColumns
);
}
else
{
setColumns
(
nextColumns
);
}
};
};
const
onTableChange
=
(
pagination
,
filters
,
sorter
,
extra
)
=>
{
const
onTableChange
=
(
pagination
,
filters
,
sorter
,
extra
)
=>
{
...
@@ -680,9 +675,9 @@ const ModelTable = (props) => {
...
@@ -680,9 +675,9 @@ const ModelTable = (props) => {
const
mergedColumns
=
()
=>
{
const
mergedColumns
=
()
=>
{
let
newColumns
=
[...
columns
];
let
newColumns
=
[...
columns
];
if
((
modelId
||
''
)
===
''
&&
(
view
===
'state'
||
(
keyword
||
''
)
!==
''
))
{
//
if ((modelId||'')==='' && (view==='state'||(keyword||'')!=='')) {
newColumns
=
[...
includePathColumns
];
//
newColumns = [...includePathColumns];
}
//
}
return
(
return
(
newColumns
.
map
((
col
,
index
)
=>
({
newColumns
.
map
((
col
,
index
)
=>
({
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment