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
13e8ef9b
Commit
13e8ef9b
authored
Apr 08, 2021
by
fanyongjun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
4.8.2
parent
5851a49f
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
308 additions
and
24 deletions
+308
-24
AssetThemeModel.xlsx
public/docs/AssetThemeModel.xlsx
+0
-0
assetmanage.js
src/model/assetmanage.js
+4
-0
index.js
src/model/index.js
+2
-5
assetmanage.js
src/service/assetmanage.js
+6
-1
axios.js
src/util/axios.js
+20
-0
AssetDetail.jsx
src/view/Manage/AssetManage/components/AssetDetail.jsx
+31
-0
AssetTable.jsx
src/view/Manage/AssetManage/components/AssetTable.jsx
+27
-12
LeftTree.jsx
src/view/Manage/AssetManage/components/LeftTree.jsx
+60
-6
ThemeFile.jsx
src/view/Manage/AssetManage/components/ThemeFile.jsx
+158
-0
No files found.
public/docs/AssetThemeModel.xlsx
0 → 100644
View file @
13e8ef9b
File added
src/model/assetmanage.js
View file @
13e8ef9b
...
...
@@ -38,3 +38,7 @@ export function* queryAllDirectoryAsTree(payload) {
export
function
*
listAllTopics
(
payload
)
{
return
yield
call
(
service
.
listAllTopics
,
payload
);
}
export
function
*
directoryImport
(
payload
)
{
return
yield
call
(
service
.
directoryImport
,
payload
);
}
src/model/index.js
View file @
13e8ef9b
...
...
@@ -8,15 +8,12 @@ import { reducers } from './reducer';
import
*
as
user
from
'./user'
;
import
*
as
map
from
'./map'
;
import
*
as
datamodel
from
'./datamodel'
;
<<<<<<<
HEAD
import
*
as
assetmanage
from
'./assetmanage'
;
const
funcs
=
Connect
({
user
,
datamodel
,
map
,
assetmanage
})
=======
import
*
as
dataassetelement
from
'./dataassetelement'
;
const
funcs
=
Connect
({
user
,
datamodel
,
map
,
dataassetelement
})
>>>>>>>
38340
f8dec7bab08e4d6f7a73db93a2d59a4c42c
const
funcs
=
Connect
({
user
,
datamodel
,
map
,
dataassetelement
,
assetmanage
})
function
*
request
(
args
)
{
const
{
type
,
payload
,
callback
,
error
}
=
args
.
args
;
...
...
src/service/assetmanage.js
View file @
13e8ef9b
import
{
PostJSON
,
Post
,
GetJSON
}
from
"../util/axios"
import
{
PostJSON
,
GetJSON
,
filePost2
}
from
"../util/axios"
export
function
addOrUpdateDataAsset
(
payload
)
{
return
PostJSON
(
"/dataassetmanager/dataAssetApi/addOrUpdateDataAsset"
,
payload
)
...
...
@@ -46,3 +46,8 @@ export function queryAllDirectoryAsTree(payload) {
export
function
listAllTopics
(
payload
)
{
return
GetJSON
(
"/dataassetmanager/directoryApi/listAllTopics"
,
payload
)
}
export
function
directoryImport
(
payload
)
{
return
filePost2
(
"/dataassetmanager/directoryApi/import"
,
payload
)
}
src/util/axios.js
View file @
13e8ef9b
...
...
@@ -142,3 +142,22 @@ export function filePost(url, payload) {
callback
)
}
export
function
filePost2
(
url
,
payload
)
{
const
{
fileList
=
null
,
params
=
null
}
=
payload
||
{};
// let formData = new FormData();
// (fileList||[]).forEach(file=> {
// formData.append('file', file);
// });
let
formData
=
new
FormData
();
// 创建form对象
formData
.
append
(
'file'
,
fileList
);
if
(
params
){
for
(
let
key
in
params
){
url
=
url
+
'?'
+
key
+
'='
+
params
[
key
]
}
}
return
fileplain
.
post
(
url
,
formData
,
).
then
(
callback
)
}
\ No newline at end of file
src/view/Manage/AssetManage/components/AssetDetail.jsx
0 → 100644
View file @
13e8ef9b
import
React
,{
useState
,
useEffect
,}
from
"react"
import
{
Modal
,
Descriptions
}
from
"antd"
export
default
(
props
)
=>
{
const
{
handleCancle
,
visible
,
boxDetail
}
=
props
return
(
<
Modal
title=
{
`资产Id:${boxDetail.id}`
}
visible=
{
visible
}
width=
{
800
}
onCancel=
{
()
=>
{
handleCancle
()}
}
// style={{ top: 30}}
footer=
{
null
}
>
<
Descriptions
size=
"small"
column=
{
2
}
bordered
>
{
boxDetail
.
basicAttrs
&&
boxDetail
.
basicAttrs
[
0
]
&&
boxDetail
.
basicAttrs
.
map
(
data
=>
{
return
(
<
Descriptions
.
Item
label=
{
data
.
key
}
>
{
data
.
value
}
</
Descriptions
.
Item
>
)
})
}
</
Descriptions
>
</
Modal
>
)
}
\ No newline at end of file
src/view/Manage/AssetManage/components/AssetTable.jsx
View file @
13e8ef9b
import
React
,{
useState
,
useEffect
}
from
"react"
import
{
Card
,
Checkbox
,
Pagination
,
Button
,
List
,
Skeleton
,
Row
,
Col
,
Typography
,
Input
,
Space
,
Modal
}
from
"antd"
import
{
EyeOutlined
,
TableOutlined
,
AreaChartOutlined
}
from
'@ant-design/icons'
;
import
{
Card
,
Checkbox
,
Button
,
List
,
Skeleton
,
Row
,
Col
,
Typography
,
Input
,
Space
,
Modal
}
from
"antd"
import
"./AssetTable.less"
import
{
dispatchLatest
,
dispatch
}
from
'../../../../model'
;
import
{
dispatch
}
from
'../../../../model'
;
import
AssetModal
from
"./AssetModal"
import
AssetDetail
from
"./AssetDetail"
const
{
Text
}
=
Typography
;
...
...
@@ -17,6 +18,7 @@ export default (props) =>{
const
[
editBox
,
setEditBox
]
=
useState
({})
const
[
keyWord
,
setKeyWord
]
=
useState
(
''
)
const
[
keyMessage
,
setKeyMessage
]
=
useState
(
''
)
const
[
tableBox
,
setTableBox
]
=
useState
({
dataList
:[],
total
:
0
,})
const
[
pageNumber
,
setPageNumber
]
=
useState
({
page
:
1
,
size
:
20
,
rebuild
:
0
})
...
...
@@ -24,6 +26,7 @@ export default (props) =>{
const
{
page
,
size
,
rebuild
}
=
pageNumber
const
[
modal
,
contextHolder
]
=
Modal
.
useModal
();
const
[
visible
,
setVisible
]
=
useState
({
visible
:
false
,
addtype
:
true
})
const
[
visible2
,
setVisible2
]
=
useState
({
visible
:
false
,
box
:{}})
useEffect
(()
=>
{
getListBasicAttrs
()
...
...
@@ -32,7 +35,7 @@ export default (props) =>{
useEffect
(()
=>
{
if
(
nodeId
)
getTable
()
},[
nodeId
,
rebuild
])
},[
nodeId
,
rebuild
,
keyMessage
])
const
changeCurrent
=
(
page
,
size
)
=>
{
...
...
@@ -61,7 +64,7 @@ export default (props) =>{
setTableLoad
(
true
)
dispatch
({
type
:
'assetmanage.listDataAssetsByPage'
,
payload
:
{
dirId
:
nodeId
,
pageNum
:
page
,
pageSize
:
size
},
payload
:
{
dirId
:
nodeId
,
pageNum
:
page
,
pageSize
:
size
,
keyword
:
keyMessage
},
callback
:
dataBox
=>
{
setTableBox
({
dataList
:
dataBox
.
data
,
total
:
dataBox
.
total
})
setTableLoad
(
false
)
...
...
@@ -107,7 +110,18 @@ export default (props) =>{
setVisible
({
addtype
:
false
,
visible
:
true
})
}
const
more
=
(
data
)
=>
{
setVisible2
({
box
:
data
,
visible
:
true
})
}
const
handleCancle2
=
()
=>
{
setVisible2
({...
visible2
,
visible
:
false
})
}
const
fetchTableList
=
()
=>
{
setKeyMessage
(
keyWord
)
}
return
(
<
Card
...
...
@@ -119,14 +133,14 @@ export default (props) =>{
<
div
style=
{
{
display
:
'flex'
,
justifyContent
:
'space-between'
,
height
:
32
}
}
>
<
div
style=
{
{
fontSize
:
18
,
fontWeight
:
800
,
color
:
'#767676'
,
lineHeight
:
'32px'
}
}
>
资产管理
</
div
>
<
Space
>
<
Input
.
Search
style=
{
{
width
:
180
,
float
:
'right'
}
}
{
/*
<Input.Search style={{width:180,float:'right'}}
onChange={e=>{ setKeyWord(e.target.value)}}
value={keyWord}
placeholder={"请输入关键字"}
enterButton
//
onSearch=
{()=
>
{
fetchTableList
()
}
}
/
>
<
Button
type=
"primary"
>
回收站
</
Button
>
onSearch={()=>{fetchTableList()}}
/>
*/
}
{
/* <Button type="primary" >回收站</Button> */
}
</
Space
>
...
...
@@ -140,8 +154,8 @@ export default (props) =>{
<
Button
type=
"primary"
onClick=
{
add
}
>
新增
</
Button
>
{
/* <Button type="primary" danger>删除</Button> */
}
<
Button
type=
"primary"
>
导入
</
Button
>
<
Button
type=
"primary"
>
导出
</
Button
>
{
/*
<Button type="primary" >导入</Button>
<Button type="primary" >导出</Button>
*/
}
</
Space
>
</
div
>
...
...
@@ -165,7 +179,7 @@ export default (props) =>{
actions=
{
[
<
Button
type=
"link"
key=
"edit"
onClick=
{
()
=>
edit
(
item
)
}
>
修改
</
Button
>,
<
Button
type=
"link"
key=
"delete"
>
删除
</
Button
>,
<
Button
type=
"link"
key=
"detail"
onClick=
{
()
=>
del
(
item
)
}
>
详情
</
Button
>,
<
Button
type=
"link"
key=
"detail"
onClick=
{
()
=>
more
(
item
)
}
>
详情
</
Button
>,
]
}
>
<
Skeleton
title=
{
false
}
loading=
{
tableLoad
}
active
>
...
...
@@ -195,6 +209,7 @@ export default (props) =>{
/>
</
Checkbox
.
Group
>
<
AssetModal
visible=
{
visible
.
visible
}
attrBox2=
{
attrBox2
}
editBox=
{
editBox
}
addType=
{
visible
.
addtype
}
handleCancle=
{
handleCancle
}
attrBox=
{
attrBox
}
nodeId=
{
nodeId
}
setPageNumber=
{
setPageNumber
}
pageNumber=
{
pageNumber
}
/>
<
AssetDetail
visible=
{
visible2
.
visible
}
boxDetail=
{
visible2
.
box
}
handleCancle=
{
handleCancle2
}
/>
{
contextHolder
}
</
Card
>
)
...
...
src/view/Manage/AssetManage/components/LeftTree.jsx
View file @
13e8ef9b
import
React
,{
useState
,
useEffect
}
from
"react"
import
{
Card
,
Spin
,
Button
,
Tooltip
,
Modal
,
Tree
,
Input
}
from
"antd"
import
{
Card
,
Spin
,
Button
,
Tooltip
,
Modal
,
Tree
,
Input
,
Dropdown
,
Menu
}
from
"antd"
import
{
PlusOutlined
,
ImportOutlined
,
EditOutlined
,
DeleteOutlined
,
ExportOutlined
}
from
'@ant-design/icons'
;
import
{
showMessage
,
generateList
}
from
'../../../../util'
;
import
{
dispatch
Latest
,
dispatch
}
from
'../../../../model'
;
import
{
dispatch
}
from
'../../../../model'
;
import
TreeModal
from
"./TreeModal"
import
ThemeFile
from
"./ThemeFile"
import
'./LeftTree.less'
;
const
{
TreeNode
}
=
Tree
export
default
(
props
)
=>
{
...
...
@@ -13,8 +14,7 @@ export default (props)=>{
const
[
treeLoad
,
setTreeLoad
]
=
useState
(
false
)
const
[
nodeBox
,
setNodeBox
]
=
useState
({
openNode
:[],
selectKey
:[],
dataBox
:{}})
const
[
treeRebuild
,
setTreeRebuild
]
=
useState
({
build
:
false
,
type
:
'build'
})
const
[
dataCache
,
setDataCache
]
=
useState
({})
const
[
treeRebuild
,
setTreeRebuild
]
=
useState
({
build
:
0
,
type
:
'build'
})
const
[
visible
,
setVisible
]
=
useState
(
false
)
const
[
searchValue
,
setSearchValue
]
=
useState
(
''
)
const
[
autoExpandParent
,
setAutoExpandParent
]
=
useState
(
false
)
...
...
@@ -22,6 +22,7 @@ export default (props)=>{
const
[
searchMessage
,
setSearchMessage
]
=
useState
(
''
)
const
[
allTpoic
,
setAllTopic
]
=
useState
([])
const
[
detailBox
,
setDetailBox
]
=
useState
({})
const
[
visible2
,
setVisible2
]
=
useState
(
false
)
useEffect
(()
=>
{
getAllTpoic
()
...
...
@@ -137,7 +138,6 @@ export default (props)=>{
const
update
=
()
=>
{
if
(
nodeBox
.
dataBox
.
nodeId
!=
undefined
){
console
.
log
(
allTpoic
)
for
(
let
topic
of
allTpoic
){
if
(
topic
.
id
===
nodeBox
.
dataBox
.
nodeId
){
setDetailBox
(
topic
)
...
...
@@ -148,6 +148,36 @@ export default (props)=>{
setTreeRebuild
({...
treeRebuild
,
type
:
'edit'
})
}
const
importFunction
=
()
=>
{
if
(
nodeBox
.
dataBox
.
nodeId
!=
undefined
){
for
(
let
topic
of
allTpoic
){
if
(
topic
.
id
===
nodeBox
.
dataBox
.
nodeId
){
setDetailBox
(
topic
)
}
}
}
setVisible2
(
true
)
}
const
exportFunction
=
(
type
)
=>
{
if
(
!
type
){
window
.
open
(
`/api/dataassetmanager/directoryApi/export`
);
}
else
{
if
(
nodeBox
.
dataBox
.
nodeId
!=
undefined
){
for
(
let
topic
of
allTpoic
){
if
(
topic
.
id
===
nodeBox
.
dataBox
.
nodeId
){
window
.
open
(
`/api/dataassetmanager/directoryApi/export?parentPath=
${
topic
.
path
}
`
);
return
}
}
}
else
{
showMessage
(
"warn"
,
"请选择目录"
)
}
}
}
const
deleteNode
=
()
=>
{
if
(
nodeBox
.
selectKey
&&
nodeBox
.
selectKey
[
0
]
!==
undefined
)
{
...
...
@@ -160,6 +190,7 @@ export default (props)=>{
title
:
'提示'
,
content
:
'节点下包含资产信息,删除后将把资产从该目录上移除,确定继续吗?'
,
onOk
:
()
=>
{
console
.
log
({
data
:[
`
${
nodeBox
.
dataBox
.
nodeId
}
`
]})
dispatch
({
type
:
'assetmanage.deleteDirectory'
,
payload
:{
data
:[
`
${
nodeBox
.
dataBox
.
nodeId
}
`
]},
...
...
@@ -194,6 +225,10 @@ export default (props)=>{
setVisible
(
false
)
}
const
handleCancle2
=
()
=>
{
setVisible2
(
false
)
}
const
onSearch
=
()
=>
{
if
(
searchMessage
!=
''
){
const
expandedKeys
=
dataList
...
...
@@ -261,6 +296,20 @@ export default (props)=>{
}
});
const
menu
=
(
<
Menu
>
<
Menu
.
Item
>
<
div
onClick=
{
()
=>
exportFunction
(
false
)
}
>
导出所有
</
div
>
</
Menu
.
Item
>
<
Menu
.
Item
>
<
div
onClick=
{
()
=>
exportFunction
(
true
)
}
>
导出选中目录
</
div
>
</
Menu
.
Item
>
</
Menu
>
);
return
(
...
...
@@ -285,9 +334,10 @@ export default (props)=>{
<
Button
shape=
"circle"
icon=
{
<
ImportOutlined
/>
}
//
onClick=
{
importFunction
}
onClick=
{
importFunction
}
/>
</
Tooltip
>
<
Dropdown
overlay=
{
menu
}
placement=
"bottomLeft"
>
<
Tooltip
title=
"导出"
className=
'ml-3'
>
<
Button
shape=
"circle"
...
...
@@ -295,6 +345,9 @@ export default (props)=>{
// onClick=
{
exportFunction
}
/>
</
Tooltip
>
</
Dropdown
>
<
Tooltip
title=
"删除"
className=
'ml-3'
>
<
Button
shape=
"circle"
...
...
@@ -330,6 +383,7 @@ export default (props)=>{
</
Tree
>
</
Spin
>
<
TreeModal
visible=
{
visible
}
handleCancle=
{
handleCancle
}
addType=
{
treeRebuild
.
type
===
'add'
?
true
:
false
}
editBox=
{
detailBox
}
selectKey=
{
nodeBox
.
selectKey
[
0
]
}
setTreeRebuild=
{
setTreeRebuild
}
treeRebuild=
{
treeRebuild
}
/>
<
ThemeFile
fileVisible=
{
visible2
}
handleCancle=
{
handleCancle2
}
editBox=
{
detailBox
}
selectKey=
{
nodeBox
.
selectKey
[
0
]
}
setTreeRebuild=
{
setTreeRebuild
}
/>
{
contextHolder
}
</
Card
>
...
...
src/view/Manage/AssetManage/components/ThemeFile.jsx
0 → 100644
View file @
13e8ef9b
import
React
,{
useState
,
useEffect
}
from
"react"
import
{
Modal
,
Form
,
Upload
,
Button
,
message
,
Radio
}
from
"antd"
import
{
PlusOutlined
}
from
'@ant-design/icons'
;
import
{
dispatch
}
from
'../../../../model'
;
import
{
showMessage
}
from
'../../../../util'
;
export
default
(
props
)
=>
{
const
{
fileVisible
,
handleCancle
,
editBox
,
selectKey
,
setTreeRebuild
}
=
props
const
[
upLoad
,
setUpLoad
]
=
useState
(
false
)
const
[
form
]
=
Form
.
useForm
()
useEffect
(()
=>
{
if
(
fileVisible
){
form
.
resetFields
()
}
},[
fileVisible
])
const
normFile
=
(
e
)
=>
{
let
data
=
[]
if
(
e
.
fileList
[
0
]){
data
=
e
.
fileList
.
slice
(
-
1
)
}
return
data
;
};
const
prop
=
{
beforeUpload
:
(
file
)
=>
{
const
isLt20M
=
file
.
size
/
1024
/
1024
<
2000
;
if
(
!
isLt20M
)
{
return
message
.
error
(
'上传文件不能超过 20MB!'
)
}
return
false
;
},
};
const
upload
=
()
=>
{
form
.
validateFields
().
then
((
value
)
=>
{
setUpLoad
(
true
)
if
(
selectKey
){
if
(
value
.
type
===
1
){
dispatch
({
type
:
'assetmanage.directoryImport'
,
payload
:
{
fileList
:
value
.
file
[
0
].
originFileObj
},
callback
:
data
=>
{
setTreeRebuild
({
build
:
new
Date
().
getTime
(),
type
:
'build'
})
showMessage
(
"success"
,
"导入成功"
)
setUpLoad
(
false
)
handleCancle
()
},
error
:
()
=>
{
}
})
}
else
{
dispatch
({
type
:
'assetmanage.directoryImport'
,
payload
:
{
params
:{
parentPath
:
editBox
.
path
},
fileList
:
value
.
file
[
0
].
originFileObj
},
callback
:
data
=>
{
setUpLoad
(
false
)
handleCancle
()
showMessage
(
"success"
,
"导入成功"
)
setTreeRebuild
({
build
:
new
Date
().
getTime
(),
type
:
'build'
})
},
error
:
()
=>
{
}
})
}
}
else
{
dispatch
({
type
:
'assetmanage.directoryImport'
,
payload
:
{
fileList
:
value
.
file
[
0
].
originFileObj
},
callback
:
data
=>
{
setUpLoad
(
false
)
handleCancle
()
showMessage
(
"success"
,
"导入成功"
)
setTreeRebuild
({
build
:
new
Date
().
getTime
(),
type
:
'build'
})
},
error
:
()
=>
{
}
})
}
}).
catch
(()
=>
{
setUpLoad
(
false
)
})
}
const
formItemLayout
=
{
labelCol
:
{
xs
:
{
span
:
24
},
sm
:
{
span
:
5
},
},
wrapperCol
:
{
xs
:
{
span
:
24
},
sm
:
{
span
:
17
},
},
};
const
download
=
()
=>
{
window
.
open
(
"/data-govern/docs/AssetThemeModel.xlsx"
);
}
return
(
<
Modal
title=
{
`目录导入`
}
visible=
{
fileVisible
}
// width={800}
onCancel=
{
()
=>
{
handleCancle
()}
}
maskClosable=
{
false
}
footer=
{
[
<
div
key=
"btn1"
>
<
Button
type=
"primary"
onClick=
{
()
=>
download
()
}
>
模版下载
</
Button
>
<
Button
type=
"primary"
onClick=
{
upload
}
loading=
{
upLoad
}
>
上传
</
Button
>
<
Button
onClick=
{
handleCancle
}
>
返回
</
Button
>
</
div
>
]
}
>
<
Form
{
...
formItemLayout
}
form=
{
form
}
>
<
Form
.
Item
label=
"文件"
name=
"type"
rules=
{
[{
required
:
true
,
message
:
'必填项'
}]
}
>
<
Radio
.
Group
>
<
Radio
value=
{
1
}
>
父节点导入
</
Radio
>
<
Radio
value=
{
2
}
disabled=
{
selectKey
!=
undefined
?
false
:
true
}
>
选中节点导入
</
Radio
>
</
Radio
.
Group
>
</
Form
.
Item
>
<
Form
.
Item
label=
"文件"
name=
"file"
rules=
{
[{
required
:
true
,
message
:
'请上传附件'
}]
}
valuePropName=
'fileList'
getValueFromEvent=
{
normFile
}
>
<
Upload
{
...
prop
}
>
<
Button
type=
'link'
icon=
{
<
PlusOutlined
/>
}
style=
{
{
padding
:
5
}
}
>
上传
</
Button
>
</
Upload
>
</
Form
.
Item
>
</
Form
>
</
Modal
>
)
}
\ 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