fix(role): 修复角色管理页面中雪花ID精度丢失问题

- 修复handleConfirmAssignMenu函数,保持字符串格式避免Number转换
- 修复handleRowSelectionChange函数,使用字符串比较避免精度丢失
- 移除菜单权限分配中的Number.parseInt转换,保持字符串格式
- 确保角色ID在整个权限分配流程中保持字符串格式

解决问题:
- 部门管理等新菜单权限无法保存的问题
- 雪花ID在前端处理时精度丢失导致的数据不匹配

影响文件:
- src/views/system/role/index.vue
This commit is contained in:
Leo 2025-07-09 16:45:31 +08:00
parent f5b06cb9b9
commit 4264ef36b7

View File

@ -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('菜单权限分配成功')