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
5c8f0919
Commit
5c8f0919
authored
Feb 28, 2022
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加资产路径
parent
3f549c0d
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
67 additions
and
27 deletions
+67
-27
constant.js
src/util/constant.js
+1
-0
AssetAction.jsx
src/view/Manage/AssetManage/Component/AssetAction.jsx
+21
-2
AssetTable.jsx
src/view/Manage/AssetManage/Component/AssetTable.jsx
+14
-13
AssetTree.jsx
src/view/Manage/AssetManage/Component/AssetTree.jsx
+24
-6
index.jsx
src/view/Manage/AssetManage/index.jsx
+6
-5
ModelTable.jsx
src/view/Manage/Model/Component/ModelTable.jsx
+1
-1
No files found.
src/util/constant.js
View file @
5c8f0919
//全文检索
//全文检索
export
const
AnchorId
=
'id'
;
export
const
AnchorId
=
'id'
;
export
const
AnchorTimestamp
=
'timestamp'
;
export
const
AnchorTimestamp
=
'timestamp'
;
export
const
AnchorDirId
=
'did'
;
//编辑模型
//编辑模型
export
const
Action
=
'action'
;
export
const
Action
=
'action'
;
...
...
src/view/Manage/AssetManage/Component/AssetAction.jsx
View file @
5c8f0919
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
Form
,
Spin
,
Input
,
Descriptions
,
Space
,
Button
}
from
'antd'
;
import
{
Form
,
Spin
,
Input
,
Descriptions
,
Space
,
Button
}
from
'antd'
;
import
{
DownOutlined
,
UpOutlined
}
from
'@ant-design/icons'
;
import
{
DownOutlined
,
UpOutlined
}
from
'@ant-design/icons'
;
import
Tag
from
'../../Tag'
;
import
LocalStorage
from
'local-storage'
;
import
MetadataInfo
from
'./MetadataInfo'
;
import
MetadataInfo
from
'./MetadataInfo'
;
import
{
dispatch
}
from
'../../../../model'
;
import
{
dispatch
}
from
'../../../../model'
;
import
{
highlightSearchContentByTerms
,
showMessage
}
from
'../../../../util'
;
import
{
highlightSearchContentByTerms
,
showMessage
}
from
'../../../../util'
;
import
{
unfoldedElements
}
from
'../util'
;
import
{
unfoldedElements
}
from
'../util'
;
import
{
AppContext
}
from
'../../../../App'
;
import
{
AppContext
}
from
'../../../../App'
;
import
Tag
from
'../../Tag'
;
const
AssetAction
=
(
props
)
=>
{
const
AssetAction
=
(
props
)
=>
{
...
@@ -77,7 +78,8 @@ const AssetAction = (props) => {
...
@@ -77,7 +78,8 @@ const AssetAction = (props) => {
dispatch
({
dispatch
({
type
:
'assetmanage.getDataAssetDetail'
,
type
:
'assetmanage.getDataAssetDetail'
,
payload
:
{
payload
:
{
dataAssetId
:
id
dataAssetId
:
id
,
dirId
:
dirId
,
},
},
callback
:
data
=>
{
callback
:
data
=>
{
setLoading
(
false
);
setLoading
(
false
);
...
@@ -120,6 +122,16 @@ const AssetAction = (props) => {
...
@@ -120,6 +122,16 @@ const AssetAction = (props) => {
}
}
}
}
const
jumpToPath
=
()
=>
{
setFullScreen
(
false
);
LocalStorage
.
set
(
'assetDirChange'
,
!
(
LocalStorage
.
get
(
'assetDirChange'
)
||
false
));
let
event
=
new
Event
(
'storage'
);
event
.
key
=
'assetDirChange'
;
event
.
dirId
=
(
assets
?.
dirIds
||
[]).
length
>
0
?
assets
.
dirIds
[
0
]:
''
;
window
?.
dispatchEvent
(
event
);
}
const
onOk
=
async
()
=>
{
const
onOk
=
async
()
=>
{
try
{
try
{
const
row
=
await
form
.
validateFields
();
const
row
=
await
form
.
validateFields
();
...
@@ -243,6 +255,13 @@ const AssetAction = (props) => {
...
@@ -243,6 +255,13 @@ const AssetAction = (props) => {
<
div
style=
{
{
padding
:
10
}
}
>
<
div
style=
{
{
padding
:
10
}
}
>
<
Descriptions
column=
{
1
}
>
<
Descriptions
column=
{
1
}
>
{
(
assets
.
currentPath
||
''
)
!==
''
&&
<
Descriptions
.
Item
label=
'路径'
style=
{
{
paddingBottom
:
10
}
}
>
<
a
onClick=
{
()
=>
{
jumpToPath
();}
}
>
{
assets
.
currentPath
||
''
}
</
a
>
</
Descriptions
.
Item
>
}
<
Descriptions
.
Item
label=
'标签'
style=
{
{
paddingBottom
:
0
}
}
>
<
Descriptions
.
Item
label=
'标签'
style=
{
{
paddingBottom
:
0
}
}
>
{
{
(
currentAction
===
'add'
||
currentAction
===
'edit'
)?<
Tag
styleType=
'complex'
id=
{
id
}
/>:<
Tag
id=
{
id
}
/>
(
currentAction
===
'add'
||
currentAction
===
'edit'
)?<
Tag
styleType=
'complex'
id=
{
id
}
/>:<
Tag
id=
{
id
}
/>
...
...
src/view/Manage/AssetManage/Component/AssetTable.jsx
View file @
5c8f0919
...
@@ -52,7 +52,8 @@ const AssetTable = (props) => {
...
@@ -52,7 +52,8 @@ const AssetTable = (props) => {
const
[
columns
,
setColumns
]
=
useState
([]);
const
[
columns
,
setColumns
]
=
useState
([]);
const
[
assets
,
setAssets
]
=
useState
([]);
const
[
assets
,
setAssets
]
=
useState
([]);
const
[
total
,
setTotal
]
=
useState
(
0
);
const
[
total
,
setTotal
]
=
useState
(
0
);
const
[
selectKey
,
setSelectKey
]
=
useState
(
''
);
const
[
selectItem
,
setSelectItem
]
=
useState
({});
const
[
checkedKeys
,
setCheckedKeys
]
=
useState
([]);
const
[
checkedKeys
,
setCheckedKeys
]
=
useState
([]);
const
[
importAssetVisible
,
setImportAssetVisible
]
=
useState
(
false
);
const
[
importAssetVisible
,
setImportAssetVisible
]
=
useState
(
false
);
const
[
filterElementVisible
,
setFilterElementVisible
]
=
useState
(
false
);
const
[
filterElementVisible
,
setFilterElementVisible
]
=
useState
(
false
);
...
@@ -78,7 +79,7 @@ const AssetTable = (props) => {
...
@@ -78,7 +79,7 @@ const AssetTable = (props) => {
useEffect
(()
=>
{
useEffect
(()
=>
{
if
((
nodeId
||
''
)
!==
''
)
{
if
((
nodeId
||
''
)
!==
''
)
{
setKeyword
(
''
);
setKeyword
(
''
);
setSelect
Key
(
''
);
setSelect
Item
({}
);
setCheckedKeys
([]);
setCheckedKeys
([]);
if
(
shouldScrollRef
.
current
===
true
)
{
if
(
shouldScrollRef
.
current
===
true
)
{
...
@@ -296,16 +297,16 @@ const AssetTable = (props) => {
...
@@ -296,16 +297,16 @@ const AssetTable = (props) => {
setAssets
(
_assets
);
setAssets
(
_assets
);
if
(
reference
===
AssetManageReference
)
{
if
(
reference
===
AssetManageReference
)
{
if
((
select
Key
||
''
)
!==
''
)
{
if
((
select
Item
?.
id
||
''
)
!==
''
)
{
const
index
=
_assets
.
findIndex
((
asset
)
=>
asset
.
id
===
select
Key
);
const
index
=
_assets
.
findIndex
((
asset
)
=>
asset
.
id
===
select
Item
?.
id
);
if
(
index
===
-
1
)
{
if
(
index
===
-
1
)
{
setSelect
Key
(
_assets
.
length
>
0
?
_assets
[
0
].
id
:
''
);
setSelect
Item
(
_assets
.
length
>
0
?
_assets
[
0
]:{}
);
onSelect
&&
onSelect
(
_assets
.
length
>
0
?
_assets
[
0
].
id
:
''
);
onSelect
&&
onSelect
(
_assets
.
length
>
0
?
_assets
[
0
].
id
:
''
,
_assets
.
length
>
0
?
_assets
[
0
].
dirId
:
''
);
}
}
}
else
{
}
else
{
setSelect
Key
(
_assets
.
length
>
0
?
_assets
[
0
].
id
:
''
);
setSelect
Item
(
_assets
.
length
>
0
?
_assets
[
0
]:{}
);
onSelect
&&
onSelect
(
_assets
.
length
>
0
?
_assets
[
0
].
id
:
''
);
onSelect
&&
onSelect
(
_assets
.
length
>
0
?
_assets
[
0
].
id
:
''
,
_assets
.
length
>
0
?
_assets
[
0
].
dirId
:
''
);
}
}
}
}
...
@@ -526,8 +527,8 @@ const AssetTable = (props) => {
...
@@ -526,8 +527,8 @@ const AssetTable = (props) => {
return
{
return
{
id
:
`data-asset-${record?.id}`
,
id
:
`data-asset-${record?.id}`
,
onClick
:
(
e
)
=>
{
onClick
:
(
e
)
=>
{
setSelect
Key
(
record
?.
i
d
);
setSelect
Item
(
recor
d
);
onSelect
&&
onSelect
(
record
?.
id
);
onSelect
&&
onSelect
(
record
?.
id
,
record
?.
dirId
);
if
(
reference
!==
AssetManageReference
)
{
if
(
reference
!==
AssetManageReference
)
{
setAssetDetailDrawerVisible
(
true
);
setAssetDetailDrawerVisible
(
true
);
...
@@ -536,7 +537,7 @@ const AssetTable = (props) => {
...
@@ -536,7 +537,7 @@ const AssetTable = (props) => {
}
}
}
}
}
}
rowClassName=
{
(
record
,
index
)
=>
{
rowClassName=
{
(
record
,
index
)
=>
{
if
(
record
?.
id
===
anchorId
||
record
?.
id
===
select
Key
)
{
if
(
record
?.
id
===
anchorId
||
record
?.
id
===
select
Item
?.
id
)
{
return
'highlight-row'
;
return
'highlight-row'
;
}
}
...
@@ -600,8 +601,8 @@ const AssetTable = (props) => {
...
@@ -600,8 +601,8 @@ const AssetTable = (props) => {
onCancel=
{
onFilterElementModalCancel
}
onCancel=
{
onFilterElementModalCancel
}
/>
/>
<
AssetDetailDrawer
<
AssetDetailDrawer
id=
{
select
Key
}
id=
{
select
Item
?.
id
}
dirId=
{
node
Id
}
dirId=
{
selectItem
?.
dir
Id
}
visible=
{
assetDetailDrawerVisible
}
visible=
{
assetDetailDrawerVisible
}
onCancel=
{
onAssetDetailDrawerCancel
}
onCancel=
{
onAssetDetailDrawerCancel
}
/>
/>
...
...
src/view/Manage/AssetManage/Component/AssetTree.jsx
View file @
5c8f0919
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
useMount
}
from
'ahooks'
;
import
{
Card
,
Spin
,
Tooltip
,
Tree
,
Input
,
Dropdown
,
Menu
,
Modal
}
from
'antd'
;
import
{
Card
,
Spin
,
Tooltip
,
Tree
,
Input
,
Dropdown
,
Menu
,
Modal
}
from
'antd'
;
import
{
PlusOutlined
,
ImportOutlined
,
EditOutlined
,
DeleteOutlined
,
ExportOutlined
,
ReloadOutlined
,
SettingOutlined
,
ArrowUpOutlined
,
ArrowDownOutlined
}
from
'@ant-design/icons'
;
import
{
PlusOutlined
,
ImportOutlined
,
EditOutlined
,
DeleteOutlined
,
ExportOutlined
,
ReloadOutlined
,
SettingOutlined
,
ArrowUpOutlined
,
ArrowDownOutlined
}
from
'@ant-design/icons'
;
import
classNames
from
'classnames'
;
import
classNames
from
'classnames'
;
...
@@ -8,7 +9,7 @@ import ImportDirectory from './ImportDirectory';
...
@@ -8,7 +9,7 @@ import ImportDirectory from './ImportDirectory';
import
UpdateDirectoryModal
from
'./UpdateDirectoryModal'
;
import
UpdateDirectoryModal
from
'./UpdateDirectoryModal'
;
import
CustomDirectoryModal
from
'./CustomDirectoryModal'
;
import
CustomDirectoryModal
from
'./CustomDirectoryModal'
;
import
{
showMessage
,
getQueryParam
}
from
'../../../../util'
;
import
{
showMessage
,
getQueryParam
}
from
'../../../../util'
;
import
{
AnchorTimestamp
,
AnchorId
,
AssetManageReference
,
AssetBrowseReference
,
ResourceBrowseReference
,
AssetMountReference
}
from
'../../../../util/constant'
;
import
{
AnchorTimestamp
,
AnchorId
,
AssetManageReference
,
AssetBrowseReference
,
ResourceBrowseReference
,
AssetMountReference
,
AnchorDirId
}
from
'../../../../util/constant'
;
import
'./AssetTree.less'
;
import
'./AssetTree.less'
;
const
AssetTree
=
(
props
)
=>
{
const
AssetTree
=
(
props
)
=>
{
...
@@ -35,6 +36,14 @@ const AssetTree = (props) => {
...
@@ -35,6 +36,14 @@ const AssetTree = (props) => {
const
timestamp
=
getQueryParam
(
AnchorTimestamp
,
props
?.
location
?.
search
);
const
timestamp
=
getQueryParam
(
AnchorTimestamp
,
props
?.
location
?.
search
);
const
id
=
getQueryParam
(
AnchorId
,
props
?.
location
?.
search
);
const
id
=
getQueryParam
(
AnchorId
,
props
?.
location
?.
search
);
useMount
(()
=>
{
window
?.
addEventListener
(
"storage"
,
storageChange
);
return
()
=>
{
window
?.
removeEventListener
(
"storage"
,
storageChange
);
}
})
useEffect
(()
=>
{
useEffect
(()
=>
{
if
((
id
||
''
)
!==
''
)
{
if
((
id
||
''
)
!==
''
)
{
getDataAssetLocationThenGetTreeData
();
getDataAssetLocationThenGetTreeData
();
...
@@ -53,11 +62,19 @@ const AssetTree = (props) => {
...
@@ -53,11 +62,19 @@ const AssetTree = (props) => {
useEffect
(()
=>
{
useEffect
(()
=>
{
if
((
centerId
||
''
)
!==
''
)
{
if
((
centerId
||
''
)
!==
''
)
{
centerIdChanged
(
);
treeDirectoryChanged
(
centerId
);
}
}
//eslint-disable-next-line react-hooks/exhaustive-deps
//eslint-disable-next-line react-hooks/exhaustive-deps
},
[
centerId
])
},
[
centerId
])
const
storageChange
=
(
e
)
=>
{
if
(
e
.
key
===
'assetDirChange'
)
{
if
((
e
.
dirId
||
''
)
!==
''
)
{
treeDirectoryChanged
(
e
.
dirId
);
}
}
}
const
getDataAssetLocationThenGetTreeData
=
()
=>
{
const
getDataAssetLocationThenGetTreeData
=
()
=>
{
setLoading
(
true
);
setLoading
(
true
);
dispatch
({
dispatch
({
...
@@ -177,7 +194,7 @@ const AssetTree = (props) => {
...
@@ -177,7 +194,7 @@ const AssetTree = (props) => {
});
});
}
}
const
centerIdChanged
=
(
)
=>
{
const
treeDirectoryChanged
=
(
did
)
=>
{
let
defaultItem
=
null
;
let
defaultItem
=
null
;
...
@@ -187,7 +204,7 @@ const AssetTree = (props) => {
...
@@ -187,7 +204,7 @@ const AssetTree = (props) => {
(
subCatalogs
||
[]).
forEach
(
catalog
=>
{
(
subCatalogs
||
[]).
forEach
(
catalog
=>
{
if
(
catalog
.
nodeId
===
centerI
d
)
{
if
(
catalog
.
nodeId
===
di
d
)
{
defaultItem
=
catalog
;
defaultItem
=
catalog
;
}
}
...
@@ -195,14 +212,14 @@ const AssetTree = (props) => {
...
@@ -195,14 +212,14 @@ const AssetTree = (props) => {
})
})
}
}
if
((
centerI
d
||
''
)
!==
''
)
{
if
((
di
d
||
''
)
!==
''
)
{
recursion
(
treeData
);
recursion
(
treeData
);
}
}
if
(
defaultItem
)
{
if
(
defaultItem
)
{
const
expandedKeys
=
(
dataList
||
[])
const
expandedKeys
=
(
dataList
||
[])
.
map
(
item
=>
{
.
map
(
item
=>
{
if
(
item
.
key
.
indexOf
(
centerI
d
)
>
-
1
)
{
if
(
item
.
key
.
indexOf
(
di
d
)
>
-
1
)
{
return
getParentKey
(
item
.
key
,
treeData
);
return
getParentKey
(
item
.
key
,
treeData
);
}
}
return
null
;
return
null
;
...
@@ -214,6 +231,7 @@ const AssetTree = (props) => {
...
@@ -214,6 +231,7 @@ const AssetTree = (props) => {
setCurrentDirId
(
defaultItem
.
nodeId
);
setCurrentDirId
(
defaultItem
.
nodeId
);
setCurrentDirType
(
defaultItem
.
type
||
''
);
setCurrentDirType
(
defaultItem
.
type
||
''
);
onSelect
&&
onSelect
(
defaultItem
.
nodeId
);
}
}
}
}
...
...
src/view/Manage/AssetManage/index.jsx
View file @
5c8f0919
...
@@ -15,7 +15,7 @@ import './index.less';
...
@@ -15,7 +15,7 @@ import './index.less';
const
AssetManage
=
(
props
)
=>
{
const
AssetManage
=
(
props
)
=>
{
const
[
nodeId
,
setNodeId
]
=
useState
(
''
);
const
[
nodeId
,
setNodeId
]
=
useState
(
''
);
const
[
asset
Id
,
setAssetId
]
=
useState
(
''
);
const
[
asset
Params
,
setAssetParams
]
=
useState
({
assetId
:
''
,
assetDirId
:
''
})
const
[
expandTree
,
setExpandTree
]
=
useState
(
true
);
const
[
expandTree
,
setExpandTree
]
=
useState
(
true
);
const
[
assetCount
,
setAssetCount
]
=
useState
(
0
);
const
[
assetCount
,
setAssetCount
]
=
useState
(
0
);
...
@@ -23,13 +23,15 @@ const AssetManage = (props) => {
...
@@ -23,13 +23,15 @@ const AssetManage = (props) => {
const
[
elementsChanged
,
setElementsChanged
]
=
useState
(
false
);
const
[
elementsChanged
,
setElementsChanged
]
=
useState
(
false
);
const
[
assetActionChanged
,
setAssetActionChanged
]
=
useState
(
false
);
const
[
assetActionChanged
,
setAssetActionChanged
]
=
useState
(
false
);
const
{
assetId
,
assetDirId
}
=
assetParams
;
const
onTreeSelect
=
(
value
,
type
)
=>
{
const
onTreeSelect
=
(
value
,
type
)
=>
{
setNodeId
(
value
||
''
);
setNodeId
(
value
||
''
);
}
}
const
onTableSelect
=
(
value
)
=>
{
const
onTableSelect
=
(
id
,
did
)
=>
{
setAsset
Id
(
value
);
setAsset
Params
({
assetId
:
id
,
assetDirId
:
did
}
);
}
}
const
treeToggleClick
=
()
=>
{
const
treeToggleClick
=
()
=>
{
...
@@ -72,9 +74,8 @@ const AssetManage = (props) => {
...
@@ -72,9 +74,8 @@ const AssetManage = (props) => {
<
AssetTable
nodeId=
{
nodeId
}
reference=
{
AssetManageReference
}
elementsChanged=
{
elementsChanged
}
assetActionChanged=
{
assetActionChanged
}
onSelect=
{
onTableSelect
}
onCountChange=
{
onAssetCountChange
}
{
...
props
}
/>
<
AssetTable
nodeId=
{
nodeId
}
reference=
{
AssetManageReference
}
elementsChanged=
{
elementsChanged
}
assetActionChanged=
{
assetActionChanged
}
onSelect=
{
onTableSelect
}
onCountChange=
{
onAssetCountChange
}
{
...
props
}
/>
</
div
>
</
div
>
<
div
className=
'right'
>
<
div
className=
'right'
>
<
AssetAction
id=
{
assetId
}
dirId=
{
node
Id
}
action=
'detail'
onChange=
{
onAssetActionChange
}
/>
<
AssetAction
id=
{
assetId
}
dirId=
{
assetDir
Id
}
action=
'detail'
onChange=
{
onAssetActionChange
}
/>
</
div
>
</
div
>
</
div
>
</
div
>
)
)
}
}
...
...
src/view/Manage/Model/Component/ModelTable.jsx
View file @
5c8f0919
import
React
,
{
useState
,
useEffect
,
useRef
}
from
"react"
;
import
React
,
{
useState
,
useEffect
,
useRef
}
from
"react"
;
import
{
Tooltip
,
Modal
,
Pagination
,
Table
,
Popover
}
from
'antd'
;
import
{
Tooltip
,
Modal
,
Pagination
,
Table
}
from
'antd'
;
import
{
DownOutlined
,
UpOutlined
}
from
'@ant-design/icons'
;
import
{
DownOutlined
,
UpOutlined
}
from
'@ant-design/icons'
;
import
SmoothScroll
from
'smooth-scroll'
;
import
SmoothScroll
from
'smooth-scroll'
;
import
classnames
from
'classnames'
;
import
classnames
from
'classnames'
;
...
...
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