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
c9101653
Commit
c9101653
authored
May 10, 2023
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
资产详情改造
parent
e7e8280f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
54 deletions
+42
-54
App.js
src/App.js
+2
-0
AssetAction.jsx
src/view/Manage/AssetManage/Component/AssetAction.jsx
+40
-54
No files found.
src/App.js
View file @
c9101653
...
...
@@ -87,6 +87,8 @@ export class App extends React.Component {
if
(
message
===
'showAssetDetail'
)
{
return
(
<
AppContext
.
Provider
value
=
{{
env
:
hostParams
?.
env
,
user
:
hostParams
?.
user
,
setGlobalState
,
onGlobalStateChange
}}
>
...
...
src/view/Manage/AssetManage/Component/AssetAction.jsx
View file @
c9101653
...
...
@@ -49,7 +49,6 @@ const AssetAction = (props) => {
const
[
metadata
,
setMetadata
]
=
useState
(
undefined
);
const
[
loadingMetadataColumnList
,
setLoadingMetadataColumnList
]
=
useState
(
false
);
const
[
metadataColumnList
,
setMetadataColumnList
]
=
useState
(
undefined
);
const
[
mode
,
setMode
]
=
useState
(
undefined
);
const
app
=
useContext
(
AppContext
);
const
uploadRef
=
useRef
(
undefined
);
...
...
@@ -129,14 +128,6 @@ const AssetAction = (props) => {
//eslint-disable-next-line react-hooks/exhaustive-deps
},
[
id
,
dirId
])
const
currentAttributeElements
=
useMemo
(()
=>
{
if
(
mode
&&
elements
?.
length
>
0
)
{
return
(
elements
||
[]).
filter
(
element
=>
element
.
type
===
mode
);
}
return
[];
},
[
mode
,
elements
])
const
domains
=
useMemo
(()
=>
{
if
(
currentDomainGroup
&&
treeDataMap
)
{
return
treeDataMap
[
currentDomainGroup
];
...
...
@@ -291,9 +282,6 @@ const AssetAction = (props) => {
})
setAssetParams
({
assets
:
{},
attributes
:
_attributes
,
attributesFoldMap
:
newAttributesFoldMap
});
if
(
_attributes
.
length
>
0
)
{
setMode
(
_attributes
[
0
]);
}
form
?.
resetFields
();
...
...
@@ -401,9 +389,6 @@ const AssetAction = (props) => {
})
setAssetParams
({
assets
:
data
,
attributes
:
_attributes
,
attributesFoldMap
:
newAttributesFoldMap
});
if
(
!
mode
&&
_attributes
.
length
>
0
)
{
setMode
(
_attributes
[
0
]);
}
let
_fieldsValue
=
{};
(
data
.
elements
||
[]).
forEach
(
element
=>
{
...
...
@@ -745,10 +730,6 @@ const AssetAction = (props) => {
})
}
const handleModeChange = (e) => {
setMode(e.target.value);
}
const onValuesChange = (changedValues, allValues) => {
if (changedValues.hasOwnProperty('主题域分组')) {
setCurrentDomainGroup(changedValues['主题域分组']);
...
...
@@ -788,7 +769,7 @@ const AssetAction = (props) => {
<Descriptions column={1}>
<Descriptions.Item
label={<div className='title-text' style={{ textAlign: 'right', width: 60 }}>资产路径</div>}
style={{ paddingBottom:
15
}}
style={{ paddingBottom:
0
}}
>
<div className='flex' style={{ flexDirection: 'column' }}>
{
...
...
@@ -838,45 +819,50 @@ const AssetAction = (props) => {
> */}
<Spin
spinning={loading}
style={{ marginTop: 30 }}
>
<
Radio.Group className='mb-3' onChange={handleModeChange} value={mod
e}>
<
Form form={form} onValuesChange={onValuesChang
e}>
{
attributes?.map((attribute, index) => {
return <Radio.Button value={attribute} key={index}>{attribute}</Radio.Button>;
return <div key={index}>
<Divider orientation='left'>{attribute}</Divider>
<Descriptions column={1} bordered>
{
elements?.map((element, index) => {
if (element.type!==attribute || element.name === '资产项') return null;
return (
<Descriptions.Item
key={index}
label={
<span>
{element.name}
{
(currentAction==='add'||currentAction==='edit') && element.required && <span style={{ color: 'red' }}>*</span>
}
</span>
}
labelStyle={{ width: 180 }}
>
{
(currentAction==='add'||currentAction==='edit') ? <Form.Item
label=''
name={element.name}
rules={[{ required: element.required }]}
style={{ width: 500, marginBottom: 0 }}
>
{elementEditComponent(element)}
</Form.Item> : <React.Fragment>
{ elementDetailComponent(element) }
</React.Fragment>
}
</Descriptions.Item>
)
})
}
</Descriptions>
</div>
})
}
</Radio.Group>
<Form form={form} onValuesChange={onValuesChange}>
<Descriptions column={1} bordered>
{
elements?.map((element, index) => {
if (element.name === '资产项') return null;
return (
<Descriptions.Item
key={index}
label={element.name}
labelStyle={{ width: 180 }}
style={{ display: (element.type===mode)?'': 'none'}}
>
{
(currentAction==='add'||currentAction==='edit') ? <Form.Item
label=''
name={element.name}
rules={[{ required: element.required }]}
style={{ width: 500, marginBottom: 0 }}
>
{elementEditComponent(element)}
</Form.Item> : <React.Fragment>
{ elementDetailComponent(element) }
</React.Fragment>
}
</Descriptions.Item>
)
})
}
</Descriptions>
</Form>
</Spin>
...
...
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