From 5835a2eaea51b05fe27abc722bbee8df6cebce84 Mon Sep 17 00:00:00 2001 From: bwy <87036052@qq.com> Date: Wed, 9 Oct 2024 14:39:20 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=B3=BB=E7=BB=9F=E7=BC=96=E7=A0=81?= =?UTF-8?q?=E7=AD=9B=E9=80=89=E8=8F=9C=E5=8D=95=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 3 +++ .env.production | 3 +++ src/api/menu.ts | 8 +++++--- src/api/system/menu/types.ts | 3 +++ src/store/modules/permission.ts | 2 +- src/types/element.d.ts | 2 +- src/types/env.d.ts | 1 + src/views/system/dict/data.vue | 2 +- src/views/system/menu/index.vue | 19 ++++++++++++++++--- 9 files changed, 34 insertions(+), 9 deletions(-) diff --git a/.env.development b/.env.development index 05d67782..fbd7edcf 100644 --- a/.env.development +++ b/.env.development @@ -30,3 +30,6 @@ VITE_APP_CLIENT_ID = 'e5cd7e4891bf95d1d19206ce24a7b32e' # websocket 开关 默认使用sse推送 VITE_APP_WEBSOCKET = false + +# 系统编码 +VITE_APP_SYSTEM_CODE = 'master' diff --git a/.env.production b/.env.production index c6b1f853..725cb3c4 100644 --- a/.env.production +++ b/.env.production @@ -33,3 +33,6 @@ VITE_APP_CLIENT_ID = 'e5cd7e4891bf95d1d19206ce24a7b32e' # websocket 开关 默认使用sse推送 VITE_APP_WEBSOCKET = false + +# 系统编码 +VITE_APP_SYSTEM_CODE = 'master' diff --git a/src/api/menu.ts b/src/api/menu.ts index a3ae80e1..bb436f82 100644 --- a/src/api/menu.ts +++ b/src/api/menu.ts @@ -1,11 +1,13 @@ import request from '@/utils/request'; import { AxiosPromise } from 'axios'; import { RouteRecordRaw } from 'vue-router'; +import { MenuQuery } from '@/api/system/menu/types'; // 获取路由 -export function getRouters(): AxiosPromise { +export function getRouters(query?: MenuQuery): AxiosPromise { return request({ - url: '/system/menu/getRouters', - method: 'get' + url: '/system/menu/getRoutersMenu', + method: 'get', + params: query }); } diff --git a/src/api/system/menu/types.ts b/src/api/system/menu/types.ts index ca19840d..fd8800f4 100644 --- a/src/api/system/menu/types.ts +++ b/src/api/system/menu/types.ts @@ -23,6 +23,7 @@ export interface MenuQuery { keywords?: string; menuName?: string; status?: string; + systemCode?: string; } /** @@ -45,6 +46,7 @@ export interface MenuVO extends BaseEntity { status: string; icon: string; remark: string; + systemCode: string; } export interface MenuForm { @@ -64,6 +66,7 @@ export interface MenuForm { status?: string; icon?: string; remark?: string; + systemCode?: string; query?: string; perms?: string; } diff --git a/src/store/modules/permission.ts b/src/store/modules/permission.ts index e90df4c3..e618e1f3 100644 --- a/src/store/modules/permission.ts +++ b/src/store/modules/permission.ts @@ -44,7 +44,7 @@ export const usePermissionStore = defineStore('permission', () => { sidebarRouters.value = routes; }; const generateRoutes = async (): Promise => { - const res = await getRouters(); + const res = await getRouters({ 'systemCode': import.meta.env.VITE_APP_SYSTEM_CODE }); const { data } = res; const sdata = JSON.parse(JSON.stringify(data)); const rdata = JSON.parse(JSON.stringify(data)); diff --git a/src/types/element.d.ts b/src/types/element.d.ts index ae6ecfcd..f9bf64af 100644 --- a/src/types/element.d.ts +++ b/src/types/element.d.ts @@ -1,6 +1,6 @@ import type * as ep from 'element-plus'; declare global { - declare type ElTagType = 'primary' | 'success' | 'info' | 'warning' | 'danger'; + declare type ElTagType = 'default' | 'primary' | 'success' | 'info' | 'warning' | 'danger'; declare type ElFormInstance = ep.FormInstance; declare type ElTableInstance = ep.TableInstance; declare type ElUploadInstance = ep.UploadInstance; diff --git a/src/types/env.d.ts b/src/types/env.d.ts index 777c8584..444b20cb 100644 --- a/src/types/env.d.ts +++ b/src/types/env.d.ts @@ -19,6 +19,7 @@ interface ImportMetaEnv { VITE_APP_RSA_PRIVATE_KEY: string; VITE_APP_CLIENT_ID: string; VITE_APP_WEBSOCKET: string; + VITE_APP_SYSTEM_CODE: string; } interface ImportMeta { readonly env: ImportMetaEnv; diff --git a/src/views/system/dict/data.vue b/src/views/system/dict/data.vue index 33c7fc8c..1fcc10e6 100644 --- a/src/views/system/dict/data.vue +++ b/src/views/system/dict/data.vue @@ -169,7 +169,7 @@ const initFormData: DictDataForm = { dictLabel: '', dictValue: '', cssClass: '', - listClass: 'primary', + listClass: 'default', dictSort: 0, remark: '' }; diff --git a/src/views/system/menu/index.vue b/src/views/system/menu/index.vue index cf5f0fca..602eb1f2 100644 --- a/src/views/system/menu/index.vue +++ b/src/views/system/menu/index.vue @@ -12,6 +12,11 @@ + + + + + 搜索 重置 @@ -80,7 +85,14 @@ - + + + + + + + + (proxy?.useDict('sys_show_hide', 'sys_normal_disable')); +const { sys_show_hide, sys_normal_disable, sys_code } = toRefs(proxy?.useDict('sys_show_hide', 'sys_normal_disable', 'sys_code')); const menuList = ref([]); const loading = ref(true); @@ -298,7 +310,8 @@ const initFormData = { isFrame: '1', isCache: '0', visible: '0', - status: '0' + status: '0', + systemCode: 'master' }; const data = reactive>({ form: { ...initFormData }, -- Gitee