Browse Source

【更新】针对菜单隐藏功能加入字典小修改

pull/178/head
小诺 1 year ago committed by 俞宝山
parent
commit
65f74a05a6
  1. 15
      snowy-admin-web/src/views/sys/resource/menu/form.vue
  2. 46
      snowy-admin-web/src/views/sys/resource/menu/index.vue
  3. 2
      snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/user/service/impl/SysUserServiceImpl.java

15
snowy-admin-web/src/views/sys/resource/menu/form.vue

@ -157,12 +157,12 @@
formData.value = record
//
if (!record.visible) {
formData.value.visible = 'true'
formData.value.visible = 'TRUE'
}
} else {
formData.value = {
menuType: 'MENU',
visible: 'true',
visible: 'TRUE',
sortCode: 99
}
formData.value = Object.assign(formData.value, record)
@ -219,16 +219,7 @@
}
const categoryOptions = tool.dictList('MENU_TYPE')
const visibleOptions = [
{
label: '显示',
value: 'true'
},
{
label: '隐藏',
value: 'false'
}
]
const visibleOptions = tool.dictList('MENU_VISIBLE')
//
const onSubmit = () => {
formRef.value

46
snowy-admin-web/src/views/sys/resource/menu/index.vue

@ -35,7 +35,7 @@
>
<template #operator class="table-operator">
<a-space>
<a-button type="primary" @click="form.onOpen(undefined, moduleType)">
<a-button type="primary" @click="formRef.onOpen(undefined, moduleType)">
<template #icon><plus-outlined /></template>
新增菜单
</a-button>
@ -68,9 +68,22 @@
{{ $TOOL.dictTypeData('MENU_TYPE', record.menuType) }}
</a-tag>
</template>
<template v-if="column.dataIndex === 'visible'">
<a-tag v-if="record.visible === 'FALSE'">
{{ $TOOL.dictTypeData('MENU_VISIBLE', record.visible) }}
</a-tag>
<a-tag v-else color="green">
<span v-if="record.visible === 'TRUE'">
{{ $TOOL.dictTypeData('MENU_VISIBLE', record.visible) }}
</span>
<span v-else>
显示
</span>
</a-tag>
</template>
<template v-if="column.dataIndex === 'action'">
<a-space>
<a @click="form.onOpen(record, moduleType)">编辑</a>
<a @click="formRef.onOpen(record, moduleType)">编辑</a>
<a-divider type="vertical" />
<a-popconfirm title="确定要删除此菜单吗?" @confirm="deleteMenu(record)">
<a-button type="link" danger size="small">删除</a-button>
@ -88,7 +101,7 @@
<a @click="changeModuleFormRef.onOpen(record)">更改模块</a>
</a-menu-item>
<a-menu-item v-if="record.menuType === 'MENU'">
<a @click="button.onOpen(record)">按钮权限</a>
<a @click="buttonRef.onOpen(record)">按钮权限</a>
</a-menu-item>
</a-menu>
</template>
@ -99,7 +112,7 @@
</template>
</s-table>
</a-card>
<Form ref="form" @successful="table.refresh(true)" />
<Form ref="formRef" @successful="table.refresh(true)" />
<changeModuleForm ref="changeModuleFormRef" @successful="table.refresh(true)" />
<Button ref="button" />
</template>
@ -107,16 +120,15 @@
<script setup name="sysMenu">
import menuApi from '@/api/sys/resource/menuApi'
import Form from './form.vue'
import changeModuleForm from './changeModuleForm.vue'
import ChangeModuleForm from './changeModuleForm.vue'
import Button from '../button/index.vue'
let searchFormState = reactive({})
const table = ref(null)
let form = ref()
let changeModuleFormRef = ref()
let button = ref()
let field = ref()
const formRef = ref()
const changeModuleFormRef = ref()
const buttonRef = ref()
const moduleType = ref()
let moduleTypeList = ref([])
const moduleTypeList = ref([])
const toolConfig = { refresh: true, height: true, columnSetting: false, striped: false }
const columns = [
{
@ -130,7 +142,8 @@
},
{
title: '类型',
dataIndex: 'menuType'
dataIndex: 'menuType',
width: 100
},
{
title: '路由地址',
@ -145,14 +158,13 @@
width: 150
},
{
title: '排序',
dataIndex: 'sortCode',
sorter: true
title: '是否可见',
dataIndex: 'visible',
width: 100
},
{
title: '创建时间',
dataIndex: 'createTime',
ellipsis: true,
title: '排序',
dataIndex: 'sortCode',
sorter: true
},
{

2
snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/user/service/impl/SysUserServiceImpl.java

@ -693,7 +693,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
if (!sysMenu.getMenuType().equals(SysResourceMenuTypeEnum.CATALOG.getValue())) {
metaJsonObject.set("type", sysMenu.getMenuType().toLowerCase());
// 如果设置了不可见,那么设置为false,为了兼容已有,所以只是false的为不显示
if (ObjectUtil.isNotEmpty(sysMenu.getVisible()) && sysMenu.getVisible().equals("false")) {
if (ObjectUtil.isNotEmpty(sysMenu.getVisible()) && sysMenu.getVisible().equals("FALSE")) {
metaJsonObject.set("hidden", true);
}
}

Loading…
Cancel
Save