mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-16 12:05:07 +08:00
菜单新增 alwaysShow 总是展示、componentName 组件名
This commit is contained in:
@ -58,14 +58,19 @@ function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) {
|
||||
icon: route.icon,
|
||||
noCache: !route.keepAlive,
|
||||
}
|
||||
// 路由地址转首字母大写驼峰,作为路由名称,适配 keepAlive
|
||||
route.name = toCamelCase(route.path, true)
|
||||
// 处理三级及以上菜单路由缓存问题,将path名字赋值给name
|
||||
if (route.path.indexOf("/") !== -1) {
|
||||
const pathArr = route.path.split("/");
|
||||
route.name = toCamelCase(pathArr[pathArr.length - 1], true)
|
||||
}
|
||||
route.hidden = !route.visible
|
||||
// 处理 name 属性
|
||||
if (route.componentName && route.componentName.length > 0) {
|
||||
route.name = route.componentName
|
||||
} else {
|
||||
// 路由地址转首字母大写驼峰,作为路由名称,适配 keepAlive
|
||||
route.name = toCamelCase(route.path, true)
|
||||
// 处理三级及以上菜单路由缓存问题,将 path 名字赋值给 name
|
||||
if (route.path.indexOf("/") !== -1) {
|
||||
const pathArr = route.path.split("/");
|
||||
route.name = toCamelCase(pathArr[pathArr.length - 1], true)
|
||||
}
|
||||
}
|
||||
// 处理 component 属性
|
||||
if (route.children) { // 父节点
|
||||
if (route.parentId === 0) {
|
||||
@ -73,8 +78,6 @@ function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) {
|
||||
} else {
|
||||
route.component = ParentView
|
||||
}
|
||||
// 解决只有一个菜单时无法显示目录
|
||||
route.alwaysShow = true
|
||||
} else { // 根节点
|
||||
route.component = loadView(route.component)
|
||||
}
|
||||
@ -85,8 +88,10 @@ function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) {
|
||||
}
|
||||
if (route.children != null && route.children && route.children.length) {
|
||||
route.children = filterAsyncRouter(route.children, route, type)
|
||||
route.alwaysShow = route.alwaysShow !== undefined ? route.alwaysShow : true
|
||||
} else {
|
||||
delete route['children']
|
||||
delete route['alwaysShow'] // 如果没有子菜单,就不需要考虑 alwaysShow 字段
|
||||
}
|
||||
return true
|
||||
})
|
||||
|
@ -132,7 +132,7 @@ import {
|
||||
} from '@/api/mp/account'
|
||||
|
||||
export default {
|
||||
name: 'mpAccount',
|
||||
name: 'MpAccount',
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
|
@ -162,7 +162,7 @@ import { getSimpleAccounts } from "@/api/mp/account";
|
||||
import { createAutoReply, deleteAutoReply, getAutoReply, getAutoReplyPage, updateAutoReply } from "@/api/mp/autoReply";
|
||||
|
||||
export default {
|
||||
name: 'mpAutoReply',
|
||||
name: 'MpAutoReply',
|
||||
components: {
|
||||
WxVideoPlayer,
|
||||
WxVoicePlayer,
|
||||
|
@ -167,7 +167,7 @@ import { getSimpleAccounts } from "@/api/mp/account";
|
||||
import {deleteFreePublish, submitFreePublish} from "@/api/mp/freePublish";
|
||||
|
||||
export default {
|
||||
name: 'mpDraft',
|
||||
name: 'MpDraft',
|
||||
components: {
|
||||
WxEditor,
|
||||
WxNews,
|
||||
|
@ -64,7 +64,7 @@ import { getSimpleAccounts } from "@/api/mp/account";
|
||||
import WxNews from '@/views/mp/components/wx-news/main.vue';
|
||||
|
||||
export default {
|
||||
name: 'mpDraft',
|
||||
name: 'MpFreePublish',
|
||||
components: {
|
||||
WxNews
|
||||
},
|
||||
|
@ -178,7 +178,7 @@ import { getMaterialPage, deletePermanentMaterial } from "@/api/mp/material";
|
||||
import { getAccessToken } from '@/utils/auth'
|
||||
|
||||
export default {
|
||||
name: 'mpMaterial',
|
||||
name: 'MpMaterial',
|
||||
components: {
|
||||
WxVoicePlayer,
|
||||
WxVideoPlayer
|
||||
|
@ -157,7 +157,7 @@ import { deleteMenu, getMenuList, saveMenu } from "@/api/mp/menu";
|
||||
import { getSimpleAccounts } from "@/api/mp/account";
|
||||
|
||||
export default {
|
||||
name: 'mpMenu',
|
||||
name: 'MpMenu',
|
||||
components: {
|
||||
WxReplySelect,
|
||||
WxNews,
|
||||
|
@ -95,7 +95,7 @@ import { getSimpleAccounts } from "@/api/mp/account";
|
||||
import { getSimpleTags } from "@/api/mp/tag";
|
||||
|
||||
export default {
|
||||
name: "WxAccountFans",
|
||||
name: "MpUser",
|
||||
components: {
|
||||
},
|
||||
data() {
|
||||
|
@ -82,7 +82,7 @@ import {addTime, beginOfDay, betweenDay, endOfDay, formatDate} from "@/utils/dat
|
||||
import { getSimpleAccounts } from "@/api/mp/account";
|
||||
|
||||
export default {
|
||||
name: 'mpStatistics',
|
||||
name: 'MpStatistics',
|
||||
data() {
|
||||
return {
|
||||
date : [beginOfDay(new Date(new Date().getTime() - 3600 * 1000 * 24 * 7)), // -7 天
|
||||
|
@ -38,18 +38,14 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="sort" label="排序" width="60"></el-table-column>
|
||||
<el-table-column prop="permission" label="权限标识" :show-overflow-tooltip="true"></el-table-column>
|
||||
<el-table-column prop="component" label="组件路径" :show-overflow-tooltip="true"></el-table-column>
|
||||
<el-table-column prop="permission" label="权限标识" :show-overflow-tooltip="true" />
|
||||
<el-table-column prop="component" label="组件路径" :show-overflow-tooltip="true" />
|
||||
<el-table-column prop="componentName" label="组件名称" :show-overflow-tooltip="true" />
|
||||
<el-table-column prop="status" label="状态" width="80">
|
||||
<template v-slot="scope">
|
||||
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间" align="center" prop="createTime">
|
||||
<template v-slot="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template v-slot="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
||||
@ -63,7 +59,7 @@
|
||||
</el-table>
|
||||
|
||||
<!-- 添加或修改菜单对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="680px" append-to-body>
|
||||
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
@ -113,22 +109,27 @@
|
||||
<el-input v-model="form.path" placeholder="请输入路由地址" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" v-if="form.type === 2">
|
||||
<el-form-item label="组件路径" prop="component">
|
||||
<el-input v-model="form.component" placeholder="请输入组件路径" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item v-if="form.type !== 1" label="权限标识">
|
||||
<el-col :span="12">
|
||||
<el-form-item v-if="form.type !== 1" label="权限标识">
|
||||
<span slot="label">
|
||||
<el-tooltip content="Controller 方法上的权限字符,如:@PreAuthorize(`@ss.hasPermission('system:user:list')`)" placement="top">
|
||||
<i class="el-icon-question" />
|
||||
</el-tooltip>
|
||||
权限字符
|
||||
</span>
|
||||
<el-input v-model="form.permission" placeholder="请权限标识" maxlength="50" />
|
||||
<el-input v-model="form.permission" placeholder="请权限标识" maxlength="50" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" v-if="form.type === 2">
|
||||
<el-form-item label="组件路径" prop="component">
|
||||
<el-input v-model="form.component" placeholder="例如说:system/user/index" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" v-if="form.type === 2">
|
||||
<el-form-item label="组件名称" prop="componentName">
|
||||
<el-input v-model="form.componentName" placeholder="例如说:SystemUser" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="菜单状态" prop="status">
|
||||
<span slot="label">
|
||||
@ -158,19 +159,33 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item v-if="form.type === 2" label="显示状态">
|
||||
<el-form-item v-if="form.type !== 3" label="总是显示">
|
||||
<span slot="label">
|
||||
<el-tooltip content="选择缓存时,则会被 `keep-alive` 缓存,需要匹配组件的 `name` 和路由地址保持一致" placement="top">
|
||||
<el-tooltip content="选择不是时,当该菜单只有一个子菜单时,不展示自己,直接展示子菜单" placement="top">
|
||||
<i class="el-icon-question" />
|
||||
</el-tooltip>
|
||||
总是显示
|
||||
</span>
|
||||
<el-radio-group v-model="form.alwaysShow">
|
||||
<el-radio :key="true" :label="true">总是</el-radio>
|
||||
<el-radio :key="false" :label="false">不是</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item v-if="form.type === 2" label="是否缓存">
|
||||
<span slot="label">
|
||||
<el-tooltip content="选择缓存时,则会被 `keep-alive` 缓存,必须填写「组件名称」字段" placement="top">
|
||||
<i class="el-icon-question" />
|
||||
</el-tooltip>
|
||||
是否缓存
|
||||
</span>
|
||||
<el-radio-group v-model="form.keepAlive">
|
||||
<el-radio :key="true" :label="true">缓存</el-radio>
|
||||
<el-radio :key="false" :label="false">不缓存</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-radio-group v-model="form.keepAlive">
|
||||
<el-radio :key="true" :label="true">缓存</el-radio>
|
||||
<el-radio :key="false" :label="false">不缓存</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
@ -296,6 +311,7 @@ export default {
|
||||
status: CommonStatusEnum.ENABLE,
|
||||
visible: true,
|
||||
keepAlive: true,
|
||||
alwaysShow: true,
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
|
Reference in New Issue
Block a user