fix: 菜单管理调整

This commit is contained in:
TsMask
2023-09-05 17:12:12 +08:00
parent 520d1ffcf9
commit 8343ccfe4e
3 changed files with 22 additions and 18 deletions

View File

@@ -7,7 +7,7 @@ import { request } from '@/plugins/http-fetch';
*/ */
export function listMenu(query?: Record<string, any>) { export function listMenu(query?: Record<string, any>) {
return request({ return request({
url: '/system/menu/list', url: '/menuManage/v1/menus',
method: 'get', method: 'get',
params: query, params: query,
}); });
@@ -20,7 +20,7 @@ export function listMenu(query?: Record<string, any>) {
*/ */
export function getMenu(menuId: string | number) { export function getMenu(menuId: string | number) {
return request({ return request({
url: `/system/menu/${menuId}`, url: `/menuManage/v1/menu/${menuId}`,
method: 'get', method: 'get',
}); });
} }
@@ -31,7 +31,7 @@ export function getMenu(menuId: string | number) {
*/ */
export function menuTreeSelect() { export function menuTreeSelect() {
return request({ return request({
url: '/system/menu/treeSelect', url: '/menuManage/v1/menus/treeSelect',
method: 'get', method: 'get',
}); });
} }
@@ -43,7 +43,7 @@ export function menuTreeSelect() {
*/ */
export function roleMenuTreeSelect(roleId: string | number) { export function roleMenuTreeSelect(roleId: string | number) {
return request({ return request({
url: `/system/menu/roleMenuTreeSelect/${roleId}`, url: `/menuManage/v1/menu/roleMenuTreeSelect/${roleId}`,
method: 'get', method: 'get',
}); });
} }
@@ -55,7 +55,7 @@ export function roleMenuTreeSelect(roleId: string | number) {
*/ */
export function addMenu(data: Record<string, any>) { export function addMenu(data: Record<string, any>) {
return request({ return request({
url: '/system/menu', url: '/menuManage/v1/menu',
method: 'post', method: 'post',
data: data, data: data,
}); });
@@ -68,7 +68,7 @@ export function addMenu(data: Record<string, any>) {
*/ */
export function updateMenu(data: Record<string, any>) { export function updateMenu(data: Record<string, any>) {
return request({ return request({
url: '/system/menu', url: '/menuManage/v1/menu',
method: 'put', method: 'put',
data: data, data: data,
}); });
@@ -81,7 +81,7 @@ export function updateMenu(data: Record<string, any>) {
*/ */
export function delMenu(menuId: string | number) { export function delMenu(menuId: string | number) {
return request({ return request({
url: `/system/menu/${menuId}`, url: `/menuManage/v1/menu/${menuId}`,
method: 'delete', method: 'delete',
}); });
} }

View File

@@ -37,25 +37,25 @@ const constantRoutes: RouteRecordRaw[] = [
{ {
path: '/index', path: '/index',
name: 'Index', name: 'Index',
meta: { title: '首页', icon: 'icon-pcduan', cache: true }, meta: { title: '首页', icon: 'icon-pcduan', hideInMenu: true },
component: () => import('@/views/index.vue'), component: () => import('@/views/index.vue'),
}, },
{ {
path: '/dome1', path: '/dome1',
name: 'Dome1', name: 'Dome1',
meta: { title: '示例一', icon: 'icon-ios' }, meta: { title: '示例一', icon: 'icon-ios', hideInMenu: true },
component: () => import('@/views/dome/dome1.vue'), component: () => import('@/views/dome/dome1.vue'),
}, },
{ {
path: '/dome2', path: '/dome2',
name: 'Dome2', name: 'Dome2',
meta: { title: '示例二', icon: 'icon-anzhuo' }, meta: { title: '示例二', icon: 'icon-anzhuo', hideInMenu: true },
component: () => import('@/views/dome/dome2.vue'), component: () => import('@/views/dome/dome2.vue'),
}, },
{ {
path: '/dome3', path: '/dome3',
name: 'Dome3', name: 'Dome3',
meta: { title: '示例三', icon: 'icon-qunzhu' }, meta: { title: '示例三', icon: 'icon-qunzhu', hideInMenu: true },
component: () => import('@/views/dome/dome3.vue'), component: () => import('@/views/dome/dome3.vue'),
}, },
{ {
@@ -64,6 +64,7 @@ const constantRoutes: RouteRecordRaw[] = [
meta: { meta: {
title: '示例目录', title: '示例目录',
icon: 'icon-zhizuoliucheng', icon: 'icon-zhizuoliucheng',
hideInMenu: true,
}, },
component: BlankLayout, component: BlankLayout,
redirect: () => ({ name: 'PageInfo' }), redirect: () => ({ name: 'PageInfo' }),
@@ -122,16 +123,18 @@ const constantRoutes: RouteRecordRaw[] = [
title: 'Github-打开新窗', title: 'Github-打开新窗',
icon: 'icon-github', icon: 'icon-github',
target: '_blank', target: '_blank',
hideInMenu: true,
}, },
component: () => {}, component: () => {},
}, },
{ {
path: 'https://www.antdv.com/components/comment-cn?sdf=12321&id=12&sdnf', path: 'https://3x.antdv.com/components/comment-cn?sdf=12321&id=12&sdnf',
name: 'SelfAnt Design Vue', name: 'SelfAnt Design Vue',
meta: { meta: {
title: 'Antdv-当前窗口', title: 'Antdv-当前窗口',
icon: 'icon-morentouxiang', icon: 'icon-morentouxiang',
target: '_self', target: '_self',
hideInMenu: true,
}, },
component: LinkLayout, component: LinkLayout,
}, },
@@ -140,9 +143,10 @@ const constantRoutes: RouteRecordRaw[] = [
name: 'Account', name: 'Account',
meta: { meta: {
title: '个人中心', title: '个人中心',
hideInMenu: true,
}, },
component: BlankLayout, component: BlankLayout,
redirect: '/account/profile', redirect: '/account/settings',
children: [ children: [
{ {
path: 'profile', path: 'profile',

View File

@@ -275,7 +275,7 @@ function fnModalVisibleByVive(menuId: string | number) {
getMenu(menuId).then(res => { getMenu(menuId).then(res => {
modalState.confirmLoading = false; modalState.confirmLoading = false;
hide(); hide();
if (res.code === 200 && res.data) { if (res.code === 1 && res.data) {
modalState.from = Object.assign(modalState.from, res.data); modalState.from = Object.assign(modalState.from, res.data);
modalState.title = '菜单信息'; modalState.title = '菜单信息';
modalState.visibleByView = true; modalState.visibleByView = true;
@@ -311,7 +311,7 @@ function fnModalVisibleByEdit(
getMenu(menuId).then(res => { getMenu(menuId).then(res => {
modalState.confirmLoading = false; modalState.confirmLoading = false;
hide(); hide();
if (res.code === 200 && res.data) { if (res.code === 1 && res.data) {
modalState.from = Object.assign(modalState.from, res.data); modalState.from = Object.assign(modalState.from, res.data);
modalState.title = '修改菜单信息'; modalState.title = '修改菜单信息';
modalState.visibleByEdit = true; modalState.visibleByEdit = true;
@@ -349,7 +349,7 @@ function fnModalOk() {
message.loading({ content: '请稍等...', key }); message.loading({ content: '请稍等...', key });
menu menu
.then(res => { .then(res => {
if (res.code === 200) { if (res.code === 1) {
message.success({ message.success({
content: `${modalState.title}成功`, content: `${modalState.title}成功`,
key, key,
@@ -398,7 +398,7 @@ function fnRecordDelete(menuId: string | number) {
const key = 'delMenu'; const key = 'delMenu';
message.loading({ content: '请稍等...', key }); message.loading({ content: '请稍等...', key });
delMenu(menuId).then(res => { delMenu(menuId).then(res => {
if (res.code === 200) { if (res.code === 1) {
message.success({ message.success({
content: `删除成功`, content: `删除成功`,
key, key,
@@ -422,7 +422,7 @@ function fnGetList() {
if (tableState.loading) return; if (tableState.loading) return;
tableState.loading = true; tableState.loading = true;
listMenu(toRaw(queryParams)).then(res => { listMenu(toRaw(queryParams)).then(res => {
if (res.code === 200 && Array.isArray(res.data)) { if (res.code === 1 && Array.isArray(res.data)) {
menuListData = JSON.parse(JSON.stringify(res.data)); menuListData = JSON.parse(JSON.stringify(res.data));
// 初始上级菜单和展开编号key // 初始上级菜单和展开编号key
if (treeDataAll.length <= 0) { if (treeDataAll.length <= 0) {