Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
bkunyun
Project
Project
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
Administrator
bkunyun
Commits
665afd03
Commit
665afd03
authored
Jul 28, 2022
by
chenshouchao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 删除项目功能打开弹窗时重置表单
parent
91bb6816
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
26 deletions
+38
-26
index.tsx
src/views/Project/ProjectSetting/BaseInfo/index.tsx
+38
-26
No files found.
src/views/Project/ProjectSetting/BaseInfo/index.tsx
View file @
665afd03
...
@@ -23,7 +23,7 @@ import InformationDisplay from "@/components/CommonComponents/InformationDisplay
...
@@ -23,7 +23,7 @@ import InformationDisplay from "@/components/CommonComponents/InformationDisplay
import
classnames
from
"classnames"
;
import
classnames
from
"classnames"
;
import
{
TextField
}
from
"@mui/material"
;
import
{
TextField
}
from
"@mui/material"
;
import
LoadingButton
from
"@mui/lab/LoadingButton"
;
import
LoadingButton
from
"@mui/lab/LoadingButton"
;
import
InputAdornment
from
'@mui/material/InputAdornment'
;
import
InputAdornment
from
"@mui/material/InputAdornment"
;
import
{
useMessage
}
from
"@/components/MySnackbar"
;
import
{
useMessage
}
from
"@/components/MySnackbar"
;
import
Loading
from
"@/views/Loading"
;
import
Loading
from
"@/views/Loading"
;
import
MyDialog
from
"@/components/mui/MyDialog"
;
import
MyDialog
from
"@/components/mui/MyDialog"
;
...
@@ -59,6 +59,13 @@ const BaseInfo = observer(() => {
...
@@ -59,6 +59,13 @@ const BaseInfo = observer(() => {
).
name
;
).
name
;
// 弹窗显示控制
// 弹窗显示控制
const
[
dialogOpen
,
setDialogOpen
]
=
useState
(
false
);
const
[
dialogOpen
,
setDialogOpen
]
=
useState
(
false
);
// 打开弹窗时重置表单
useEffect
(()
=>
{
if
(
dialogOpen
)
{
setDeleteProjectName
(
""
);
}
},
[
dialogOpen
]);
// 是否拥有编辑权限
// 是否拥有编辑权限
const
hasEditAuth
=
useMemo
(()
=>
{
const
hasEditAuth
=
useMemo
(()
=>
{
if
(
!
currentUserName
)
{
if
(
!
currentUserName
)
{
...
@@ -75,7 +82,10 @@ const BaseInfo = observer(() => {
...
@@ -75,7 +82,10 @@ const BaseInfo = observer(() => {
},
[
currentUserName
,
projectInfo
]);
},
[
currentUserName
,
projectInfo
]);
const
{
run
,
loading
}
=
useMyRequest
(
getProject
,
{
const
{
run
,
loading
}
=
useMyRequest
(
getProject
,
{
onSuccess
:
(
result
:
any
)
=>
{
onSuccess
:
(
result
:
any
)
=>
{
setProjectInfo
({
...
result
.
data
,
projectBudget
:
result
.
data
.
projectBudget
.
toFixed
(
2
)
});
setProjectInfo
({
...
result
.
data
,
projectBudget
:
result
.
data
.
projectBudget
.
toFixed
(
2
),
});
},
},
});
});
useEffect
(()
=>
{
useEffect
(()
=>
{
...
@@ -185,41 +195,41 @@ const BaseInfo = observer(() => {
...
@@ -185,41 +195,41 @@ const BaseInfo = observer(() => {
};
};
const
budgetChange
=
(
e
:
any
)
=>
{
const
budgetChange
=
(
e
:
any
)
=>
{
let
inputValue
=
e
.
target
.
value
.
replace
(
'.'
,
''
)
let
inputValue
=
e
.
target
.
value
.
replace
(
"."
,
""
);
if
(
inputValue
.
indexOf
(
'.'
)
!==
-
1
)
{
if
(
inputValue
.
indexOf
(
"."
)
!==
-
1
)
{
setBudgetCheck
({
setBudgetCheck
({
error
:
true
,
error
:
true
,
help
:
"格式错误,请输入正确的金额,可精确至分(两位小数)"
,
help
:
"格式错误,请输入正确的金额,可精确至分(两位小数)"
,
});
});
return
return
;
}
}
if
(
isNaN
(
Number
(
inputValue
)))
{
if
(
isNaN
(
Number
(
inputValue
)))
{
setBudgetCheck
({
setBudgetCheck
({
error
:
true
,
error
:
true
,
help
:
"格式错误,请输入正确的金额,可精确至分(两位小数)"
,
help
:
"格式错误,请输入正确的金额,可精确至分(两位小数)"
,
});
});
return
return
;
}
else
{
}
else
{
setProjectInfo
({
setProjectInfo
({
...
projectInfo
,
...
projectInfo
,
projectBudget
:
e
.
target
.
value
projectBudget
:
e
.
target
.
value
,
})
})
;
setBudgetCheck
({
setBudgetCheck
({
error
:
false
,
error
:
false
,
help
:
""
,
help
:
""
,
});
});
}
}
}
}
;
const
budgetBlur
=
(
e
:
any
)
=>
{
const
budgetBlur
=
(
e
:
any
)
=>
{
setProjectInfo
({
setProjectInfo
({
...
projectInfo
,
...
projectInfo
,
projectBudget
:
Number
(
e
.
target
.
value
).
toFixed
(
2
)
projectBudget
:
Number
(
e
.
target
.
value
).
toFixed
(
2
)
,
})
})
;
setBudgetCheck
({
setBudgetCheck
({
error
:
false
,
error
:
false
,
help
:
""
,
help
:
""
,
});
});
}
}
;
const
{
run
:
updateProjectRun
,
loading
:
updateLoading
}
=
useMyRequest
(
const
{
run
:
updateProjectRun
,
loading
:
updateLoading
}
=
useMyRequest
(
updateProject
,
updateProject
,
...
@@ -312,9 +322,9 @@ const BaseInfo = observer(() => {
...
@@ -312,9 +322,9 @@ const BaseInfo = observer(() => {
size=
"small"
size=
"small"
sx=
{
{
sx=
{
{
width
:
"560px"
,
width
:
"560px"
,
'& .MuiOutlinedInput-root'
:
{
"& .MuiOutlinedInput-root"
:
{
height
:
'36px'
height
:
"36px"
,
}
}
,
}
}
}
}
/>
/>
{
/* <input
{
/* <input
...
@@ -390,12 +400,14 @@ const BaseInfo = observer(() => {
...
@@ -390,12 +400,14 @@ const BaseInfo = observer(() => {
size=
"small"
size=
"small"
sx=
{
{
sx=
{
{
width
:
"560px"
,
width
:
"560px"
,
'& .MuiOutlinedInput-root'
:
{
"& .MuiOutlinedInput-root"
:
{
height
:
'36px'
height
:
"36px"
,
}
}
,
}
}
}
}
InputProps=
{
{
InputProps=
{
{
startAdornment
:
<
InputAdornment
position=
"start"
>
¥
</
InputAdornment
>,
startAdornment
:
(
<
InputAdornment
position=
"start"
>
¥
</
InputAdornment
>
),
}
}
}
}
/>
/>
</
div
>
</
div
>
...
@@ -426,15 +438,15 @@ const BaseInfo = observer(() => {
...
@@ -426,15 +438,15 @@ const BaseInfo = observer(() => {
删除项目将删除其存储的数据和所有相关资源,并且已删除的项目无法恢复!请谨慎操作!
删除项目将删除其存储的数据和所有相关资源,并且已删除的项目无法恢复!请谨慎操作!
</
div
>
</
div
>
<
MyButton
<
MyButton
text=
'删除项目'
text=
"删除项目"
variant=
"contained"
variant=
"contained"
onClick=
{
()
=>
setDialogOpen
(
true
)
}
onClick=
{
()
=>
setDialogOpen
(
true
)
}
color=
'error'
color=
"error"
// style={{
// style={{
// backgroundColor: "#fff",
// backgroundColor: "#fff",
// color: "#FF4E4E",
// color: "#FF4E4E",
// border: "1px solid #FF4E4E",
// border: "1px solid #FF4E4E",
// }}
// }}
/>
/>
</
div
>
</
div
>
<
MyDialog
<
MyDialog
...
...
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