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
31169abf
Commit
31169abf
authored
Apr 23, 2023
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
主题域
parent
5bd92c73
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
74 additions
and
3 deletions
+74
-3
AssetAction.jsx
src/view/Manage/AssetManage/Component/AssetAction.jsx
+74
-3
No files found.
src/view/Manage/AssetManage/Component/AssetAction.jsx
View file @
31169abf
import
React
,
{
useEffect
,
useState
,
useContext
}
from
'react'
;
import
React
,
{
useEffect
,
useState
,
useContext
,
useMemo
}
from
'react'
;
import
{
Form
,
Spin
,
Input
,
Descriptions
,
Space
,
Button
,
Tooltip
,
Select
}
from
'antd'
;
import
{
Form
,
Spin
,
Input
,
Descriptions
,
Space
,
Button
,
Tooltip
,
Select
}
from
'antd'
;
import
{
DownOutlined
,
UpOutlined
}
from
'@ant-design/icons'
;
import
{
DownOutlined
,
UpOutlined
}
from
'@ant-design/icons'
;
...
@@ -37,12 +37,16 @@ const AssetAction = (props) => {
...
@@ -37,12 +37,16 @@ const AssetAction = (props) => {
const
[
loadingUsers
,
setLoadingUsers
]
=
useState
(
false
);
const
[
loadingUsers
,
setLoadingUsers
]
=
useState
(
false
);
const
[
departments
,
setDepartments
]
=
useState
([]);
const
[
departments
,
setDepartments
]
=
useState
([]);
const
[
loadingDepartments
,
setLoadingDepartments
]
=
useState
(
false
);
const
[
loadingDepartments
,
setLoadingDepartments
]
=
useState
(
false
);
const
[
treeData
,
setTreeData
]
=
useState
([]);
const
[
treeDataMap
,
setTreeDataMap
]
=
useState
(
undefined
);
const
[
currentDomainGroup
,
setCurrentDomainGroup
]
=
useState
(
undefined
);
const
app
=
useContext
(
AppContext
);
const
app
=
useContext
(
AppContext
);
useEffect
(()
=>
{
useEffect
(()
=>
{
getSystems
();
getSystems
();
getUsers
();
getUsers
();
getTreeData
();
getDepartments
();
getDepartments
();
if
(
action
===
'add'
)
{
if
(
action
===
'add'
)
{
getElements
();
getElements
();
...
@@ -63,6 +67,14 @@ const AssetAction = (props) => {
...
@@ -63,6 +67,14 @@ const AssetAction = (props) => {
//eslint-disable-next-line react-hooks/exhaustive-deps
//eslint-disable-next-line react-hooks/exhaustive-deps
},
[
id
,
dirId
])
},
[
id
,
dirId
])
const
domains
=
useMemo
(()
=>
{
if
(
currentDomainGroup
&&
treeDataMap
)
{
return
treeDataMap
[
currentDomainGroup
];
}
return
[];
},
[
currentDomainGroup
,
treeDataMap
])
const
getAssetPaths
=
()
=>
{
const
getAssetPaths
=
()
=>
{
dispatch
({
dispatch
({
type
:
'assetmanage.getAssetPaths'
,
type
:
'assetmanage.getAssetPaths'
,
...
@@ -106,6 +118,21 @@ const AssetAction = (props) => {
...
@@ -106,6 +118,21 @@ const AssetAction = (props) => {
})
})
}
}
const
getTreeData
=
()
=>
{
dispatch
({
type
:
'assetmanage.queryAllDirectoryAsTree'
,
callback
:
(
data
)
=>
{
setTreeData
(
data
);
const
newTreeDataMap
=
{};
data
?.
forEach
(
item
=>
{
newTreeDataMap
[
item
.
text
]
=
item
.
children
;
})
setTreeDataMap
(
newTreeDataMap
);
}
})
}
const
getDepartments
=
()
=>
{
const
getDepartments
=
()
=>
{
setLoadingDepartments
(
true
);
setLoadingDepartments
(
true
);
dispatch
({
dispatch
({
...
@@ -245,6 +272,9 @@ const AssetAction = (props) => {
...
@@ -245,6 +272,9 @@ const AssetAction = (props) => {
let
_fieldsValue
=
{};
let
_fieldsValue
=
{};
(
data
.
elements
||
[]).
forEach
(
element
=>
{
(
data
.
elements
||
[]).
forEach
(
element
=>
{
_fieldsValue
[
element
.
name
]
=
element
.
value
||
''
;
_fieldsValue
[
element
.
name
]
=
element
.
value
||
''
;
if
(
element
.
name
===
'主题域分组'
)
{
setCurrentDomainGroup
(
element
.
value
);
}
})
})
form
?.
setFieldsValue
(
_fieldsValue
);
form
?.
setFieldsValue
(
_fieldsValue
);
...
@@ -467,6 +497,40 @@ const AssetAction = (props) => {
...
@@ -467,6 +497,40 @@ const AssetAction = (props) => {
/>
/>
}
}
if (element.name === '主题域分组') {
return (
<Select
allowClear
disabled={element.manualMaintain==='否'}
>
{
treeData?.map((item, index) => {
return <Select.Option key={index} value={item.text}>
{item.text}
</Select.Option>
})
}
</Select>
)
}
if (element.name === '主题域') {
return (
<Select
allowClear
disabled={element.manualMaintain==='否'}
>
{
domains?.map((item, index) => {
return <Select.Option key={index} value={item.text}>
{item.text}
</Select.Option>
})
}
</Select>
)
}
if (element.selectMode==='单选') {
if (element.selectMode==='单选') {
return (
return (
<Select
<Select
...
@@ -509,6 +573,13 @@ const AssetAction = (props) => {
...
@@ -509,6 +573,13 @@ const AssetAction = (props) => {
return <span className='text-color'>{highlightSearchContentByTerms(item.value||'', terms)}</span>;
return <span className='text-color'>{highlightSearchContentByTerms(item.value||'', terms)}</span>;
}
}
const onValuesChange = (changedValues, allValues) => {
if (changedValues.hasOwnProperty('主题域分组')) {
setCurrentDomainGroup(changedValues['主题域分组']);
form.setFieldsValue({'主题域': ''});
}
}
return (
return (
<div
<div
className='flex'
className='flex'
...
@@ -703,7 +774,7 @@ const AssetAction = (props) => {
...
@@ -703,7 +774,7 @@ const AssetAction = (props) => {
});
});
return (
return (
<Form {...formItemLayout} form={form} labelWrap>
<Form {...formItemLayout} form={form} labelWrap
onValuesChange={onValuesChange}
>
{
{
(sameAttributeElements||[]).map((element, _index) => {
(sameAttributeElements||[]).map((element, _index) => {
return (
return (
...
...
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