fix(role): 修复角色管理页面中雪花ID精度丢失问题
- 修复handleConfirmAssignMenu函数,保持字符串格式避免Number转换 - 修复handleRowSelectionChange函数,使用字符串比较避免精度丢失 - 移除菜单权限分配中的Number.parseInt转换,保持字符串格式 - 确保角色ID在整个权限分配流程中保持字符串格式 解决问题: - 部门管理等新菜单权限无法保存的问题 - 雪花ID在前端处理时精度丢失导致的数据不匹配 影响文件: - src/views/system/role/index.vue
This commit is contained in:
parent
f5b06cb9b9
commit
4264ef36b7
@ -816,8 +816,9 @@ async function handleReset() {
|
||||
|
||||
// 行选择变化
|
||||
function handleRowSelectionChange(rowKeys: (string | number)[]) {
|
||||
const numericKeys = rowKeys.map(key => typeof key === 'string' ? Number.parseInt(key) : key)
|
||||
selectedRows.value = tableData.value.filter(row => numericKeys.includes(row.roleId))
|
||||
// 保持字符串格式避免精度丢失
|
||||
const stringKeys = rowKeys.map(key => String(key))
|
||||
selectedRows.value = tableData.value.filter(row => stringKeys.includes(String(row.roleId)))
|
||||
}
|
||||
|
||||
// 批量修改(选中一个角色进行修改)
|
||||
@ -1078,9 +1079,8 @@ async function handleConfirmAssignMenu() {
|
||||
// 确保选中子菜单时父菜单也被包含
|
||||
const completeMenuIds = ensureParentMenusIncluded(checkedKeys.value, menuData.value)
|
||||
|
||||
// 将字符串格式的key转换为数字格式发送给后端
|
||||
const menuIds = completeMenuIds.map(key => Number.parseInt(String(key)))
|
||||
const response = await saveRoleMenuPermission(currentAssignRole.value.roleId, menuIds)
|
||||
// 保持字符串格式避免精度丢失
|
||||
const response = await saveRoleMenuPermission(String(currentAssignRole.value.roleId), completeMenuIds)
|
||||
|
||||
if (response.isSuccess) {
|
||||
coiMsgSuccess('菜单权限分配成功')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user