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
4584f8f6
Commit
4584f8f6
authored
Apr 15, 2021
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
资产管理
parent
229f5244
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
202 additions
and
67 deletions
+202
-67
assetmanage.js
src/model/assetmanage.js
+4
-0
assetmanage.js
src/service/assetmanage.js
+5
-0
AssetDetail.jsx
src/view/Manage/AssetManage/components/AssetDetail.jsx
+2
-2
AssetModal.jsx
src/view/Manage/AssetManage/components/AssetModal.jsx
+41
-35
AssetTable.jsx
src/view/Manage/AssetManage/components/AssetTable.jsx
+42
-26
ImportAsset.jsx
src/view/Manage/AssetManage/components/ImportAsset.jsx
+98
-0
LeftTree.jsx
src/view/Manage/AssetManage/components/LeftTree.jsx
+2
-1
index.jsx
src/view/Manage/AssetManage/index.jsx
+8
-3
No files found.
src/model/assetmanage.js
View file @
4584f8f6
...
...
@@ -43,6 +43,10 @@ export function* directoryImport(payload) {
return
yield
call
(
service
.
directoryImport
,
payload
);
}
export
function
*
assetImport
(
payload
)
{
return
yield
call
(
service
.
assetImport
,
payload
);
}
export
function
*
getDirectoryById
(
payload
)
{
return
yield
call
(
service
.
getDirectoryById
,
payload
);
}
src/service/assetmanage.js
View file @
4584f8f6
...
...
@@ -52,6 +52,10 @@ export function directoryImport(payload) {
return
filePost2
(
"/dataassetmanager/directoryApi/import"
,
payload
)
}
export
function
assetImport
(
payload
)
{
return
filePost2
(
"/dataassetmanager/dataAssetApi/import"
,
payload
);
}
export
function
getDirectoryById
(
payload
)
{
return
GetJSON
(
"/dataassetmanager/directoryApi/getDirectoryById"
,
payload
)
}
\ No newline at end of file
src/view/Manage/AssetManage/components/AssetDetail.jsx
View file @
4584f8f6
...
...
@@ -16,9 +16,9 @@ const AssetDetail = (props)=>{
footer=
{
null
}
>
<
Descriptions
size=
"small"
column=
{
2
}
bordered
>
{
boxDetail
.
basicAttrs
&&
boxDetail
.
basicAttrs
[
0
]
&&
boxDetail
.
basicAttrs
.
map
((
data
,
index
)
=>
{
{
boxDetail
.
elements
&&
boxDetail
.
elements
.
map
((
element
,
index
)
=>
{
return
(
<
Descriptions
.
Item
key=
{
index
}
label=
{
data
.
key
}
>
{
data
.
value
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
key=
{
index
}
label=
{
element
.
name
}
>
{
element
.
value
}
</
Descriptions
.
Item
>
)
})
...
...
src/view/Manage/AssetManage/components/AssetModal.jsx
View file @
4584f8f6
...
...
@@ -5,7 +5,7 @@ import { showMessage } from '../../../../util';
const
AssetModal
=
(
props
)
=>
{
const
{
handleCancle
,
visible
,
editBox
,
addType
,
attrBox
,
nodeId
,
attrBox2
,
setPageNumber
,
pageNumber
}
=
props
const
{
handleCancle
,
visible
,
editBox
,
addType
,
nodeId
,
attrBox
,
setPageNumber
,
pageNumber
}
=
props
const
[
form
]
=
Form
.
useForm
()
const
[
saveLoad
,
setSaveLod
]
=
useState
(
false
)
...
...
@@ -16,27 +16,30 @@ const AssetModal = (props)=>{
//eslint-disable-next-line react-hooks/exhaustive-deps
},[
visible
])
useEffect
(()
=>
{
if
(
attrBox2
){
reset
()
}
//eslint-disable-next-line react-hooks/exhaustive-deps
},[
attrBox2
])
//
useEffect(()=>{
// if(attrBox
){
//
reset()
//
}
//
//eslint-disable-next-line react-hooks/exhaustive-deps
// },[attrBox
])
const
handleOk
=
async
()
=>
{
setSaveLod
(
true
)
form
.
validateFields
().
then
((
value
)
=>
{
if
(
addType
){
let
attr
=
[]
for
(
let
key
in
value
){
attr
.
push
({
'key'
:
key
,
'value'
:
value
[
key
]})
}
let
box
=
{
"basicAttrs"
:
attr
,
}
let
elements
=
[...
attrBox
];
(
elements
||
[]).
forEach
((
element
)
=>
{
for
(
let
key
in
value
)
{
if
(
key
===
element
.
name
)
{
element
.
value
=
value
[
key
];
}
}
});
dispatch
({
type
:
'assetmanage.addOrUpdateDataAsset'
,
payload
:
{
params
:{
dirId
:
nodeId
},
data
:
box
},
payload
:
{
params
:{
dirId
:
nodeId
},
data
:
{
elements
}
},
callback
:
data
=>
{
setSaveLod
(
false
)
handleCancle
()
...
...
@@ -49,18 +52,18 @@ const AssetModal = (props)=>{
}
})
}
else
{
let
attr
=
[]
for
(
let
key
in
value
)
{
attr
.
push
({
'key'
:
key
,
'value'
:
value
[
key
]})
}
let
box
=
{
"basicAttrs"
:
attr
,
id
:
editBox
.
id
}
let
elements
=
[...
attrBox
];
(
elements
||
[]).
forEach
((
element
)
=>
{
for
(
let
key
in
value
)
{
if
(
key
===
element
.
name
)
{
element
.
value
=
value
[
key
];
}
}
});
dispatch
({
type
:
'assetmanage.addOrUpdateDataAsset'
,
payload
:
{
params
:{
dirId
:
nodeId
},
data
:
box
},
payload
:
{
params
:{
dirId
:
nodeId
},
data
:
{
...
editBox
,
elements
}
},
callback
:
data
=>
{
setSaveLod
(
false
)
setPageNumber
({...
pageNumber
,
rebuild
:
new
Date
().
getTime
()})
...
...
@@ -113,16 +116,19 @@ const AssetModal = (props)=>{
}
>
<
Form
{
...
formItemLayout
}
form=
{
form
}
>
{
attrBox
&&
attrBox
[
0
]
&&
attrBox
.
map
((
item
,
i
)
=>
{
return
(
<
Form
.
Item
label=
{
item
.
key
}
name=
{
item
.
key
}
key=
{
`form${i}`
}
initialValue=
{
attrBox2
[
item
.
key
]?
attrBox2
[
item
.
key
]
:
''
}
>
<
Input
/>
</
Form
.
Item
>
{
attrBox
.
map
((
item
,
i
)
=>
{
return
(
item
.
manualMaintain
===
'是'
?(
<
Form
.
Item
label=
{
item
.
name
}
name=
{
item
.
name
}
key=
{
`form${i}`
}
initialValue=
{
item
.
value
||
''
}
>
<
Input
/>
</
Form
.
Item
>
)
:
null
)
})
}
</
Form
>
...
...
src/view/Manage/AssetManage/components/AssetTable.jsx
View file @
4584f8f6
...
...
@@ -4,13 +4,14 @@ import "./AssetTable.less"
import
{
dispatch
}
from
'../../../../model'
;
import
AssetModal
from
"./AssetModal"
import
AssetDetail
from
"./AssetDetail"
import
ImportAsset
from
'./ImportAsset'
;
import
{
showMessage
}
from
'../../../../util'
;
const
{
Text
}
=
Typography
;
const
AssetTable
=
(
props
)
=>
{
const
{
nodeId
,}
=
props
const
{
nodeId
,
node
}
=
props
const
[
tableLoad
,
setTableLoad
]
=
useState
(
false
)
const
[
attrBox
,
setAttrBox
]
=
useState
([])
...
...
@@ -31,6 +32,7 @@ const AssetTable = (props) =>{
const
[
selectBox
,
setSelectBox
]
=
useState
([])
const
[
checkValue
,
setCheckValue
]
=
useState
(
false
)
const
[
assetNames
,
setAssetNames
]
=
useState
([]);
const
[
importAssetVisible
,
setImportAssetVisible
]
=
useState
(
false
);
useEffect
(()
=>
{
getListBasicAttrs
()
...
...
@@ -62,11 +64,11 @@ const AssetTable = (props) =>{
type
:
'assetmanage.listBasicAttrs'
,
payload
:
null
,
callback
:
dataBox
=>
{
let
box
=
{}
for
(
let
item
of
dataBox
){
box
[
item
.
key
]
=
item
.
value
}
setAttrBox2
(
b
ox
)
//
let box = {}
//
for(let item of dataBox){
//
box[item.key] = item.value
//
}
// setAttrBox2(dataB
ox)
setAttrBox
(
dataBox
)
},
error
:
()
=>
{
...
...
@@ -82,10 +84,10 @@ const AssetTable = (props) =>{
payload
:
{
dirId
:
nodeId
,
pageNum
:
page
,
pageSize
:
size
,
keyword
:
keyMessage
!==
''
?
keyMessage
:
undefined
},
callback
:
dataBox
=>
{
const
_assetNames
=
[];
(
dataBox
.
data
||
[]).
forEach
((
item
)
=>
{
(
item
.
basicAttrs
||
[]).
forEach
((
attr
)
=>
{
if
(
attr
.
key
===
'中文名称'
)
{
_assetNames
.
push
(
attr
.
value
||
''
);
(
dataBox
.
data
||
[]).
forEach
((
table
)
=>
{
(
table
.
elements
||
[]).
forEach
((
element
)
=>
{
if
(
element
.
name
===
'中文名称'
)
{
_assetNames
.
push
(
element
.
value
||
''
);
}
})
})
...
...
@@ -109,20 +111,16 @@ const AssetTable = (props) =>{
}
const
handleCancle
=
()
=>
{
let
box
=
attrBox2
for
(
let
item
of
attrB
ox
){
box
[
item
.
key
]
=
''
let
box
=
[
...
attrBox
];
for
(
let
element
of
b
ox
){
element
.
value
=
''
}
setAttrBox
2
(
box
)
setAttrBox
(
box
);
setVisible
({...
visible
,
visible
:
false
})
}
const
edit
=
(
data
)
=>
{
let
box
=
attrBox2
for
(
let
item
of
data
.
basicAttrs
){
box
[
item
.
key
]
=
item
.
value
}
setAttrBox2
(
box
)
setAttrBox
(
data
.
elements
||
[])
setEditBox
(
data
)
setVisible
({
addtype
:
false
,
visible
:
true
})
}
...
...
@@ -148,6 +146,14 @@ const AssetTable = (props) =>{
})
}
const
importAssets
=
()
=>
{
setImportAssetVisible
(
true
);
}
const
exportAssets
=
()
=>
{
window
.
open
(
`/api/dataassetmanager/dataAssetApi/export?parentPath=
${
node
.
path
||
''
}
`
);
}
const
more
=
(
data
)
=>
{
setVisible2
({
box
:
data
,
visible
:
true
})
...
...
@@ -211,6 +217,11 @@ const AssetTable = (props) =>{
}
}
const
onImportAssetCancel
=
(
refresh
=
false
)
=>
{
setImportAssetVisible
(
false
);
refresh
&&
getTable
();
}
return
(
<
Card
bordered=
{
false
}
...
...
@@ -241,8 +252,8 @@ const AssetTable = (props) =>{
<
Button
type=
"primary"
onClick=
{
add
}
>
新增
</
Button
>
<
Button
type=
"primary"
danger
onClick=
{
dels
}
>
删除
</
Button
>
{
/* <Button type="primary"
>导入</Button>
<Button type="primary"
>导出</Button> */
}
<
Button
type=
"primary"
onClick=
{
importAssets
}
>
导入
</
Button
>
<
Button
type=
"primary"
onClick=
{
exportAssets
}
>
导出
</
Button
>
</
Space
>
</
div
>
...
...
@@ -270,11 +281,11 @@ const AssetTable = (props) =>{
}
description=
{
<
Row
>
{
item
.
basicAttrs
&&
item
.
basicAttrs
.
map
(
data
=>
{
{
item
.
elements
&&
item
.
elements
.
map
(
element
=>
{
return
(
<
Col
md=
{
6
}
key=
{
data
.
key
}
>
<
Text
>
{
data
.
key
}
:
</
Text
>
{
data
.
value
}
<
Col
md=
{
6
}
key=
{
element
.
id
||
''
}
>
<
Text
>
{
element
.
name
}
:
</
Text
>
{
element
.
value
}
</
Col
>
)
})
...
...
@@ -299,8 +310,13 @@ const AssetTable = (props) =>{
showTotal=
{
total
=>
`共 ${total} 条`
}
/>
</
Checkbox
.
Group
>
<
AssetModal
visible=
{
visible
.
visible
}
attrBox
2=
{
attrBox2
}
editBox=
{
editBox
}
addType=
{
visible
.
addtype
}
handleCancle=
{
handleCancle
}
attrBox=
{
attrBox
}
nodeId=
{
nodeId
}
setPageNumber=
{
setPageNumber
}
pageNumber=
{
pageNumber
}
/>
<
AssetModal
visible=
{
visible
.
visible
}
attrBox
=
{
attrBox
}
editBox=
{
editBox
}
addType=
{
visible
.
addtype
}
handleCancle=
{
handleCancle
}
attrBox=
{
attrBox
}
nodeId=
{
nodeId
}
setPageNumber=
{
setPageNumber
}
pageNumber=
{
pageNumber
}
/>
<
AssetDetail
visible=
{
visible2
.
visible
}
boxDetail=
{
visible2
.
box
}
handleCancle=
{
handleCancle2
}
/>
<
ImportAsset
visible=
{
importAssetVisible
}
onCancel=
{
onImportAssetCancel
}
node
=
{
node
}
/>
{
contextHolder
}
</
Card
>
)
...
...
src/view/Manage/AssetManage/components/ImportAsset.jsx
0 → 100644
View file @
4584f8f6
import
React
from
'react'
;
import
{
Modal
,
Button
,
Upload
}
from
'antd'
;
import
{
DownloadOutlined
,
UploadOutlined
}
from
'@ant-design/icons'
;
import
{
dispatch
}
from
'../../../../model'
;
class
ImportAsset
extends
React
.
Component
{
constructor
()
{
super
();
this
.
state
=
{
fileList
:
[],
confirmLoading
:
false
,
};
}
downloadTemplate
=
()
=>
{
window
.
open
(
"/api/dataassetmanager/dataAssetApi/getImportTemplate"
);
}
reset
=
()
=>
{
this
.
setState
({
fileList
:
[],
confirmLoading
:
false
});
}
onOk
=
()
=>
{
const
{
node
,
onCancel
}
=
this
.
props
;
const
{
fileList
}
=
this
.
state
;
this
.
setState
({
confirmLoading
:
true
},
()
=>
{
dispatch
({
type
:
'assetmanage.assetImport'
,
payload
:
{
fileList
:
fileList
[
0
],
params
:
{
parentPath
:
node
.
path
||
''
}
},
callback
:
()
=>
{
this
.
setState
({
confirmLoading
:
false
},
()
=>
{
onCancel
&&
onCancel
(
true
);
});
},
error
:
()
=>
{
this
.
setState
({
confirmLoading
:
false
});
}
});
});
}
render
()
{
const
{
visible
,
onCancel
}
=
this
.
props
;
const
{
fileList
}
=
this
.
state
;
const
uploadProps
=
{
onRemove
:
file
=>
{
const
index
=
fileList
.
indexOf
(
file
);
const
newFileList
=
fileList
.
slice
();
newFileList
.
splice
(
index
,
1
);
this
.
setState
({
fileList
:
newFileList
});
},
beforeUpload
:
file
=>
{
this
.
setState
({
fileList
:
[
file
]
});
return
false
;
},
accept
:
".xlsx"
,
fileList
:
fileList
||
[]
};
return
(
<
Modal
forceRender
visible=
{
visible
}
title=
{
'导入资产'
}
width=
{
520
}
onOk=
{
this
.
onOk
}
onCancel=
{
()
=>
{
this
.
reset
();
onCancel
&&
onCancel
();
}
}
>
<>
<
div
>
<
Button
icon=
{
<
DownloadOutlined
/>
}
onClick=
{
this
.
downloadTemplate
}
>
模版下载
</
Button
>
</
div
>
<
div
className=
'mt-3'
>
<
Upload
{
...
uploadProps
}
>
<
Button
icon=
{
<
UploadOutlined
/>
}
>
选择文件上传
</
Button
>
</
Upload
>
</
div
>
</>
</
Modal
>
)
}
}
export
default
ImportAsset
;
\ No newline at end of file
src/view/Manage/AssetManage/components/LeftTree.jsx
View file @
4584f8f6
...
...
@@ -9,7 +9,7 @@ import './LeftTree.less';
const
{
TreeNode
}
=
Tree
const
LeftTree
=
(
props
)
=>
{
const
{
setNodeId
,
nodeId
}
=
props
const
{
setNodeId
,
nodeId
,
setNode
}
=
props
const
[
treeBox
,
setTreeBox
]
=
useState
([])
const
[
dataList
,
setDataList
]
=
useState
([])
...
...
@@ -54,6 +54,7 @@ const LeftTree = (props)=>{
payload
:
{
dirId
:
nodeId
},
callback
:
dataBox
=>
{
setDetailBox
(
dataBox
)
setNode
(
dataBox
)
},
error
:
()
=>
{
}
...
...
src/view/Manage/AssetManage/index.jsx
View file @
4584f8f6
...
...
@@ -7,7 +7,8 @@ class Index extends React.Component {
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
nodeId
:
null
nodeId
:
null
,
node
:
null
,
};
}
...
...
@@ -19,14 +20,18 @@ class Index extends React.Component {
this
.
setState
({
nodeId
:
data
})
}
setNode
=
(
data
)
=>
{
this
.
setState
({
node
:
data
});
}
render
()
{
return
(
<
Row
gutter=
{
15
}
style=
{
{
backgroundColor
:
'#ededed'
}
}
>
<
Col
span=
{
6
}
>
<
LeftTree
setNodeId=
{
this
.
setNodeId
}
nodeId=
{
this
.
state
.
nodeId
}
/>
<
LeftTree
setNodeId=
{
this
.
setNodeId
}
setNode=
{
this
.
setNode
}
nodeId=
{
this
.
state
.
nodeId
}
/>
</
Col
>
<
Col
span=
{
18
}
>
<
AssetTable
nodeId=
{
this
.
state
.
nodeId
}
/>
<
AssetTable
nodeId=
{
this
.
state
.
nodeId
}
node=
{
this
.
state
.
node
}
/>
</
Col
>
</
Row
>
)
...
...
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