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
1a49688f
Commit
1a49688f
authored
Dec 07, 2023
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fix
parent
8f0a0408
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
72 additions
and
64 deletions
+72
-64
AssetAction.jsx
src/view/Manage/AssetManage/Component/AssetAction.jsx
+72
-64
No files found.
src/view/Manage/AssetManage/Component/AssetAction.jsx
View file @
1a49688f
...
@@ -70,6 +70,51 @@ const AssetAction = (props) => {
...
@@ -70,6 +70,51 @@ const AssetAction = (props) => {
const
app
=
useContext
(
AppContext
);
const
app
=
useContext
(
AppContext
);
const
uploadRef
=
useRef
(
undefined
);
const
uploadRef
=
useRef
(
undefined
);
const
actionCol
=
{
title
:
'操作'
,
dataIndex
:
'action'
,
width
:
170
,
fixed
:
'right'
,
render
:
(
_
,
record
)
=>
{
return
(
reference
===
AssetManageReference
||
canEdit
)
?
<
Space
>
<
Button
size=
'small'
onClick=
{
()
=>
{
setSelectStandardParam
({
visible
:
true
,
id
:
record
.
_id
});
}
}
>
关联标准
</
Button
>
{
record
.
standard
?.
standardId
&&
<
Button
size=
'small'
onClick=
{
()
=>
{
modal
.
confirm
({
title
:
'您确定要取消关联标准吗?'
,
onOk
:
()
=>
{
dispatch
({
type
:
'assetmanage.deleteStandardBatchMetadata'
,
payload
:
{
params
:
{
ids
:
record
.
standard
?.
id
}
},
callback
:
()
=>
{
showMessage
(
"success"
,
"取消成功"
);
getMetadataStandardList
();
}
})
}
})
}
}
>
取消关联
</
Button
>
}
</
Space
>:
null
;
}
}
const
columns
=
[
const
columns
=
[
{
{
title
:
'技术ID(英文名称)'
,
title
:
'技术ID(英文名称)'
,
...
@@ -159,54 +204,33 @@ const AssetAction = (props) => {
...
@@ -159,54 +204,33 @@ const AssetAction = (props) => {
}
}
</
AppContext
.
Consumer
>
</
AppContext
.
Consumer
>
}
}
},
{
title
:
'操作'
,
dataIndex
:
'action'
,
width
:
170
,
fixed
:
'right'
,
render
:
(
_
,
record
)
=>
{
return
(
reference
===
AssetManageReference
||
canEdit
)
?
<
Space
>
<
Button
size=
'small'
onClick=
{
()
=>
{
setSelectStandardParam
({
visible
:
true
,
id
:
record
.
_id
});
}
}
>
关联标准
</
Button
>
{
record
.
standard
?.
standardId
&&
<
Button
size=
'small'
onClick=
{
()
=>
{
modal
.
confirm
({
title
:
'您确定要取消关联标准吗?'
,
onOk
:
()
=>
{
dispatch
({
type
:
'assetmanage.deleteStandardBatchMetadata'
,
payload
:
{
params
:
{
ids
:
record
.
standard
?.
id
}
},
callback
:
()
=>
{
showMessage
(
"success"
,
"取消成功"
);
getMetadataStandardList
();
}
})
}
})
}
}
>
取消关联
</
Button
>
}
</
Space
>:
null
;
}
}
}
];
];
const
[
cols
,
setCols
]
=
useState
(
columns
)
const
cols
=
useMemo
(()
=>
{
let
newCols
=
[...
columns
]
if
(
!
permissionId
)
{
newCols
=
newCols
.
filter
(
item
=>
item
.
dataIndex
!==
'permission'
)
}
const
haveCode
=
(
metadataColumnList
??[]).
some
(
item
=>
item
.
code
)
//字段有编号才显示
if
(
haveCode
)
{
newCols
.
splice
(
2
,
0
,
{
title
:
'编号'
,
dataIndex
:
'code'
,
width
:
100
,
ellipsis
:
true
,
render
:
(
text
,
_
)
=>
highlightSearchContentByTerms
(
text
||
''
,
terms
)
});
}
if
(
reference
===
AssetManageReference
||
(
reference
!==
AssetDraftReference
&&
canEdit
))
{
newCols
.
push
(
actionCol
)
}
return
newCols
},
[
columns
,
actionCol
,
canEdit
,
metadataColumnList
,
reference
,
permissionId
])
useEffect
(()
=>
{
useEffect
(()
=>
{
getSystems
();
getSystems
();
...
@@ -501,23 +525,7 @@ const AssetAction = (props) => {
...
@@ -501,23 +525,7 @@ const AssetAction = (props) => {
});
});
}
}
setMetadataColumnList
(
newData
);
setMetadataColumnList
(
newData
);
const
haveCode
=
(
newData
??[]).
some
(
item
=>
item
.
code
)
//字段有编号才显示
if
(
haveCode
)
{
setCols
(
prevCols
=>
{
const
newCols
=
[...
prevCols
]
newCols
.
splice
(
2
,
0
,
{
title
:
'编号'
,
dataIndex
:
'code'
,
width
:
100
,
ellipsis
:
true
,
render
:
(
text
,
_
)
=>
highlightSearchContentByTerms
(
text
||
''
,
terms
)
});
return
newCols
})
}
},
},
error
:
()
=>
{
error
:
()
=>
{
setLoadingMetadataColumnList
(
false
);
setLoadingMetadataColumnList
(
false
);
...
@@ -1071,7 +1079,7 @@ const AssetAction = (props) => {
...
@@ -1071,7 +1079,7 @@ const AssetAction = (props) => {
<Space style={{ marginLeft: 'auto' }}>
<Space style={{ marginLeft: 'auto' }}>
{
{
(reference===AssetManageReference||
canEdit
) && <Button
(reference===AssetManageReference||
(reference!==AssetDraftReference&&canEdit)
) && <Button
type='primary'
type='primary'
onClick={() => {
onClick={() => {
if (metadata?.metadataTableId) {
if (metadata?.metadataTableId) {
...
@@ -1133,7 +1141,7 @@ const AssetAction = (props) => {
...
@@ -1133,7 +1141,7 @@ const AssetAction = (props) => {
<Table
<Table
className='mt-3'
className='mt-3'
loading={loadingMetadataColumnList}
loading={loadingMetadataColumnList}
columns={
permissionId?cols:cols.filter(item => item.dataIndex !== 'permission')
}
columns={
cols??[]
}
rowKey='_id'
rowKey='_id'
dataSource={tableData||[]}
dataSource={tableData||[]}
pagination={{
pagination={{
...
...
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