Commit 58cdc0be132964df2997195674a32aed915ca843

Authored by xingyu
1 parent 340790de

fix: fix menu active bug

sql/mysql/vue3-menu.sql
... ... @@ -257,7 +257,7 @@ INSERT INTO `system_menu` VALUES (1264, '客户端查询', 'system:oauth2-client
257 257 INSERT INTO `system_menu` VALUES (1265, '客户端创建', 'system:oauth2-client:create', 3, 2, 1263, '', '', '', 0, b'1', b'1', '', '2022-05-10 16:26:33', '1', '2022-05-11 00:31:23', b'0');
258 258 INSERT INTO `system_menu` VALUES (1266, '客户端更新', 'system:oauth2-client:update', 3, 3, 1263, '', '', '', 0, b'1', b'1', '', '2022-05-10 16:26:33', '1', '2022-05-11 00:31:28', b'0');
259 259 INSERT INTO `system_menu` VALUES (1267, '客户端删除', 'system:oauth2-client:delete', 3, 4, 1263, '', '', '', 0, b'1', b'1', '', '2022-05-10 16:26:33', '1', '2022-05-11 00:31:33', b'0');
260   -INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1281, '可视化报表', '', 1, 12, 0, '/visualization', 'chart', NULL, 0, b'1', b'1', '1', '2022-07-10 20:22:15', '1', '2022-07-10 20:33:30', b'0');
261   -INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1282, '积木报表', '', 2, 1, 1281, 'jimu-report', 'example', 'visualization/jmreport/index', 0, b'1', b'1', '1', '2022-07-10 20:26:36', '1', '2022-07-28 21:17:34', b'0');
  260 +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1281, '可视化报表', '', 1, 12, 0, '/visualization', 'ep:histogram', NULL, 0, b'1', b'1', '1', '2022-07-10 20:22:15', '1', '2022-07-10 20:33:30', b'0');
  261 +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1282, '积木报表', '', 2, 1, 1281, 'jimu-report', 'ep:histogram', 'visualization/jmreport/index', 0, b'1', b'1', '1', '2022-07-10 20:26:36', '1', '2022-07-28 21:17:34', b'0');
262 262  
263 263 SET FOREIGN_KEY_CHECKS = 1;
... ...
yudao-ui-admin-vue3/src/api/infra/codegen/types.ts
1 1 export type CodegenTableVO = {
  2 + id: number
2 3 tableId: number
3 4 isParentMenuIdValid: boolean
4 5 dataSourceConfigId: number
... ...
yudao-ui-admin-vue3/src/components/Menu/src/Menu.vue
... ... @@ -94,8 +94,8 @@ export default defineComponent({
94 94 >
95 95 {{
96 96 default: () => {
97   - const { renderMenuItem } = useRenderMenuItem(unref(routers), unref(menuMode))
98   - return renderMenuItem()
  97 + const { renderMenuItem } = useRenderMenuItem(unref(menuMode))
  98 + return renderMenuItem(unref(routers))
99 99 }
100 100 }}
101 101 </ElMenu>
... ...
yudao-ui-admin-vue3/src/components/Menu/src/components/useRenderMenuItem.tsx
1 1 import { ElSubMenu, ElMenuItem } from 'element-plus'
2 2 import type { RouteMeta } from 'vue-router'
3   -import { getAllParentPath, hasOneShowingChild } from '../helper'
  3 +import { hasOneShowingChild } from '../helper'
4 4 import { isUrl } from '@/utils/is'
5 5 import { useRenderMenuTitle } from './useRenderMenuTitle'
6 6 import { useDesign } from '@/hooks/web/useDesign'
7 7 import { pathResolve } from '@/utils/routerHelper'
8 8  
9 9 export const useRenderMenuItem = (
10   - allRouters: AppRouteRecordRaw[] = [],
  10 + // allRouters: AppRouteRecordRaw[] = [],
11 11 menuMode: 'vertical' | 'horizontal'
12 12 ) => {
13   - const renderMenuItem = (routers?: AppRouteRecordRaw[]) => {
14   - return (routers || allRouters).map((v) => {
  13 + const renderMenuItem = (routers: AppRouteRecordRaw[], parentPath = '/') => {
  14 + return routers.map((v) => {
15 15 const meta = (v.meta ?? {}) as RouteMeta
16 16 if (!meta.hidden) {
17 17 const { oneShowingChild, onlyOneChild } = hasOneShowingChild(v.children, v)
18   - const fullPath = isUrl(v.path)
19   - ? v.path
20   - : getAllParentPath<AppRouteRecordRaw>(allRouters, v.path).join('/')
  18 + const fullPath = isUrl(v.path) ? v.path : pathResolve(parentPath, v.path) // getAllParentPath<AppRouteRecordRaw>(allRouters, v.path).join('/')
21 19  
22 20 const { renderMenuTitle } = useRenderMenuTitle()
23 21  
... ... @@ -46,7 +44,7 @@ export const useRenderMenuItem = (
46 44 >
47 45 {{
48 46 title: () => renderMenuTitle(meta),
49   - default: () => renderMenuItem(v.children)
  47 + default: () => renderMenuItem(v.children!, fullPath)
50 48 }}
51 49 </ElSubMenu>
52 50 )
... ...
yudao-ui-admin-vue3/src/components/TagsView/src/TagsView.vue
... ... @@ -492,15 +492,12 @@ watch(
492 492 }
493 493 }
494 494  
495   - &__item + &__item {
496   - margin-left: 4px;
497   - }
498   -
499 495 &__item {
500 496 position: relative;
501 497 top: 2px;
502 498 height: calc(~'100% - 4px');
503 499 padding-right: 25px;
  500 + margin-left: 4px;
504 501 font-size: 12px;
505 502 cursor: pointer;
506 503 border: 1px solid #d9d9d9;
... ... @@ -528,6 +525,7 @@ watch(
528 525 &__item.is-active {
529 526 color: var(--el-color-white);
530 527 background-color: var(--el-color-primary);
  528 + border: 1px solid var(--el-color-primary);
531 529 .@{prefix-cls}__item--close {
532 530 :deep(span) {
533 531 color: var(--el-color-white) !important;
... ...
yudao-ui-admin-vue3/src/views/Home/Index.vue
... ... @@ -208,7 +208,12 @@ const getUserAccessSource = async () =&gt; {
208 208 'legend.data',
209 209 data.map((v) => t(v.name))
210 210 )
211   - set(pieOptionsData, 'series.data', data)
  211 + pieOptionsData!.series![0].data = data.map((v) => {
  212 + return {
  213 + name: t(v.name),
  214 + value: v.value
  215 + }
  216 + })
212 217 }
213 218 const barOptionsData = reactive<EChartsOption>(barOptions) as EChartsOption
214 219  
... ...