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
fa76e217
Commit
fa76e217
authored
Oct 18, 2023
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
资产项
parent
8fb6e69d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
151 additions
and
11 deletions
+151
-11
assetmanage.js
src/model/assetmanage.js
+5
-0
metadata.js
src/service/metadata.js
+5
-0
table.jsx
src/view/Manage/AssetResourceManage/table.jsx
+141
-11
No files found.
src/model/assetmanage.js
View file @
fa76e217
...
...
@@ -300,4 +300,8 @@ export function* syncResourceDraft(payload) {
export
function
*
getTasks
(
payload
)
{
return
yield
call
(
service
.
getTasks
,
payload
)
}
export
function
*
getMetadataColumns
(
payload
)
{
return
yield
call
(
metadataService
.
getMetadataColumns
,
payload
)
}
\ No newline at end of file
src/service/metadata.js
View file @
fa76e217
...
...
@@ -34,4 +34,8 @@ export function getDatabases(payload) {
export
function
getSchemas
(
payload
)
{
return
GetJSON
(
'/metadatarepo/rest/query/getChildBySys'
,
payload
)
}
export
function
getMetadataColumns
(
payload
)
{
return
PostJSON
(
'/metadatarepo/rest/metadata/getChild'
,
payload
)
}
\ No newline at end of file
src/view/Manage/AssetResourceManage/table.jsx
View file @
fa76e217
import
React
from
'react'
import
classNames
from
'classnames'
import
{
Tooltip
,
Typography
,
Space
,
Dropdown
,
Button
,
Menu
,
Checkbox
,
Input
,
Select
,
Modal
}
from
'antd'
import
{
Tooltip
,
Typography
,
Space
,
Dropdown
,
Button
,
Menu
,
Checkbox
,
Input
,
Select
,
Modal
,
Table
as
AntdTable
}
from
'antd'
import
ResizeObserver
from
'rc-resize-observer'
import
{
debounceTime
,
Subject
}
from
'rxjs'
import
{
DownOutlined
,
UpOutlined
}
from
"@ant-design/icons"
...
...
@@ -29,14 +29,6 @@ import TagCell from '../Model/Component/tag-help'
import
'../AssetManage/Component/AssetTable.less'
// public static final String ADD_AS_ASSET_NAME = "addAsAsset";//新增为资产
// public static final String DISTRIBUTE_NAME = "distribute";//分配
// public static final String REDISTRIBUTE_NAME = "reDistribute";//转分配
// public static final String CHECK_NAME = "check";//复核
// public static final String CONVERT_TO_NON_ASSET_NAME = "convertToNonAsset";//转为非资产
// public static final String SYNC_NAME = "sync";//同步
// public static final String NOT_SYNC_NAME = "notSync";//不同步
// public static final String CONVERT_TO_UN_SORTING = "convertToUnSorting";//转为未梳理
const
operationMap
=
{
addAsAsset
:
'新增为资产'
,
distribute
:
'分配'
,
...
...
@@ -352,8 +344,6 @@ const FC = (props) => {
col
.
width
=
isSzseEnv
?
230
:
160
}
else
if
(
element
.
name
===
'英文名称'
)
{
col
.
width
=
isSzseEnv
?
224
:
160
}
else
if
(
element
.
name
===
'资源项'
)
{
col
.
width
=
isSzseEnv
?
250
:
120
}
else
if
(
element
.
name
===
'资源路径'
)
{
col
.
render
=
(
text
,
record
)
=>
{
return
(
...
...
@@ -371,6 +361,9 @@ const FC = (props) => {
</
Tooltip
>
)
}
}
else
if
(
element
.
metadataItem
===
'是'
)
{
col
.
width
=
isSzseEnv
?
250
:
120
col
.
render
=
(
text
,
record
)
=>
<
MetadataColumn
data=
{
text
}
/>
}
newColumns
.
push
(
col
)
...
...
@@ -1389,4 +1382,140 @@ const ExpandedRow = ({ id, columns, onRowClick, onSyncClick }) => {
{contextHolder}
</div>
)
}
const MetadataColumnTooltipTitle = ({ data }) => {
const [currentMetadataId, setMetadataId] = React.useState()
const [loading, setLoading] = React.useState(false)
const [columnData, setColumnData] = React.useState()
const cols = React.useMemo(() => {
return (
[
{
title: '名称',
width: 160,
dataIndex: 'name',
ellipsis: true,
},
{
title: '中文名称',
width: 160,
dataIndex: 'cnName',
ellipsis: true,
},
{
title: '类型',
width: 150,
dataIndex: 'typeName',
ellipsis: true,
},
{
title: '是否允许为空',
dataIndex: 'isNullable',
width: 100,
ellipsis: true,
},
{
title: '是否为主键',
dataIndex: 'isPrimaryKey',
width: 100,
ellipsis: true,
},
]
)
}, [])
React.useEffect(() => {
if ((data??[]).length > 0) {
setMetadataId(data[0].metadataId)
}
}, [data])
React.useEffect(() => {
if (currentMetadataId) {
getMetadataColumns()
}
}, [currentMetadataId])
const getMetadataColumns = () => {
setLoading(true)
dispatch({
type: 'assetmanage.getMetadataColumns',
payload: {
params: {
parentId: currentMetadataId
},
data: ["Catalog,Database,Schema,Table,Column"]
},
callback: (data) => {
setLoading(false)
setColumnData(data)
},
error: () => {
setLoading(false)
}
})
}
return (
<div style={{ maxHeight: 300, overflow: 'auto' }}>
<div className='mb-2'>
<Select
value={currentMetadataId}
onChange={(value) => {
setMetadataId(value)
}}
style={{ width: 170 }}
>
{
(data??[]).map((item, index) => <Select.Option value={item.metadataId} key={index}>{item.enName}</Select.Option>)
}
</Select>
</div>
<AntdTable
dataSource={columnData}
columns={cols}
loading={loading}
pagination={false}
size='small'
/>
</div>
)
}
const MetadataColumn = ({ data }) => {
const decodeData = React.useMemo(() => {
if (data) {
try {
return JSON.parse(data)
} catch(error) {
return data
}
}
return []
}, [data])
return (
<React.Fragment>
{
(typeof decodeData === 'string') ? <Tooltip
overlayClassName='tooltip-common'
title={decodeData}
>
<Typography.Text ellipsis={true}>
{decodeData}
</Typography.Text>
</Tooltip> : ((typeof decodeData === 'object') ? <Tooltip
overlayClassName='tooltip-common'
title={<MetadataColumnTooltipTitle data={decodeData} />}
>
<Typography.Text ellipsis={true}>
{(decodeData??[]).map(item => item.enName).toString()}
</Typography.Text>
</Tooltip> : null
)
}
</React.Fragment>
)
}
\ 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