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
c4f08074
Commit
c4f08074
authored
Apr 12, 2024
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fix
parent
49238dcc
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
77 deletions
+14
-77
AssetAction.jsx
src/view/Manage/AssetManage/Component/AssetAction.jsx
+13
-67
asset-relation-assets.jsx
...ew/Manage/AssetManage/Component/asset-relation-assets.jsx
+1
-10
No files found.
src/view/Manage/AssetManage/Component/AssetAction.jsx
View file @
c4f08074
...
...
@@ -65,7 +65,6 @@ const AssetAction = (props) => {
const
[
publishedAssetPaths
,
setPublishedAssetPaths
]
=
useState
([]);
const
[
publishedAsset
,
setPublishedAsset
]
=
useState
();
const
[
isMetadataEdit
,
setMetadataEdit
]
=
useState
(
false
);
const
[
loadingSaveAsDraft
,
setLoadingSaveAsDraft
]
=
React
.
useState
(
false
)
const
[
needSaveAsDraft
,
setNeedSaveAsDraft
]
=
React
.
useState
()
...
...
@@ -140,7 +139,7 @@ const AssetAction = (props) => {
>
<
MetadataColumnEditableItem
value=
{
text
}
isEdit=
{
isMetadataEdit
}
isEdit=
{
currentAction
!==
'detail'
}
terms=
{
terms
}
onChange=
{
(
e
)
=>
{
onMetadataColumnEditableItemChange
(
e
.
target
.
value
,
'enName'
,
index
)
...
...
@@ -156,7 +155,7 @@ const AssetAction = (props) => {
ellipsis
:
true
,
render
:
(
text
,
_
,
index
)
=>
<
MetadataColumnEditableItem
value=
{
text
}
isEdit=
{
isMetadataEdit
}
isEdit=
{
currentAction
!==
'detail'
}
terms=
{
terms
}
onChange=
{
(
e
)
=>
{
onMetadataColumnEditableItemChange
(
e
.
target
.
value
,
'cnName'
,
index
)
...
...
@@ -169,7 +168,7 @@ const AssetAction = (props) => {
ellipsis
:
true
,
render
:
(
text
,
_
,
index
)
=>
<
MetadataColumnEditableItem
value=
{
text
}
isEdit=
{
isMetadataEdit
}
isEdit=
{
currentAction
!==
'detail'
}
terms=
{
terms
}
onChange=
{
(
e
)
=>
{
onMetadataColumnEditableItemChange
(
e
.
target
.
value
,
'remarks'
,
index
)
...
...
@@ -270,19 +269,19 @@ const AssetAction = (props) => {
let
newCols
=
[]
if
(
assets
)
{
newCols
=
assets
.
structured
?[...
columns
]:[...
businessColumns
]
if
(
!
assets
.
structured
&&
isMetadataEdit
)
{
if
(
!
assets
.
structured
&&
currentAction
!==
'detail'
)
{
newCols
.
push
(
businessActionCol
)
}
}
return
newCols
},
[
isMetadataEdit
,
assets
,
columns
,
businessColumns
,
businessActionCol
])
},
[
currentAction
,
assets
,
columns
,
businessColumns
,
businessActionCol
])
const
[
tableData
,
total
]
=
useMemo
(()
=>
{
let
currentMetadataColumnList
=
isMetadataEdit
?
[...
modifyMetadataColumnList
||
[]]
:
[...
metadataColumnList
||
[]]
let
currentMetadataColumnList
=
currentAction
!==
'detail'
?
[...
modifyMetadataColumnList
||
[]]
:
[...
metadataColumnList
||
[]]
return
[
paginate
(
currentMetadataColumnList
,
pageNum
,
pageSize
),
currentMetadataColumnList
.
length
];
},
[
metadataColumnList
,
modifyMetadataColumnList
,
pagination
,
keyword
,
isMetadataEdit
,
assets
])
},
[
metadataColumnList
,
modifyMetadataColumnList
,
pagination
,
keyword
,
currentAction
,
assets
])
const
getPermission
=
()
=>
{
dispatch
({
...
...
@@ -541,6 +540,7 @@ const AssetAction = (props) => {
callback
:
data
=>
{
setLoadingMetadataColumnList
(
false
);
setMetadataColumnList
(
data
);
setModifyMetadataColumnList
(
data
);
},
error
:
()
=>
{
setLoadingMetadataColumnList
(
false
);
...
...
@@ -597,21 +597,10 @@ const AssetAction = (props) => {
}
// const jumpToRelation = (relation) => {
// const timestamp = new Date().getTime();
// if (relation.resourceType==='innerSource'||relation.resourceType==='outerSource') {
// window.open(`
/
center
-
home
/
menu
/
asset
-
resource
-
browse
?
$
{
AnchorId
}
=
$
{
relation
?.
dataAssetId
}
&
$
{
AnchorDirId
}
=
$
{
relation
?.
dirId
}
&
timestamp
=
$
{
timestamp
}
`);
// } else if (relation.resourceType==='dataAsset') {
// window.open(`
/
center
-
home
/
menu
/
asset
-
browse
?
$
{
AnchorId
}
=
$
{
relation
?.
dataAssetId
}
&
$
{
AnchorDirId
}
=
$
{
relation
?.
dirId
}
&
timestamp
=
$
{
timestamp
}
`);
// } else {
// showMessage('warn', '资产目录类型不是资源也不是资产!');
// }
// }
const onOk = async() => {
try {
const row = await form?.validateFields();
await columnForm?.validateFields();
const newElements = [...elements];
(newElements||[]).forEach(element => {
...
...
@@ -653,7 +642,7 @@ const AssetAction = (props) => {
let data = action==='add' ? { elements: newElements } : { ...assets, elements: newElements }
data = {...data, businessRelations: relationAssetsRef.current?.assets}
data = {...data, businessRelations: relationAssetsRef.current?.assets
, businessColumns: modifyMetadataColumnList
}
dispatch({
type: needSaveAsDraft?'assetmanage.saveAsDraft':'assetmanage.addOrUpdateDataAsset',
...
...
@@ -972,17 +961,9 @@ const AssetAction = (props) => {
},
}}
/> : <React.Fragment>
<
Space style={{ marginLeft: 'auto
' }}>
<
div className='flex' style={{ justifyContent: 'end
' }}>
{
!readonly && (reference===AssetManageReference||canEdit) && <React.Fragment>
{
isMetadataEdit ? <React.Fragment>
<Button onClick={() => {
setMetadataEdit(false)
}}>
取消
</Button>
<Button onClick={ async () => {
(currentAction !== 'detail') && <Button onClick={async () => {
try {
await columnForm?.validateFields()
setModifyMetadataColumnList(prev => {
...
...
@@ -996,43 +977,8 @@ const AssetAction = (props) => {
}}>
新增
</Button>
<Button onClick={async () => {
try {
await columnForm?.validateFields()
setLoadingMetadataColumnList(true)
dispatch({
type: 'assetmanage.saveBusinessColumns',
payload: {
params: {
dataAssetId: assets?.id,
},
data: modifyMetadataColumnList,
},
callback: () => {
setLoadingMetadataColumnList(false)
setMetadataEdit(false)
getMetadataAttributes()
},
error: () => {
setLoadingMetadataColumnList(false)
}
})
} catch (errInfo) {
}
}}>
保存
</Button>
</React.Fragment> : <Button onClick={() => {
setModifyMetadataColumnList(metadataColumnList)
setMetadataEdit(true)
}}>
编辑
</Button>
}
</React.Fragment>
}
</Space>
</div>
<Form form={columnForm}>
<Table
...
...
src/view/Manage/AssetManage/Component/asset-relation-assets.jsx
View file @
c4f08074
...
...
@@ -161,21 +161,12 @@ const FC = React.forwardRef(function ({ item, reference, action, onChange }, ref
<
Space
>
{
action
!==
'detail'
&&
<
React
.
Fragment
>
<
Button
onClick=
{
onEditClick
}
>
编辑
</
Button
>
<
Button
onClick=
{
onEditClick
}
>
新增
</
Button
>
<
Tooltip
title=
{
(
selectedRows
??[]).
length
===
0
?
'请先选择资产'
:
''
}
>
<
Button
disabled=
{
(
selectedRows
??[]).
length
===
0
}
onClick=
{
onDeleteClick
}
>
删除
</
Button
>
</
Tooltip
>
</
React
.
Fragment
>
}
<
Input
size=
"middle"
placeholder=
'搜索资产名称'
value=
{
keyword
}
bordered=
{
true
}
allowClear
style=
{
{
width
:
200
}
}
onChange=
{
(
e
)
=>
{
setPagination
({...
pagination
,
pageNum
:
1
})
setKeyword
(
e
.
target
.
value
)
}
}
/>
</
Space
>
</
div
>
<
div
className=
'mt-3'
>
...
...
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