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
9fb407f4
Commit
9fb407f4
authored
Oct 11, 2023
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
资源新增目录
parent
e16c8575
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
246 additions
and
16 deletions
+246
-16
assetmanage.js
src/model/assetmanage.js
+5
-0
dataassetmanager.js
src/service/dataassetmanager.js
+7
-3
table.jsx
src/view/Manage/AssetResourceManage/table.jsx
+8
-5
tree.jsx
src/view/Manage/AssetResourceManage/tree.jsx
+8
-8
update-node.jsx
src/view/Manage/AssetResourceManage/update-node.jsx
+218
-0
No files found.
src/model/assetmanage.js
View file @
9fb407f4
...
@@ -235,4 +235,8 @@ export function* getPrivilegeByRangeAndDirId(payload) {
...
@@ -235,4 +235,8 @@ export function* getPrivilegeByRangeAndDirId(payload) {
export
function
*
getPreviewRangeByDirId
(
payload
)
{
export
function
*
getPreviewRangeByDirId
(
payload
)
{
return
yield
call
(
service
.
getPreviewRangeByDirId
,
payload
);
return
yield
call
(
service
.
getPreviewRangeByDirId
,
payload
);
}
export
function
*
resourceAddOrUpdateDirectory
(
payload
)
{
return
yield
call
(
service
.
resourceAddOrUpdateDirectory
,
payload
)
}
}
\ No newline at end of file
src/service/dataassetmanager.js
View file @
9fb407f4
...
@@ -69,7 +69,7 @@ export function listDataAssetsByPage(payload) {
...
@@ -69,7 +69,7 @@ export function listDataAssetsByPage(payload) {
}
}
export
function
listDataResourcesByPage
(
payload
)
{
export
function
listDataResourcesByPage
(
payload
)
{
return
Ge
tJSON
(
"/dataassetmanager/resourceApi/listResourcesByPage"
,
payload
);
return
Pos
tJSON
(
"/dataassetmanager/resourceApi/listResourcesByPage"
,
payload
);
}
}
export
function
listDataAssetsByPersonalCustomType
(
payload
)
{
export
function
listDataAssetsByPersonalCustomType
(
payload
)
{
...
@@ -242,4 +242,8 @@ export function getPrivilegeByRangeAndDirId(payload) {
...
@@ -242,4 +242,8 @@ export function getPrivilegeByRangeAndDirId(payload) {
export
function
getPreviewRangeByDirId
(
payload
)
{
export
function
getPreviewRangeByDirId
(
payload
)
{
return
Get
(
"/dataassetmanager/dataAssetApi/getPreviewRangeByDirId"
,
payload
);
return
Get
(
"/dataassetmanager/dataAssetApi/getPreviewRangeByDirId"
,
payload
);
}
}
\ No newline at end of file
export
function
resourceAddOrUpdateDirectory
(
payload
)
{
return
PostJSON
(
"/dataassetmanager/resourceApi/addOrUpdateDirectory"
,
payload
);
}
\ No newline at end of file
src/view/Manage/AssetResourceManage/table.jsx
View file @
9fb407f4
...
@@ -292,11 +292,14 @@ const FC = (props) => {
...
@@ -292,11 +292,14 @@ const FC = (props) => {
dispatch
({
dispatch
({
type
:
'assetmanage.listDataResourcesByPage'
,
type
:
'assetmanage.listDataResourcesByPage'
,
payload
:
{
payload
:
{
dirId
:
node
?.
nodeId
,
data
:
[],
pageNum
:
args
.
params
.
page
,
params
:
{
pageSize
:
args
.
params
.
size
,
dirId
:
node
?.
nodeId
,
keyword
:
args
.
params
.
keyword
,
pageNum
:
args
.
params
.
page
,
range
:
getAssetRange
(
ResourceManageReference
),
pageSize
:
args
.
params
.
size
,
keyword
:
args
.
params
.
keyword
,
range
:
getAssetRange
(
ResourceManageReference
),
}
},
},
callback
:
data
=>
{
callback
:
data
=>
{
setLoading
(
false
)
setLoading
(
false
)
...
...
src/view/Manage/AssetResourceManage/tree.jsx
View file @
9fb407f4
...
@@ -7,7 +7,7 @@ import { dispatch } from '../../../model'
...
@@ -7,7 +7,7 @@ import { dispatch } from '../../../model'
import
{
showMessage
,
highlightSearchContentByTerms
}
from
'../../../util'
import
{
showMessage
,
highlightSearchContentByTerms
}
from
'../../../util'
import
Tree
from
'../../../util/Component/Tree'
import
Tree
from
'../../../util/Component/Tree'
import
PermissionButton
from
'../../../util/Component/PermissionButton'
import
PermissionButton
from
'../../../util/Component/PermissionButton'
import
UpdateNode
from
'.
./AssetManage/Component/UpdateDirectoryModal
'
import
UpdateNode
from
'.
/update-node
'
import
ImportNode
from
'../AssetManage/Component/ImportDirectory'
import
ImportNode
from
'../AssetManage/Component/ImportDirectory'
import
CustomNode
from
'../AssetManage/Component/CustomDirectoryModal'
import
CustomNode
from
'../AssetManage/Component/CustomDirectoryModal'
...
@@ -57,7 +57,7 @@ const FC = (props) => {
...
@@ -57,7 +57,7 @@ const FC = (props) => {
const
[
updateNodeParam
,
setUpdateNodeParam
]
=
useState
({
const
[
updateNodeParam
,
setUpdateNodeParam
]
=
useState
({
visible
:
false
,
visible
:
false
,
action
:
undefined
,
action
:
undefined
,
dirI
d
:
undefined
,
i
d
:
undefined
,
})
})
const
[
importNodeParam
,
setImportNodeParam
]
=
useState
({
const
[
importNodeParam
,
setImportNodeParam
]
=
useState
({
visible
:
false
,
visible
:
false
,
...
@@ -235,9 +235,9 @@ const FC = (props) => {
...
@@ -235,9 +235,9 @@ const FC = (props) => {
const
onAddClick
=
()
=>
{
const
onAddClick
=
()
=>
{
setUpdateNodeParam
({
setUpdateNodeParam
({
type
:
'add'
,
visible
:
true
,
visible
:
true
,
dirId
:
selectedKey
action
:
'add'
,
id
:
selectedKey
})
})
}
}
...
@@ -316,9 +316,9 @@ const FC = (props) => {
...
@@ -316,9 +316,9 @@ const FC = (props) => {
const
onUpdateNodeCancel
=
(
refresh
=
false
,
nodeId
=
undefined
)
=>
{
const
onUpdateNodeCancel
=
(
refresh
=
false
,
nodeId
=
undefined
)
=>
{
setUpdateNodeParam
({
setUpdateNodeParam
({
type
:
undefined
,
visible
:
false
,
visible
:
false
,
dirId
:
undefined
action
:
undefined
,
id
:
undefined
})
})
if
(
refresh
)
{
if
(
refresh
)
{
...
@@ -354,9 +354,9 @@ const FC = (props) => {
...
@@ -354,9 +354,9 @@ const FC = (props) => {
onDeleteNodeClick
(
node
)
onDeleteNodeClick
(
node
)
}
else
if
(
key
===
'edit'
)
{
}
else
if
(
key
===
'edit'
)
{
setUpdateNodeParam
({
setUpdateNodeParam
({
type
:
'edit'
,
visible
:
true
,
visible
:
true
,
dirId
:
rightSelectedNode
?.
nodeId
action
:
'edit'
,
id
:
rightSelectedNode
?.
nodeId
})
})
}
else
if
(
key
===
'up'
)
{
}
else
if
(
key
===
'up'
)
{
onMoveNodeClick
(
1
)
onMoveNodeClick
(
1
)
...
...
src/view/Manage/AssetResourceManage/update-node.jsx
0 → 100644
View file @
9fb407f4
import
React
from
'react'
import
{
Modal
,
Button
,
Spin
,
Form
,
Input
,
Radio
,
Select
}
from
'antd'
import
{
dispatch
}
from
'../../../model'
const
resourceTypes
=
[
{
key
:
'innerSource'
,
name
:
'内部资源'
},
{
key
:
'outerSource'
,
name
:
'外部资源'
},
{
key
:
'custom'
,
name
:
'自定义'
},
]
const
FC
=
(
props
)
=>
{
const
{
id
,
action
,
visible
,
onCancel
}
=
props
const
[
loading
,
setLoading
]
=
React
.
useState
(
false
)
const
[
waiting
,
setWaiting
]
=
React
.
useState
(
false
)
const
[
node
,
setNode
]
=
React
.
useState
()
const
basicRef
=
React
.
useRef
()
React
.
useEffect
(()
=>
{
if
(
visible
&&
id
)
{
getDetail
()
}
},
[
visible
,
id
])
const
getDetail
=
()
=>
{
dispatch
({
type
:
'assetmanage.getDirectoryById'
,
payload
:
{
dirId
:
id
},
callback
:
data
=>
{
setNode
(
data
)
}
})
}
const
close
=
(
refresh
=
false
)
=>
{
setLoading
(
false
)
setWaiting
(
false
)
setNode
()
onCancel
?.(
refresh
)
}
const
save
=
async
()
=>
{
try
{
const
rows
=
await
basicRef
.
current
?.
validate
()
setWaiting
(
true
)
let
parentPath
=
''
if
(
action
===
'add'
)
{
if
(
basicRef
.
current
?.
getType
===
'child'
)
{
parentPath
=
node
.
path
}
}
else
{
parentPath
=
node
?.
path
.
substring
(
0
,
node
?.
path
.
lastIndexOf
(
"/"
))
}
dispatch
({
type
:
'assetmanage.resourceAddOrUpdateDirectory'
,
payload
:
{
data
:
{
directory
:
(
action
===
'add'
)?
rows
:{...
node
,
...
rows
},
},
params
:
{
parentPath
}
},
callback
:
data
=>
{
setWaiting
(
false
)
onCancel
?.(
true
,
data
?.
id
)
},
error
:
()
=>
{
setWaiting
(
false
)
}
})
}
catch
(
e
)
{
}
}
const
footer
=
React
.
useMemo
(()
=>
{
return
[
<
Button
key=
{
'cancel'
}
onClick=
{
()
=>
close
()
}
>
取消
</
Button
>,
<
Button
key=
{
'save'
}
type=
'primary'
onClick=
{
()
=>
save
()
}
>
确定
</
Button
>
]
},
[
close
,
save
])
return
(
<
Modal
visible=
{
visible
}
footer=
{
footer
}
width=
'600px'
bodyStyle=
{
{
padding
:
'15px 15px 0px 15px'
,
overflowX
:
'auto'
,
maxHeight
:
'80vh'
}
}
title=
'资源目录信息'
centered
destroyOnClose
onCancel=
{
()
=>
{
close
()
}
}
>
<
Spin
spinning=
{
waiting
}
>
<
Basic
ref=
{
basicRef
}
node=
{
node
}
action=
{
action
}
/>
</
Spin
>
</
Modal
>
)
}
export
default
FC
export
const
Basic
=
React
.
forwardRef
(
function
({
node
,
action
},
ref
)
{
const
[
type
,
setType
]
=
React
.
useState
(
'root'
)
const
[
currentResourceType
,
setCurrentResourceType
]
=
React
.
useState
()
const
[
form
]
=
Form
.
useForm
()
React
.
useImperativeHandle
(
ref
,
()
=>
({
getType
:
type
,
validate
:
async
()
=>
{
return
await
form
.
validateFields
()
},
}),
[
type
,
form
])
React
.
useEffect
(()
=>
{
if
(
node
)
{
const
index
=
resourceTypes
.
findIndex
(
item
=>
item
.
key
===
node
?.
resourceType
)
if
(
index
!==
-
1
)
{
setCurrentResourceType
(
resourceTypes
[
index
].
name
)
}
if
(
action
!==
'add'
)
{
form
.
setFieldsValue
(
node
)
}
}
},
[
action
,
node
])
const
onValuesChange
=
(
changedValues
,
allValues
)
=>
{
}
return
(
<
Form
form=
{
form
}
labelCol=
{
{
span
:
5
}
}
wrapperCol=
{
{
span
:
17
}
}
autoComplete=
"off"
onValuesChange=
{
onValuesChange
}
>
{
action
===
'add'
&&
<
Form
.
Item
label=
"类型"
rules=
{
[{
required
:
true
,
message
:
'请选择类型!'
}]
}
>
<
Radio
.
Group
value=
{
type
}
onChange=
{
(
e
)
=>
{
setType
(
e
.
target
.
value
)
}
}
>
<
Radio
value=
'root'
>
栏目
</
Radio
>
<
Radio
value=
'child'
disabled=
{
!
node
?.
id
}
>
目录
</
Radio
>
</
Radio
.
Group
>
</
Form
.
Item
>
}
<
Form
.
Item
label=
"资源类型"
name=
"resourceType"
rules=
{
[{
required
:
true
,
message
:
'请选择资源类型!'
}]
}
>
{
(
action
===
'add'
&&
type
===
'root'
)
?
<
Select
allowClear
>
{
resourceTypes
.
map
((
item
,
index
)
=>
{
return
<
Select
.
Option
key=
{
item
.
key
}
>
{
item
.
name
}
</
Select
.
Option
>
})
}
</
Select
>
:
<
span
>
{
currentResourceType
}
</
span
>
}
</
Form
.
Item
>
<
Form
.
Item
label=
"编号"
name=
"code"
rules=
{
[{
required
:
true
,
message
:
'必填项'
}]
}
>
<
Input
placeholder=
"请输入编号"
/>
</
Form
.
Item
>
<
Form
.
Item
label=
"名称"
name=
"name"
rules=
{
[{
required
:
true
,
message
:
'必填项'
}]
}
>
<
Input
placeholder=
"请输入名称"
/>
</
Form
.
Item
>
{
action
!==
'add'
&&
(
<
Form
.
Item
label=
"路径"
name=
"path"
>
<
span
>
{
node
?.
path
}
</
span
>
</
Form
.
Item
>
)
}
<
Form
.
Item
label=
"描述"
name=
"desc"
>
<
Input
.
TextArea
placeholder=
"请输入描述"
autoSize=
{
{
minRows
:
4
,
maxRows
:
4
}
}
/>
</
Form
.
Item
>
<
Form
.
Item
label=
"备注"
name=
"remarks"
>
<
Input
.
TextArea
placeholder=
"请输入备注"
autoSize=
{
{
minRows
:
4
,
maxRows
:
4
}
}
/>
</
Form
.
Item
>
</
Form
>
)
})
\ No newline at end of file
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