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
2257ad9e
Commit
2257ad9e
authored
Mar 13, 2025
by
fanyj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tijiao
parent
45990b72
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
107 additions
and
26 deletions
+107
-26
AssetAction.jsx
src/view/Manage/AssetManage/Component/AssetAction.jsx
+12
-5
AssetManageTree.jsx
src/view/Manage/AssetManage/Component/AssetManageTree.jsx
+75
-13
AssetTable.jsx
src/view/Manage/AssetManage/Component/AssetTable.jsx
+14
-5
AssetTree.jsx
src/view/Manage/AssetManage/Component/AssetTree.jsx
+3
-1
index.jsx
src/view/Manage/AssetManage/index.jsx
+3
-2
No files found.
src/view/Manage/AssetManage/Component/AssetAction.jsx
View file @
2257ad9e
...
...
@@ -70,6 +70,8 @@ const AssetAction = React.forwardRef(function (props, ref) {
const
[
businessElements
,
setBusinessElements
]
=
useState
();
const
[
businessColumns
,
setBusinessColumns
]
=
useState
();
console
.
log
(
'refence'
,
reference
)
const
[
loadingSaveAsDraft
,
setLoadingSaveAsDraft
]
=
React
.
useState
(
false
)
const
[
needSaveAsDraft
,
setNeedSaveAsDraft
]
=
React
.
useState
()
...
...
@@ -960,11 +962,16 @@ const AssetAction = React.forwardRef(function (props, ref) {
</Form>
</Spin>
<MatchMetaInfo
item={assets} reference={reference} AssetDraftReference={AssetDraftReference} getAsset={getAsset}
dirId={dirId} metadataId={metadataId} needSaveAsDraft={needSaveAsDraft} currentAction={currentAction}
selectData={selectData} setSelectData={setSelectData}
/>
{
assets?.structedState==='unStructured'&&(
<MatchMetaInfo
item={assets} reference={reference} AssetDraftReference={AssetDraftReference} getAsset={getAsset}
dirId={dirId} metadataId={metadataId} needSaveAsDraft={needSaveAsDraft} currentAction={currentAction}
selectData={selectData} setSelectData={setSelectData}
/>
)
}
<div>
<div style={{display:'flex',justifyContent:'space-between',alignItems:'center',gap:10}}>
<div style={{flex:1}}>
...
...
src/view/Manage/AssetManage/Component/AssetManageTree.jsx
View file @
2257ad9e
import
React
,
{
useEffect
,
useState
,
useRef
}
from
'react'
;
import
React
,
{
useEffect
,
useState
,
useRef
,
useMemo
}
from
'react'
;
import
{
Card
,
Spin
,
Tooltip
,
Tree
,
Dropdown
,
Menu
,
Modal
,
AutoComplete
,
Select
,
Descriptions
}
from
'antd'
;
import
{
PlusOutlined
,
ImportOutlined
,
ExportOutlined
,
ReloadOutlined
,
SettingOutlined
,
UnorderedListOutlined
}
from
'@ant-design/icons'
;
import
classNames
from
'classnames'
;
...
...
@@ -18,6 +18,7 @@ import './AssetManageTree.less';
import
'react-contexify/dist/ReactContexify.css'
;
import
{
appId
}
from
'../../../../App'
;
import
{
getTemplateType
}
from
'../../../../util/axios'
;
import
PermissionButton
from
"../../../../util/Component/PermissionButton"
const
{
Option
}
=
AutoComplete
;
...
...
@@ -57,7 +58,7 @@ const AssetManageTree = (props) => {
id
:
MENU_ID
,
});
const
{
checkable
=
false
,
onSelect
,
className
,
onCheck
,
tableId
,
reference
=
AssetManageReference
,
onDirectoryChange
,
centerId
,
metadataIds
,
onTemplateChange
}
=
props
;
const
{
checkable
=
false
,
onSelect
,
className
,
onCheck
,
tableId
,
reference
=
AssetManageReference
,
onDirectoryChange
,
centerId
,
metadataIds
,
onTemplateChange
,
addDirInfo
}
=
props
;
const
[
keyword
,
setKeyword
]
=
useState
(
''
);
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
treeData
,
setTreeData
]
=
useState
([]);
...
...
@@ -82,6 +83,7 @@ const AssetManageTree = (props) => {
const
[
currentTemplateType
,
setTemplateType
]
=
useState
()
const
[
metadataRelatedTemplate
,
setMetadataRelatedTemplate
]
=
useState
()
const
[
viewSelectedKey
,
setViewSelectedKey
]
=
useState
(
viewModes
[
0
].
key
);
const
[
permissions
,
setPermissions
]
=
useState
([])
const
[
modal
,
contextHolder
]
=
Modal
.
useModal
();
...
...
@@ -111,6 +113,10 @@ const AssetManageTree = (props) => {
//eslint-disable-next-line react-hooks/exhaustive-deps
},
[
metadataIds
])
useEffect
(()
=>
{
getPermissions
()
},[])
// useEffect(() => {
// if ((did||'') !== '') {
// getAllDirectoryAsTree(true, did);
...
...
@@ -146,6 +152,22 @@ const AssetManageTree = (props) => {
}
}
const
getPermissions
=
()
=>
{
dispatch
({
type
:
'assetmanage.getPrivilegeByRange'
,
payload
:
{
range
:
getAssetRange
(
AssetManageReference
),
},
callback
:
data
=>
{
setPermissions
(
data
);
}
})
}
const
havePermission
=
useMemo
(()
=>
{
return
(
permissions
??[]).
findIndex
(
item
=>
item
===
'dirManage'
)
!==
-
1
},
[
permissions
])
const
getTemplates
=
()
=>
{
setLoadingTemplates
(
true
)
dispatch
({
...
...
@@ -864,26 +886,66 @@ const AssetManageTree = (props) => {
</
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
>
viewSelectedKeyRef
.
current
===
'dir'
&&
(
<
PermissionButton
defaultPermission=
{
havePermission
||
addDirInfo
}
tip=
"新增目录"
type=
"text"
icon=
{
<
PlusOutlined
className=
{
(
currentDir
?.
resourceType
===
'custom'
)?
'disable'
:
'default'
}
style=
{
{
fontSize
:
16
,
cursor
:
(
currentDirType
===
'custom'
)?
'not-allowed'
:
'pointer'
}
}
/>
}
onClick=
{
addDir
}
// size="small"
style=
{
{
width
:
18
}
}
/>
// <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
>
{
viewSelectedKeyRef
.
current
===
'dir'
?
<>
<
Tooltip
title=
"导入目录"
>
<
PermissionButton
defaultPermission=
{
havePermission
}
tip=
"导入目录"
type=
"text"
icon=
{
<
ImportOutlined
className=
{
(
currentDirType
===
'custom'
)?
'disable'
:
'default'
}
onClick=
{
importDir
}
style=
{
{
fontSize
:
16
,
cursor
:(
currentDirType
===
'custom'
)?
'not-allowed'
:
'pointer'
}
}
/>
}
onClick=
{
importDir
}
// size="small"
style=
{
{
width
:
18
}
}
/>
{
/* <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=
"导出目录"
>
</Tooltip> */
}
<
Dropdown
overlay=
{
havePermission
?
exportMenu
:<></>
}
placement=
"bottomCenter"
>
<
PermissionButton
defaultPermission=
{
havePermission
}
tip=
"导出目录"
type=
"text"
icon=
{
<
ExportOutlined
className=
'default'
style=
{
{
fontSize
:
16
,
cursor
:
'pointer'
}
}
/>
}
// onClick=
{
importDir
}
// size="small"
style=
{
{
width
:
18
}
}
/>
{
/* <Tooltip title="导出目录">
<ExportOutlined className='default' style={{ fontSize:16,cursor:'pointer' }} />
</
Tooltip
>
</Tooltip>
*/
}
</
Dropdown
>
</>
:
<
Tooltip
title=
"自定义目录"
>
</>
:
<>
<
PermissionButton
defaultPermission=
{
havePermission
}
tip=
"自定义目录"
type=
"text"
icon=
{
<
SettingOutlined
className=
'default'
style=
{
{
fontSize
:
16
,
cursor
:
'pointer'
}
}
/>
}
onClick=
{
customDir
}
// size="small"
style=
{
{
width
:
18
}
}
/>
{
/* <Tooltip title="自定义目录">
<SettingOutlined className='default' onClick={customDir} style={{ fontSize:16,cursor:'pointer' }} />
</
Tooltip
>
</Tooltip> */
}
</>
}
</
div
>
)
}
...
...
@@ -955,7 +1017,7 @@ const AssetManageTree = (props) => {
checkedKeys=
{
checkedKeys
}
checkStrictly
onRightClick=
{
({
event
,
node
})
=>
{
if
(
reference
===
AssetManageReference
)
{
if
(
reference
===
AssetManageReference
&&
havePermission
)
{
setCurrentRightClickDir
(
node
);
setCurrentDirType
(
node
.
type
||
''
);
displayMenu
(
event
);
...
...
src/view/Manage/AssetManage/Component/AssetTable.jsx
View file @
2257ad9e
...
...
@@ -104,7 +104,7 @@ export const listSubject = new Subject();
const
AssetTable
=
(
props
)
=>
{
const
{
className
,
nodeId
,
nodeType
,
nodeLevel
,
nodeAllowdLoadDataAsset
,
elementsChanged
,
assetActionChanged
,
onSelect
,
onCountChange
,
reference
=
AssetManageReference
,
onFullScreenChange
,
template
}
=
props
;
const
{
className
,
nodeId
,
nodeType
,
setAddDir
,
nodeAllowdLoadDataAsset
,
elementsChanged
,
assetActionChanged
,
onSelect
,
onCountChange
,
reference
=
AssetManageReference
,
onFullScreenChange
,
template
}
=
props
;
const
MENU_ID
=
'asset-table'
;
...
...
@@ -329,8 +329,8 @@ const AssetTable = (props) => {
}
},
[
nodeId
,
nodeType
])
const
[
addAble
,
importAble
,
exportAble
,
changeDirectoryAble
,
deleteAble
,
offlineAble
,
addTagAble
,
subscribeAble
]
=
React
.
useMemo
(()
=>
{
let
[
_addAble
,
_importAble
,
_exportAble
,
_changeDirectoryAble
,
_deleteAble
,
_offlineAble
,
_addTagAble
,
_subscribeAble
]
=
[
false
,
false
,
false
,
false
,
false
,
false
,
false
,
false
]
const
[
addAble
,
importAble
,
exportAble
,
changeDirectoryAble
,
deleteAble
,
offlineAble
,
addTagAble
,
subscribeAble
,
adddirAble
]
=
React
.
useMemo
(()
=>
{
let
[
_addAble
,
_importAble
,
_exportAble
,
_changeDirectoryAble
,
_deleteAble
,
_offlineAble
,
_addTagAble
,
_subscribeAble
,
_addDirAble
]
=
[
false
,
false
,
false
,
false
,
false
,
false
,
false
,
false
,
false
]
_addAble
=
(
permissions
??[]).
findIndex
(
item
=>
item
===
'add'
)
!==
-
1
...
...
@@ -354,13 +354,14 @@ const AssetTable = (props) => {
_exportAble
=
allowExport
}
let
[
allowChangeDirectory
,
allowDelete
,
allowOffline
,
allowAddTag
,
allowSubscribe
]
=
[
true
,
true
,
true
,
true
,
true
]
let
[
allowChangeDirectory
,
allowDelete
,
allowOffline
,
allowAddTag
,
allowSubscribe
,
allowAddDir
]
=
[
true
,
true
,
true
,
true
,
true
,
true
]
for
(
const
row
of
selectedRows
??[])
{
const
changeDirecotoryIndex
=
(
row
.
allowButtons
??[]).
findIndex
(
item
=>
item
===
'changeDir'
)
const
deleteIndex
=
(
row
.
allowButtons
??[]).
findIndex
(
item
=>
item
===
'delete'
)
const
offlineIndex
=
(
row
.
allowButtons
??[]).
findIndex
(
item
=>
item
===
'offline'
)
const
addTagIndex
=
(
row
.
allowButtons
??[]).
findIndex
(
item
=>
item
===
'addTag'
)
const
subscribeIndex
=
(
row
.
allowButtons
??[]).
findIndex
(
item
=>
item
===
'subscribe'
)
const
addDir
=
(
row
.
allowButtons
??[]).
findIndex
(
item
=>
item
===
'addDir'
)
if
(
changeDirecotoryIndex
===
-
1
)
{
allowChangeDirectory
=
false
}
...
...
@@ -376,6 +377,9 @@ const AssetTable = (props) => {
if
(
subscribeIndex
===
-
1
)
{
allowSubscribe
=
false
}
if
(
addDir
===-
1
){
allowAddDir
=
false
}
}
_changeDirectoryAble
=
allowChangeDirectory
...
...
@@ -383,10 +387,15 @@ const AssetTable = (props) => {
_offlineAble
=
allowOffline
_addTagAble
=
allowAddTag
_subscribeAble
=
allowSubscribe
_addDirAble
=
allowAddDir
return
[
_addAble
,
_importAble
,
_exportAble
,
_changeDirectoryAble
,
_deleteAble
,
_offlineAble
,
_addTagAble
,
_subscribeAble
]
return
[
_addAble
,
_importAble
,
_exportAble
,
_changeDirectoryAble
,
_deleteAble
,
_offlineAble
,
_addTagAble
,
_subscribeAble
,
_addDirAble
]
},
[
permissions
,
selectedRows
])
useEffect
(()
=>
{
setAddDir
(
adddirAble
)
},[
adddirAble
])
const
realAssets
=
useMemo
(()
=>
{
const
newAssets
=
[...
assets
];
// if (users?.length > 0 && assets?.length > 0 && columns?.length > 0) {
...
...
src/view/Manage/AssetManage/Component/AssetTree.jsx
View file @
2257ad9e
import
React
,
{
useEffect
,
useState
,
useRef
}
from
'react'
;
import
React
,
{
useEffect
,
useState
,
useRef
,
useMemo
}
from
'react'
;
import
{
Card
,
Spin
,
Tooltip
,
Tree
,
Modal
,
AutoComplete
,
Select
,
Button
,
Menu
,
Dropdown
,
Space
}
from
'antd'
;
import
{
ReloadOutlined
,
SettingOutlined
,
UnorderedListOutlined
}
from
'@ant-design/icons'
;
import
{
useContextMenu
,
Menu
as
RcMenu
,
Item
as
RcItem
}
from
"react-contexify"
;
...
...
@@ -64,6 +64,7 @@ const AssetTree = (props) => {
const
[
updateDirectoryModalVisible
,
setUpdateDirectoryModalVisible
]
=
useState
(
false
);
const
[
viewSelectedKey
,
setViewSelectedKey
]
=
useState
(
viewModes
[
0
].
key
);
const
[
modal
,
contextHolder
]
=
Modal
.
useModal
();
const
timestamp
=
getQueryParam
(
AnchorTimestamp
,
props
?.
location
?.
search
);
...
...
@@ -76,6 +77,7 @@ const AssetTree = (props) => {
useEffect
(()
=>
{
getTemplates
()
window
?.
addEventListener
(
"storage"
,
storageChange
);
return
()
=>
{
...
...
src/view/Manage/AssetManage/index.jsx
View file @
2257ad9e
...
...
@@ -28,6 +28,7 @@ const AssetManage = (props) => {
const
[
elementsChanged
,
setElementsChanged
]
=
useState
(
false
);
const
[
template
,
setTemplate
]
=
useState
();
const
[
form
]
=
Form
.
useForm
();
const
[
addDir
,
setAddDir
]
=
useState
(
false
)
const
{
assetId
,
assetDirId
}
=
assetParams
;
...
...
@@ -83,7 +84,7 @@ const AssetManage = (props) => {
axis=
'x'
minConstraints=
{
[
230
,
Infinity
]
}
maxConstraints=
{
[
Infinity
,
Infinity
]
}
>
<
AssetTree
onSelect=
{
onTreeSelect
}
onDirectoryChange=
{
onDirectoryChange
}
onTemplateChange=
{
onTemplateChange
}
{
...
props
}
/>
<
AssetTree
onSelect=
{
onTreeSelect
}
addDirInfo=
{
addDir
}
onDirectoryChange=
{
onDirectoryChange
}
onTemplateChange=
{
onTemplateChange
}
{
...
props
}
/>
</
ResizableBox
>
{
expandTree
&&
<
Separate
width=
{
15
}
/>
...
...
@@ -91,7 +92,7 @@ const AssetManage = (props) => {
<
div
className=
{
middleClasses
}
>
{
/* <AssetDirectory id={nodeId} assetCount={assetCount} directoryChanged={directoryChanged} onElementsChange={onElementsChange} />
<Separate height={15} /> */
}
<
AssetTable
template=
{
template
}
nodeId=
{
nodeId
}
nodeType=
{
nodeType
}
nodeLevel=
{
nodeLevel
}
nodeAllowdLoadDataAsset=
{
nodeAllowdLoadDataAsset
}
reference=
{
AssetManageReference
}
elementsChanged=
{
elementsChanged
}
onSelect=
{
onTableSelect
}
onCountChange=
{
onAssetCountChange
}
onFullScreenChange=
{
onFullScreenChange
}
{
...
props
}
/>
<
AssetTable
template=
{
template
}
setAddDir=
{
setAddDir
}
nodeId=
{
nodeId
}
nodeType=
{
nodeType
}
nodeLevel=
{
nodeLevel
}
nodeAllowdLoadDataAsset=
{
nodeAllowdLoadDataAsset
}
reference=
{
AssetManageReference
}
elementsChanged=
{
elementsChanged
}
onSelect=
{
onTableSelect
}
onCountChange=
{
onAssetCountChange
}
onFullScreenChange=
{
onFullScreenChange
}
{
...
props
}
/>
<
div
className=
'tree-toggle'
onClick=
{
treeToggleClick
}
>
{
expandTree
?
<
CaretLeftOutlined
/>
:
<
CaretRightOutlined
/>
}
</
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