Pre Merge pull request !149 from 伤感的风铃草/dev_sys_menu

This commit is contained in:
伤感的风铃草 2024-10-14 04:03:05 +00:00 committed by Gitee
commit 2e89490c94
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
9 changed files with 34 additions and 9 deletions

View File

@ -30,3 +30,6 @@ VITE_APP_CLIENT_ID = 'e5cd7e4891bf95d1d19206ce24a7b32e'
# websocket 开关 默认使用sse推送
VITE_APP_WEBSOCKET = false
# 系统编码
VITE_APP_SYSTEM_CODE = 'master'

View File

@ -33,3 +33,6 @@ VITE_APP_CLIENT_ID = 'e5cd7e4891bf95d1d19206ce24a7b32e'
# websocket 开关 默认使用sse推送
VITE_APP_WEBSOCKET = false
# 系统编码
VITE_APP_SYSTEM_CODE = 'master'

View File

@ -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<RouteRecordRaw[]> {
export function getRouters(query?: MenuQuery): AxiosPromise<RouteRecordRaw[]> {
return request({
url: '/system/menu/getRouters',
method: 'get'
url: '/system/menu/getRoutersMenu',
method: 'get',
params: query
});
}

View File

@ -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;
}

View File

@ -44,7 +44,7 @@ export const usePermissionStore = defineStore('permission', () => {
sidebarRouters.value = routes;
};
const generateRoutes = async (): Promise<RouteRecordRaw[]> => {
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));

View File

@ -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;

1
src/types/env.d.ts vendored
View File

@ -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;

View File

@ -169,7 +169,7 @@ const initFormData: DictDataForm = {
dictLabel: '',
dictValue: '',
cssClass: '',
listClass: 'primary',
listClass: 'default',
dictSort: 0,
remark: ''
};

View File

@ -12,6 +12,11 @@
<el-option v-for="dict in sys_normal_disable" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
<el-form-item label="系统编码" prop="systemCode">
<el-select v-model="queryParams.systemCode" placeholder="系统编码" clearable>
<el-option v-for="dict in sys_code" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
@ -80,7 +85,14 @@
<el-dialog v-model="dialog.visible" :title="dialog.title" destroy-on-close append-to-bod width="750px">
<el-form ref="menuFormRef" :model="form" :rules="rules" label-width="100px">
<el-row>
<el-col :span="24">
<el-col :span="12">
<el-form-item label="系统编码" prop="systemCode">
<el-select v-model="form.systemCode" placeholder="系统编码" clearable>
<el-option v-for="dict in sys_code" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="上级菜单">
<el-tree-select
v-model="form.parentId"
@ -272,7 +284,7 @@ interface MenuOptionsType {
}
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { sys_show_hide, sys_normal_disable } = toRefs<any>(proxy?.useDict('sys_show_hide', 'sys_normal_disable'));
const { sys_show_hide, sys_normal_disable, sys_code } = toRefs<any>(proxy?.useDict('sys_show_hide', 'sys_normal_disable', 'sys_code'));
const menuList = ref<MenuVO[]>([]);
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<PageData<MenuForm, MenuQuery>>({
form: { ...initFormData },