fix: menu order error

This commit is contained in:
chansee97 2025-09-16 22:37:06 +08:00
parent d400ebedc0
commit ecb880b177
3 changed files with 9 additions and 10 deletions

View File

@ -1,7 +1,7 @@
/// <reference path="../../typings/global.d.ts" />
import type { MenuOption } from 'naive-ui'
import { $t, renderIcon } from '@/utils'
import { clone, isEmpty, min, pick } from 'radash'
import { clone, isEmpty, isNumber, min, pick } from 'radash'
import { RouterLink } from 'vue-router'
import arrayToTree from 'array-to-tree'
@ -98,13 +98,11 @@ function transformAuthRoutesToMenus(userRoutes: Entity.Menu[]) {
.filter(route => route.menuVisible !== false)
// Sort the menu according to the order size
.sort((a, b) => {
if (a.sort && b.sort)
return a.sort - b.sort
else if (a.sort)
return -1
else if (b.sort)
return 1
else return 0
const aHas = isNumber(a.sort)
const bHas = isNumber(b.sort)
if (aHas && bHas)
return (a.sort as number) - (b.sort as number)
return 0
})
// Convert to side menu data structure
.map((item) => {

View File

@ -6,7 +6,7 @@ import { renderProCopyableText } from 'pro-naive-ui'
// 登录日志搜索表单数据类型
export interface LoginLogSearchFormData {
ipaddr?: string
userName?: string
username?: string
status?: number
loginTime?: string
}
@ -47,7 +47,7 @@ export const searchColumns: ProSearchFormColumns<LoginLogSearchFormData> = [
field: 'date-time-range',
fieldProps: {
clearable: true,
format: 'yyyy-MM-dd HH:mm:ss',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
defaultTime: ['00:00:00', '23:59:59'],
},

View File

@ -152,6 +152,7 @@ defineExpose({
title="父级目录"
path="parentId"
:field-props="{
clearable: true,
options: treeData,
keyField: 'value',
}"