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
7278b225
Commit
7278b225
authored
Jan 22, 2024
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
岗位关联
parent
165b9d19
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
164 additions
and
45 deletions
+164
-45
assetmanage.js
src/model/assetmanage.js
+21
-0
dataassetmanager.js
src/service/dataassetmanager.js
+21
-2
AddAssetModel.jsx
src/view/Manage/AssetManage/Component/AddAssetModel.jsx
+2
-1
AssetAction.jsx
src/view/Manage/AssetManage/Component/AssetAction.jsx
+1
-1
post-relation.jsx
src/view/Manage/AssetManage/Component/post-relation.jsx
+77
-31
select-asset.jsx
src/view/Manage/AssetManage/Component/select-asset.jsx
+5
-0
select-data-service.jsx
...view/Manage/AssetManage/Component/select-data-service.jsx
+1
-1
select-resource.jsx
src/view/Manage/AssetManage/Component/select-resource.jsx
+36
-9
No files found.
src/model/assetmanage.js
View file @
7278b225
...
...
@@ -385,4 +385,24 @@ export function* addSubscribe(payload) {
export
function
*
startProcess
(
payload
)
{
return
yield
call
(
service
.
startProcess
,
payload
);
}
export
function
*
getRelatedAssets
(
payload
)
{
return
yield
call
(
service
.
getRelatedAssets
,
payload
);
}
export
function
*
getRelatedServices
(
payload
)
{
return
yield
call
(
service
.
getRelatedServices
,
payload
);
}
export
function
*
fillRelatedAssetsInfo
(
payload
)
{
return
yield
call
(
service
.
fillRelatedAssetsInfo
,
payload
);
}
export
function
*
getDraftRelatedAssets
(
payload
)
{
return
yield
call
(
service
.
getDraftRelatedAssets
,
payload
);
}
export
function
*
getDraftRelatedServices
(
payload
)
{
return
yield
call
(
service
.
getDraftRelatedServices
,
payload
);
}
\ No newline at end of file
src/service/dataassetmanager.js
View file @
7278b225
...
...
@@ -367,4 +367,24 @@ export function addSubscribe(payload) {
export
function
startProcess
(
payload
)
{
return
PostJSON
(
"/dataassetmanager/flowApi/startProcess"
,
payload
)
}
\ No newline at end of file
}
export
function
getRelatedAssets
(
payload
)
{
return
PostJSON
(
"/dataassetmanager/postApi/getRelatedAssets"
,
payload
)
}
export
function
getRelatedServices
(
payload
)
{
return
PostJSON
(
"/dataassetmanager/postApi/getRelatedServices"
,
payload
)
}
export
function
fillRelatedAssetsInfo
(
payload
)
{
return
PostJSON
(
"/dataassetmanager/postApi/fillRelatedAssetsInfo"
,
payload
)
}
export
function
getDraftRelatedAssets
(
payload
)
{
return
PostJSON
(
"/dataassetmanager/postDraftApi/getRelatedAssets"
,
payload
)
}
export
function
getDraftRelatedServices
(
payload
)
{
return
PostJSON
(
"/dataassetmanager/postDraftApi/getRelatedServices"
,
payload
)
}
src/view/Manage/AssetManage/Component/AddAssetModel.jsx
View file @
7278b225
...
...
@@ -44,10 +44,11 @@ const AddAssetModel = (props) => {
showMessage
(
'warn'
,
'已存在相同的资产目录编号,请重新输入'
);
}
else
{
dispatch
({
type
:
'assetmanage.
addOrUpdateDataAsse
t'
,
type
:
'assetmanage.
saveAsDraf
t'
,
payload
:
{
params
:
{
dirId
:
nodeId
,
operation
:
'change'
,
},
data
:
{
elements
:
newElements
}
},
...
...
src/view/Manage/AssetManage/Component/AssetAction.jsx
View file @
7278b225
...
...
@@ -1359,7 +1359,7 @@ const AssetAction = (props) => {
{
action!=='add' && <React.Fragment>
{
isPostAsset(assets?.templateType) ? <div className='mt-2'><PostRelation /></div> : <React.Fragment>
isPostAsset(assets?.templateType) ? <div className='mt-2'><PostRelation
reference={reference} action={currentAction} item={assets}
/></div> : <React.Fragment>
<div>
<Divider orientation='left'>字段级资产目录信息</Divider>
</div>
...
...
src/view/Manage/AssetManage/Component/post-relation.jsx
View file @
7278b225
...
...
@@ -4,17 +4,21 @@ import { Tabs, Space, Button, Input, Pagination, Tooltip, Modal } from 'antd'
import
{
paginate
}
from
'../../../../util'
import
Table
from
'../../ResizeableTable'
import
SelectResource
from
'./select-resource'
import
{
dispatch
}
from
'../../../../model'
;
import
{
AssetDraftReference
}
from
'../../../../util/constant'
const
FC
=
(
props
)
=>
{
const
{
item
,
}
=
props
const
{
item
,
reference
,
action
}
=
props
const
[
activeKey
,
setActiveKey
]
=
React
.
useState
(
'asset'
)
const
[
keyword
,
setKeyword
]
=
React
.
useState
()
const
[
pagination
,
setPagination
]
=
React
.
useState
({
pageNum
:
1
,
pageSize
:
20
,
})
const
[
loading
,
setLoading
]
=
React
.
useState
(
false
)
const
[
data
,
setData
]
=
React
.
useState
()
const
[
loadingAssets
,
setLoadingAssets
]
=
React
.
useState
(
false
)
const
[
assets
,
setAssets
]
=
React
.
useState
()
const
[
loadingServices
,
setLoadingServices
]
=
React
.
useState
(
false
)
const
[
services
,
setServices
]
=
React
.
useState
()
const
[
selectedRows
,
setSelectedRows
]
=
React
.
useState
()
const
[
selectResourceParams
,
setSelectResourceParams
]
=
React
.
useState
({
visible
:
false
,
...
...
@@ -25,17 +29,18 @@ const FC = (props) => {
const
[
modal
,
contextHolder
]
=
Modal
.
useModal
()
React
.
useEffect
(()
=>
{
getRelations
()
getRelatedAssets
()
getRelatedServices
()
},
[])
const
[
tableData
,
total
]
=
React
.
useMemo
(()
=>
{
let
newTableData
=
[...
data
??[]]
let
newTableData
=
(
activeKey
===
'asset'
)?[...
assets
??[]]:[...
services
??[]]
if
(
keyword
)
{
newTableData
=
(
newTableData
??[]).
filter
(
item
=>
(
item
.
name
??
''
).
indexOf
(
keyword
)
!==
-
1
)
}
return
[
paginate
(
newTableData
,
pagination
.
pageNum
,
pagination
.
pageSize
),
(
newTableData
??[]).
length
]
},
[
data
,
keyword
,
pagination
])
},
[
activeKey
,
assets
,
services
,
keyword
,
pagination
])
const
cols
=
[
{
...
...
@@ -58,15 +63,42 @@ const FC = (props) => {
},
]
const
getRelations
=
()
=>
{
setLoading
(
true
)
setTimeout
(()
=>
{
setLoading
(
false
)
setData
(
Array
.
from
({
length
:
90
},
(
_
,
key
)
=>
({
id
:
`
${
key
}
`
,
name
:
`test
${
key
}
`
})))
},
3000
)
const
getRelatedAssets
=
()
=>
{
setLoadingAssets
(
true
)
dispatch
({
type
:
(
reference
===
AssetDraftReference
)?
'assetmanage.getDraftRelatedAssets'
:
'assetmanage.getRelatedAssets'
,
payload
:
{
params
:
{
dataAssetId
:
item
?.
id
}
},
callback
:
(
data
)
=>
{
setLoadingAssets
(
false
)
setAssets
(
data
)
},
error
:
()
=>
{
setLoadingAssets
(
false
)
}
})
}
const
getRelatedServices
=
()
=>
{
setLoadingServices
(
true
)
dispatch
({
type
:
(
reference
===
AssetDraftReference
)?
'assetmanage.getDraftRelatedServices'
:
'assetmanage.getRelatedServices'
,
payload
:
{
params
:
{
dataAssetId
:
item
?.
id
}
},
callback
:
(
data
)
=>
{
setLoadingServices
(
false
)
setServices
(
data
)
},
error
:
()
=>
{
setLoadingServices
(
false
)
}
})
}
const
onEditClick
=
()
=>
{
...
...
@@ -89,6 +121,26 @@ const FC = (props) => {
})
}
const
onSelectResourceCancel
=
(
data
)
=>
{
setSelectResourceParams
({
visible
:
false
,
item
:
undefined
,
type
:
undefined
})
if
(
data
)
{
if
(
activeKey
===
'asset'
)
{
setAssets
(
prevAssets
=>
{
return
[...
prevAssets
??[],
...
data
]
})
}
else
if
(
activeKey
===
'service'
)
{
setServices
(
prevServices
=>
{
return
[...
prevServices
??[],
...
data
]
})
}
}
}
return
(
<
div
>
<
Tabs
activeKey=
{
activeKey
}
onChange=
{
(
val
)
=>
{
setActiveKey
(
val
)
}
}
>
...
...
@@ -96,12 +148,14 @@ const FC = (props) => {
<
Tabs
.
TabPane
tab=
'关联服务'
key=
'service'
/>
</
Tabs
>
<
div
style=
{
{
display
:
'flex'
,
justifyContent
:
'space-between'
}
}
>
<
Space
>
<
Button
onClick=
{
onEditClick
}
>
编辑
</
Button
>
<
Tooltip
title=
{
(
selectedRows
??[]).
length
===
0
?(
activeKey
===
'asset'
?
'请先选择资产'
:
'请先选择服务'
):
''
}
>
<
Button
disabled=
{
(
selectedRows
??[]).
length
===
0
}
onClick=
{
onDeleteClick
}
>
删除
</
Button
>
</
Tooltip
>
</
Space
>
{
action
===
'edit'
&&
<
Space
>
<
Button
onClick=
{
onEditClick
}
>
编辑
</
Button
>
<
Tooltip
title=
{
(
selectedRows
??[]).
length
===
0
?(
activeKey
===
'asset'
?
'请先选择资产'
:
'请先选择服务'
):
''
}
>
<
Button
disabled=
{
(
selectedRows
??[]).
length
===
0
}
onClick=
{
onDeleteClick
}
>
删除
</
Button
>
</
Tooltip
>
</
Space
>
}
<
Input
size=
"middle"
placeholder=
{
activeKey
===
'service'
?
'搜索服务名称'
:
''
}
value=
{
keyword
}
...
...
@@ -115,7 +169,7 @@ const FC = (props) => {
<
div
className=
'mt-3'
>
<
Table
rowKey=
'id'
loading=
{
loading
}
loading=
{
loading
Assets
||
loadingServices
}
columns=
{
cols
}
dataSource=
{
tableData
??[]
}
pagination=
{
false
}
...
...
@@ -143,15 +197,7 @@ const FC = (props) => {
</
div
>
<
SelectResource
{
...
selectResourceParams
}
onCancel=
{
(
refresh
)
=>
{
setSelectResourceParams
({
visible
:
false
,
item
:
undefined
,
type
:
undefined
})
refresh
&&
getRelations
()
}
}
onCancel=
{
onSelectResourceCancel
}
/>
{
contextHolder
}
</
div
>
...
...
src/view/Manage/AssetManage/Component/select-asset.jsx
View file @
7278b225
...
...
@@ -14,6 +14,7 @@ import './select-asset.less'
// const specialCol = ['数据关键用户', '业务数据owner', 'it责任人', '创建人', '更新人']
const
FC
=
(
props
)
=>
{
const
{
onChange
}
=
props
const
[
args
,
setArgs
]
=
React
.
useState
(()
=>
({
page
:
1
,
size
:
20
,
...
...
@@ -59,6 +60,10 @@ const FC = (props) => {
}
},
[
currentTemplate
,
node
])
React
.
useEffect
(()
=>
{
onChange
?.(
selectedRows
)
},
[
selectedRows
])
useDebounceEffect
(()
=>
{
if
(
currentTemplate
)
{
getAssets
()
...
...
src/view/Manage/AssetManage/Component/select-data-service.jsx
View file @
7278b225
...
...
@@ -63,7 +63,7 @@ const FC = (props) => {
},
[
rootNode
,
args
],
{
wait
:
300
})
React
.
useEffect
(()
=>
{
onChange
?.(
(
selectedRows
??[]).
map
(
item
=>
item
.
id
)
)
onChange
?.(
selectedRows
)
},
[
selectedRows
])
const
treeData1
=
React
.
useMemo
(()
=>
{
...
...
src/view/Manage/AssetManage/Component/select-resource.jsx
View file @
7278b225
...
...
@@ -3,6 +3,7 @@ import { Modal, Button, Spin, message, } from 'antd'
import
SelectAsset
from
'./select-asset'
import
SelectDataService
from
'./select-data-service'
import
{
dispatch
}
from
'../../../../model'
;
const
FC
=
({
visible
,
item
,
type
,
onCancel
})
=>
{
const
[
animated
,
setAnimated
]
=
React
.
useState
(
true
)
...
...
@@ -17,20 +18,46 @@ const FC = ({ visible, item, type, onCancel }) => {
}
},
[
visible
])
const
close
=
(
refresh
=
false
)
=>
{
const
close
=
(
data
=
null
)
=>
{
setWaiting
(
false
)
setAnimated
(
true
)
onCancel
?.(
refresh
)
onCancel
?.(
data
)
}
const
save
=
async
()
=>
{
const
selectedRow
Keys
=
basicRef
.
current
?.
selectedRowKey
s
if
((
selectedRow
Key
s
??[]).
length
===
0
)
{
const
selectedRow
s
=
basicRef
.
current
?.
selectedRow
s
if
((
selectedRows
??[]).
length
===
0
)
{
message
.
warn
(
type
===
'asset'
?
'请先选择资产'
:
'请先选择服务'
)
return
}
setWaiting
(
true
)
if
(
type
===
'asset'
)
{
setWaiting
(
true
)
dispatch
({
type
:
'assetmanage.fillRelatedAssetsInfo'
,
payload
:
{
params
:
{
dataAssetIds
:
(
selectedRows
??[]).
map
(
item
=>
item
.
id
).
toString
()
}
},
callback
:
(
data
)
=>
{
setWaiting
(
false
)
close
(
data
)
},
error
:
()
=>
{
setWaiting
(
false
)
}
})
}
else
{
close
((
selectedRows
??[]).
map
(
item
=>
({
cnName
:
item
.
basicInfo
?.
cnName
,
name
:
item
.
basicInfo
?.
name
,
path
:
item
.
path
,
relatedServiceCode
:
item
.
basicInfo
?.
code
,
relatedServiceId
:
item
.
id
,
remark
:
item
.
remark
,
})))
}
}
const
footer
=
React
.
useMemo
(()
=>
{
...
...
@@ -67,14 +94,14 @@ const FC = ({ visible, item, type, onCancel }) => {
export
default
FC
const
Basic
=
React
.
forwardRef
(
function
({
type
},
ref
)
{
const
[
selectedRow
Keys
,
setSelectedRowKey
s
]
=
React
.
useState
()
const
[
selectedRow
s
,
setSelectedRow
s
]
=
React
.
useState
()
React
.
useImperativeHandle
(
ref
,
()
=>
({
selectedRow
Key
s
}),
[
selectedRow
Key
s
])
selectedRows
}),
[
selectedRows
])
const
onChange
=
(
val
)
=>
{
setSelectedRow
Key
s
(
val
)
setSelectedRows
(
val
)
}
return
(
...
...
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