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
957f033f
Commit
957f033f
authored
Jan 09, 2023
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
资产目录编号问题
parent
71f293f1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
5 deletions
+33
-5
UpdateDirectoryModal.jsx
...iew/Manage/AssetManage/Component/UpdateDirectoryModal.jsx
+33
-5
No files found.
src/view/Manage/AssetManage/Component/UpdateDirectoryModal.jsx
View file @
957f033f
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
React
,
{
useEffect
,
useState
,
useMemo
}
from
'react'
;
import
{
Modal
,
Form
,
Input
,
Space
,
Button
,
Radio
,
Select
}
from
'antd'
;
import
{
dispatch
}
from
'../../../../model'
;
...
...
@@ -38,6 +38,18 @@ const UpdateDirectoryModal = (props) => {
//eslint-disable-next-line react-hooks/exhaustive-deps
},
[
visible
])
const
codeRestrict
=
useMemo
(()
=>
{
if
(
action
===
'add'
)
{
if
(
isThemeAdd
)
return
true
;
return
(
dir
&&
dir
.
level
===
1
)
?
true
:
false
;
}
else
{
return
(
dir
&&
dir
.
level
<=
2
)
?
true
:
false
;
}
return
false
;
},
[
action
,
dir
,
isThemeAdd
])
const
getDirectory
=
()
=>
{
setDir
(
null
);
dispatch
({
...
...
@@ -105,6 +117,7 @@ const UpdateDirectoryModal = (props) => {
payload
:
payload
,
callback
:
data
=>
{
setConfirmLoading
(
false
);
reset
();
onCancel
&&
onCancel
(
true
,
data
?.
id
||
''
);
},
error
:
()
=>
{
...
...
@@ -117,6 +130,12 @@ const UpdateDirectoryModal = (props) => {
}
}
const
reset
=
()
=>
{
setIsThemeAdd
(
false
);
setDir
(
undefined
);
form
.
resetFields
();
}
const
onReset
=
()
=>
{
if
(
action
===
'add'
)
{
setIsThemeAdd
(
false
);
...
...
@@ -134,7 +153,10 @@ const UpdateDirectoryModal = (props) => {
const
onValuesChange
=
(
changedValues
,
allValues
)
=>
{
if
(
action
===
'add'
)
{
if
(
changedValues
.
type
===
'theme'
)
{
setIsThemeAdd
(
true
);
setIsThemeAdd
(
true
);
if
(
allValues
.
code
?.
length
>
3
)
{
form
.
setFieldsValue
({
code
:
''
});
}
}
else
if
(
changedValues
.
type
===
'directory'
)
{
setIsThemeAdd
(
false
);
}
...
...
@@ -158,12 +180,18 @@ const UpdateDirectoryModal = (props) => {
title=
{
'资产目录信息'
}
visible=
{
visible
}
width=
{
600
}
onCancel=
{
()
=>
{
onCancel
&&
onCancel
()
}
}
onCancel=
{
()
=>
{
reset
();
onCancel
&&
onCancel
();
}
}
footer=
{
<
Space
>
<
Button
type=
"primary"
onClick=
{
onOk
}
loading=
{
confirmLoading
}
>
提交
</
Button
>
<
Button
onClick=
{
onReset
}
>
重置
</
Button
>
<
Button
onClick=
{
()
=>
onCancel
&&
onCancel
()
}
>
返回
</
Button
>
<
Button
onClick=
{
()
=>
{
reset
();
onCancel
&&
onCancel
();
}
}
>
返回
</
Button
>
</
Space
>
}
>
...
...
@@ -203,7 +231,7 @@ const UpdateDirectoryModal = (props) => {
name=
"code"
rules=
{
[{
required
:
true
,
message
:
'必填项'
}]
}
>
<
Input
placeholder=
"请输入编号"
disabled=
{
action
!==
'add'
}
/>
<
Input
placeholder=
"请输入编号"
disabled=
{
action
!==
'add'
}
maxLength=
{
codeRestrict
?
3
:
null
}
/>
</
Form
.
Item
>
<
Form
.
Item
label=
"名称"
...
...
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