mirror of
				https://github.com/continew-org/continew-admin-ui.git
				synced 2025-11-04 10:57:08 +08:00 
			
		
		
		
	fix(system/role): 修复角色权限禁用逻辑
This commit is contained in:
		@@ -295,23 +295,28 @@ const save = async () => {
 | 
				
			|||||||
const showCheckedAll = ref(true)
 | 
					const showCheckedAll = ref(true)
 | 
				
			||||||
// 加载角色详情
 | 
					// 加载角色详情
 | 
				
			||||||
const fetchRole = async (id: string) => {
 | 
					const fetchRole = async (id: string) => {
 | 
				
			||||||
  disabled.value = !has.hasPermOr(['system:role:updatePermission'])
 | 
					  try {
 | 
				
			||||||
  // 查询角色详情
 | 
					    loading.value = true
 | 
				
			||||||
  const { data } = await getRole(id)
 | 
					    disabled.value = !has.hasPermOr(['system:role:updatePermission'])
 | 
				
			||||||
  if (!disabled.value) {
 | 
					    // 查询角色详情
 | 
				
			||||||
    disabled.value = data.isSystem
 | 
					    const { data } = await getRole(id)
 | 
				
			||||||
 | 
					    if (!disabled.value) {
 | 
				
			||||||
 | 
					      disabled.value = data.isSystem && data.code === 'admin'
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    isCascade.value = data.menuCheckStrictly
 | 
				
			||||||
 | 
					    // 更新选中键集合
 | 
				
			||||||
 | 
					    selectedKeys.value = new Set(data.menuIds)
 | 
				
			||||||
 | 
					    // 更新表格数据的选中状态
 | 
				
			||||||
 | 
					    updateTableDataCheckedStatus(tableData.value, data.menuIds)
 | 
				
			||||||
 | 
					    // 手动设置表格行的选中状态,确保组件响应
 | 
				
			||||||
 | 
					    await nextTick(() => {
 | 
				
			||||||
 | 
					      tableRef.value?.tableRef?.selectAll(false)
 | 
				
			||||||
 | 
					      tableRef.value?.tableRef?.select(data.menuIds, true)
 | 
				
			||||||
 | 
					      showCheckedAll.value = !disabled.value
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					  } finally {
 | 
				
			||||||
 | 
					    loading.value = false
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  isCascade.value = data.menuCheckStrictly
 | 
					 | 
				
			||||||
  // 更新选中键集合
 | 
					 | 
				
			||||||
  selectedKeys.value = new Set(data.menuIds)
 | 
					 | 
				
			||||||
  // 更新表格数据的选中状态
 | 
					 | 
				
			||||||
  updateTableDataCheckedStatus(tableData.value, data.menuIds)
 | 
					 | 
				
			||||||
  // 手动设置表格行的选中状态,确保组件响应
 | 
					 | 
				
			||||||
  await nextTick(() => {
 | 
					 | 
				
			||||||
    tableRef.value?.tableRef?.selectAll(false)
 | 
					 | 
				
			||||||
    tableRef.value?.tableRef?.select(data.menuIds, true)
 | 
					 | 
				
			||||||
    showCheckedAll.value = !disabled.value
 | 
					 | 
				
			||||||
  })
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 刷新
 | 
					// 刷新
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user