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
265bf08d
Commit
265bf08d
authored
Jan 16, 2024
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
岗位新增资产
parent
8e4946ef
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
182 additions
and
175 deletions
+182
-175
AddAssetModel.jsx
src/view/Manage/AssetManage/Component/AddAssetModel.jsx
+29
-39
AddAssetModel.less
src/view/Manage/AssetManage/Component/AddAssetModel.less
+0
-7
AssetAction.jsx
src/view/Manage/AssetManage/Component/AssetAction.jsx
+151
-125
AssetTable.jsx
src/view/Manage/AssetManage/Component/AssetTable.jsx
+2
-4
No files found.
src/view/Manage/AssetManage/Component/AddAssetModel.jsx
View file @
265bf08d
import
React
,
{
useState
}
from
'react'
;
import
React
,
{
useState
}
from
'react'
;
import
{
Modal
,
Form
,
Space
,
Button
}
from
'antd'
;
import
{
Modal
,
Form
,
Space
,
Button
,
Spin
}
from
'antd'
;
import
{
showMessage
}
from
'../../../../util'
;
import
{
showMessage
}
from
'../../../../util'
;
import
{
dispatch
}
from
'../../../../model'
;
import
{
dispatch
}
from
'../../../../model'
;
import
AssetAction
from
'./AssetAction'
;
import
AssetAction
from
'./AssetAction'
;
import
'./AddAssetModel.less'
;
const
AddAssetModel
=
(
props
)
=>
{
const
AddAssetModel
=
(
props
)
=>
{
const
{
onCancel
,
visible
,
nodeId
}
=
props
;
const
{
onCancel
,
visible
,
nodeId
}
=
props
;
const
[
confirmLoading
,
setConfirmLoading
]
=
useState
(
false
);
const
[
waiting
,
setWaiting
]
=
useState
(
false
);
const
[
metadataId
,
setMetadataId
]
=
useState
(
''
);
const
[
elements
,
setElements
]
=
useState
([]);
const
[
elements
,
setElements
]
=
useState
([]);
const
[
form
]
=
Form
.
useForm
();
const
[
form
]
=
Form
.
useForm
();
...
@@ -19,14 +15,15 @@ const AddAssetModel = (props) => {
...
@@ -19,14 +15,15 @@ const AddAssetModel = (props) => {
setElements
(
value
);
setElements
(
value
);
}
}
const
onMetadataChange
=
(
value
)
=>
{
const
close
=
(
refresh
=
false
)
=>
{
setMetadataId
(
value
);
setWaiting
(
false
)
form
?.
resetFields
()
onCancel
?.(
refresh
)
}
}
const
onOk
=
async
()
=>
{
const
onOk
=
async
()
=>
{
try
{
try
{
const
row
=
await
form
?.
validateFields
();
const
row
=
await
form
?.
validateFields
();
const
newElements
=
[...
elements
];
const
newElements
=
[...
elements
];
(
newElements
||
[]).
forEach
(
element
=>
{
(
newElements
||
[]).
forEach
(
element
=>
{
if
(
row
.
hasOwnProperty
(
element
.
name
))
{
if
(
row
.
hasOwnProperty
(
element
.
name
))
{
...
@@ -34,15 +31,7 @@ const AddAssetModel = (props) => {
...
@@ -34,15 +31,7 @@ const AddAssetModel = (props) => {
}
}
});
});
const
params
=
{
setWaiting
(
true
);
dirId
:
nodeId
,
}
if
((
metadataId
||
''
)
!==
''
)
{
params
.
metadataId
=
metadataId
;
}
setConfirmLoading
(
true
);
dispatch
({
dispatch
({
type
:
'assetmanage.checkCodeIsExist'
,
type
:
'assetmanage.checkCodeIsExist'
,
...
@@ -51,62 +40,63 @@ const AddAssetModel = (props) => {
...
@@ -51,62 +40,63 @@ const AddAssetModel = (props) => {
},
},
callback
:
isExist
=>
{
callback
:
isExist
=>
{
if
(
isExist
===
'true'
)
{
if
(
isExist
===
'true'
)
{
set
ConfirmLoad
ing
(
false
);
set
Wait
ing
(
false
);
showMessage
(
'warn'
,
'已存在相同的资产目录编号,请重新输入'
);
showMessage
(
'warn'
,
'已存在相同的资产目录编号,请重新输入'
);
}
else
{
}
else
{
dispatch
({
dispatch
({
type
:
'assetmanage.addOrUpdateDataAsset'
,
type
:
'assetmanage.addOrUpdateDataAsset'
,
payload
:
{
payload
:
{
params
,
params
:
{
dirId
:
nodeId
,
},
data
:
{
elements
:
newElements
}
data
:
{
elements
:
newElements
}
},
},
callback
:
()
=>
{
callback
:
()
=>
{
setConfirmLoading
(
false
);
showMessage
(
"success"
,
"新增成功"
);
showMessage
(
"success"
,
"新增成功"
);
onCancel
&&
onCancel
(
true
);
close
(
true
)
},
},
error
:
()
=>
{
error
:
()
=>
{
set
ConfirmLoad
ing
(
false
);
set
Wait
ing
(
false
);
}
}
})
})
}
}
},
},
error
:
()
=>
{
error
:
()
=>
{
set
ConfirmLoad
ing
(
false
);
set
Wait
ing
(
false
);
}
}
})
})
}
catch
(
errInfo
)
{
}
catch
(
errInfo
)
{
console
.
log
(
'Validate Failed:'
,
errInfo
);
console
.
log
(
'Validate Failed:'
,
errInfo
);
set
ConfirmLoad
ing
(
false
);
set
Wait
ing
(
false
);
}
}
}
}
return
(
return
(
<
Modal
<
Modal
forceRender
destroyOnClose
className=
'asset-add'
className=
'asset-add'
title=
'新增资产目录信息'
title=
'新增资产目录信息'
visible=
{
visible
}
visible=
{
visible
}
width=
{
600
}
centered
onCancel=
{
()
=>
{
onCancel
&&
onCancel
();
}
}
width=
{
800
}
onCancel=
{
()
=>
{
close
()
}
}
footer=
{
footer=
{
<
Space
>
<
Space
>
<
Button
onClick=
{
()
=>
onCancel
&&
onCancel
()
}
>
取消
</
Button
>
<
Button
onClick=
{
()
=>
onCancel
&&
onCancel
()
}
>
取消
</
Button
>
<
Button
type=
"primary"
onClick=
{
onOk
}
loading=
{
confirmLoad
ing
}
>
确定
</
Button
>
<
Button
type=
"primary"
onClick=
{
onOk
}
disabled=
{
wait
ing
}
>
确定
</
Button
>
</
Space
>
</
Space
>
}
}
bodyStyle=
{
{
padding
:
'10px
'
}
}
bodyStyle=
{
{
overflowX
:
'auto'
,
height
:
'80vh
'
}
}
>
>
{
<
Spin
spinning=
{
waiting
}
>
visible
&&
<
AssetAction
<
AssetAction
form=
{
form
}
form=
{
form
}
dirId=
{
nodeId
}
dirId=
{
nodeId
}
action=
'add'
action=
'add'
onMetadataChange=
{
onMetadataChange
}
onElementsChange=
{
onElementsChange
}
onElementsChange=
{
onElementsChange
}
/>
/>
</
Spin
>
}
</
Modal
>
</
Modal
>
);
);
}
}
...
...
src/view/Manage/AssetManage/Component/AddAssetModel.less
deleted
100644 → 0
View file @
8e4946ef
.asset-add {
.yy-modal-body {
max-height: 500px !important;
overflow: auto !important;
}
}
\ No newline at end of file
src/view/Manage/AssetManage/Component/AssetAction.jsx
View file @
265bf08d
...
@@ -398,7 +398,7 @@ const AssetAction = (props) => {
...
@@ -398,7 +398,7 @@ const AssetAction = (props) => {
getTreeData
();
getTreeData
();
getDepartments
();
getDepartments
();
if
(
action
===
'add'
)
{
if
(
action
===
'add'
)
{
getElements
();
}
else
{
}
else
{
setCurrentAction
(
'detail'
);
setCurrentAction
(
'detail'
);
if
(
id
)
{
if
(
id
)
{
...
@@ -545,6 +545,26 @@ const AssetAction = (props) => {
...
@@ -545,6 +545,26 @@ const AssetAction = (props) => {
})
})
}
}
const
getElements
=
()
=>
{
setLoading
(
true
);
dispatch
({
type
:
'assetmanage.listElements'
,
callback
:
(
data
)
=>
{
setLoading
(
false
);
const
_attributes
=
Array
.
from
(
new
Set
((
data
??[]).
map
(
item
=>
item
.
type
)));
setElements
(
data
);
onElementsChange
?.(
data
);
setAssetParams
({
attributes
:
_attributes
});
if
((
_attributes
??[]).
length
>
0
)
{
setCurrentAttribute
(
_attributes
[
0
])
}
},
error
:
()
=>
{
setLoading
(
false
);
}
})
}
const
getTreeData
=
()
=>
{
const
getTreeData
=
()
=>
{
dispatch
({
dispatch
({
type
:
'assetmanage.queryAllDirectoryAsTree'
,
type
:
'assetmanage.queryAllDirectoryAsTree'
,
...
@@ -1217,47 +1237,49 @@ const AssetAction = (props) => {
...
@@ -1217,47 +1237,49 @@ const AssetAction = (props) => {
))
))
}
}
</Radio.Group>
</Radio.Group>
<Space>
{
{
action!=='add' && <Space>
(!readonly && (reference===AssetManageReference||canEdit)) && <React.Fragment>
{
{
(!readonly && (reference===AssetManageReference||canEdit)) && <React.Fragment>
currentAction==='detail' ? <Button onClick={onActionButtonClick}>编辑</Button> : <React.Fragment>
{
<Button onClick={onCancelButtonClick}>取消</Button>
currentAction==='detail' ? <Button onClick={onActionButtonClick}>编辑</Button> : <React.Fragment>
<Button onClick={onActionButtonClick}>{(reference===AssetDraftReference||isAdmin)?'保存':'保存草稿'}</Button>
<Button onClick={onCancelButtonClick}>取消</Button>
</React.Fragment>
<Button onClick={onActionButtonClick}>{(reference===AssetDraftReference||isAdmin)?'保存':'保存草稿'}</Button>
}
</React.Fragment>
{
}
reference!==AssetDraftReference && <Button onClick={onAuthorizationButtonClick}>授权</Button>
{
}
reference!==AssetDraftReference && <Button onClick={onAuthorizationButtonClick}>授权</Button>
</React.Fragment>
}
}
</React.Fragment>
}
<Button onClick={shareAsset}>分享</Button>
<Button onClick={shareAsset}>分享</Button>
<Button onClick={onSubsrcibeClick}>收藏</Button>
<Button onClick={onSubsrcibeClick}>收藏</Button>
<Dropdown overlay={
<Dropdown overlay={
<Menu onClick={({ key })=>{
<Menu onClick={({ key })=>{
if (metadata?.metadataTableId) {
if (metadata?.metadataTableId) {
app?.setGlobalState?.({
app?.setGlobalState?.({
message: 'data-govern-show-metadata-relation',
message: 'data-govern-show-metadata-relation',
data: { id: metadata?.metadataTableId, type: key }
data: { id: metadata?.metadataTableId, type: key }
})
})
} else {
} else {
showMessage("warn","该资产目录没有关联元数据信息");
showMessage("warn","该资产目录没有关联元数据信息");
}
}
}}>
}}>
<Menu.Item key="lineage">血缘分析</Menu.Item>
<Menu.Item key="lineage">血缘分析</Menu.Item>
<Menu.Item key="impact">影响分析</Menu.Item>
<Menu.Item key="impact">影响分析</Menu.Item>
<Menu.Item key="lineage,impact">全链分析</Menu.Item>
<Menu.Item key="lineage,impact">全链分析</Menu.Item>
</Menu>
</Menu>
}>
}>
<Button>
<Button>
<Space>
<Space>
关系分析
关系分析
<DownOutlined />
<DownOutlined />
</Space>
</Space>
</Button>
</Button>
</Dropdown>
</Dropdown>
</Space>
</Space>
}
</div>
</div>
{
{
attributes?.map((attribute, index) => {
attributes?.map((attribute, index) => {
...
@@ -1335,95 +1357,99 @@ const AssetAction = (props) => {
...
@@ -1335,95 +1357,99 @@ const AssetAction = (props) => {
</Spin>
</Spin>
{
{
isPostAsset(assets?.templateType) ? <div className='mt-2'><PostRelation /></div> :
<React.Fragment>
action!=='add' &&
<React.Fragment>
<div>
{
<Divider orientation='left'>字段级资产目录信息</Divider
>
isPostAsset(assets?.templateType) ? <div className='mt-2'><PostRelation /></div> : <React.Fragment
>
</
div>
<
div>
<Space style={{ marginLeft: 'auto' }}
>
<Divider orientation='left'>字段级资产目录信息</Divider
>
{
</div>
(reference===AssetManageReference||(reference!==AssetDraftReference&&canEdit)) && <React.Fragment
>
<Space style={{ marginLeft: 'auto' }}
>
{
{
isMetadataEdit ? <React.Fragment>
(reference===AssetManageReference||(reference!==AssetDraftReference&&canEdit)) && <React.Fragment>
<Button onClick={() => {
{
setMetadataEdit(false)
isMetadataEdit ? <React.Fragment>
}}>
<Button onClick={() => {
取消
</Button>
<Button onClick={() => {
setLoadingMetadataColumnList(true)
dispatch({
type: 'assetmanage.batchUpdateAttributes',
payload: {
data: modifyMetadataColumnList
},
callback: () => {
setLoadingMetadataColumnList(false)
setMetadataEdit(false)
setMetadataEdit(false)
getMetadataAttributes()
}}>
},
取消
error: () => {
</Button>
setLoadingMetadataColumnList(false)
<Button onClick={() => {
setLoadingMetadataColumnList(true)
dispatch({
type: 'assetmanage.batchUpdateAttributes',
payload: {
data: modifyMetadataColumnList
},
callback: () => {
setLoadingMetadataColumnList(false)
setMetadataEdit(false)
getMetadataAttributes()
},
error: () => {
setLoadingMetadataColumnList(false)
}
})
}}>
保存
</Button>
</React.Fragment> : <Button onClick={() => {
setModifyMetadataColumnList(metadataColumnList)
setMetadataEdit(true)
}}>
编辑
</Button>
}
<Button
onClick={() => {
if (metadata?.metadataTableId) {
setAttributeMaintainParam({
visible: true,
metadataId: metadata?.metadataTableId
});
} else {
showMessage("warn","该资产目录没有关联元数据信息");
}
}
}
)
}
}
}}
>
>
保存
字段级维护
</Button>
</Button>
</React.Fragment> : <Button onClick={() => {
</React.Fragment>
setModifyMetadataColumnList(metadataColumnList)
setMetadataEdit(true)
}}>
编辑
</Button>
}
}
<Button
<Input size="middle"
onClick={() => {
placeholder={assets?.templateType==='mdg'?'搜索中英文名称/业务定义':'搜索中英文名称/业务规则'}
if (metadata?.metadataTableId) {
value={keyword}
setAttributeMaintainParam({
bordered={true} allowClear
visible: true,
style={{ width: 200 }}
metadataId: metadata?.metadataTableId
onChange={(e) => {
});
setPagination({...paginate, pageNum: 1})
} else {
setKeyword(e.target.value)
showMessage("warn","该资产目录没有关联元数据信息");
}} />
}
</Space>
}}
>
<Table
字段级维护
className='mt-3'
</Button>
loading={loadingMetadataColumnList}
</React.Fragment>
columns={cols??[]}
}
rowKey='_id'
<Input size="middle"
dataSource={tableData||[]}
placeholder={assets?.templateType==='mdg'?'搜索中英文名称/业务定义':'搜索中英文名称/业务规则'}
pagination={{
value={keyword}
position: ['bottomLeft'],
bordered={true} allowClear
size: 'small',
style={{ width: 200 }}
total: (metadataColumnList||[]).length,
onChange={(e) => {
showTotal: (total) => `
共
$
{
total
}
项
`,
setPagination({...paginate, pageNum: 1})
showSizeChanger: true,
setKeyword(e.target.value)
current: pageNum,
}} />
pageSize,
</Space>
onChange: (_pageNum, _pageSize) => {
setPagination({ pageNum: _pageNum||1, pageSize: _pageSize || 20 });
<Table
},
className='mt-3'
onShowSizeChange: (_pageNum, _pageSize) => {
loading={loadingMetadataColumnList}
setPagination({ pageNum: _pageNum||1, pageSize: _pageSize || 20 });
columns={cols??[]}
},
rowKey='_id'
}}
dataSource={tableData||[]}
/>
pagination={{
</React.Fragment>
position: ['bottomLeft'],
}
size: 'small',
total: (metadataColumnList||[]).length,
showTotal: (total) => `
共
$
{
total
}
项
`,
showSizeChanger: true,
current: pageNum,
pageSize,
onChange: (_pageNum, _pageSize) => {
setPagination({ pageNum: _pageNum||1, pageSize: _pageSize || 20 });
},
onShowSizeChange: (_pageNum, _pageSize) => {
setPagination({ pageNum: _pageNum||1, pageSize: _pageSize || 20 });
},
}}
/>
</React.Fragment>
</React.Fragment>
}
}
...
...
src/view/Manage/AssetManage/Component/AssetTable.jsx
View file @
265bf08d
...
@@ -13,7 +13,7 @@ import ImportAssetDrawer from './ImportAssetDrawer';
...
@@ -13,7 +13,7 @@ import ImportAssetDrawer from './ImportAssetDrawer';
import
AssetEdit
from
'./AddAssetModel'
;
import
AssetEdit
from
'./AddAssetModel'
;
import
AssetDetailDrawer
from
"./AssetDetailDrawer"
;
import
AssetDetailDrawer
from
"./AssetDetailDrawer"
;
import
{
dispatch
,
dispatchLatestHomepage
}
from
'../../../../model'
;
import
{
dispatch
,
dispatchLatestHomepage
}
from
'../../../../model'
;
import
{
showMessage
,
showNotifaction
,
getQueryParam
,
inputWidth
,
isSzseEnv
,
highlightSearchContentByTerms
}
from
'../../../../util'
;
import
{
showMessage
,
showNotifaction
,
getQueryParam
,
inputWidth
,
isSzseEnv
,
highlightSearchContentByTerms
,
isPostAsset
}
from
'../../../../util'
;
import
{
AnchorId
,
AnchorDirId
,
AnchorTimestamp
,
AssetBrowseReference
,
AssetManageReference
,
AssetRecycleReference
,
ResourceBrowseReference
}
from
'../../../../util/constant'
;
import
{
AnchorId
,
AnchorDirId
,
AnchorTimestamp
,
AssetBrowseReference
,
AssetManageReference
,
AssetRecycleReference
,
ResourceBrowseReference
}
from
'../../../../util/constant'
;
import
{
FullScreenSvg
,
CancelFullScreenSvg
}
from
'./AssetSvg'
;
import
{
FullScreenSvg
,
CancelFullScreenSvg
}
from
'./AssetSvg'
;
import
AssetDeleteModal
from
'./AssetDeleteModal'
;
import
AssetDeleteModal
from
'./AssetDeleteModal'
;
...
@@ -935,7 +935,6 @@ const AssetTable = (props) => {
...
@@ -935,7 +935,6 @@ const AssetTable = (props) => {
</
Menu
.
Item
>
</
Menu
.
Item
>
}
}
{
{
//自定义目录下的资产不允许新增 删除
(
nodeType
!==
'custom'
)
&&
<
Menu
.
Item
disabled=
{
(
checkedKeys
||
[]).
length
===
0
}
>
(
nodeType
!==
'custom'
)
&&
<
Menu
.
Item
disabled=
{
(
checkedKeys
||
[]).
length
===
0
}
>
<
div
className=
'text-center'
onClick=
{
deleteAssets
}
>
<
div
className=
'text-center'
onClick=
{
deleteAssets
}
>
删除
删除
...
@@ -987,8 +986,7 @@ const AssetTable = (props) => {
...
@@ -987,8 +986,7 @@ const AssetTable = (props) => {
>
>
<
Space
size=
{
15
}
>
<
Space
size=
{
15
}
>
{
{
//栏目和自定义目录 不允许新增资产
(
reference
===
AssetManageReference
&&
isPostAsset
(
getTemplateType
())
&&
nodeId
)
&&
<
Button
onClick=
{
addAsset
}
>
新增
</
Button
>
// (reference===AssetManageReference && nodeLevel!==1 && nodeType!=='custom') && <Button onClick=
{
addAsset
}
>
新增
<
/Button>
}
}
{
{
...
...
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