Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CivManage
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
ReactWeb5
CivManage
Commits
6e9b4a0c
Commit
6e9b4a0c
authored
4 years ago
by
张烨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: value callback return values
parent
97edfa8c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
61 additions
and
28 deletions
+61
-28
ListCard.jsx
src/pages/orgnazation/ListCard.jsx
+8
-10
listCardItem.jsx
src/pages/orgnazation/listCardItem.jsx
+11
-4
UserManage.js
src/pages/userCenter/UserManage.js
+18
-12
SiteManage.jsx
src/pages/userCenter/siteManage/SiteManage.jsx
+2
-2
api.js
src/services/userCenter/userManage/api.js
+22
-0
No files found.
src/pages/orgnazation/ListCard.jsx
View file @
6e9b4a0c
...
...
@@ -7,16 +7,16 @@ import { orgTest } from '@/services/orgnazation/api';
const
tip
=
'loading...'
;
const
ListCard
=
props
=>
{
const
{
ouid
,
searchWord
,
valueCallback
}
=
props
;
const
[
valueList
,
setValueList
]
=
useState
(
[]
);
const
[
valueList
,
setValueList
]
=
useState
(
{}
);
const
[
dataList
,
setdataList
]
=
useState
([]);
const
[
loading
,
setLoading
]
=
useState
(
true
);
const
callbackValue
=
useRef
([]);
const
getValueCallback
=
useCallback
((
value
,
index
)
=>
{
console
.
log
(
value
,
index
);
setValueList
((
valueList
[
index
]
=
value
));
callbackValue
.
current
=
valueList
;
console
.
log
(
valueList
,
'valueList'
);
valueList
[
index
]
=
value
;
setValueList
({
...
valueList
});
valueCallback
({
...
valueList
});
},
[]);
useEffect
(()
=>
{
setLoading
(
true
);
const
defaultConfig
=
{
...
...
@@ -34,8 +34,9 @@ const ListCard = props => {
.
then
(
res
=>
{
setLoading
(
false
);
const
list
=
[];
// eslint-disable-next-line no-unused-expressions
res
&&
res
.
map
(
item
=>
{
res
.
forEach
(
item
=>
{
list
.
push
({
...
defaultConfig
,
...
item
});
});
setdataList
(
list
);
...
...
@@ -48,9 +49,6 @@ const ListCard = props => {
// orgTest().then(res =>{
// console.log(res,'res')
// })
return
()
=>
{
callbackValue
.
current
=
[];
};
},
[
ouid
]);
return
(
<
div
>
...
...
This diff is collapsed.
Click to expand it.
src/pages/orgnazation/listCardItem.jsx
View file @
6e9b4a0c
...
...
@@ -41,8 +41,12 @@ const ListCardItem = props => {
arr2
.
push
(
item
.
userID
||
item
.
roleID
||
item
.
stationID
);
}
});
setIndeterminate
(
userList
.
some
(
u
=>
u
.
isChecked
));
setAllChecked
(
userList
.
every
(
u
=>
u
.
isChecked
));
// eslint-disable-next-line no-unused-expressions
getValueCallback
&&
getValueCallback
(
arr2
,
itemid
);
const
all
=
userList
.
every
(
u
=>
u
.
isChecked
);
setIndeterminate
(
!
all
&&
userList
.
some
(
u
=>
u
.
isChecked
));
setAllChecked
(
all
);
setCheckList
(
arr2
);
},
[
userList
]);
...
...
@@ -55,7 +59,8 @@ const ListCardItem = props => {
}
setIndeterminate
(
false
);
setCheckList
(
arr
);
getValueCallback
(
arr
,
itemid
);
// eslint-disable-next-line no-unused-expressions
getValueCallback
&&
getValueCallback
(
arr
,
itemid
);
};
const
handleChecked
=
e
=>
{
...
...
@@ -64,7 +69,9 @@ const ListCardItem = props => {
setIndeterminate
(
!!
e
.
length
&&
e
.
length
<
defaultList
.
length
);
getValueCallback
(
e
,
itemid
);
};
if
(
defaultList
.
length
===
0
)
{
return
null
;
}
return
(
<>
<
div
className=
{
`${styles.divBox}`
}
>
...
...
This diff is collapsed.
Click to expand it.
src/pages/userCenter/UserManage.js
View file @
6e9b4a0c
...
...
@@ -46,10 +46,10 @@ import {
setUserState
as
postSetUserState
,
editUser
as
postEditUser
,
updateUserPassword
,
setUserRelation
,
}
from
'@/services/userCenter/userManage/api'
;
const
UserManage
=
()
=>
{
const
time
=
new
Date
();
const
[
treeLoading
,
setTreeLoading
]
=
useState
(
false
);
const
[
tableLoading
,
setTableLoading
]
=
useState
(
false
);
const
[
loading
,
setLoading
]
=
useState
(
true
);
...
...
@@ -79,10 +79,10 @@ const UserManage = () => {
const
[
newOrgID
,
setNewOrgID
]
=
useState
();
const
[
currentUser
,
setCurrentUser
]
=
useState
({});
const
[
rolelist
,
setRolelist
]
=
useState
([]);
const
[
stationlist
,
setStationlist
]
=
useState
([]);
const
[
valueList
,
setRoleValueList
]
=
useState
([]);
const
[
stationValueList
,
setStationValueList
]
=
useState
([]);
const
[
roleValueList
,
setRoleValueList
]
=
useState
({});
const
[
stationValueList
,
setStationValueList
]
=
useState
({});
const
[
searchUserForm
]
=
Form
.
useForm
();
const
[
addUserForm
]
=
Form
.
useForm
();
...
...
@@ -93,15 +93,13 @@ const UserManage = () => {
const
{
TabPane
}
=
Tabs
;
const
getRoleValueCallback
=
useCallback
((
value
,
index
)
=>
{
const
result
=
[...
valueList
];
result
[
index
]
=
value
;
setRoleValueList
(
result
);
roleValueList
[
index
]
=
value
;
setRoleValueList
({
...
roleValueList
});
},
[]);
const
getStationValueCallback
=
useCallback
((
value
,
index
)
=>
{
const
result
=
[...
stationValueList
];
result
[
index
]
=
value
;
setStationValueList
(
result
);
stationValueList
[
index
]
=
value
;
setStationValueList
({
...
stationValueList
});
},
[]);
// 用户表列名
...
...
@@ -533,7 +531,15 @@ const UserManage = () => {
});
};
const
submitRole
=
()
=>
{
addToOrg
(
currentUser
.
userID
,
orgID
,
newOrgID
)
setUserRelation
(
currentUser
.
userID
,
Object
.
keys
(
roleValueList
)
.
map
(
k
=>
roleValueList
[
k
])
.
flat
(),
Object
.
keys
(
stationValueList
)
.
map
(
k
=>
stationValueList
[
k
])
.
flat
(),
)
.
then
(
res
=>
{
if
(
res
.
success
)
{
setChangeOrgVisible
(
false
);
...
...
@@ -872,7 +878,7 @@ const UserManage = () => {
<
Modal
title
=
"用户关联"
visible
=
{
roleVisible
}
//
onOk={submitRole}
onOk
=
{
submitRole
}
onCancel
=
{()
=>
setRoleVisible
(
false
)}
okText
=
"确认"
cancelText
=
"取消"
...
...
This diff is collapsed.
Click to expand it.
src/pages/userCenter/siteManage/SiteManage.jsx
View file @
6e9b4a0c
...
...
@@ -134,8 +134,8 @@ const SiteManage = () => {
setEditVisible
(
false
);
setFlag
(
flag
+
1
);
};
const
valueCallback
=
props
=>
{
console
.
log
(
props
);
const
valueCallback
=
valueOBJ
=>
{
console
.
log
(
valueOBJ
);
};
return
(
<
PageContainer
>
...
...
This diff is collapsed.
Click to expand it.
src/services/userCenter/userManage/api.js
View file @
6e9b4a0c
...
...
@@ -132,3 +132,25 @@ export const deleteUser = userID =>
_dc
:
Date
.
now
(),
userID
,
});
export
const
setUserRelation
=
(
userID
,
roleList
=
[],
stationList
)
=>
{
const
formData
=
new
FormData
();
formData
.
append
(
'userID'
,
userID
);
formData
.
append
(
'roleList'
,
`
${
roleList
.
join
(
','
)}
,`
);
formData
.
append
(
'stationList'
,
stationList
.
length
?
`
${
stationList
.
join
(
','
)}
,`
:
''
,
);
formData
.
append
(
'headList'
,
''
);
formData
.
append
(
'mobileMapList'
,
''
);
formData
.
append
(
'currentSolution'
,
'熊猫智慧水务平台'
);
return
post
(
`/Cityinterface/rest/services/OMS.svc/U_SetUserRelationList?_version=9999`
,
formData
,
{
headers
:
{
'Content-Type'
:
'application/x-www-form-urlencoded'
,
},
},
);
};
This diff is collapsed.
Click to expand it.
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