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
92905c60
Commit
92905c60
authored
Apr 25, 2021
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
资产调整
parent
fc7c399f
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
295 additions
and
177 deletions
+295
-177
assetmanage.js
src/model/assetmanage.js
+12
-3
dataassetmanager.js
src/service/dataassetmanager.js
+12
-4
AssetDetail.jsx
src/view/Manage/AssetManage/components/AssetDetail.jsx
+30
-9
AssetEdit.jsx
src/view/Manage/AssetManage/components/AssetEdit.jsx
+152
-0
AssetModal.jsx
src/view/Manage/AssetManage/components/AssetModal.jsx
+0
-141
AssetTable.jsx
src/view/Manage/AssetManage/components/AssetTable.jsx
+0
-0
FilterElement.jsx
src/view/Manage/AssetManage/components/FilterElement.jsx
+36
-7
LeftTree.jsx
src/view/Manage/AssetManage/components/LeftTree.jsx
+6
-6
AssetMount.jsx
src/view/Manage/AssetRecycle/AssetMount.jsx
+23
-0
index.jsx
src/view/Manage/AssetRecycle/index.jsx
+17
-5
ImportActionTable.jsx
src/view/Manage/Model/Component/ImportActionTable.jsx
+7
-2
No files found.
src/model/assetmanage.js
View file @
92905c60
...
...
@@ -9,6 +9,18 @@ export function* getLogs(payload) {
return
yield
call
(
service
.
getLogs
,
payload
);
}
export
function
*
listElements
()
{
return
yield
call
(
service
.
listElements
);
}
export
function
*
listFilterElementIds
()
{
return
yield
call
(
service
.
listFilterElementIds
);
}
export
function
*
setupFilterElementIds
(
payload
)
{
return
yield
call
(
service
.
setupFilterElementIds
,
payload
);
}
export
function
*
addOrUpdateDataAsset
(
payload
)
{
return
yield
call
(
service
.
addOrUpdateDataAsset
,
payload
);
}
...
...
@@ -21,9 +33,6 @@ export function* getDataAssetDetail(payload) {
return
yield
call
(
service
.
getDataAssetDetail
,
payload
);
}
export
function
*
listBasicAttrs
(
payload
)
{
return
yield
call
(
service
.
listBasicAttrs
,
payload
);
}
export
function
*
listDataAssetsByPage
(
payload
)
{
return
yield
call
(
service
.
listDataAssetsByPage
,
payload
);
}
...
...
src/service/dataassetmanager.js
View file @
92905c60
...
...
@@ -8,6 +8,18 @@ export function getLogs(payload) {
return
GetJSON
(
"/dataassetmanager/elementApi/listOperationLogsByPage"
,
payload
);
}
export
function
listElements
()
{
return
PostJSON
(
"/dataassetmanager/elementApi/listElements"
);
}
export
function
listFilterElementIds
()
{
return
GetJSON
(
"/dataassetmanager/elementApi/listFilterElementIds"
);
}
export
function
setupFilterElementIds
(
payload
)
{
return
PostJSON2
(
"/dataassetmanager/elementApi/setupFilterElementIds"
,
payload
);
}
export
function
addOrUpdateDataAsset
(
payload
)
{
return
PostJSON
(
"/dataassetmanager/dataAssetApi/addOrUpdateDataAsset"
,
payload
);
}
...
...
@@ -20,10 +32,6 @@ export function getDataAssetDetail(payload) {
return
GetJSON
(
"/dataassetmanager/dataAssetApi/getDataAssetDetail"
,
payload
);
}
export
function
listBasicAttrs
(
payload
)
{
return
GetJSON
(
"/dataassetmanager/dataAssetApi/listBasicAttrs"
,
payload
);
}
export
function
listDataAssetsByPage
(
payload
)
{
return
GetJSON
(
"/dataassetmanager/dataAssetApi/listDataAssetsByPage"
,
payload
);
}
...
...
src/view/Manage/AssetManage/components/AssetDetail.jsx
View file @
92905c60
import
React
,
{
useEffect
,
useState
}
from
"react"
import
{
Modal
,
Typography
}
from
"antd"
import
React
,
{
useEffect
,
useState
}
from
"react"
;
import
{
Modal
,
Typography
}
from
"antd"
;
import
AssetItem
from
'./AssetItem'
;
import
{
dispatch
}
from
'../../../../model'
;
const
AssetDetail
=
(
props
)
=>
{
const
{
onCancel
,
visible
,
item
}
=
props
const
{
onCancel
,
visible
,
id
}
=
props
;
const
[
asset
,
setAsset
]
=
useState
(
''
);
const
[
assetName
,
setAssetName
]
=
useState
(
''
);
useEffect
(()
=>
{
if
(
item
)
{
const
index
=
(
item
.
elements
||
[]).
findIndex
(
element
=>
element
.
name
===
'中文名称'
);
if
((
id
||
''
)
!==
''
)
{
getAssetThenGetAssetName
();
}
//eslint-disable-next-line react-hooks/exhaustive-deps
},
[
id
])
const
getAssetThenGetAssetName
=
()
=>
{
dispatch
({
type
:
'assetmanage.getDataAssetDetail'
,
payload
:
{
dataAssetId
:
id
},
callback
:
data
=>
{
setAsset
(
data
);
getAssetName
(
data
);
}
})
}
const
getAssetName
=
(
data
)
=>
{
if
(
data
)
{
const
index
=
(
data
.
elements
||
[]).
findIndex
(
element
=>
element
.
name
===
'中文名称'
);
if
(
index
!==
-
1
)
{
setAssetName
(
item
.
elements
[
index
].
value
||
''
);
setAssetName
(
data
.
elements
[
index
].
value
||
''
);
}
}
//eslint-disable-next-line react-hooks/exhaustive-deps
},
[
item
])
}
return
(
<
Modal
...
...
@@ -34,7 +55,7 @@ const AssetDetail = (props)=>{
onCancel=
{
()
=>
{
onCancel
&&
onCancel
()}
}
footer=
{
null
}
>
<
AssetItem
data=
{
item
}
/>
<
AssetItem
data=
{
asset
}
/>
</
Modal
>
)
}
...
...
src/view/Manage/AssetManage/components/AssetEdit.jsx
0 → 100644
View file @
92905c60
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
Modal
,
Form
,
Input
,
Space
,
Button
}
from
'antd'
;
import
{
showMessage
}
from
'../../../../util'
;
import
{
dispatch
}
from
'../../../../model'
;
const
AssetEdit
=
(
props
)
=>
{
const
{
onCancel
,
visible
,
action
,
id
,
nodeId
}
=
props
;
const
[
form
]
=
Form
.
useForm
();
const
[
confirmLoading
,
setConfirmLoading
]
=
useState
(
false
);
const
[
elements
,
setElements
]
=
useState
([]);
const
[
asset
,
setAsset
]
=
useState
(
''
);
useEffect
(()
=>
{
if
(
visible
)
{
if
(
action
===
'add'
)
{
getAllElements
();
}
else
if
(
id
)
{
getAllElements
(()
=>
{
getAsset
();
});
}
}
//eslint-disable-next-line react-hooks/exhaustive-deps
},
[
visible
,
action
,
id
])
const
getAllElements
=
(
cb
=
null
)
=>
{
dispatch
({
type
:
'assetmanage.listElements'
,
callback
:
data
=>
{
setElements
(
data
||
[]);
if
(
action
===
'add'
)
{
let
_fieldsValue
=
{};
(
data
||
[]).
forEach
(
element
=>
{
if
(
element
.
manualMaintain
===
'是'
)
{
_fieldsValue
[
element
.
name
]
=
''
;
}
})
form
.
setFieldsValue
(
_fieldsValue
);
}
cb
&&
cb
();
}
})
}
const
getAsset
=
()
=>
{
dispatch
({
type
:
'assetmanage.getDataAssetDetail'
,
payload
:
{
dataAssetId
:
id
},
callback
:
data
=>
{
setAsset
(
data
);
let
_fieldsValue
=
{};
(
data
.
elements
||
[]).
forEach
(
element
=>
{
if
(
element
.
manualMaintain
===
'是'
)
{
_fieldsValue
[
element
.
name
]
=
element
.
value
;
}
})
form
.
setFieldsValue
(
_fieldsValue
);
}
})
}
const
onOk
=
async
()
=>
{
try
{
const
row
=
await
form
.
validateFields
();
const
newElements
=
[...
elements
];
(
newElements
||
[]).
forEach
(
element
=>
{
if
(
row
.
hasOwnProperty
(
element
.
name
))
{
element
.
value
=
row
[
element
.
name
];
}
});
dispatch
({
type
:
'assetmanage.addOrUpdateDataAsset'
,
payload
:
{
params
:
{
dirId
:
nodeId
},
data
:
action
===
'add'
?
{
elements
:
newElements
}
:
{
...
asset
,
elements
:
newElements
}
},
callback
:
()
=>
{
setConfirmLoading
(
false
);
onCancel
&&
onCancel
(
true
);
showMessage
(
"success"
,(
action
===
'add'
)?
"新增成功"
:
"修改成功"
);
},
error
:
()
=>
{
setConfirmLoading
(
false
);
}
})
}
catch
(
errInfo
)
{
console
.
log
(
'Validate Failed:'
,
errInfo
);
setConfirmLoading
(
false
);
}
}
const
formItemLayout
=
{
labelCol
:
{
xs
:
{
span
:
24
},
sm
:
{
span
:
5
},
},
wrapperCol
:
{
xs
:
{
span
:
24
},
sm
:
{
span
:
17
},
},
};
return
(
<
Modal
forceRender
title=
'资产信息'
visible=
{
visible
}
width=
{
600
}
onCancel=
{
()
=>
{
onCancel
&&
onCancel
();
}
}
footer=
{
<
Space
>
<
Button
type=
"primary"
onClick=
{
onOk
}
loading=
{
confirmLoading
}
>
提交
</
Button
>
<
Button
onClick=
{
()
=>
onCancel
&&
onCancel
()
}
>
返回
</
Button
>
</
Space
>
}
>
<
Form
{
...
formItemLayout
}
form=
{
form
}
>
{
(
elements
||
[]).
map
((
element
,
index
)
=>
{
return
(
element
.
manualMaintain
===
'是'
?
(
<
Form
.
Item
label=
{
element
.
name
}
name=
{
element
.
name
}
key=
{
index
}
>
<
Input
/>
</
Form
.
Item
>
)
:
null
)
})
}
</
Form
>
</
Modal
>
);
}
export
default
AssetEdit
;
\ No newline at end of file
src/view/Manage/AssetManage/components/AssetModal.jsx
deleted
100644 → 0
View file @
fc7c399f
import
React
,{
useState
,
useEffect
,}
from
"react"
import
{
Modal
,
Form
,
Input
,
Space
,
Button
}
from
"antd"
import
{
dispatch
}
from
'../../../../model'
;
import
{
showMessage
}
from
'../../../../util'
;
const
AssetModal
=
(
props
)
=>
{
const
{
handleCancle
,
visible
,
editBox
,
addType
,
nodeId
,
attrBox
,
setPageNumber
,
pageNumber
}
=
props
const
[
form
]
=
Form
.
useForm
()
const
[
saveLoad
,
setSaveLod
]
=
useState
(
false
)
useEffect
(()
=>
{
if
(
visible
){
reset
()
}
//eslint-disable-next-line react-hooks/exhaustive-deps
},[
visible
])
// 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
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
:
{
elements
}
},
callback
:
data
=>
{
setSaveLod
(
false
)
handleCancle
()
setPageNumber
({...
pageNumber
,
rebuild
:
new
Date
().
getTime
()})
showMessage
(
"success"
,
"新增成功"
)
},
error
:
()
=>
{
}
})
}
else
{
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
:
{
...
editBox
,
elements
}
},
callback
:
data
=>
{
setSaveLod
(
false
)
setPageNumber
({...
pageNumber
,
rebuild
:
new
Date
().
getTime
()})
handleCancle
()
showMessage
(
"success"
,
"修改成功"
)
},
error
:
()
=>
{
}
})
}
}).
catch
(()
=>
{
setSaveLod
(
false
)
})
}
const
reset
=
()
=>
{
form
.
resetFields
()
}
const
formItemLayout
=
{
labelCol
:
{
xs
:
{
span
:
24
},
sm
:
{
span
:
5
},
},
wrapperCol
:
{
xs
:
{
span
:
24
},
sm
:
{
span
:
17
},
},
};
return
(
<
Modal
forceRender
title=
{
`资产信息`
}
visible=
{
visible
}
width=
{
600
}
onCancel=
{
()
=>
{
handleCancle
()}
}
// style={{ top: 30}}
footer=
{
<
Space
>
<
Button
type=
"primary"
onClick=
{
handleOk
}
loading=
{
saveLoad
}
>
提交
</
Button
>
<
Button
onClick=
{
()
=>
reset
()
}
>
重置
</
Button
>
<
Button
onClick=
{
()
=>
handleCancle
()
}
>
返回
</
Button
>
</
Space
>
}
>
<
Form
{
...
formItemLayout
}
form=
{
form
}
>
{
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
>
</
Modal
>
)
}
export
default
AssetModal
;
\ No newline at end of file
src/view/Manage/AssetManage/components/AssetTable.jsx
View file @
92905c60
This diff is collapsed.
Click to expand it.
src/view/Manage/AssetManage/components/FilterElement.jsx
View file @
92905c60
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
Avatar
,
Row
,
Col
,
Divider
,
Checkbox
,
Typography
,
Space
,
Button
,
Switch
}
from
'antd'
;
import
{
dispatch
}
from
'../../../../model'
;
import
'./FilterElement.less'
;
const
colors
=
[
...
...
@@ -17,19 +18,38 @@ const colors = [
const
FilterElement
=
(
props
)
=>
{
const
{
elements
,
onCancel
}
=
props
;
const
{
onCancel
}
=
props
;
const
[
elements
,
setElements
]
=
useState
([]);
const
[
typesOfElements
,
setTypesOfElements
]
=
useState
([]);
const
[
selectedKeys
,
setSelectedKeys
]
=
useState
([]);
useEffect
(()
=>
{
if
(
elements
)
{
convertData
();
}
getAllFilterElementIdsThenGetAllElements
();
//eslint-disable-next-line react-hooks/exhaustive-deps
},
[
elements
]);
},
[]);
const
getAllFilterElementIdsThenGetAllElements
=
()
=>
{
dispatch
({
type
:
'assetmanage.listFilterElementIds'
,
callback
:
data
=>
{
setSelectedKeys
(
data
||
[]);
getAllElements
();
}
})
}
const
convertData
=
()
=>
{
const
getAllElements
=
()
=>
{
dispatch
({
type
:
'assetmanage.listElements'
,
callback
:
data
=>
{
setElements
(
data
||
[]);
convertElements
(
data
||
[]);
}
})
}
const
convertElements
=
(
elements
)
=>
{
const
_typesOfElements
=
[];
const
_types
=
[];
...
...
@@ -72,7 +92,16 @@ const FilterElement = (props) => {
}
const
onOk
=
()
=>
{
onCancel
&&
onCancel
();
dispatch
({
type
:
'assetmanage.setupFilterElementIds'
,
payload
:
{
data
:
selectedKeys
},
callback
:
()
=>
{
onCancel
&&
onCancel
(
false
,
true
);
}
})
}
return
(
...
...
src/view/Manage/AssetManage/components/LeftTree.jsx
View file @
92905c60
...
...
@@ -9,7 +9,7 @@ import './LeftTree.less';
const
{
TreeNode
}
=
Tree
const
LeftTree
=
(
props
)
=>
{
const
{
setNodeId
,
nodeId
,
setNode
}
=
props
const
{
setNodeId
,
nodeId
,
setNode
,
readOnly
=
false
}
=
props
const
[
treeBox
,
setTreeBox
]
=
useState
([])
const
[
dataList
,
setDataList
]
=
useState
([])
...
...
@@ -35,10 +35,10 @@ const LeftTree = (props)=>{
}
//展开树
const
selectNode
=
(
selectedKeys
,
e
)
=>
{
//
console.log('selectedKeys',selectedKeys)
//
console.log('e',e)
console
.
log
(
'selectedKeys'
,
selectedKeys
)
console
.
log
(
'e'
,
e
)
if
(
e
.
selectedNodes
[
0
]){
setNodeId
(
selectedKeys
[
0
])
setNodeId
&&
setNodeId
(
selectedKeys
[
0
])
getNodeDetail
(
selectedKeys
[
0
])
setNodeBox
({...
nodeBox
,
selectKey
:
selectedKeys
,
dataBox
:
e
.
selectedNodes
[
0
].
dataRef
})
}
else
{
...
...
@@ -54,7 +54,7 @@ const LeftTree = (props)=>{
payload
:
{
dirId
:
nodeId
},
callback
:
dataBox
=>
{
setDetailBox
(
dataBox
)
setNode
(
dataBox
)
setNode
&&
setNode
(
dataBox
)
},
error
:
()
=>
{
}
...
...
@@ -307,7 +307,7 @@ const LeftTree = (props)=>{
<
Card
className=
{
"asset-tree"
}
title=
{
<
Space
>
title=
{
readOnly
?
null
:
<
Space
>
<
Tooltip
title=
"新增目录"
>
<
Button
shape=
"circle"
...
...
src/view/Manage/AssetRecycle/AssetMount.jsx
0 → 100644
View file @
92905c60
import
React
from
"react"
;
import
{
Modal
}
from
"antd"
;
import
LeftTree
from
'../AssetManage/components/LeftTree'
;
const
AssetMount
=
(
props
)
=>
{
const
{
onCancel
,
visible
,
item
}
=
props
return
(
<
Modal
title=
'挂载详情'
visible=
{
visible
}
width=
{
800
}
onCancel=
{
()
=>
{
onCancel
&&
onCancel
()}
}
>
<
LeftTree
readOnly=
{
true
}
/>
</
Modal
>
)
}
export
default
AssetMount
;
\ No newline at end of file
src/view/Manage/AssetRecycle/index.jsx
View file @
92905c60
...
...
@@ -4,6 +4,7 @@ import { ReconciliationOutlined, DeleteOutlined, UndoOutlined } from '@ant-desi
import
{
dispatchLatest
}
from
'../../../model'
;
import
AssetDetail
from
'../AssetManage/components/AssetDetail'
;
import
AssetMount
from
'./AssetMount'
;
import
'./index.less'
;
...
...
@@ -15,6 +16,7 @@ const AssetRecycle = (props) => {
const
[
pagination
,
setPagination
]
=
useState
(
{
pageNum
:
1
,
pageSize
:
20
}
);
const
[
currentAsset
,
setCurrentAsset
]
=
useState
(
null
);
const
[
assetDetailVisible
,
setAssetDetailVisible
]
=
useState
(
false
);
const
[
assetMountVisible
,
setAssetMountVisible
]
=
useState
(
false
);
const
{
pageNum
,
pageSize
}
=
pagination
;
...
...
@@ -55,7 +57,7 @@ const AssetRecycle = (props) => {
<
Button
icon=
{
<
ReconciliationOutlined
/>
}
size=
'small'
onClick=
{
()
=>
{
detailItem
(
record
);
}
}
/>
</
Tooltip
>
<
Tooltip
placement=
'bottom'
title=
'挂载'
>
<
Button
icon=
{
<
UndoOutlined
/>
}
size=
'small'
onClick=
{
()
=>
{
recycle
Item
(
record
);
}
}
/>
<
Button
icon=
{
<
UndoOutlined
/>
}
size=
'small'
onClick=
{
()
=>
{
mount
Item
(
record
);
}
}
/>
</
Tooltip
>
<
Tooltip
placement=
'bottom'
title=
'删除'
>
<
Button
icon=
{
<
DeleteOutlined
/>
}
size=
'small'
onClick=
{
()
=>
{
deleteItem
(
record
);
}
}
/>
...
...
@@ -90,8 +92,9 @@ const AssetRecycle = (props) => {
setAssetDetailVisible
(
true
);
}
const
recycleItem
=
(
record
)
=>
{
const
mountItem
=
(
record
)
=>
{
setCurrentAsset
(
record
);
setAssetMountVisible
(
true
);
}
const
deleteItem
=
(
record
)
=>
{
...
...
@@ -102,6 +105,10 @@ const AssetRecycle = (props) => {
setAssetDetailVisible
(
false
);
}
const
onAssetMountCancel
=
()
=>
{
setAssetMountVisible
(
false
);
}
return
(
<
div
className=
'asset-recycle p-3'
style=
{
{
backgroundColor
:
'#fff'
}
}
>
<
Table
...
...
@@ -130,8 +137,13 @@ const AssetRecycle = (props) => {
/>
<
AssetDetail
visible=
{
assetDetailVisible
}
item
=
{
currentAsset
}
onCancel
=
{
onAssetDetailCancel
}
item=
{
currentAsset
}
onCancel=
{
onAssetDetailCancel
}
/>
<
AssetMount
visible=
{
assetMountVisible
}
item=
{
currentAsset
}
onCancel=
{
onAssetMountCancel
}
/>
</
div
>
);
...
...
src/view/Manage/Model/Component/ImportActionTable.jsx
View file @
92905c60
...
...
@@ -338,8 +338,13 @@ const ImportActionTable = (props) => {
const
newData
=
[...
data
];
const
index
=
newData
.
findIndex
((
item
)
=>
editingKey
===
item
.
iid
);
const
item
=
newData
[
index
];
newData
.
splice
(
index
,
1
,
{
...
item
,
...
allValues
});
if
(
index
===
-
1
)
{
newData
.
splice
(
0
,
0
,
{
iid
:
editingKey
,
...
allValues
});
}
else
if
(
index
!==
-
1
)
{
const
item
=
newData
[
index
];
newData
.
splice
(
index
,
1
,
{
...
item
,
...
allValues
});
}
dispatchLatest
({
type
:
'datamodel.suggest'
,
...
...
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