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
5b0d6263
Commit
5b0d6263
authored
Jun 09, 2023
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
字段级维护
parent
05964b02
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
418 additions
and
9 deletions
+418
-9
assetmanage.js
src/model/assetmanage.js
+14
-2
dataassetmanager.js
src/service/dataassetmanager.js
+9
-0
metadata.js
src/service/metadata.js
+5
-0
AssetAction.jsx
src/view/Manage/AssetManage/Component/AssetAction.jsx
+44
-6
AssetDetailDrawer.jsx
src/view/Manage/AssetManage/Component/AssetDetailDrawer.jsx
+1
-1
AttributeMaintain.jsx
src/view/Manage/AssetManage/Component/AttributeMaintain.jsx
+345
-0
No files found.
src/model/assetmanage.js
View file @
5b0d6263
...
@@ -280,6 +280,10 @@ export function* importMetadataAttributes(payload) {
...
@@ -280,6 +280,10 @@ export function* importMetadataAttributes(payload) {
return
yield
call
(
metadataService
.
importAttributes
,
payload
);
return
yield
call
(
metadataService
.
importAttributes
,
payload
);
}
}
export
function
*
getMetadataImportAssetLog
(
payload
)
{
return
yield
call
(
metadataService
.
listImportAssetLog
,
payload
);
}
export
function
*
getStandardTree
(
payload
)
{
export
function
*
getStandardTree
(
payload
)
{
return
yield
call
(
service
.
getStandardTree
,
payload
);
return
yield
call
(
service
.
getStandardTree
,
payload
);
}
}
...
@@ -298,4 +302,12 @@ export function* getMetadataStandardList(payload) {
...
@@ -298,4 +302,12 @@ export function* getMetadataStandardList(payload) {
export
function
*
deleteStandardBatchMetadata
(
payload
)
{
export
function
*
deleteStandardBatchMetadata
(
payload
)
{
return
yield
call
(
service
.
deleteStandardBatchMetadata
,
payload
);
return
yield
call
(
service
.
deleteStandardBatchMetadata
,
payload
);
}
}
\ No newline at end of file
export
function
*
importIndicator
(
payload
)
{
return
yield
call
(
service
.
importIndicator
,
payload
);
}
export
function
*
importIndicatorLog
(
payload
)
{
return
yield
call
(
service
.
importIndicatorLog
,
payload
);
}
\ No newline at end of file
src/service/dataassetmanager.js
View file @
5b0d6263
...
@@ -291,3 +291,11 @@ export function getMetadataStandardList(payload) {
...
@@ -291,3 +291,11 @@ export function getMetadataStandardList(payload) {
export
function
deleteStandardBatchMetadata
(
payload
)
{
export
function
deleteStandardBatchMetadata
(
payload
)
{
return
PostJSON
(
'/standard/indicator/delete'
,
payload
);
return
PostJSON
(
'/standard/indicator/delete'
,
payload
);
}
}
export
function
importIndicator
(
payload
)
{
return
PostFile
(
'/standard/indicator/import'
,
payload
);
}
export
function
importIndicatorLog
(
payload
)
{
return
GetJSON
(
'/standard/indicator/importLog'
,
payload
);
}
\ No newline at end of file
src/service/metadata.js
View file @
5b0d6263
...
@@ -30,4 +30,8 @@ export function exportAttributes(payload) {
...
@@ -30,4 +30,8 @@ export function exportAttributes(payload) {
export
function
importAttributes
(
payload
)
{
export
function
importAttributes
(
payload
)
{
return
PostFile
(
"/metadatarepo/rest/import/importAssetInf"
,
payload
);
return
PostFile
(
"/metadatarepo/rest/import/importAssetInf"
,
payload
);
}
export
function
listImportAssetLog
(
payload
)
{
return
GetJSON
(
'/metadatarepo/rest/import/listImportAssertLog'
,
payload
);
}
}
\ No newline at end of file
src/view/Manage/AssetManage/Component/AssetAction.jsx
View file @
5b0d6263
...
@@ -19,6 +19,8 @@ import SelectFilter from '../../Model/Component/SelectFilter';
...
@@ -19,6 +19,8 @@ import SelectFilter from '../../Model/Component/SelectFilter';
import
{
checkDataAssetEditable
}
from
'../../../../service/dataassetmanager'
;
import
{
checkDataAssetEditable
}
from
'../../../../service/dataassetmanager'
;
import
download
from
'../../../../util/download'
;
import
download
from
'../../../../util/download'
;
import
SelectStandard
from
'./SelectStandard'
;
import
SelectStandard
from
'./SelectStandard'
;
import
AttributeMaintain
from
'./AttributeMaintain'
;
import
'./AssetAction.less'
;
import
'./AssetAction.less'
;
const
AssetAction
=
(
props
)
=>
{
const
AssetAction
=
(
props
)
=>
{
...
@@ -53,6 +55,10 @@ const AssetAction = (props) => {
...
@@ -53,6 +55,10 @@ const AssetAction = (props) => {
const
[
metadataColumnList
,
setMetadataColumnList
]
=
useState
(
undefined
);
const
[
metadataColumnList
,
setMetadataColumnList
]
=
useState
(
undefined
);
const
[
selectStandardParam
,
setSelectStandardParam
]
=
useState
({
visible
:
false
,
id
:
undefined
});
const
[
selectStandardParam
,
setSelectStandardParam
]
=
useState
({
visible
:
false
,
id
:
undefined
});
const
[
standardList
,
setStandardList
]
=
useState
(
undefined
);
const
[
standardList
,
setStandardList
]
=
useState
(
undefined
);
const
[
attributeMaintainParam
,
setAttributeMaintainParam
]
=
useState
({
visible
:
false
,
metadataId
:
undefined
});
const
[
modal
,
contextHolder
]
=
Modal
.
useModal
();
const
[
modal
,
contextHolder
]
=
Modal
.
useModal
();
const
app
=
useContext
(
AppContext
);
const
app
=
useContext
(
AppContext
);
...
@@ -62,7 +68,7 @@ const AssetAction = (props) => {
...
@@ -62,7 +68,7 @@ const AssetAction = (props) => {
{
{
title
:
'技术ID(英文名称)'
,
title
:
'技术ID(英文名称)'
,
dataIndex
:
'name'
,
dataIndex
:
'name'
,
width
:
20
0
,
width
:
16
0
,
ellipsis
:
true
,
ellipsis
:
true
,
render
:
(
text
,
record
,
_
)
=>
{
render
:
(
text
,
record
,
_
)
=>
{
return
(
return
(
...
@@ -79,7 +85,7 @@ const AssetAction = (props) => {
...
@@ -79,7 +85,7 @@ const AssetAction = (props) => {
{
{
title
:
'名称'
,
title
:
'名称'
,
dataIndex
:
'cnName'
,
dataIndex
:
'cnName'
,
width
:
200
,
//
width: 200,
ellipsis
:
true
,
ellipsis
:
true
,
},
},
{
{
...
@@ -812,6 +818,18 @@ const AssetAction = (props) => {
...
@@ -812,6 +818,18 @@ const AssetAction = (props) => {
refresh && getMetadataStandardList();
refresh && getMetadataStandardList();
}
}
const onAttributeMaintainCancel = () => {
setAttributeMaintainParam({visible: false, metadataId: undefined});
}
const onAttributeMaintainChange = (catalogId) => {
if (catalogId === '1') {
getMetadataAttributes();
} else {
getMetadataStandardList();
}
}
const onValuesChange = (changedValues, allValues) => {
const onValuesChange = (changedValues, allValues) => {
if (changedValues.hasOwnProperty('主题域分组')) {
if (changedValues.hasOwnProperty('主题域分组')) {
setCurrentDomainGroup(changedValues['主题域分组']);
setCurrentDomainGroup(changedValues['主题域分组']);
...
@@ -969,15 +987,28 @@ const AssetAction = (props) => {
...
@@ -969,15 +987,28 @@ const AssetAction = (props) => {
</div>
</div>
<Space style={{ marginLeft: 'auto' }}>
<Space style={{ marginLeft: 'auto' }}>
{
(reference===AssetManageReference||canEdit) && <Button
type='primary'
onClick={() => {
setAttributeMaintainParam({
visible: true,
metadataId: metadata.metadataTableId
});
}}
>
字段级维护
</Button>
}
{/* {
{/* {
(reference===AssetManageReference||canEdit) && <Button type='primary' onClick={() => {
(reference===AssetManageReference||canEdit) && <Button type='primary' onClick={() => {
uploadRef.current?.chooseFile()
uploadRef.current?.chooseFile()
}}>导入</Button>
}}>导入</Button>
} */}
} */}
<Button type='primary' onClick={() => {
{/*
<Button type='primary' onClick={() => {
uploadRef.current?.chooseFile()
uploadRef.current?.chooseFile()
}}>导入</Button>
}}>导入</Button>
<Button type='primary' onClick={onExportClick}>导出</Button>
<Button type='primary' onClick={onExportClick}>导出</Button>
*/}
</Space>
</Space>
<Table
<Table
...
@@ -993,7 +1024,7 @@ const AssetAction = (props) => {
...
@@ -993,7 +1024,7 @@ const AssetAction = (props) => {
}}
}}
/>
/>
<Upload ref={uploadRef} accept={'.xls,.xlsx'} upload={(files) => {
{/*
<Upload ref={uploadRef} accept={'.xls,.xlsx'} upload={(files) => {
dispatch({
dispatch({
type: 'assetmanage.importMetadataAttributes',
type: 'assetmanage.importMetadataAttributes',
payload: {
payload: {
...
@@ -1009,13 +1040,20 @@ const AssetAction = (props) => {
...
@@ -1009,13 +1040,20 @@ const AssetAction = (props) => {
}
}
})
})
}} />
}} />
*/}
<SelectStandard
<SelectStandard
visible={selectStandardParam.visible}
visible={selectStandardParam.visible}
id={selectStandardParam.id}
id={selectStandardParam.id}
onCancel={onSelectStandardCancel}
onCancel={onSelectStandardCancel}
/>
/>
<AttributeMaintain
visible={attributeMaintainParam.visible}
metadataId={attributeMaintainParam.metadataId}
onCancel={onAttributeMaintainCancel}
onChange={onAttributeMaintainChange}
/>
<AppContext.Consumer>
<AppContext.Consumer>
{
{
value => {
value => {
...
...
src/view/Manage/AssetManage/Component/AssetDetailDrawer.jsx
View file @
5b0d6263
...
@@ -13,7 +13,7 @@ const AssetDetailDrawer = (props) => {
...
@@ -13,7 +13,7 @@ const AssetDetailDrawer = (props) => {
forceRender
forceRender
visible=
{
visible
}
visible=
{
visible
}
title=
'资产详情'
title=
'资产详情'
width=
'
9
0%'
width=
'
8
0%'
placement=
"right"
placement=
"right"
closable=
{
true
}
closable=
{
true
}
onClose=
{
()
=>
{
onClose=
{
()
=>
{
...
...
src/view/Manage/AssetManage/Component/AttributeMaintain.jsx
0 → 100644
View file @
5b0d6263
import
React
,
{
useState
,
useEffect
,
useContext
}
from
'react'
;
import
{
Button
,
Upload
,
Drawer
,
Table
,
Pagination
,
Divider
,
Form
,
Typography
,
Select
,
Space
,
Radio
}
from
'antd'
;
import
{
UploadOutlined
,
DownloadOutlined
}
from
'@ant-design/icons'
;
import
{
dispatch
}
from
'../../../../model'
;
import
{
showMessage
,
formatDate
}
from
'../../../../util'
;
import
{
AppContext
}
from
'../../../../App'
;
import
download
from
'../../../../util/download'
;
const
catalogs
=
[
{
title
:
'字段级资产'
,
key
:
'1'
},
{
title
:
'映射关系'
,
key
:
'2'
},
]
const
FC
=
(
props
)
=>
{
const
{
onCancel
,
onSuccess
,
visible
,
metadataId
,
onChange
}
=
props
;
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
catalogId
,
setCatalogId
]
=
useState
(
'1'
);
const
[
logs
,
setLogs
]
=
useState
([]);
const
[
pagination
,
setPagination
]
=
useState
({
pageNum
:
1
,
pageSize
:
20
});
const
{
pageNum
,
pageSize
}
=
pagination
;
const
[
total
,
setTotal
]
=
useState
(
0
);
const
[
step
,
setStep
]
=
useState
(
1
);
const
[
fileList
,
setFileList
]
=
useState
([]);
const
app
=
useContext
(
AppContext
);
const
columns
=
[
{
title
:
'序号'
,
dataIndex
:
'key'
,
render
:
(
text
,
record
,
index
)
=>
{
return
(
index
+
1
).
toString
();
},
width
:
60
,
},
{
title
:
'开始时间'
,
dataIndex
:
'startTime'
,
ellipsis
:
true
,
render
:
(
_
,
record
,
__
)
=>
{
return
formatDate
(
record
.
startTime
);
}
},
{
title
:
'结束时间'
,
dataIndex
:
'endTime'
,
ellipsis
:
true
,
render
:
(
_
,
record
,
__
)
=>
{
return
formatDate
(
record
.
endTime
);
}
},
{
title
:
'耗时'
,
dataIndex
:
'costTime'
,
ellipsis
:
true
,
render
:
(
_
,
record
,
__
)
=>
{
return
record
.
costTime
?
`
${
Number
(
record
.
costTime
/
1000
)}
秒`
:
''
;
}
},
// {
// title: '导入人',
// dataIndex: 'operator',
// width: 100,
// ellipsis: true,
// },
{
title
:
'导入状态'
,
dataIndex
:
'state'
,
ellipsis
:
true
,
}
]
useEffect
(()
=>
{
if
(
visible
)
{
getLogs
();
}
//eslint-disable-next-line react-hooks/exhaustive-deps
},
[
visible
,
pagination
,
catalogId
])
const
getLogs
=
()
=>
{
setLoading
(
true
);
if
(
catalogId
===
'1'
)
{
dispatch
({
type
:
'assetmanage.getMetadataImportAssetLog'
,
payload
:
{
catalog
:
app
?.
env
?.
domainId
,
page
:
pageNum
,
size
:
pageSize
,
},
callback
:
data
=>
{
setLoading
(
false
);
setTotal
(
data
.
totalElements
);
setLogs
(
data
.
content
||
[]);
},
error
:
()
=>
{
setLoading
(
false
);
}
});
}
else
{
dispatch
({
type
:
'assetmanage.importIndicatorLog'
,
payload
:
{
page
:
pageNum
,
size
:
pageSize
,
updater
:
app
?.
user
?.
userName
,
},
callback
:
data
=>
{
setLoading
(
false
);
setTotal
(
data
.
totalElements
);
data
.
content
?.
forEach
(
item
=>
{
// item.startTime = item._id?.time
// item.endTime
// item.costTime
});
setLogs
(
data
.
content
||
[]);
},
error
:
()
=>
{
setLoading
(
false
);
}
});
}
}
const
reset
=
()
=>
{
setFileList
([]);
setStep
(
1
);
setCatalogId
(
'1'
);
}
const
downloadTemplate
=
()
=>
{
if
(
catalogId
===
'2'
)
{
window
.
open
(
"/api/standard/indicator/exportModel"
);
}
}
const
onImportClick
=
()
=>
{
if
(
fileList
.
length
===
0
)
{
showMessage
(
'warn'
,
'请先上传文件'
);
return
;
}
if
(
catalogId
===
'1'
)
{
dispatch
({
type
:
'assetmanage.importMetadataAttributes'
,
payload
:
{
fileList
:
[
fileList
[
0
]],
params
:
{
catalog
:
app
?.
env
?.
domainId
,
}
},
callback
:
(
data
)
=>
{
onChange
?.(
catalogId
);
}
})
}
else
{
dispatch
({
type
:
'assetmanage.importIndicator'
,
payload
:
{
fileList
:
[
fileList
[
0
]],
params
:
{
updater
:
app
?.
user
?.
userName
}
},
callback
:
(
data
)
=>
{
onChange
?.(
catalogId
);
}
})
}
}
const
onExportClick
=
()
=>
{
if
(
catalogId
===
'1'
)
{
dispatch
({
type
:
'assetmanage.exportMetadataAttributes'
,
payload
:
{
responseType
:
'blob'
,
params
:
{
tableId
:
metadataId
}
},
callback
:
(
res
)
=>
{
download
(
res
);
}
})
}
else
{
dispatch
({
type
:
'assetmanage.getMetadataStandardList'
,
payload
:
{
data
:
{
parentMetadataId
:
metadataId
},
params
:
{
page
:
1
,
size
:
999999
}
},
callback
:
data
=>
{
window
.
open
(
`/api/standard/indicator/exportData?ids=
${
data
.
content
?.
map
(
item
=>
item
.
id
).
toString
()}
`);
},
});
}
}
const uploadProps = {
onRemove: file => {
const index = fileList.indexOf(file);
const newFileList = fileList.slice();
newFileList.splice(index, 1);
setFileList(newFileList);
},
beforeUpload: file => {
const isLt2OM = file.size / 1024 / 1024 < 20;
if (!isLt2OM) {
showMessage('error', '上传文件必须小于20M');
setFileList([]);
return false;
}
setFileList([file]);
return false;
},
fileList: fileList || [],
accept:".xlsx",
};
return (
<Drawer
visible={visible}
title='字段级资产维护'
width={900}
placement="right"
closable={ true }
onClose={() => {
reset();
onCancel?.();
}}
>
{
step === 1 && <React.Fragment>
<div className='flex' style={{ justifyContent: 'space-between' }}>
<Button type='primary' onClick={() => {setStep(2);}}>上传文件</Button>
<Space>
<Select
value={catalogId}
onChange={(value) => {
setCatalogId(value);
}}
style={{ width: 150 }}
>
{
catalogs?.map((catalog, index) => {
return <Select.Option key={index} value={catalog.key}>
{catalog.title}
</Select.Option>
})
}
</Select>
<Button onClick={() => getLogs()}>刷新</Button>
</Space>
</div>
<Table
className='mt-3'
columns={columns||[]}
rowKey='id'
dataSource={logs||[]}
pagination={false}
loading={loading}
expandable={{
expandedRowRender: record => <React.Fragment>
{
record.message ? record.message?.split('<br/>').map((info, index) => {
return <Typography.Paragraph key={index}>{info}</Typography.Paragraph>
}) : '暂无数据'
}
</React.Fragment>
}}
sticky
/>
<Pagination
className="text-center mt-3"
showSizeChanger
showQuickJumper
onChange={(_pageNum, _pageSize) => {
setPagination({ pageNum: _pageNum||1, pageSize: _pageSize || 20 });
}}
onShowSizeChange={(_pageNum, _pageSize) => {
setPagination({ pageNum: _pageNum || 1, pageSize: _pageSize || 20 });
}}
current={pageNum}
pageSize={pageSize}
defaultCurrent={1}
total={total}
pageSizeOptions={[10,20]}
showTotal={total => `
共
$
{
total
}
条
`}
/>
</React.Fragment>
}
{
step === 2 && <React.Fragment>
<div className='flex' style={{ justifyContent: 'space-between', alignItems: 'center' }}>
<Radio.Group
onChange={(e) => {
setCatalogId(e.target.value);
}}
value={catalogId}
>
{
catalogs.map((catalog, index) => <Radio key={index} value={catalog.key}>{catalog.title}</Radio>)
}
</Radio.Group>
<Button onClick={() => { setStep(1); }}>查看日志</Button>
</div>
<div className='flex mt-3' style={{ justifyContent: 'space-between' }}>
<Upload style={{ display: 'inline' }} {...uploadProps }>
<Button icon={
<UploadOutlined />}>
选择文件上传
</Button>
</Upload>
{
catalogId === '2' && <Button icon={<DownloadOutlined />} onClick={ downloadTemplate }>
模板下载
</Button>
}
</div>
<div className='mt-3'>
<Space>
<Button type='primary' onClick={onImportClick}>导入</Button>
<Button type='primary' onClick={onExportClick}>导出</Button>
</Space>
</div>
</React.Fragment>
}
</Drawer>
)
}
export default FC;
\ 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