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
9b40465f
Commit
9b40465f
authored
Apr 12, 2024
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
关联资产
parent
78dec2cf
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
260 additions
and
223 deletions
+260
-223
assetmanage.js
src/model/assetmanage.js
+5
-0
dataassetmanager.js
src/service/dataassetmanager.js
+9
-4
AssetAction.jsx
src/view/Manage/AssetManage/Component/AssetAction.jsx
+13
-213
asset-relation-assets.jsx
...ew/Manage/AssetManage/Component/asset-relation-assets.jsx
+230
-0
select-asset.jsx
src/view/Manage/AssetManage/Component/select-asset.jsx
+1
-2
select-resource.jsx
src/view/Manage/AssetManage/Component/select-resource.jsx
+2
-4
No files found.
src/model/assetmanage.js
View file @
9b40465f
...
...
@@ -413,3 +413,7 @@ export function* importDraftLogs(payload) {
export
function
*
draftAssetImport
(
payload
)
{
return
yield
call
(
service
.
draftAssetImport
,
payload
);
}
export
function
*
fillRelationDisplayInfo
(
payload
)
{
return
yield
call
(
service
.
fillRelationDisplayInfo
,
payload
);
}
\ No newline at end of file
src/service/dataassetmanager.js
View file @
9b40465f
...
...
@@ -393,10 +393,6 @@ export function startProcess(payload) {
return
PostJSON
(
"/dataassetmanagertest/flowApi/startProcess"
,
payload
)
}
export
function
getRelatedAssets
(
payload
)
{
return
PostJSON
(
"/dataassetmanagertest/postApi/getRelatedAssets"
,
payload
)
}
export
function
getRelatedServices
(
payload
)
{
return
PostJSON
(
"/dataassetmanagertest/postApi/getRelatedServices"
,
payload
)
}
...
...
@@ -420,3 +416,11 @@ export function importDraftLogs(payload) {
export
function
draftAssetImport
(
payload
)
{
return
PostFile
(
"/dataassetmanagertest/draftApi/batchUpdateByImport"
,
payload
);
}
export
function
getRelatedAssets
(
payload
)
{
return
GetJSON
(
"/dataassetmanagertest/dataAssetRelatedApi/listRelations"
,
payload
)
}
export
function
fillRelationDisplayInfo
(
payload
)
{
return
GetJSON
(
"/dataassetmanagertest/dataAssetRelatedApi/fillRelationDisplayInfo"
,
payload
)
}
\ No newline at end of file
src/view/Manage/AssetManage/Component/AssetAction.jsx
View file @
9b40465f
...
...
@@ -24,7 +24,7 @@ import { checkDataAssetEditable } from '../../../../service/dataassetmanager';
import
download
from
'../../../../util/download'
;
import
SelectStandard
from
'./SelectStandard'
;
import
AttributeMaintain
from
'./AttributeMaintain'
;
import
PostRelation
from
'./post-relation
'
;
import
RelationAssets
from
'./asset-relation-assets
'
;
import
'./AssetAction.less'
;
...
...
@@ -79,7 +79,7 @@ const AssetAction = (props) => {
const
app
=
useContext
(
AppContext
);
const
uploadRef
=
useRef
(
undefined
);
const
postRealtion
Ref
=
useRef
();
const
relationAssets
Ref
=
useRef
();
const
actionCol
=
{
title
:
'操作'
,
...
...
@@ -877,10 +877,6 @@ const AssetAction = (props) => {
if (reference === AssetDraftReference) {
let data = action==='add' ? { elements: newElements } : { ...assets, elements: newElements }
if (isPostAsset(assets?.templateType)) {
data = {...data, ...postRealtionRef.current?.relations}
}
dispatch({
type: 'assetmanage.updateDraft',
payload: {
...
...
@@ -919,9 +915,7 @@ const AssetAction = (props) => {
let data = action==='add' ? { elements: newElements } : { ...assets, elements: newElements }
if (isPostAsset(assets?.templateType)) {
data = {...data, ...postRealtionRef.current?.relations}
}
data = {...data, businessRelations: relationAssetsRef.current?.assets}
dispatch({
type: needSaveAsDraft?'assetmanage.saveAsDraft':'assetmanage.addOrUpdateDataAsset',
...
...
@@ -989,94 +983,6 @@ const AssetAction = (props) => {
// };
const elementEditComponent = (element) => {
if (element.name==='资产项') return <MetadataInfo />;
if (element.name === '数据源系统') {
return (
<Select
allowClear
loading={loadingSystems}
disabled={element.manualMaintain==='否'}
>
{
systems?.map((system, index) => {
return <Select.Option key={index} value={system.scopeName}>
{system.scopeName}
</Select.Option>
})
}
</Select>
)
}
if (element.enName==='dataKeyUser' || element.enName==='businessDepartmentOwner' || element.enName==='itResponsiblePerson') {
return <SelectUser
type='edit'
loading={loadingUsers}
users={users}
disabled={element.manualMaintain==='否'}
/>
}
if (element.enName==='businessResponsibleDepartment' || element.enName==='itResponsibleDepartment') {
return <SelectFilter
loading={loadingDepartments}
data={departments}
disabled={element.manualMaintain==='否'}
/>
}
if (element.name === '主题域分组') {
return (
<Select
allowClear
disabled={element.manualMaintain==='否'}
>
{
treeData?.map((item, index) => {
return <Select.Option key={index} value={item.text}>
{item.text}
</Select.Option>
})
}
</Select>
)
}
if (element.name === '主题域') {
return (
<Select
allowClear
disabled={element.manualMaintain==='否'}
>
{
domains?.map((item, index) => {
return <Select.Option key={index} value={item.text}>
{item.text}
</Select.Option>
})
}
</Select>
)
}
if (element.name === '业务对象') {
return (
<Select
allowClear
disabled={element.manualMaintain==='否'}
>
{
businessData?.map((item, index) => {
return <Select.Option key={index} value={item.text}>
{item.text}
</Select.Option>
})
}
</Select>
)
}
if (element.selectMode==='单选') {
return (
<Select
...
...
@@ -1100,24 +1006,6 @@ const AssetAction = (props) => {
}
const elementDetailComponent = (item, publishedItem) => {
if (item.name === '资产项') {
return <MetadataInfo config={false} value={item.value||''} terms={terms} />;
}
if (item.name === '指标标准编码') {
return <IndexCode value={item.value||''} terms={terms} publishedValue={publishedItem?.value} />;
}
if (item.enName==='dataKeyUser' || item.enName==='businessDepartmentOwner' || item.enName==='itResponsiblePerson' || item.enName==='creator' || item.enName==='updater') {
return <SelectUser
type='detail'
users={users}
terms={terms}
value={item.value||''}
publishedValue={publishedItem?.value}
/>
}
return <span>
<Typography.Text>{highlightSearchContentByTerms(item.value||'', terms)}</Typography.Text>
{
...
...
@@ -1166,98 +1054,8 @@ const AssetAction = (props) => {
}
}
// const onSubsrcibeClick = () => {
// modal.confirm({
// title: '提示',
// content: '是否确认收藏该资产目录?',
// onOk: () => {
// dispatch({
// type: 'assetmanage.addSubscribe',
// payload: {
// params: {
// appType: 'dataAssetManager',
// subType: assets?.templateType,
// resourceIds: id,
// env: app?.env?.domainId||catalog||LocalStorage.get('assetsEnv'),
// }
// },
// callback: () => {
// showMessage("success","收藏成功");
// },
// error: () => {
// }
// })
// }
// })
// }
const onValuesChange = (changedValues, allValues) => {
if (changedValues.hasOwnProperty('主题域分组')) {
setCurrentDomainGroup(changedValues['主题域分组']);
form.setFieldsValue({'主题域': '', '业务对象': ''});
} else if (changedValues.hasOwnProperty('主题域')) {
setCurrentBussinessDomain(changedValues['主题域']);
form.setFieldsValue({'业务对象': ''});
}
for (const name in changedValues) {
const index = (elements??[]).findIndex(item => item.name === name)
if (index!==-1) {
if (elements[index].enName === 'dataKeyUser') {
const index1 = (users||[]).findIndex(item => item.pernr === changedValues[name]);
if (index1 !== -1) {
const index2 = (elements??[]).findIndex(item => item.enName === 'dataKeyUserName')
let newFieldsValue = {}
if (index2 !== -1) {
newFieldsValue[elements[index2].name] = users[index1].nachn
}
const index3 = (elements??[]).findIndex(item => item.enName === 'dataKeyUserDepartment')
if (index3 !== -1) {
newFieldsValue[elements[index3].name] = users[index1].org3TXT
}
form.setFieldsValue(newFieldsValue)
}
}
if (elements[index].enName === 'businessDepartmentOwner') {
const index1 = (users||[]).findIndex(item => item.pernr === changedValues[name]);
if (index1 !== -1) {
const index2 = (elements??[]).findIndex(item => item.enName === 'businessDepartmentOwnerName')
let newFieldsValue = {}
if (index2 !== -1) {
newFieldsValue[elements[index2].name] = users[index1].nachn
}
const index3 = (elements??[]).findIndex(item => item.enName === 'businessResponsibleDepartment')
if (index3 !== -1) {
newFieldsValue[elements[index3].name] = users[index1].org3TXT
}
form.setFieldsValue(newFieldsValue)
}
}
if (elements[index].enName === 'itResponsiblePerson') {
const index1 = (users||[]).findIndex(item => item.pernr === changedValues[name]);
if (index1 !== -1) {
const index2 = (elements??[]).findIndex(item => item.enName === 'itResponsiblePersonName')
let newFieldsValue = {}
if (index2 !== -1) {
newFieldsValue[elements[index2].name] = users[index1].nachn
}
const index3 = (elements??[]).findIndex(item => item.enName === 'itResponsibleDepartment')
if (index3 !== -1) {
newFieldsValue[elements[index3].name] = users[index1].org3TXT
}
form.setFieldsValue(newFieldsValue)
}
}
}
}
}
return (
...
...
@@ -1436,10 +1234,6 @@ const AssetAction = (props) => {
</Spin>
{
action!=='add' ? <React.Fragment>
{
isPostAsset(assets?.templateType) ? <div className='mt-2'><PostRelation ref={postRealtionRef} reference={reference} action={currentAction} item={assets} onChange={onPostRelationsChange} /></div> : <React.Fragment>
<div>
<Divider orientation='left'>字段级资产目录信息</Divider>
</div>
...
...
@@ -1533,10 +1327,16 @@ const AssetAction = (props) => {
},
}}
/>
</React.Fragment>
}
</React.Fragment> : <div className='mt-2'><PostRelation ref={postRealtionRef} reference={reference} action={currentAction} item={assets} onChange={onPostRelationsChange} /></div>
}
<div>
<Divider orientation='left'>关联资产</Divider>
<RelationAssets
ref={relationAssetsRef}
reference={reference}
action={currentAction}
item={assets}
/>
</div>
<SelectStandard
visible={selectStandardParam.visible}
...
...
src/view/Manage/AssetManage/Component/asset-relation-assets.jsx
0 → 100644
View file @
9b40465f
import
React
from
'react'
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'
import
AssetDetailDrawer
from
"./AssetDetailDrawer"
;
import
{
AppContext
}
from
'../../../../App'
const
FC
=
React
.
forwardRef
(
function
({
item
,
reference
,
action
,
onChange
},
ref
)
{
const
[
keyword
,
setKeyword
]
=
React
.
useState
()
const
[
pagination
,
setPagination
]
=
React
.
useState
({
pageNum
:
1
,
pageSize
:
20
,
})
const
[
loadingAssets
,
setLoadingAssets
]
=
React
.
useState
(
false
)
const
[
assets
,
setAssets
]
=
React
.
useState
()
const
[
selectedRows
,
setSelectedRows
]
=
React
.
useState
()
const
[
selectResourceParams
,
setSelectResourceParams
]
=
React
.
useState
({
visible
:
false
,
item
:
undefined
,
type
:
undefined
,
})
const
[
detailParams
,
setDetailParams
]
=
React
.
useState
({
visible
:
false
,
id
:
undefined
,
dirId
:
undefined
,
})
const
app
=
React
.
useContext
(
AppContext
)
const
[
modal
,
contextHolder
]
=
Modal
.
useModal
()
React
.
useImperativeHandle
(
ref
,
()
=>
({
assets
}),
[
assets
])
React
.
useEffect
(()
=>
{
onChange
?.(
assets
)
},
[
assets
])
React
.
useEffect
(()
=>
{
if
(
item
?.
id
)
{
getRelatedAssets
()
}
},
[
item
])
const
[
tableData
,
total
]
=
React
.
useMemo
(()
=>
{
let
newTableData
=
[...
assets
??[]]
if
(
keyword
)
{
newTableData
=
(
newTableData
??[]).
filter
(
item
=>
(
item
.
name
??
''
).
indexOf
(
keyword
)
!==
-
1
)
}
return
[
paginate
(
newTableData
,
pagination
.
pageNum
,
pagination
.
pageSize
),
(
newTableData
??[]).
length
]
},
[
assets
,
keyword
,
pagination
])
const
assetCols
=
[
{
title
:
'序号'
,
dataIndex
:
'index'
,
width
:
60
,
render
:(
_
,
__
,
index
)
=>
((
pagination
.
pageNum
-
1
)
*
pagination
.
pageSize
+
index
+
1
)
},
{
title
:
'路径'
,
dataIndex
:
'relatedDataAssetPath'
,
},
{
title
:
'资产编码'
,
dataIndex
:
'relatedDataAssetCode'
,
},
{
title
:
'名称'
,
dataIndex
:
'relatedDataAssetEnName'
,
},
{
title
:
'操作'
,
dataIndex
:
'action'
,
width
:
80
,
render
:
(
_
,
record
)
=>
{
return
(
<
Space
>
<
a
onClick=
{
(
e
)
=>
{
e
.
stopPropagation
();
setDetailParams
({
visible
:
true
,
id
:
record
?.
relatedDataAssetId
,
})
}
}
>
详情
</
a
>
</
Space
>
)
}
}
]
const
getRelatedAssets
=
()
=>
{
setLoadingAssets
(
true
)
let
url
=
(
reference
===
AssetDraftReference
)?
'assetmanage.getDraftRelatedAssets'
:
'assetmanage.getRelatedAssets'
let
params
=
(
reference
===
AssetDraftReference
)?{
draftId
:
item
?.
id
}:{
dataAssetId
:
item
?.
id
}
dispatch
({
type
:
url
,
payload
:
params
,
callback
:
(
data
)
=>
{
setLoadingAssets
(
false
)
setAssets
(
data
)
},
error
:
()
=>
{
setLoadingAssets
(
false
)
}
})
}
const
onEditClick
=
()
=>
{
setSelectResourceParams
({
visible
:
true
,
item
,
type
:
'asset'
,
})
}
const
onDeleteClick
=
()
=>
{
setAssets
(
prevAssets
=>
{
const
filterData
=
(
prevAssets
??[]).
filter
(
item
=>
(
selectedRows
??[]).
map
(
_item
=>
_item
.
relatedAssetId
).
indexOf
(
item
.
relatedAssetId
)
===-
1
)
return
filterData
})
setSelectedRows
(
prevSelectedRows
=>
{
return
[]
})
}
const
onSelectResourceCancel
=
(
data
)
=>
{
setSelectResourceParams
({
visible
:
false
,
item
:
undefined
,
type
:
undefined
})
if
(
data
)
{
setAssets
(
prevAssets
=>
{
const
filterData
=
(
data
??[]).
filter
(
item
=>
(
prevAssets
??[]).
map
(
_item
=>
_item
.
relatedDataAssetId
).
indexOf
(
item
.
relatedDataAssetId
)
===-
1
)
return
[...
prevAssets
??[],
...
filterData
]
})
}
}
return
(
<
div
>
<
div
style=
{
{
display
:
'flex'
,
justifyContent
:
'space-between'
}
}
>
{
action
!==
'detail'
?
<
Space
>
<
Button
onClick=
{
onEditClick
}
>
编辑
</
Button
>
<
Tooltip
title=
{
(
selectedRows
??[]).
length
===
0
?
'请先选择资产'
:
''
}
>
<
Button
disabled=
{
(
selectedRows
??[]).
length
===
0
}
onClick=
{
onDeleteClick
}
>
删除
</
Button
>
</
Tooltip
>
</
Space
>
:
<
div
/>
}
<
Input
size=
"middle"
placeholder=
'搜索资产名称'
value=
{
keyword
}
bordered=
{
true
}
allowClear
style=
{
{
width
:
200
}
}
onChange=
{
(
e
)
=>
{
setPagination
({...
pagination
,
pageNum
:
1
})
setKeyword
(
e
.
target
.
value
)
}
}
/>
</
div
>
<
div
className=
'mt-3'
>
<
Table
extraColWidth=
{
32
}
rowKey=
'relatedDataAssetId'
loading=
{
loadingAssets
}
columns=
{
assetCols
}
dataSource=
{
tableData
??[]
}
pagination=
{
false
}
rowSelection=
{
{
selectedRowKeys
:
(
selectedRows
??[]).
map
(
item
=>
item
.
relatedDataAssetId
),
onChange
:
(
selectedRowKeys
,
selectedRows
)
=>
{
setSelectedRows
(
selectedRows
)
},
}
}
/>
{
(
total
!==
0
)
&&
<
Pagination
className=
"text-center my-3"
showSizeChanger
onChange=
{
(
page
,
size
)
=>
{
setPagination
({
pageNum
:
page
,
pageSize
:
size
})
}
}
current=
{
pagination
.
pageNum
}
pageSize=
{
pagination
.
pageSize
}
defaultCurrent=
{
1
}
total=
{
total
}
showTotal=
{
()
=>
`共${total??0}项`
}
/>
}
</
div
>
<
SelectResource
{
...
selectResourceParams
}
onCancel=
{
onSelectResourceCancel
}
/>
<
AssetDetailDrawer
{
...
detailParams
}
readonly=
{
true
}
onCancel=
{
()
=>
{
setDetailParams
({
visible
:
false
,
id
:
undefined
,
dirId
:
undefined
,
})
}
}
/>
{
contextHolder
}
</
div
>
)
})
export
default
FC
\ No newline at end of file
src/view/Manage/AssetManage/Component/select-asset.jsx
View file @
9b40465f
...
...
@@ -238,7 +238,7 @@ const FC = (props) => {
type
:
'assetmanage.listFilterElementsGroupByType'
,
payload
:
{
templateType
:
currentTemplate
?.
type
,
isAdmin
:
fals
e
isAdmin
:
tru
e
},
callback
:
data
=>
{
setLoadingElements
(
false
)
...
...
@@ -261,7 +261,6 @@ const FC = (props) => {
keyword
:
args
.
keyword
??
''
,
recursive
:
true
,
templateType
:
currentTemplate
?.
type
,
checkPermission
:
true
,
},
callback
:
data
=>
{
setLoading
(
false
)
...
...
src/view/Manage/AssetManage/Component/select-resource.jsx
View file @
9b40465f
...
...
@@ -34,11 +34,9 @@ const FC = ({ visible, item, type, onCancel }) => {
if
(
type
===
'asset'
)
{
setWaiting
(
true
)
dispatch
({
type
:
'assetmanage.fillRelat
edAssets
Info'
,
type
:
'assetmanage.fillRelat
ionDisplay
Info'
,
payload
:
{
params
:
{
dataAssetIds
:
(
selectedRows
??[]).
map
(
item
=>
item
.
id
).
toString
()
}
relatedDataAssetIds
:
(
selectedRows
??[]).
map
(
item
=>
item
.
id
).
toString
()
},
callback
:
(
data
)
=>
{
setWaiting
(
false
)
...
...
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