Commit ab5e1594 authored by 前端-陈智峰's avatar 前端-陈智峰

fix: 权限问题

parent 26cb711e
...@@ -38,7 +38,7 @@ const SetMemberAuth: React.FC<{}> = () => { ...@@ -38,7 +38,7 @@ const SetMemberAuth: React.FC<{}> = () => {
// 编辑和预览模式下需回显数据 // 编辑和预览模式下需回显数据
const fetchRoleDetail = async () => { const fetchRoleDetail = async () => {
// 10秒缓存 // 10秒缓存
const res = await getMemberPlatformRoleAuthTree({roleId: id,source}, { useCache: true, ttl: 10 * 1000 }) const res = await getMemberPlatformRoleAuthTree({roleId: id,source})
setCheckedIds(() => [...res['data']['checkIds']]) setCheckedIds(() => [...res['data']['checkIds']])
return res return res
} }
...@@ -78,13 +78,22 @@ const SetMemberAuth: React.FC<{}> = () => { ...@@ -78,13 +78,22 @@ const SetMemberAuth: React.FC<{}> = () => {
source, source,
fetchItemDetailData, fetchItemDetailData,
}) })
const resset= ()=>{
setFormValue(null)
setButtonInfos([])
setCheckedIds([])
setDataExpand([])
setDataSource([])
}
useEffect(() => { useEffect(() => {
resset()
if (!id) return ; if (!id) return ;
fetchRoleDetail().then(res => { fetchRoleDetail().then(res => {
const { data } = res const { data } = res
setFormValue(data) setFormValue(data)
}) })
}, []) }, [source])
//fix: 按钮权限不显示问题 //fix: 按钮权限不显示问题
const formInitValue = nodeRecord ? getTreeMaps(nodeRecord.key) : null const formInitValue = nodeRecord ? getTreeMaps(nodeRecord.key) : null
...@@ -219,8 +228,6 @@ const SetMemberAuth: React.FC<{}> = () => { ...@@ -219,8 +228,6 @@ const SetMemberAuth: React.FC<{}> = () => {
// 菜单是否全选 // 菜单是否全选
const isAllCheckedMenu = (treeKeys.length === allTreeDataRef.current?.length) && (treeKeys.length !== checkedIds.length) const isAllCheckedMenu = (treeKeys.length === allTreeDataRef.current?.length) && (treeKeys.length !== checkedIds.length)
console.log(currentAuthBtnKeys, nodeRecord, formInitValue, allTreeDataRef.current, treeKeys)
// 展开数据与权限变动数据 整合 // 展开数据与权限变动数据 整合
const ids = _expand.map(item => item['menuId']) const ids = _expand.map(item => item['menuId'])
const params = _source.filter(item => item.changed).map(item => { const params = _source.filter(item => item.changed).map(item => {
...@@ -261,9 +268,6 @@ const SetMemberAuth: React.FC<{}> = () => { ...@@ -261,9 +268,6 @@ const SetMemberAuth: React.FC<{}> = () => {
// 更新角色权限 // 更新角色权限
await postMemberPlatformRoleAuthUpdate(args) await postMemberPlatformRoleAuthUpdate(args)
console.log(dataExpand, dataSource, params, 'params', args)
setLoading(false) setLoading(false)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment