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
c546178a
Commit
c546178a
authored
Aug 08, 2024
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
资产管理增加自定义目录
parent
c071979a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
138 additions
and
88 deletions
+138
-88
assetmanage.js
src/model/assetmanage.js
+5
-0
dataassetmanager.js
src/service/dataassetmanager.js
+5
-0
AssetManageTree.jsx
src/view/Manage/AssetManage/Component/AssetManageTree.jsx
+127
-74
AssetTable.jsx
src/view/Manage/AssetManage/Component/AssetTable.jsx
+1
-0
CustomDirectoryModal.jsx
...iew/Manage/AssetManage/Component/CustomDirectoryModal.jsx
+0
-14
No files found.
src/model/assetmanage.js
View file @
c546178a
...
...
@@ -524,4 +524,8 @@ export function* compareDataAssetWithDescribeInfo(payload) {
export
function
*
listDataAssetHistoryTimeline
(
payload
)
{
return
yield
call
(
service
.
listDataAssetHistoryTimeline
,
payload
);
}
export
function
*
queryCustomTypeRootDirectory
()
{
return
yield
call
(
service
.
queryCustomTypeRootDirectory
);
}
\ No newline at end of file
src/service/dataassetmanager.js
View file @
c546178a
...
...
@@ -531,4 +531,8 @@ export function compareDataAssetWithDescribeInfo(payload) {
export
function
listDataAssetHistoryTimeline
(
payload
)
{
return
GetJSON
(
"/dataassetmanager/versionApi/listDataAssetHistoryTimeline"
,
payload
);
}
export
function
queryCustomTypeRootDirectory
()
{
return
GetJSON
(
"/dataassetmanager/directoryApi/queryCustomTypeRootDirectory"
);
}
\ No newline at end of file
src/view/Manage/AssetManage/Component/AssetManageTree.jsx
View file @
c546178a
import
React
,
{
useEffect
,
useState
,
useRef
}
from
'react'
;
import
{
Card
,
Spin
,
Tooltip
,
Tree
,
Dropdown
,
Menu
,
Modal
,
AutoComplete
,
Select
,
Descriptions
}
from
'antd'
;
import
{
PlusOutlined
,
ImportOutlined
,
ExportOutlined
,
ReloadOutlined
,
SettingOutlined
}
from
'@ant-design/icons'
;
import
{
PlusOutlined
,
ImportOutlined
,
ExportOutlined
,
ReloadOutlined
,
SettingOutlined
,
UnorderedListOutlined
}
from
'@ant-design/icons'
;
import
classNames
from
'classnames'
;
import
{
useContextMenu
,
Menu
as
RcMenu
,
Item
as
RcItem
}
from
"react-contexify"
;
import
LocalStorage
from
'local-storage'
;
...
...
@@ -21,6 +21,17 @@ import { getTemplateType } from '../../../../util/axios';
const
{
Option
}
=
AutoComplete
;
const
viewModes
=
[
{
key
:
'dir'
,
name
:
'目录视角'
},
{
key
:
'custom'
,
name
:
'自定义目录视角'
}
];
function
updateTreeData
(
list
,
key
,
children
)
{
return
list
.
map
((
node
)
=>
{
if
(
node
.
nodeId
===
key
)
{
...
...
@@ -70,6 +81,7 @@ const AssetManageTree = (props) => {
const
[
templates
,
setTemplates
]
=
useState
()
const
[
currentTemplateType
,
setTemplateType
]
=
useState
()
const
[
metadataRelatedTemplate
,
setMetadataRelatedTemplate
]
=
useState
()
const
[
viewSelectedKey
,
setViewSelectedKey
]
=
useState
(
viewModes
[
0
].
key
);
const
[
modal
,
contextHolder
]
=
Modal
.
useModal
();
...
...
@@ -79,6 +91,7 @@ const AssetManageTree = (props) => {
const
treeDataRef
=
useRef
([]);
const
dataListRef
=
useRef
([]);
const
viewSelectedKeyRef
=
useRef
(
viewModes
[
0
].
key
)
useEffect
(()
=>
{
if
(
reference
===
AssetManageReference
)
{
...
...
@@ -153,7 +166,7 @@ const AssetManageTree = (props) => {
}
onSelect
?.(
''
,
''
,
null
,
false
)
getAllDirectoryAsTree
(
fals
e
)
getAllDirectoryAsTree
(
tru
e
)
}
},
error
:
()
=>
{
...
...
@@ -227,10 +240,6 @@ const AssetManageTree = (props) => {
let
newData
=
[...
data
];
if
(
reference
===
AssetMountReference
)
{
newData
=
newData
.
filter
(
item
=>
item
.
resourceType
!==
'custom'
);
}
setLoadedKeys
([]);
setTreeData
(
newData
);
...
...
@@ -245,15 +254,6 @@ const AssetManageTree = (props) => {
dataListRef
.
current
=
_dataList
;
let
defaultItem
=
null
;
if
((
defaultSelectedId
||
''
)
===
''
)
{
_dataList
.
forEach
(
item
=>
{
if
((
defaultSelectedId
||
''
)
===
''
)
{
defaultSelectedId
=
item
.
key
;
}
})
}
function
recursion
(
subCatalogs
)
{
if
((
subCatalogs
||
[]).
length
===
0
)
return
;
...
...
@@ -270,10 +270,9 @@ const AssetManageTree = (props) => {
if
((
defaultSelectedId
||
''
)
!==
''
)
{
recursion
(
newData
);
}
}
if
(
resetCurrentDirId
)
{
if
(
defaultItem
)
{
const
expandedKeys
=
_dataList
.
map
(
item
=>
{
...
...
@@ -284,21 +283,42 @@ const AssetManageTree = (props) => {
})
.
filter
((
item
,
i
,
self
)
=>
item
&&
self
.
indexOf
(
item
)
===
i
);
setExpandedKeys
(
[...
expandedKeys
,
defaultSelectedId
]
);
setExpandedKeys
(
expandedKeys
);
setAutoExpandParent
(
true
);
setCurrentDirId
(
defaultItem
.
nodeId
);
setCurrentDirType
(
defaultItem
.
type
||
''
);
setCurrentDir
(
defaultItem
);
onSelect
&&
onSelect
(
defaultItem
.
nodeId
,
defaultItem
.
type
||
''
,
defaultItem
.
level
,
defaultItem
.
allowdLoadDataAsset
);
}
}
else
if
((
newData
??[]).
length
>
0
)
{
defaultItem
=
newData
[
0
]
setCurrentDirId
(
defaultItem
.
nodeId
);
setCurrentDirType
(
defaultItem
.
type
||
''
);
setCurrentDir
(
defaultItem
);
onSelect
&&
onSelect
(
defaultItem
.
nodeId
,
defaultItem
.
type
||
''
,
defaultItem
.
level
,
defaultItem
.
allowdLoadDataAsset
);
}
}
}
let
url
=
'assetmanage.queryAllDirectoryAsTree'
;
if
(
viewSelectedKeyRef
.
current
===
'custom'
)
{
url
=
'assetmanage.queryCustomTypeRootDirectory'
;
}
dispatch
({
type
:
'assetmanage.queryAllDirectoryAsTree'
,
type
:
url
,
callback
:
data
=>
{
disposeData
(
data
)
let
newData
=
[];
if
(
viewSelectedKeyRef
.
current
===
'dir'
)
{
newData
=
[...
data
];
}
else
{
newData
=
(
data
||
[]).
map
((
item
)
=>
{
return
{...
item
,
text
:
item
.
name
,
nodeId
:
item
.
id
,
type
:
item
.
resourceType
}
});
}
disposeData
(
newData
)
},
error
:
()
=>
{
setLoading
(
false
);
...
...
@@ -702,6 +722,7 @@ const AssetManageTree = (props) => {
type
:
'assetmanage.getDirectoryChild'
,
payload
:
{
parentId
:
key
,
currentDirIsCustom
:
true
,
},
callback
:
(
data
)
=>
{
if
(
data
&&
data
.
length
>
0
)
{
...
...
@@ -718,6 +739,32 @@ const AssetManageTree = (props) => {
});
});
const
onViewClick
=
({
key
})
=>
{
if
(
viewSelectedKey
&&
viewSelectedKey
===
key
)
return
;
viewSelectedKeyRef
.
current
=
key
;
setViewSelectedKey
(
key
);
setExpandedKeys
([]);
getAllDirectoryAsTree
();
}
const
viewMenus
=
(
<
Menu
selectedKeys=
{
[
viewSelectedKey
]
}
onClick=
{
onViewClick
}
>
{
viewModes
&&
viewModes
.
map
(
item
=>
{
return
(
<
Menu
.
Item
key=
{
item
.
key
}
value=
{
item
.
key
}
>
<
div
style=
{
{
textAlign
:
'center'
}
}
>
{
item
.
name
}
</
div
>
</
Menu
.
Item
>
)
})
}
</
Menu
>
);
const
exportMenu
=
(
<
Menu
>
<
Menu
.
Item
>
...
...
@@ -746,8 +793,7 @@ const AssetManageTree = (props) => {
>
{
item
.
text
}
{
//自定义类型栏目不统计资产数
(
item
.
level
!==
1
||
(
item
.
level
===
1
&&
item
.
resourceType
!==
'custom'
))
&&
<
span
>
{
` (${item.dataAssetAndSubDirCount})`
}
</
span
>
viewSelectedKeyRef
.
current
===
'dir'
&&
<
span
>
{
` (${item.dataAssetAndSubDirCount})`
}
</
span
>
}
</
span
>
);
...
...
@@ -808,23 +854,33 @@ const AssetManageTree = (props) => {
(
templates
??[]).
map
((
item
,
index
)
=>
<
Select
.
Option
key=
{
index
}
value=
{
item
.
type
}
>
{
item
.
name
}
</
Select
.
Option
>)
}
</
Select
>
<
Tooltip
title=
"新增目录"
>
<
PlusOutlined
className=
{
(
currentDir
?.
resourceType
===
'custom'
)?
'disable'
:
'default'
}
onClick=
{
addDir
}
style=
{
{
fontSize
:
16
,
cursor
:
(
currentDirType
===
'custom'
)?
'not-allowed'
:
'pointer'
}
}
/>
</
Tooltip
>
<
Dropdown
overlay=
{
viewMenus
}
placement=
"bottomLeft"
>
<
Tooltip
title=
"视角"
>
<
UnorderedListOutlined
className=
'default'
style=
{
{
fontSize
:
16
,
cursor
:
'pointer'
}
}
/>
</
Tooltip
>
</
Dropdown
>
{
viewSelectedKeyRef
.
current
===
'dir'
&&
<
Tooltip
title=
"新增目录"
>
<
PlusOutlined
className=
{
(
currentDir
?.
resourceType
===
'custom'
)?
'disable'
:
'default'
}
onClick=
{
addDir
}
style=
{
{
fontSize
:
16
,
cursor
:
(
currentDirType
===
'custom'
)?
'not-allowed'
:
'pointer'
}
}
/>
</
Tooltip
>
}
<
Tooltip
title=
"刷新目录"
>
<
ReloadOutlined
className=
'default'
onClick=
{
refreshTree
}
style=
{
{
fontSize
:
16
,
cursor
:
'pointer'
}
}
/>
</
Tooltip
>
<
Tooltip
title=
"导入目录"
>
<
ImportOutlined
className=
{
(
currentDirType
===
'custom'
)?
'disable'
:
'default'
}
onClick=
{
importDir
}
style=
{
{
fontSize
:
16
,
cursor
:(
currentDirType
===
'custom'
)?
'not-allowed'
:
'pointer'
}
}
/>
</
Tooltip
>
<
Dropdown
overlay=
{
exportMenu
}
placement=
"bottomCenter"
>
<
Tooltip
title=
"导出目录"
>
<
ExportOutlined
className=
'default'
style=
{
{
fontSize
:
16
,
cursor
:
'pointer'
}
}
/>
{
viewSelectedKeyRef
.
current
===
'dir'
?
<>
<
Tooltip
title=
"导入目录"
>
<
ImportOutlined
className=
{
(
currentDirType
===
'custom'
)?
'disable'
:
'default'
}
onClick=
{
importDir
}
style=
{
{
fontSize
:
16
,
cursor
:(
currentDirType
===
'custom'
)?
'not-allowed'
:
'pointer'
}
}
/>
</
Tooltip
>
<
Dropdown
overlay=
{
exportMenu
}
placement=
"bottomCenter"
>
<
Tooltip
title=
"导出目录"
>
<
ExportOutlined
className=
'default'
style=
{
{
fontSize
:
16
,
cursor
:
'pointer'
}
}
/>
</
Tooltip
>
</
Dropdown
>
</>
:
<
Tooltip
title=
"自定义目录"
>
<
SettingOutlined
className=
'default'
onClick=
{
customDir
}
style=
{
{
fontSize
:
16
,
cursor
:
'pointer'
}
}
/>
</
Tooltip
>
</
Dropdown
>
{
/* <Tooltip title="自定义目录">
<SettingOutlined className='default' onClick={customDir} style={{ fontSize:16,cursor:'pointer' }} />
</Tooltip> */
}
}
</
div
>
)
}
bordered=
{
false
}
...
...
@@ -858,28 +914,30 @@ const AssetManageTree = (props) => {
}
<
Spin
spinning=
{
loading
}
>
<
AutoComplete
allowClear
value=
{
keyword
}
style=
{
{
marginBottom
:
10
,
width
:
'100%'
}
}
placeholder=
'搜索目录'
onSelect=
{
onAutoCompleteSelect
}
onSearch=
{
onAutoCompleteSearch
}
onClear=
{
()
=>
{
setKeyword
(
''
);
}
}
notFoundContent=
{
keyword
?<
span
>
暂无数据
</
span
>:
null
}
>
{
(
options
||
[]).
map
((
item
,
index
)
=>
{
return
(
<
Option
key=
{
item
.
key
}
value=
{
item
.
value
}
>
<
div
style=
{
{
whiteSpace
:
'normal'
}
}
>
{
highlightSearchContentByTerms
(
item
.
value
,
[
keyword
])
}
</
div
>
</
Option
>
);
})
viewSelectedKeyRef
.
current
!==
'custom'
&&
<
AutoComplete
allowClear
value=
{
keyword
}
style=
{
{
marginBottom
:
10
,
width
:
'100%'
}
}
placeholder=
'搜索目录'
onSelect=
{
onAutoCompleteSelect
}
onSearch=
{
onAutoCompleteSearch
}
onClear=
{
()
=>
{
setKeyword
(
''
);
}
}
notFoundContent=
{
keyword
?<
span
>
暂无数据
</
span
>:
null
}
>
{
(
options
||
[]).
map
((
item
,
index
)
=>
{
return
(
<
Option
key=
{
item
.
key
}
value=
{
item
.
value
}
>
<
div
style=
{
{
whiteSpace
:
'normal'
}
}
>
{
highlightSearchContentByTerms
(
item
.
value
,
[
keyword
])
}
</
div
>
</
Option
>
);
})
}
</
AutoComplete
>
}
</
AutoComplete
>
<
Tree
className=
'tree-contextmenu'
checkable=
{
checkable
}
...
...
@@ -926,26 +984,21 @@ const AssetManageTree = (props) => {
{
(
reference
!==
AssetMountReference
)
&&
<
RcMenu
id=
{
MENU_ID
}
>
{
currentRightClickDir
&&
(
currentRightClickDir
.
type
!==
'custom'
)
&&
<
RcItem
id=
"detail"
onClick=
{
onDetailClick
}
>
{
(
currentRightClickDir
.
level
===
1
)?
'栏目详情'
:
'目录详情'
}
</
RcItem
>
viewSelectedKeyRef
.
current
===
'dir'
&&
<
React
.
Fragment
>
<
RcItem
id=
"edit"
onClick=
{
editDir
}
>
修改目录
</
RcItem
>
<
RcItem
id=
"up"
onClick=
{
()
=>
{
moveNode
(
1
);
}
}
>
上移目录
</
RcItem
>
<
RcItem
id=
"down"
onClick=
{
()
=>
{
moveNode
(
-
1
);
}
}
>
下移目录
</
RcItem
>
</
React
.
Fragment
>
}
{
currentRightClickDir
&&
(
currentRightClickDir
.
type
!==
'custom'
)
&&
<
RcItem
id=
"edit"
onClick=
{
editDir
}
>
{
(
currentRightClickDir
.
level
===
1
)?
'修改栏目'
:
'修改目录'
}
</
RcItem
>
}
<
RcItem
id=
"up"
onClick=
{
()
=>
{
moveNode
(
1
);
}
}
>
{
(
currentRightClickDir
.
level
===
1
)?
'上移栏目'
:
'上移目录'
}
</
RcItem
>
<
RcItem
id=
"down"
onClick=
{
()
=>
{
moveNode
(
-
1
);
}
}
>
{
(
currentRightClickDir
.
level
===
1
)?
'下移栏目'
:
'下移目录'
}
<
RcItem
id=
"delete"
onClick=
{
deleteDir
}
>
删除目录
</
RcItem
>
{
currentRightClickDir
&&
(
currentRightClickDir
.
type
!==
'custom'
||
(
currentRightClickDir
.
type
===
'custom'
&&
currentRightClickDir
.
level
===
2
))
&&
<
RcItem
id=
"delete"
onClick=
{
deleteDir
}
>
{
(
currentRightClickDir
.
level
===
1
)?
'删除栏目'
:
'删除目录'
}
</
RcItem
>
}
</
RcMenu
>
}
{
contextHolder
}
...
...
src/view/Manage/AssetManage/Component/AssetTable.jsx
View file @
c546178a
...
...
@@ -554,6 +554,7 @@ const AssetTable = (props) => {
let
params
=
{
queryElementId
:
currentElementId
,
dirId
:
nodeId
,
currentDirIsCustom
:
nodeType
===
'custom'
,
pageNum
,
pageSize
,
keyword
:
encodeURIComponent
(
keyword
)
...
...
src/view/Manage/AssetManage/Component/CustomDirectoryModal.jsx
View file @
c546178a
...
...
@@ -303,20 +303,6 @@ const CustomDirectoryModal = (props) => {
>
<
Input
/>
</
Form
.
Item
>
{
reference
===
AssetManageReference
&&
<
Form
.
Item
label=
'数据范围'
name=
'resourceTypes'
>
<
Select
mode=
"multiple"
allowClear
>
{
resourceTypes
.
map
((
item
,
index
)
=>
{
return
<
Select
.
Option
key=
{
item
.
key
}
>
{
item
.
name
}
</
Select
.
Option
>
})
}
</
Select
>
</
Form
.
Item
>
}
<
Form
.
Item
label=
'描述或原因'
name=
'desc'
...
...
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