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
77d130eb
Commit
77d130eb
authored
Nov 13, 2023
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
资产详情样式与标准保持统一
parent
154749c8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
89 additions
and
76 deletions
+89
-76
AssetAction.jsx
src/view/Manage/AssetManage/Component/AssetAction.jsx
+89
-76
No files found.
src/view/Manage/AssetManage/Component/AssetAction.jsx
View file @
77d130eb
import
React
,
{
useEffect
,
useState
,
useContext
,
useMemo
,
useRef
}
from
'react'
;
import
{
Form
,
Spin
,
Input
,
Descriptions
,
Space
,
Button
,
Tooltip
,
Select
,
Cascader
,
Radio
,
Divider
,
Typography
,
Modal
,
Row
,
Col
,
Pagination
,
Dropdown
,
Menu
}
from
'antd'
;
import
{
Form
,
Spin
,
Input
,
Descriptions
,
Space
,
Button
,
Tooltip
,
Select
,
Cascader
,
Radio
,
Divider
,
Typography
,
Modal
,
Row
,
Col
,
Pagination
,
Dropdown
,
Menu
,
message
}
from
'antd'
;
import
{
DownOutlined
,
UpOutlined
,
QuestionCircleOutlined
}
from
'@ant-design/icons'
;
import
LocalStorage
from
'local-storage'
;
...
...
@@ -32,6 +32,7 @@ const AssetAction = (props) => {
const
[
assetParams
,
setAssetParams
]
=
useState
({
assets
:
{},
attributes
:
[],
attributesFoldMap
:
{}
});
const
[
elements
,
setElements
]
=
useState
([]);
const
[
wholeElements
,
setWholeElements
]
=
useState
([]);
const
[
currentAttribute
,
setCurrentAttribute
]
=
useState
();
const
[
metadataId
,
setMetadataId
]
=
useState
(
''
);
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
confirmLoading
,
setConfirmLoading
]
=
useState
(
false
);
...
...
@@ -226,6 +227,7 @@ const AssetAction = (props) => {
}
else
{
setMetadataId
(
''
);
setAssetParams
({...
assetParams
,
...{
assets
:
{},
attributes
:
[]}});
setCurrentAttribute
();
getElements
();
}
}
...
...
@@ -482,6 +484,9 @@ const AssetAction = (props) => {
})
setAssetParams
({
assets
:
data
,
attributes
:
_attributes
,
attributesFoldMap
:
newAttributesFoldMap
});
if
((
_attributes
??[]).
length
>
0
)
{
setCurrentAttribute
(
_attributes
[
0
])
}
let
_fieldsValue
=
{};
(
data
.
elements
||
[]).
forEach
(
element
=>
{
...
...
@@ -668,16 +673,16 @@ const AssetAction = (props) => {
} catch (errInfo) {
console.log('Validate Failed:', errInfo);
s
etConfirmLoading(false);
s
howMessage('warn', '请完成资产必填项')
}
}
const onFoldButtonClick = (attribute, fold) => {
let newAttributesFoldMap = {...attributesFoldMap};
newAttributesFoldMap[attribute] = fold;
//
const onFoldButtonClick = (attribute, fold) => {
//
let newAttributesFoldMap = {...attributesFoldMap};
//
newAttributesFoldMap[attribute] = fold;
setAssetParams({...assetParams, attributesFoldMap: newAttributesFoldMap});
}
//
setAssetParams({...assetParams, attributesFoldMap: newAttributesFoldMap});
//
}
const onFullScreenClick = () => {
setFullScreen(!fullScreen);
...
...
@@ -999,78 +1004,86 @@ const AssetAction = (props) => {
spinning={loading}
>
<Form form={form} onValuesChange={onValuesChange}>
{
attributes?.map((attribute, index) => {
return <div key={index}>
<Divider orientation='left'>{attribute}</Divider>
<Descriptions column={1} bordered>
{
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;
}
<Radio.Group className='mb-3' value={currentAttribute} onChange={(e) => {
setCurrentAttribute(e.target.value)
}}>
{
(attributes??[]).map((item,key) => (
<Radio.Button key={key} value={item}>{item}</Radio.Button>
))
}
</Radio.Group>
{
attributes?.map((attribute, index) => {
return <div key={index} style={{ display: (attribute===currentAttribute)?'':'none' }}>
<Descriptions column={1} bordered>
{
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 (
<Descriptions.Item
key={index}
label={
<span>
{element.name}
{
(currentAction==='add'||currentAction==='edit') && element.required && <span style={{ color: 'red' }}>*</span>
return (
<Descriptions.Item
key={index}
label={
<span>
{element.name}
{
(currentAction==='add'||currentAction==='edit') && element.required && <span style={{ color: 'red' }}>*</span>
}
</span>
}
</span>
}
labelStyle={{ width: 180 }}
>
{
(currentAction==='add'||currentAction==='edit') ?
<Row gutter={8} align='middle'>
<Col span={22}>
<Form.Item
label=''
name={element.name}
rules={[{ required: element.required }]}
style={{ marginBottom: 0 }}
>
{elementEditComponent(element)}
</Form.Item>
</Col>
{
interpretation && <Col span={2}>
<Tooltip placement="left" title={interpretation}>
<QuestionCircleOutlined style={{ fontSize: 16 }} />
</Tooltip>
labelStyle={{ width: 180 }}
>
{
(currentAction==='add'||currentAction==='edit') ?
<Row gutter={8} align='middle'>
<Col span={22}>
<Form.Item
label=''
name={element.name}
rules={[{ required: element.required }]}
style={{ marginBottom: 0 }}
>
{elementEditComponent(element)}
</Form.Item>
</Col>
}
</Row>
: <React.Fragment
>
<Row gutter={8} align='middle'
>
<Col span={22}
>
{ elementDetailComponent(element) }
</Col>
{
interpretation && <Col span={2}
>
<Tooltip placement="left" title={interpretation}
>
<QuestionCircleOutlined style={{ fontSize: 16 }} /
>
</Tooltip>
{
interpretation && <Col span={2}>
<Tooltip placement="left" title={interpretation}
>
<QuestionCircleOutlined style={{ fontSize: 16 }} /
>
</Tooltip
>
</Col>
}
</Row>
: <React.Fragment
>
<Row gutter={8} align='middle'
>
<Col span={22}
>
{ elementDetailComponent(element) }
</Col>
}
</Row>
</React.Fragment>
}
</Descriptions.Item>
)
})
}
</Descriptions>
</div>
})
}
{
interpretation && <Col span={2}>
<Tooltip placement="left" title={interpretation}>
<QuestionCircleOutlined style={{ fontSize: 16 }} />
</Tooltip>
</Col>
}
</Row>
</React.Fragment>
}
</Descriptions.Item>
)
})
}
</Descriptions>
</div>
})
}
</Form>
</Spin>
...
...
@@ -1152,7 +1165,7 @@ const AssetAction = (props) => {
</Space>
<Table
className='mt-
2
'
className='mt-
3
'
loading={loadingMetadataColumnList}
columns={permissionId?columns:columns.filter(item => item.dataIndex !== 'permission')}
rowKey='_id'
...
...
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