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
f200bd01
Commit
f200bd01
authored
Jun 07, 2024
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fix
parent
62ff8beb
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
9 deletions
+30
-9
update-branch.jsx
src/view/Manage/Model/Component/update-branch.jsx
+30
-9
No files found.
src/view/Manage/Model/Component/update-branch.jsx
View file @
f200bd01
...
@@ -12,8 +12,10 @@ import { showMessage } from '../../../../util'
...
@@ -12,8 +12,10 @@ import { showMessage } from '../../../../util'
const
FC
=
(
props
)
=>
{
const
FC
=
(
props
)
=>
{
const
{
visible
,
type
,
item
,
onCancel
}
=
props
const
{
visible
,
type
,
item
,
onCancel
}
=
props
const
[
loading
,
setLoading
]
=
React
.
useState
(
false
)
const
[
loading
,
setLoading
]
=
React
.
useState
(
false
)
const
[
loadingUser
,
setLoadingUser
]
=
React
.
useState
(
false
)
const
[
waiting
,
setWaiting
]
=
React
.
useState
(
false
)
const
[
waiting
,
setWaiting
]
=
React
.
useState
(
false
)
const
[
branch
,
setBranch
]
=
React
.
useState
()
const
[
branch
,
setBranch
]
=
React
.
useState
()
const
[
user
,
setUser
]
=
React
.
useState
()
const
basicRef
=
React
.
useRef
()
const
basicRef
=
React
.
useRef
()
...
@@ -21,6 +23,10 @@ const FC = (props) => {
...
@@ -21,6 +23,10 @@ const FC = (props) => {
if
(
visible
&&
type
===
'update'
)
{
if
(
visible
&&
type
===
'update'
)
{
getBranch
()
getBranch
()
}
}
if
(
visible
)
{
getUser
()
}
},
[
visible
,
type
])
},
[
visible
,
type
])
const
title
=
React
.
useMemo
(()
=>
{
const
title
=
React
.
useMemo
(()
=>
{
...
@@ -30,6 +36,20 @@ const FC = (props) => {
...
@@ -30,6 +36,20 @@ const FC = (props) => {
return
''
return
''
},
[
type
])
},
[
type
])
const
getUser
=
()
=>
{
setLoadingUser
(
true
)
dispatch
({
type
:
'user.fetchSessionInfo'
,
callback
:
(
data
)
=>
{
setLoadingUser
(
false
)
setUser
(
data
)
},
error
:
()
=>
{
setLoadingUser
(
false
)
}
})
}
const
getBranch
=
()
=>
{
const
getBranch
=
()
=>
{
setLoading
(
true
)
setLoading
(
true
)
dispatch
({
dispatch
({
...
@@ -49,8 +69,10 @@ const FC = (props) => {
...
@@ -49,8 +69,10 @@ const FC = (props) => {
const
close
=
(
val
)
=>
{
const
close
=
(
val
)
=>
{
setLoading
(
false
)
setLoading
(
false
)
setLoadingUser
(
false
)
setWaiting
(
false
)
setWaiting
(
false
)
setBranch
()
setBranch
()
setUser
()
onCancel
?.(
val
)
onCancel
?.(
val
)
}
}
...
@@ -103,8 +125,8 @@ const FC = (props) => {
...
@@ -103,8 +125,8 @@ const FC = (props) => {
centered
destroyOnClose
centered
destroyOnClose
onCancel=
{
()
=>
{
close
()
}
}
onCancel=
{
()
=>
{
close
()
}
}
>
>
<
Spin
spinning=
{
loading
||
waiting
}
>
<
Spin
spinning=
{
loading
||
loadingUser
||
waiting
}
>
<
Basic
ref=
{
basicRef
}
type=
{
type
}
item=
{
branch
}
/>
<
Basic
ref=
{
basicRef
}
type=
{
type
}
item=
{
branch
}
user=
{
user
}
/>
</
Spin
>
</
Spin
>
</
Modal
>
</
Modal
>
)
)
...
@@ -112,22 +134,21 @@ const FC = (props) => {
...
@@ -112,22 +134,21 @@ const FC = (props) => {
export
default
FC
export
default
FC
const
Basic
=
React
.
forwardRef
(
function
({
type
,
item
},
ref
)
{
const
Basic
=
React
.
forwardRef
(
function
({
type
,
item
,
user
},
ref
)
{
const
[
loadingUsers
,
setLoadingUsers
]
=
React
.
useState
(
false
)
const
[
loadingUsers
,
setLoadingUsers
]
=
React
.
useState
(
false
)
const
[
users
,
setUsers
]
=
React
.
useState
()
const
[
users
,
setUsers
]
=
React
.
useState
()
const
[
form
]
=
Form
.
useForm
()
const
[
form
]
=
Form
.
useForm
()
const
app
=
React
.
useContext
(
AppContext
)
React
.
useImperativeHandle
(
ref
,
()
=>
({
React
.
useImperativeHandle
(
ref
,
()
=>
({
validate
:
async
()
=>
{
validate
:
async
()
=>
{
let
rows
=
await
form
.
validateFields
()
let
rows
=
await
form
.
validateFields
()
if
(
type
===
'add'
)
{
if
(
type
===
'add'
)
{
let
newMembers
=
[...
rows
.
members
??[]].
filter
(
item
=>
item
.
id
!==
app
?.
user
?.
userId
)
let
newMembers
=
[...
rows
.
members
??[]].
filter
(
item
=>
item
.
id
!==
user
?.
userId
)
newMembers
=
[
newMembers
=
[
{
{
admin
:
true
,
admin
:
true
,
id
:
app
?.
user
?.
userId
,
id
:
user
?.
userId
,
name
:
app
?.
user
?.
userName
,
name
:
user
?.
userName
,
},
},
...(
newMembers
.
map
(
item
=>
({
...(
newMembers
.
map
(
item
=>
({
admin
:
false
,
admin
:
false
,
...
@@ -157,7 +178,7 @@ const Basic = React.forwardRef(function ({ type, item }, ref) {
...
@@ -157,7 +178,7 @@ const Basic = React.forwardRef(function ({ type, item }, ref) {
}
}
return
rows
return
rows
},
},
}),
[
form
,
type
,
users
])
}),
[
form
,
type
,
user
,
user
s
])
React
.
useEffect
(()
=>
{
React
.
useEffect
(()
=>
{
getUsers
()
getUsers
()
...
@@ -231,7 +252,7 @@ const Basic = React.forwardRef(function ({ type, item }, ref) {
...
@@ -231,7 +252,7 @@ const Basic = React.forwardRef(function ({ type, item }, ref) {
rules=
{
[{
required
:
(
type
===
'update'
),
message
:
'请选择项目负责人!'
}]
}
rules=
{
[{
required
:
(
type
===
'update'
),
message
:
'请选择项目负责人!'
}]
}
>
>
{
{
type
===
'add'
?
<
span
>
{
app
?.
user
?.
userName
}
</
span
>
:
<
UsersItem
loading=
{
loadingUsers
}
users=
{
users
}
/>
type
===
'add'
?
<
span
>
{
user
?.
userName
}
</
span
>
:
<
UsersItem
loading=
{
loadingUsers
}
users=
{
users
}
/>
}
}
</
Form
.
Item
>
</
Form
.
Item
>
<
Form
.
Item
<
Form
.
Item
...
...
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