修改菜单管理

This commit is contained in:
xie7654
2025-06-30 21:18:26 +08:00
parent bfe190ef74
commit c7f7bf9258
9 changed files with 23 additions and 21 deletions

View File

@@ -94,7 +94,6 @@ class MenuViewSet(CustomModelViewSet):
if name: if name:
queryset = queryset.filter(name=name) queryset = queryset.filter(name=name)
has_menu_name = queryset.exists() has_menu_name = queryset.exists()
print(has_menu_name, 'has_menu_name')
return self._build_response(data=has_menu_name) return self._build_response(data=has_menu_name)
@action(detail=False, methods=['get'], url_path='path-exists') @action(detail=False, methods=['get'], url_path='path-exists')
@@ -114,7 +113,6 @@ class MenuViewSet(CustomModelViewSet):
# If 'prefetch_related' has been applied to a queryset, we need to # If 'prefetch_related' has been applied to a queryset, we need to
# forcibly invalidate the prefetch cache on the instance. # forcibly invalidate the prefetch cache on the instance.
instance._prefetched_objects_cache = {} instance._prefetched_objects_cache = {}
headers = self.get_success_headers(serializer.data)
return self._build_response( return self._build_response(
data=serializer.data, data=serializer.data,
message="ok", message="ok",

View File

@@ -16,7 +16,7 @@ export namespace SystemDeptApi {
/** /**
* 获取部门列表数据 * 获取部门列表数据
*/ */
async function getDeptList(params: Recordable<any>) { async function getDeptList(params?: Recordable<any>) {
return requestClient.get<Array<SystemDeptApi.SystemDept>>('/system/dept/', { return requestClient.get<Array<SystemDeptApi.SystemDept>>('/system/dept/', {
params, params,
}); });

View File

@@ -98,15 +98,12 @@ const [Grid, gridApi] = useVbenVxeGrid({
height: 'auto', height: 'auto',
keepSource: true, keepSource: true,
pagerConfig: { pagerConfig: {
enabled: true, enabled: false,
}, },
proxyConfig: { proxyConfig: {
ajax: { ajax: {
query: async ({ page }, _params) => { query: async (_params) => {
return await getDeptList({ return await getDeptList();
page: page.currentPage,
pageSize: page.pageSize,
});
}, },
}, },
}, },

View File

@@ -7,6 +7,7 @@ import type { SystemDictDataApi } from '#/api/system/dict_data';
import { z } from '#/adapter/form'; import { z } from '#/adapter/form';
import { getDictTypeList } from '#/api/system/dict_type'; import { getDictTypeList } from '#/api/system/dict_type';
import { $t } from '#/locales'; import { $t } from '#/locales';
import {format_datetime} from "#/utils/date";
/** /**
* 获取编辑表单的字段配置。如果没有使用多语言可以直接export一个数组常量 * 获取编辑表单的字段配置。如果没有使用多语言可以直接export一个数组常量
@@ -157,7 +158,6 @@ export function useColumns(
{ {
field: 'color_type', field: 'color_type',
title: '颜色类型', title: '颜色类型',
}, },
{ {
field: 'css_class', field: 'css_class',
@@ -183,6 +183,7 @@ export function useColumns(
field: 'create_time', field: 'create_time',
title: '创建时间', title: '创建时间',
width: 180, width: 180,
formatter: ({ cellValue }) => format_datetime(cellValue),
}, },
{ {
align: 'right', align: 'right',

View File

@@ -6,6 +6,7 @@ import type { SystemDictTypeApi } from '#/api/system/dict_type';
import { z } from '#/adapter/form'; import { z } from '#/adapter/form';
import { $t } from '#/locales'; import { $t } from '#/locales';
import {format_datetime} from "#/utils/date";
/** /**
* 获取编辑表单的字段配置。如果没有使用多语言可以直接export一个数组常量 * 获取编辑表单的字段配置。如果没有使用多语言可以直接export一个数组常量
@@ -113,6 +114,7 @@ export function useColumns(
field: 'create_time', field: 'create_time',
title: '创建时间', title: '创建时间',
width: 180, width: 180,
formatter: ({ cellValue }) => format_datetime(cellValue),
}, },
{ {
align: 'right', align: 'right',

View File

@@ -42,7 +42,7 @@ export function useColumns(
width: 100, width: 100,
}, },
{ {
field: 'authCode', field: 'auth_code',
title: $t('system.menu.authCode'), title: $t('system.menu.authCode'),
width: 200, width: 200,
}, },

View File

@@ -29,7 +29,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
height: 'auto', height: 'auto',
keepSource: true, keepSource: true,
pagerConfig: { pagerConfig: {
enabled: true, enabled: false,
}, },
proxyConfig: { proxyConfig: {
ajax: { ajax: {

View File

@@ -245,11 +245,13 @@ const schema: VbenFormSchema[] = [
return values.type === 'action' ? 'required' : null; return values.type === 'action' ? 'required' : null;
}, },
show: (values) => { show: (values) => {
return ['action', 'catalog', 'embedded', 'menu'].includes(values.type); return ['action', 'button', 'catalog', 'embedded', 'menu'].includes(
values.type,
);
}, },
triggerFields: ['type'], triggerFields: ['type'],
}, },
fieldName: 'authCode', fieldName: 'auth_code',
label: $t('system.menu.authCode'), label: $t('system.menu.authCode'),
}, },
{ {
@@ -278,7 +280,8 @@ const schema: VbenFormSchema[] = [
}, },
dependencies: { dependencies: {
show: (values) => { show: (values) => {
return values.type !== 'action'; // return values.type !== 'action';
return !['action', 'button'].includes(values.type);
}, },
triggerFields: ['type'], triggerFields: ['type'],
}, },
@@ -296,7 +299,7 @@ const schema: VbenFormSchema[] = [
}, },
dependencies: { dependencies: {
show: (values) => { show: (values) => {
return values.type !== 'action'; return !['action', 'button'].includes(values.type);
}, },
triggerFields: ['type'], triggerFields: ['type'],
}, },
@@ -315,7 +318,7 @@ const schema: VbenFormSchema[] = [
}, },
dependencies: { dependencies: {
show: (values) => { show: (values) => {
return values.type !== 'action'; return !['action', 'button'].includes(values.type);
}, },
triggerFields: ['type'], triggerFields: ['type'],
}, },
@@ -326,7 +329,7 @@ const schema: VbenFormSchema[] = [
component: 'Divider', component: 'Divider',
dependencies: { dependencies: {
show: (values) => { show: (values) => {
return !['action', 'link'].includes(values.type); return !['action', 'button', 'link'].includes(values.type);
}, },
triggerFields: ['type'], triggerFields: ['type'],
}, },
@@ -373,7 +376,7 @@ const schema: VbenFormSchema[] = [
component: 'Checkbox', component: 'Checkbox',
dependencies: { dependencies: {
show: (values) => { show: (values) => {
return !['action'].includes(values.type); return !['action', 'button'].includes(values.type);
}, },
triggerFields: ['type'], triggerFields: ['type'],
}, },
@@ -403,7 +406,7 @@ const schema: VbenFormSchema[] = [
component: 'Checkbox', component: 'Checkbox',
dependencies: { dependencies: {
show: (values) => { show: (values) => {
return !['action', 'link'].includes(values.type); return !['action', 'button', 'link'].includes(values.type);
}, },
triggerFields: ['type'], triggerFields: ['type'],
}, },
@@ -418,7 +421,7 @@ const schema: VbenFormSchema[] = [
component: 'Checkbox', component: 'Checkbox',
dependencies: { dependencies: {
show: (values) => { show: (values) => {
return !['action', 'link'].includes(values.type); return !['action', 'button', 'link'].includes(values.type);
}, },
triggerFields: ['type'], triggerFields: ['type'],
}, },

View File

@@ -70,6 +70,7 @@ async function loadPermissions() {
loadingPermissions.value = true; loadingPermissions.value = true;
try { try {
const res = await getMenuList(); const res = await getMenuList();
console.log(res, 'res')
permissions.value = res.items as unknown as DataNode[]; permissions.value = res.items as unknown as DataNode[];
} finally { } finally {
loadingPermissions.value = false; loadingPermissions.value = false;