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

pull/178/head
小诺 1 year ago committed by 俞宝山
parent 865d891a1b
commit 65f74a05a6

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

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

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

Loading…
Cancel
Save