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
216b1d23
Commit
216b1d23
authored
Feb 26, 2022
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
资产浏览详情
parent
20ba0632
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
134 additions
and
23 deletions
+134
-23
AssetAction.jsx
src/view/Manage/AssetManage/Component/AssetAction.jsx
+4
-2
AssetDetailDrawer.jsx
src/view/Manage/AssetManage/Component/AssetDetailDrawer.jsx
+27
-0
AssetTable.jsx
src/view/Manage/AssetManage/Component/AssetTable.jsx
+103
-21
No files found.
src/view/Manage/AssetManage/Component/AssetAction.jsx
View file @
216b1d23
...
@@ -10,7 +10,7 @@ import { AppContext } from '../../../../App';
...
@@ -10,7 +10,7 @@ import { AppContext } from '../../../../App';
const
AssetAction
=
(
props
)
=>
{
const
AssetAction
=
(
props
)
=>
{
const
{
id
,
dirId
,
action
,
terms
,
onChange
}
=
props
;
const
{
id
,
dirId
,
action
,
terms
,
onChange
,
readOnly
=
false
}
=
props
;
const
[
currentAction
,
setCurrentAction
]
=
useState
(
action
);
const
[
currentAction
,
setCurrentAction
]
=
useState
(
action
);
const
[
assetParams
,
setAssetParams
]
=
useState
({
assets
:
[],
attributes
:
[],
attributesFoldMap
:
{}
});
const
[
assetParams
,
setAssetParams
]
=
useState
({
assets
:
[],
attributes
:
[],
attributesFoldMap
:
{}
});
...
@@ -221,7 +221,8 @@ const AssetAction = (props) => {
...
@@ -221,7 +221,8 @@ const AssetAction = (props) => {
zIndex
:
fullScreen
?
100
:
0
,
zIndex
:
fullScreen
?
100
:
0
,
}
}
}
}
>
>
<
div
{
!
readOnly
&&
<
div
className=
'flex px-3'
className=
'flex px-3'
style=
{
{
style=
{
{
height
:
52
,
height
:
52
,
...
@@ -237,6 +238,7 @@ const AssetAction = (props) => {
...
@@ -237,6 +238,7 @@ const AssetAction = (props) => {
<
Button
onClick=
{
onFullScreenClick
}
>
全屏
</
Button
>
<
Button
onClick=
{
onFullScreenClick
}
>
全屏
</
Button
>
</
Space
>
</
Space
>
</
div
>
</
div
>
}
<
div
<
div
style=
{
{
style=
{
{
...
...
src/view/Manage/AssetManage/Component/AssetDetailDrawer.jsx
0 → 100644
View file @
216b1d23
import
React
from
'react'
;
import
{
Drawer
}
from
'antd'
;
import
AssetAction
from
'./AssetAction'
;
const
AssetDetailDrawer
=
(
props
)
=>
{
const
{
onCancel
,
visible
,
id
,
dirId
}
=
props
;
return
(
<
Drawer
forceRender
visible=
{
visible
}
title=
'资产详情'
width=
{
600
}
placement=
"right"
closable=
{
true
}
onClose=
{
()
=>
{
onCancel
&&
onCancel
();
}
}
>
<
AssetAction
id=
{
id
}
dirId=
{
dirId
}
action=
'detail'
readOnly
/>
</
Drawer
>
)
}
export
default
AssetDetailDrawer
;
\ No newline at end of file
src/view/Manage/AssetManage/Component/AssetTable.jsx
View file @
216b1d23
...
@@ -2,17 +2,49 @@ import React,{ useState, useEffect, useRef } from "react";
...
@@ -2,17 +2,49 @@ import React,{ useState, useEffect, useRef } from "react";
import
{
Button
,
Pagination
,
Space
,
Modal
,
Input
,
Table
,
Tooltip
,
Checkbox
}
from
"antd"
;
import
{
Button
,
Pagination
,
Space
,
Modal
,
Input
,
Table
,
Tooltip
,
Checkbox
}
from
"antd"
;
import
classNames
from
'classnames'
;
import
classNames
from
'classnames'
;
import
SmoothScroll
from
'smooth-scroll'
;
import
SmoothScroll
from
'smooth-scroll'
;
import
{
Resizable
}
from
'react-resizable'
;
import
FilterElementModal
from
'./FilterElementModal'
;
import
FilterElementModal
from
'./FilterElementModal'
;
import
AssetMount
from
'../../AssetRecycle/Component/AssetMount'
;
import
AssetMount
from
'../../AssetRecycle/Component/AssetMount'
;
import
ImportAssetDrawer
from
'./ImportAssetDrawer'
;
import
ImportAssetDrawer
from
'./ImportAssetDrawer'
;
import
AssetEdit
from
'./AssetEdit'
;
import
AssetEdit
from
'./AssetEdit'
;
import
AssetDetailDrawer
from
"./AssetDetailDrawer"
;
import
{
dispatch
,
dispatchLatestHomepage
}
from
'../../../../model'
;
import
{
dispatch
,
dispatchLatestHomepage
}
from
'../../../../model'
;
import
{
showMessage
,
showNotifaction
,
getQueryParam
,
inputWidth
,
isSzseEnv
}
from
'../../../../util'
;
import
{
showMessage
,
showNotifaction
,
getQueryParam
,
inputWidth
,
isSzseEnv
}
from
'../../../../util'
;
import
{
AnchorId
,
AnchorTimestamp
,
AssetBrowseReference
,
AssetManageReference
,
AssetRecycleReference
,
ResourceBrowseReference
}
from
'../../../../util/constant'
;
import
{
AnchorId
,
AnchorTimestamp
,
AssetBrowseReference
,
AssetManageReference
,
AssetRecycleReference
,
ResourceBrowseReference
}
from
'../../../../util/constant'
;
import
"./AssetTable.less"
;
import
"./AssetTable.less"
;
const
ResizeableHeaderCell
=
props
=>
{
const
{
onResize
,
width
,
onClick
,
...
restProps
}
=
props
;
if
(
!
width
)
{
return
<
th
{
...
restProps
}
/>;
}
return
(
<
Resizable
width=
{
width
}
height=
{
0
}
handle=
{
<
span
className=
"react-resizable-handle"
onClick=
{
(
e
)
=>
{
e
.
stopPropagation
();
}
}
/>
}
onResize=
{
onResize
}
draggableOpts=
{
{
enableUserSelectHack
:
false
}
}
>
<
th
onClick=
{
onClick
}
{
...
restProps
}
/>
</
Resizable
>
);
};
const
AssetTable
=
(
props
)
=>
{
const
AssetTable
=
(
props
)
=>
{
const
{
className
,
nodeId
,
elementsChanged
,
assetActionChanged
,
onSelect
,
onCountChange
,
reference
=
AssetManageReference
}
=
props
;
const
{
className
,
nodeId
,
elementsChanged
,
assetActionChanged
,
onSelect
,
onCountChange
,
reference
=
AssetManageReference
}
=
props
;
...
@@ -26,7 +58,8 @@ const AssetTable = (props) => {
...
@@ -26,7 +58,8 @@ const AssetTable = (props) => {
const
[
filterElementVisible
,
setFilterElementVisible
]
=
useState
(
false
);
const
[
filterElementVisible
,
setFilterElementVisible
]
=
useState
(
false
);
const
[
assetEditVisible
,
setAssetEditVisible
]
=
useState
(
false
);
const
[
assetEditVisible
,
setAssetEditVisible
]
=
useState
(
false
);
const
[
assetMountVisible
,
setAssetMountVisible
]
=
useState
(
false
);
const
[
assetMountVisible
,
setAssetMountVisible
]
=
useState
(
false
);
const
[
currentAssetId
,
setCurrentAssetId
]
=
useState
(
''
);
const
[
assetDetailDrawerVisible
,
setAssetDetailDrawerVisible
]
=
useState
(
false
);
// const [ currentAssetId, setCurrentAssetId ] = useState('');
const
[
assetEditAction
,
setAssetEditAction
]
=
useState
(
''
);
const
[
assetEditAction
,
setAssetEditAction
]
=
useState
(
''
);
const
[
pagination
,
setPagination
]
=
useState
(
{
pageNum
:
1
,
pageSize
:
20
}
);
const
[
pagination
,
setPagination
]
=
useState
(
{
pageNum
:
1
,
pageSize
:
20
}
);
const
{
pageNum
,
pageSize
}
=
pagination
;
const
{
pageNum
,
pageSize
}
=
pagination
;
...
@@ -120,7 +153,7 @@ const AssetTable = (props) => {
...
@@ -120,7 +153,7 @@ const AssetTable = (props) => {
dispatch
({
dispatch
({
type
:
'assetmanage.listFilterElementsGroupByType'
,
type
:
'assetmanage.listFilterElementsGroupByType'
,
callback
:
data
=>
{
callback
:
data
=>
{
cons
t
_columns
=
[];
le
t
_columns
=
[];
let
index
=
0
,
_metadataIndex
=
''
;
let
index
=
0
,
_metadataIndex
=
''
;
(
data
||
[]).
forEach
(
group
=>
{
(
data
||
[]).
forEach
(
group
=>
{
...
@@ -143,21 +176,21 @@ const AssetTable = (props) => {
...
@@ -143,21 +176,21 @@ const AssetTable = (props) => {
if
(
name
===
'编号'
)
{
if
(
name
===
'编号'
)
{
params
.
width
=
60
;
params
.
width
=
60
;
params
.
fixed
=
'left'
;
//
params.fixed = 'left';
}
else
if
(
name
===
'中文名称'
)
{
}
else
if
(
name
===
'中文名称'
)
{
params
.
fixed
=
'left'
;
//
params.fixed = 'left';
}
else
if
(
name
===
'英文名称'
)
{
}
else
if
(
name
===
'英文名称'
)
{
params
.
width
=
isSzseEnv
?
250
:
120
;
params
.
width
=
isSzseEnv
?
250
:
120
;
params
.
fixed
=
'left'
;
//
params.fixed = 'left';
params
.
render
=
(
text
,
record
)
=>
{
//
params.render = (text, record) => {
return
(
//
return (
<
Tooltip
title=
{
text
||
''
}
>
//
<Tooltip title={text||''}>
<
a
onClick=
{
()
=>
{
detailAsset
(
record
);}
}
>
//
<a onClick={()=>{detailAsset(record);}}>
{
text
||
''
}
//
{text||''}
</
a
>
//
</a>
</
Tooltip
>
//
</Tooltip>
);
//
);
}
//
}
}
else
if
(
name
===
'资产项'
)
{
}
else
if
(
name
===
'资产项'
)
{
params
.
width
=
isSzseEnv
?
250
:
120
;
params
.
width
=
isSzseEnv
?
250
:
120
;
params
.
fixed
=
'right'
;
params
.
fixed
=
'right'
;
...
@@ -188,6 +221,15 @@ const AssetTable = (props) => {
...
@@ -188,6 +221,15 @@ const AssetTable = (props) => {
})
})
})
})
const
_index
=
_columns
.
findIndex
(
column
=>
column
.
title
===
'资产项'
);
//资产项放到最后一列
if
(
_index
!==
-
1
)
{
const
metaColumn
=
_columns
[
_index
];
_columns
=
_columns
.
filter
(
column
=>
column
.
title
!==
'资产项'
);
_columns
.
push
(
metaColumn
);
}
setAssets
([]);
setAssets
([]);
setColumns
(
_columns
);
setColumns
(
_columns
);
...
@@ -253,6 +295,7 @@ const AssetTable = (props) => {
...
@@ -253,6 +295,7 @@ const AssetTable = (props) => {
setAssets
(
_assets
);
setAssets
(
_assets
);
if
(
reference
===
AssetManageReference
)
{
if
((
selectKey
||
''
)
!==
''
)
{
if
((
selectKey
||
''
)
!==
''
)
{
const
index
=
_assets
.
findIndex
((
asset
)
=>
asset
.
id
===
selectKey
);
const
index
=
_assets
.
findIndex
((
asset
)
=>
asset
.
id
===
selectKey
);
...
@@ -264,6 +307,7 @@ const AssetTable = (props) => {
...
@@ -264,6 +307,7 @@ const AssetTable = (props) => {
setSelectKey
(
_assets
.
length
>
0
?
_assets
[
0
].
id
:
''
);
setSelectKey
(
_assets
.
length
>
0
?
_assets
[
0
].
id
:
''
);
onSelect
&&
onSelect
(
_assets
.
length
>
0
?
_assets
[
0
].
id
:
''
);
onSelect
&&
onSelect
(
_assets
.
length
>
0
?
_assets
[
0
].
id
:
''
);
}
}
}
setTotal
(
data
.
total
||
0
);
setTotal
(
data
.
total
||
0
);
onCountChange
&&
onCountChange
(
data
.
total
||
0
);
onCountChange
&&
onCountChange
(
data
.
total
||
0
);
...
@@ -315,10 +359,10 @@ const AssetTable = (props) => {
...
@@ -315,10 +359,10 @@ const AssetTable = (props) => {
}
}
}
}
const
detailAsset
=
(
item
)
=>
{
//
const detailAsset = (item)=>{
setCurrentAssetId
(
item
.
id
);
//
setCurrentAssetId(item.id);
window
.
open
(
`/center-home/asset-detail?id=
${
item
.
id
}
&dirId=
${
nodeId
}
`
);
//
window.open(`/center-home/asset-detail?id=${item.id}&dirId=${nodeId}`);
}
//
}
const
deleteAssets
=
()
=>
{
const
deleteAssets
=
()
=>
{
if
((
checkedKeys
||
[]).
length
>
0
)
{
if
((
checkedKeys
||
[]).
length
>
0
)
{
...
@@ -371,6 +415,10 @@ const AssetTable = (props) => {
...
@@ -371,6 +415,10 @@ const AssetTable = (props) => {
refresh
&&
getFilterElementsGroupThenGetDataAssets
();
refresh
&&
getFilterElementsGroupThenGetDataAssets
();
}
}
const
onAssetDetailDrawerCancel
=
()
=>
{
setAssetDetailDrawerVisible
(
false
);
}
const
onBatchCatalogChangeBtnClick
=
()
=>
{
const
onBatchCatalogChangeBtnClick
=
()
=>
{
setBatchCatalogChange
(
true
);
setBatchCatalogChange
(
true
);
setAssetMountVisible
(
true
);
setAssetMountVisible
(
true
);
...
@@ -384,6 +432,16 @@ const AssetTable = (props) => {
...
@@ -384,6 +432,16 @@ const AssetTable = (props) => {
setFullScreen
(
!
fullScreen
);
setFullScreen
(
!
fullScreen
);
}
}
const
handleResize
=
index
=>
(
e
,
{
size
})
=>
{
const
nextColumns
=
[...
columns
];
nextColumns
[
index
]
=
{
...
nextColumns
[
index
],
width
:
size
.
width
,
};
setColumns
(
nextColumns
);
};
const
rowSelection
=
{
const
rowSelection
=
{
selectedRowKeys
:
checkedKeys
,
selectedRowKeys
:
checkedKeys
,
onChange
:
onSelectChange
,
onChange
:
onSelectChange
,
...
@@ -459,12 +517,21 @@ const AssetTable = (props) => {
...
@@ -459,12 +517,21 @@ const AssetTable = (props) => {
>
>
<
Table
<
Table
rowSelection=
{
rowSelection
}
rowSelection=
{
rowSelection
}
components=
{
{
header
:
{
cell
:
ResizeableHeaderCell
,
}
}
}
onRow=
{
(
record
)
=>
{
onRow=
{
(
record
)
=>
{
return
{
return
{
id
:
`data-asset-${record?.id}`
,
id
:
`data-asset-${record?.id}`
,
onClick
:
(
e
)
=>
{
onClick
:
(
e
)
=>
{
setSelectKey
(
record
?.
id
);
setSelectKey
(
record
?.
id
);
onSelect
&&
onSelect
(
record
?.
id
);
onSelect
&&
onSelect
(
record
?.
id
);
if
(
reference
!==
AssetManageReference
)
{
setAssetDetailDrawerVisible
(
true
);
}
}
}
}
}
}
}
}
}
...
@@ -476,7 +543,17 @@ const AssetTable = (props) => {
...
@@ -476,7 +543,17 @@ const AssetTable = (props) => {
return
''
;
return
''
;
}
}
}
}
loading=
{
loading
}
loading=
{
loading
}
columns=
{
columns
}
columns=
{
columns
.
map
((
column
,
index
)
=>
{
return
{
...
column
,
onHeaderCell
:
column
=>
({
width
:
column
.
width
,
onResize
:
handleResize
(
index
),
}),
};
})
}
rowKey=
'id'
rowKey=
'id'
dataSource=
{
assets
}
dataSource=
{
assets
}
pagination=
{
false
}
pagination=
{
false
}
...
@@ -501,7 +578,6 @@ const AssetTable = (props) => {
...
@@ -501,7 +578,6 @@ const AssetTable = (props) => {
<
AssetEdit
<
AssetEdit
visible=
{
assetEditVisible
}
visible=
{
assetEditVisible
}
action=
{
assetEditAction
}
action=
{
assetEditAction
}
id=
{
currentAssetId
}
nodeId=
{
nodeId
}
nodeId=
{
nodeId
}
onCancel=
{
onAssetEditCancel
}
onCancel=
{
onAssetEditCancel
}
/>
/>
...
@@ -514,7 +590,7 @@ const AssetTable = (props) => {
...
@@ -514,7 +590,7 @@ const AssetTable = (props) => {
<
AssetMount
<
AssetMount
visible=
{
assetMountVisible
}
visible=
{
assetMountVisible
}
reference=
{
reference
}
reference=
{
reference
}
ids=
{
batchCatalogChange
?
checkedKeys
:[
currentAssetId
]
}
ids=
{
batchCatalogChange
?
checkedKeys
:[]
}
onCancel=
{
onAssetMountCancel
}
onCancel=
{
onAssetMountCancel
}
{
...
props
}
{
...
props
}
/>
/>
...
@@ -523,6 +599,12 @@ const AssetTable = (props) => {
...
@@ -523,6 +599,12 @@ const AssetTable = (props) => {
visible=
{
filterElementVisible
}
visible=
{
filterElementVisible
}
onCancel=
{
onFilterElementModalCancel
}
onCancel=
{
onFilterElementModalCancel
}
/>
/>
<
AssetDetailDrawer
id=
{
selectKey
}
dirId=
{
nodeId
}
visible=
{
assetDetailDrawerVisible
}
onCancel=
{
onAssetDetailDrawerCancel
}
/>
{
contextHolder
}
{
contextHolder
}
</
div
>
</
div
>
)
)
...
...
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