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
53cf45a4
Commit
53cf45a4
authored
Nov 22, 2023
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fix
parent
9f33ce11
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
127 additions
and
148 deletions
+127
-148
AssetAction.jsx
src/view/Manage/AssetManage/Component/AssetAction.jsx
+127
-148
No files found.
src/view/Manage/AssetManage/Component/AssetAction.jsx
View file @
53cf45a4
...
@@ -31,7 +31,6 @@ const AssetAction = (props) => {
...
@@ -31,7 +31,6 @@ const AssetAction = (props) => {
const
[
currentAction
,
setCurrentAction
]
=
useState
(
action
);
const
[
currentAction
,
setCurrentAction
]
=
useState
(
action
);
const
[
assetParams
,
setAssetParams
]
=
useState
({
assets
:
{},
attributes
:
[],
attributesFoldMap
:
{}
});
const
[
assetParams
,
setAssetParams
]
=
useState
({
assets
:
{},
attributes
:
[],
attributesFoldMap
:
{}
});
const
[
elements
,
setElements
]
=
useState
([]);
const
[
elements
,
setElements
]
=
useState
([]);
const
[
wholeElements
,
setWholeElements
]
=
useState
([]);
const
[
currentAttribute
,
setCurrentAttribute
]
=
useState
();
const
[
currentAttribute
,
setCurrentAttribute
]
=
useState
();
const
[
metadataId
,
setMetadataId
]
=
useState
(
''
);
const
[
metadataId
,
setMetadataId
]
=
useState
(
''
);
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
loading
,
setLoading
]
=
useState
(
false
);
...
@@ -213,12 +212,11 @@ const AssetAction = (props) => {
...
@@ -213,12 +212,11 @@ const AssetAction = (props) => {
getTreeData
();
getTreeData
();
getDepartments
();
getDepartments
();
if
(
action
===
'add'
)
{
if
(
action
===
'add'
)
{
// getElements();
}
else
{
}
else
{
setCurrentAction
(
'detail'
);
setCurrentAction
(
'detail'
);
if
((
id
||
''
)
!==
''
)
{
if
((
id
||
''
)
!==
''
)
{
setPagination
({...
pagination
,
pageNum
:
1
});
setPagination
({...
pagination
,
pageNum
:
1
});
getElements
();
getAssetPaths
();
getAssetPaths
();
getResourceRelations
();
getResourceRelations
();
checkDataAssetEditable
();
checkDataAssetEditable
();
...
@@ -228,7 +226,6 @@ const AssetAction = (props) => {
...
@@ -228,7 +226,6 @@ const AssetAction = (props) => {
setMetadataId
(
''
);
setMetadataId
(
''
);
setAssetParams
({...
assetParams
,
...{
assets
:
{},
attributes
:
[]}});
setAssetParams
({...
assetParams
,
...{
assets
:
{},
attributes
:
[]}});
setCurrentAttribute
();
setCurrentAttribute
();
getElements
();
}
}
}
}
//eslint-disable-next-line react-hooks/exhaustive-deps
//eslint-disable-next-line react-hooks/exhaustive-deps
...
@@ -385,20 +382,6 @@ const AssetAction = (props) => {
...
@@ -385,20 +382,6 @@ const AssetAction = (props) => {
});
});
}
}
const
getElements
=
(
cb
=
null
)
=>
{
dispatch
({
type
:
(
currentAction
===
'add'
)?
'assetmanage.listElementsAndFillValue'
:
'assetmanage.listElements'
,
payload
:
(
currentAction
===
'add'
)?{
params
:
{
dirId
}
}:
undefined
,
callback
:
data
=>
{
setWholeElements
(
data
||
[]);
}
})
}
const
getUserElements
=
()
=>
{
const
getUserElements
=
()
=>
{
setLoading
(
true
);
setLoading
(
true
);
dispatch
({
dispatch
({
...
@@ -597,7 +580,7 @@ const AssetAction = (props) => {
...
@@ -597,7 +580,7 @@ const AssetAction = (props) => {
if
(
item
.
resourceType
===
'innerSource'
||
item
.
resourceType
===
'outerSource'
)
{
if
(
item
.
resourceType
===
'innerSource'
||
item
.
resourceType
===
'outerSource'
)
{
window
.
open
(
`/center-home/menu/asset-resource-browse?
${
AnchorId
}
=
${
item
?.
dataAssetId
}
&
$
{
AnchorDirId
}
=
$
{
item
?.
dirId
}
&
timestamp
=
$
{
timestamp
}
`);
window
.
open
(
`/center-home/menu/asset-resource-browse?
${
AnchorId
}
=
${
item
?.
dataAssetId
}
&
$
{
AnchorDirId
}
=
$
{
item
?.
dirId
}
&
timestamp
=
$
{
timestamp
}
`);
} else if (item.resourceType==='dataAsset') {
} else if (item.resourceType==='dataAsset') {
window.open(`
/
center
-
home
/
menu
/
asset
-
browse
?
$
{
AnchorId
}
=
$
{
item
?.
dataAssetId
}
&
$
{
AnchorDirId
}
=
$
{
item
?.
dirId
}
&
templateType
=
$
{
LocalStorage
.
get
(
`templateType-
${
appId
}
`
)
}
&
timestamp
=
$
{
timestamp
}
`);
window.open(`
/
center
-
home
/
menu
/
asset
-
browse
?
$
{
AnchorId
}
=
$
{
item
?.
dataAssetId
}
&
$
{
AnchorDirId
}
=
$
{
item
?.
dirId
}
&
templateType
=
$
{
assets
?.
templateType
}
&
timestamp
=
$
{
timestamp
}
`);
} else {
} else {
showMessage('warn', '资产目录类型不是资源也不是资产!');
showMessage('warn', '资产目录类型不是资源也不是资产!');
}
}
...
@@ -946,53 +929,57 @@ const AssetAction = (props) => {
...
@@ -946,53 +929,57 @@ const AssetAction = (props) => {
</Space>
</Space>
</div>
</div>
}
}
{
(action!=='add' && (id||'')!=='') && <div>
<Spin
<div className='pl-common py-compact-common'>
spinning={loading}
<Descriptions column={1}>
>
<Descriptions.Item
{
label={<div className='title-text' style={{ textAlign: 'right', width: 90 }}>资产目录路径</div>}
(action!=='add' && (id||'')!=='') && <div>
style={{ paddingBottom: 0 }}
<div className='pl-common py-compact-common'>
>
<Descriptions column={1}>
<div className='flex' style={{ flexDirection: 'column' }}>
<Descriptions.Item
{
label={<div className='title-text' style={{ textAlign: 'right', width: 90 }}>资产目录路径</div>}
(assetPaths||[]).map((item, key) => {
style={{ paddingBottom: 0 }}
return (
>
<a key={key} onClick={() => { jumpToPath(item); }}>
<div className='flex' style={{ flexDirection: 'column' }}>
<span>{item?.dataAssetName||''}</span>
{
</a>
(assetPaths||[]).map((item, key) => {
);
return (
})
<a key={key} onClick={() => { jumpToPath(item); }}>
}
<span>{item?.dataAssetName||''}</span>
</div>
</a>
</Descriptions.Item>
);
{/* <Descriptions.Item label={<div className='title-text' style={{ textAlign: 'right', width: 90 }}>资产目录标签</div>} style={{ paddingBottom: 15 }}>
})
<AppContext.Consumer>
}
{
</div>
value => {
</Descriptions.Item>
return (currentAction==='add'||currentAction==='edit')?<Tag styleType='complex' id={id} creator={value?.user?.userName||''} onAssetTag={onAssetTag} />:<Tag id={id} creator={value?.user?.userName||''} />
{/* <Descriptions.Item label={<div className='title-text' style={{ textAlign: 'right', width: 90 }}>资产目录标签</div>} style={{ paddingBottom: 15 }}>
}
<AppContext.Consumer>
}
{
</AppContext.Consumer>
value => {
</Descriptions.Item> */}
return (currentAction==='add'||currentAction==='edit')?<Tag styleType='complex' id={id} creator={value?.user?.userName||''} onAssetTag={onAssetTag} />:<Tag id={id} creator={value?.user?.userName||''} />
{/* <Descriptions.Item
}
label={<div className='title-text' style={{ textAlign: 'right', width: 80 }}>关联关系</div>}
}
style={{ paddingBottom: 0 }}
</AppContext.Consumer>
>
</Descriptions.Item> */}
<div className='flex' style={{ flexDirection: 'column' }}>
{/* <Descriptions.Item
{
label={<div className='title-text' style={{ textAlign: 'right', width: 80 }}>关联关系</div>}
(resourceRelations||[]).map((item, key) => {
style={{ paddingBottom: 0 }}
return (
>
<a key={key} onClick={() => { jumpToRelation(item); }}>{item?.dataAssetName||''}</a>
<div className='flex' style={{ flexDirection: 'column' }}>
);
{
})
(resourceRelations||[]).map((item, key) => {
}
return (
</div>
<a key={key} onClick={() => { jumpToRelation(item); }}>{item?.dataAssetName||''}</a>
</Descriptions.Item> */}
);
</Descriptions>
})
</div>
}
</div>
</div>
}
</Descriptions.Item> */}
</Descriptions>
</div>
</div>
}
{/* <div
{/* <div
style={{
style={{
...
@@ -1000,93 +987,85 @@ const AssetAction = (props) => {
...
@@ -1000,93 +987,85 @@ const AssetAction = (props) => {
overflow: 'auto',
overflow: 'auto',
}}
}}
> */}
> */}
<Spin
spinning={loading}
<Form form={form} onValuesChange={onValuesChange}>
>
<Radio.Group buttonStyle='solid' className='mb-3' value={currentAttribute} onChange={(e) => {
<Form form={form} onValuesChange={onValuesChange}>
setCurrentAttribute(e.target.value)
<Radio.Group buttonStyle='solid' className='mb-3' value={currentAttribute} onChange={(e) => {
}}>
setCurrentAttribute(e.target.value)
{
}}>
(attributes??[]).map((item,key) => (
{
<Radio.Button key={key} value={item}>{item}</Radio.Button>
(attributes??[]).map((item,key) => (
))
<Radio.Button key={key} value={item}>{item}</Radio.Button>
}
))
</Radio.Group>
}
{
</Radio.Group>
attributes?.map((attribute, index) => {
{
return <div key={index} style={{ display: (attribute===currentAttribute)?'':'none' }}>
attributes?.map((attribute, index) => {
<Descriptions column={1} bordered>
return <div key={index} style={{ display: (attribute===currentAttribute)?'':'none' }}>
{
<Descriptions column={1} bordered>
elements?.map((element, index) => {
{
if (element.type!==attribute || element.name === '资产项') return null;
wholeElements?.length>0 && elements?.map((element, index) => {
if (element.type!==attribute || element.name === '资产项') return null;
let interpretation = null;
const filterElements = wholeElements?.filter(_element => _element.id === element.id);
if (filterElements.length>0) {
interpretation = filterElements[0].interpretation;
}
return (
return (
<Descriptions.Item
<Descriptions.Item
key={index}
key={index}
label={
label={
<span>
<span>
{element.name}
{element.name}
{
{
(currentAction==='add'||currentAction==='edit') && element.required && <span style={{ color: 'red' }}>*</span>
(currentAction==='add'||currentAction==='edit') && element.required && <span style={{ color: 'red' }}>*</span>
}
</span>
}
}
labelStyle={{ width: 180 }}
</span>
>
}
{
labelStyle={{ width: 180 }}
(currentAction==='add'||currentAction==='edit') ?
>
<Row gutter={8} align='middle'>
{
<Col span={22}>
(currentAction==='add'||currentAction==='edit') ?
<Form.Item
<Row gutter={8} align='middle'>
label=''
<Col span={22}>
name={element.name}
<Form.Item
rules={[{ required: element.required }]}
label=''
style={{ marginBottom: 0 }}
name={element.name}
>
rules={[{ required: element.required }]}
{elementEditComponent(element)}
style={{ marginBottom: 0 }}
</Form.Item>
>
{elementEditComponent(element)}
</Form.Item>
</Col>
{
element.interpretation && <Col span={2}>
<Tooltip placement="left" title={element.interpretation}>
<QuestionCircleOutlined style={{ fontSize: 16 }} />
</Tooltip>
</Col>
</Col>
{
}
interpretation && <Col span={2}>
</Row>
<Tooltip placement="left" title={interpretation}
>
: <React.Fragment
>
<QuestionCircleOutlined style={{ fontSize: 16 }} /
>
<Row gutter={8} align='middle'
>
</Tooltip
>
<Col span={22}
>
</Col>
{ elementDetailComponent(element) }
}
</Col>
</Row>
{
: <React.Fragment
>
element.interpretation && <Col span={2}
>
<Row gutter={8} align='middle'
>
<Tooltip placement="left" title={element.interpretation}
>
<Col span={22}
>
<QuestionCircleOutlined style={{ fontSize: 16 }} /
>
{ elementDetailComponent(element) }
</Tooltip>
</Col>
</Col>
{
}
interpretation && <Col span={2}>
</Row>
<Tooltip placement="left" title={interpretation}>
</React.Fragment>
<QuestionCircleOutlined style={{ fontSize: 16 }} />
}
</Tooltip>
</Descriptions.Item>
</Col>
)
}
})
</Row>
}
</React.Fragment>
</Descriptions>
}
</div>
</Descriptions.Item>
})
)
}
})
</Form>
}
</Descriptions>
</div>
})
}
</Form>
</Spin>
</Spin>
{/* </div> */}
{/* </div> */}
<div>
<div>
...
...
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