diff --git a/README.md b/README.md index f4108c2..6462291 100644 --- a/README.md +++ b/README.md @@ -8,12 +8,24 @@ 它是一个完全开源的快速开发平台,个人、团体使用免费,Django-Vue3-Admin 是一个基于 RBAC(基于角色的访问控制)模型进行权限控制的全面基础开发平台,权限控制粒度达到列级。它遵循前后端分离的架构,后端使用 Django 和 Django Rest Framework,前端使用 Vue3、Composition API、TypeScript、Vite 和 vben-admin(Ant Design Vue)。 # 启动说明 +python 版本 3.12 +node 版本v22.17.0 ## 后端启动 0. 修改数据库配置: 打开 backend/backend/settings.py,找到 DATABASES,根据实际情况修改数据库连接信息(如主机、端口、用户名、密码、数据库名等)。 - + ```python + DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.mysql', + 'NAME': 'django_vue', + 'USER': 'root', + 'PASSWORD': '', + 'HOST': 'localhost', + } +} +``` 1. 进入 backend 目录: ```bash cd backend @@ -38,6 +50,8 @@ ## 前端启动(以 web-antd 为例) +> 说明:web-ele 目前暂不支持,待 InputPassword 等组件开发完毕后再兼容。 + 1. 进入前端目录: ```bash cd web/apps/web-antd diff --git a/backend/system/migrations/0001_initial.py b/backend/system/migrations/0001_initial.py index 8c16fc3..1703163 100644 --- a/backend/system/migrations/0001_initial.py +++ b/backend/system/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 5.2.1 on 2025-07-03 03:44 +# Generated by Django 5.2.1 on 2025-07-03 08:43 import django.contrib.auth.models import django.contrib.auth.validators @@ -88,7 +88,7 @@ class Migration(migrations.Migration): ), ), ( - "type", + "value", models.CharField( db_index=True, default="", diff --git a/backend/system/models.py b/backend/system/models.py index 966795d..35299d4 100644 --- a/backend/system/models.py +++ b/backend/system/models.py @@ -180,7 +180,7 @@ class RolePermission(CoreModel): class DictType(CoreModel): """字典类型表""" name = models.CharField(max_length=100, default='', verbose_name='字典名称') - type = models.CharField(max_length=100, default='', verbose_name='字典类型', db_index=True) + value = models.CharField(max_length=100, default='', verbose_name='字典类型', db_index=True) status = models.IntegerField( choices=CommonStatus.choices, default=CommonStatus.ENABLED, diff --git a/backend/system/views/dict_type.py b/backend/system/views/dict_type.py index d4f2760..dbf2e60 100644 --- a/backend/system/views/dict_type.py +++ b/backend/system/views/dict_type.py @@ -1,6 +1,7 @@ from rest_framework import serializers, viewsets from system.models import DictType from utils.custom_model_viewSet import CustomModelViewSet +from django_filters import rest_framework as filters class DictTypeSerializer(serializers.ModelSerializer): @@ -10,6 +11,20 @@ class DictTypeSerializer(serializers.ModelSerializer): fields = '__all__' +class DictTypeFilter(filters.FilterSet): + name = filters.CharFilter(field_name='name', lookup_expr='icontains') + value = filters.CharFilter(field_name='value', lookup_expr='icontains') + status = filters.CharFilter(field_name='status') + + class Meta: + model = DictType + fields = ['name', 'value', 'status'] + + class DictTypeViewSet(CustomModelViewSet): - queryset = DictType.objects.filter(is_deleted=False) - serializer_class = DictTypeSerializer \ No newline at end of file + queryset = DictType.objects.all() + serializer_class = DictTypeSerializer + filterset_class = DictTypeFilter + search_fields = ['name', 'type'] + ordering_fields = ['create_time', 'id'] + ordering = ['-create_time'] \ No newline at end of file diff --git a/backend/system/views/login_log.py b/backend/system/views/login_log.py index e76ecde..d340514 100644 --- a/backend/system/views/login_log.py +++ b/backend/system/views/login_log.py @@ -3,6 +3,7 @@ from utils.serializers import CustomModelSerializer from utils.custom_model_viewSet import CustomModelViewSet from rest_framework import serializers from utils.permissions import HasButtonPermission +from django_filters import rest_framework as filters class LoginLogSerializer(CustomModelSerializer): """ @@ -19,14 +20,23 @@ class LoginLogSerializer(CustomModelSerializer): return obj.get_result_display() +class LoginLogFilter(filters.FilterSet): + username = filters.CharFilter(field_name='username', lookup_expr='icontains') + create_time = filters.DateFromToRangeFilter(field_name='create_time') + + class Meta: + model = LoginLog + fields = ['username', 'create_time'] + + class LoginLogViewSet(CustomModelViewSet): """ 系统访问记录 视图集 """ queryset = LoginLog.objects.filter(is_deleted=False).order_by('-id') serializer_class = LoginLogSerializer - filterset_fields = ['id', 'remark', 'creator', 'modifier', 'is_deleted', 'username', 'result', 'user_ip', 'user_agent'] - search_fields = ['name'] # 根据实际字段调整 + filterset_class = LoginLogFilter + search_fields = ['username'] ordering_fields = ['create_time', 'id'] ordering = ['-create_time'] permission_classes = [HasButtonPermission] diff --git a/backend/system/views/post.py b/backend/system/views/post.py index 1b766ee..38ee1ab 100644 --- a/backend/system/views/post.py +++ b/backend/system/views/post.py @@ -1,6 +1,7 @@ from system.models import Post from utils.serializers import CustomModelSerializer from utils.custom_model_viewSet import CustomModelViewSet +from django_filters import rest_framework as filters class PostSerializer(CustomModelSerializer): """ @@ -12,13 +13,23 @@ class PostSerializer(CustomModelSerializer): read_only_fields = ['id', 'create_time', 'update_time'] +class PostFilter(filters.FilterSet): + name = filters.CharFilter(field_name='name', lookup_expr='icontains') + code = filters.CharFilter(field_name='code', lookup_expr='icontains') + status = filters.CharFilter(field_name='status') + + class Meta: + model = Post + fields = ['name', 'code', 'status'] + + class PostViewSet(CustomModelViewSet): """ 岗位信息表 视图集 """ queryset = Post.objects.filter(is_deleted=False) serializer_class = PostSerializer - filterset_fields = ['id', 'remark', 'creator', 'modifier', 'is_deleted', 'code', 'name', 'sort', 'status'] - search_fields = ['name'] # 根据实际字段调整 - ordering_fields = ['create_time', 'id', 'sort'] - ordering = ['sort'] + filterset_class = PostFilter + search_fields = ['name', 'code'] + ordering_fields = ['create_time', 'id'] + ordering = ['-create_time'] diff --git a/sql/django_vue.sql b/sql/django_vue.sql index d84062b..3bbb0a4 100644 --- a/sql/django_vue.sql +++ b/sql/django_vue.sql @@ -11,7 +11,7 @@ Target Server Version : 90300 (9.3.0) File Encoding : 65001 - Date: 03/07/2025 11:45:13 + Date: 03/07/2025 16:53:14 */ SET NAMES utf8mb4; @@ -241,35 +241,35 @@ CREATE TABLE `django_migrations` ( `name` varchar(255) NOT NULL, `applied` datetime(6) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=79 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; +) ENGINE=InnoDB AUTO_INCREMENT=103 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; -- ---------------------------- -- Records of django_migrations -- ---------------------------- BEGIN; -INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (56, 'contenttypes', '0001_initial', '2025-07-03 03:44:52.908813'); -INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (57, 'contenttypes', '0002_remove_content_type_name', '2025-07-03 03:44:52.911127'); -INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (58, 'auth', '0001_initial', '2025-07-03 03:44:52.912623'); -INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (59, 'auth', '0002_alter_permission_name_max_length', '2025-07-03 03:44:52.914061'); -INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (60, 'auth', '0003_alter_user_email_max_length', '2025-07-03 03:44:52.915784'); -INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (61, 'auth', '0004_alter_user_username_opts', '2025-07-03 03:44:52.917590'); -INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (62, 'auth', '0005_alter_user_last_login_null', '2025-07-03 03:44:52.919017'); -INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (63, 'auth', '0006_require_contenttypes_0002', '2025-07-03 03:44:52.920316'); -INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (64, 'auth', '0007_alter_validators_add_error_messages', '2025-07-03 03:44:52.922403'); -INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (65, 'auth', '0008_alter_user_username_max_length', '2025-07-03 03:44:52.924155'); -INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (66, 'auth', '0009_alter_user_last_name_max_length', '2025-07-03 03:44:52.925595'); -INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (67, 'auth', '0010_alter_group_name_max_length', '2025-07-03 03:44:52.927191'); -INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (68, 'auth', '0011_update_proxy_permissions', '2025-07-03 03:44:52.928422'); -INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (69, 'auth', '0012_alter_user_first_name_max_length', '2025-07-03 03:44:52.929767'); -INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (70, 'system', '0001_initial', '2025-07-03 03:44:52.931096'); -INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (71, 'admin', '0001_initial', '2025-07-03 03:44:52.932402'); -INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (72, 'admin', '0002_logentry_remove_auto_add', '2025-07-03 03:44:52.933654'); -INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (73, 'admin', '0003_logentry_add_action_flag_choices', '2025-07-03 03:44:52.934944'); -INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (74, 'authtoken', '0001_initial', '2025-07-03 03:44:52.936279'); -INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (75, 'authtoken', '0002_auto_20160226_1747', '2025-07-03 03:44:52.937883'); -INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (76, 'authtoken', '0003_tokenproxy', '2025-07-03 03:44:52.939255'); -INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (77, 'authtoken', '0004_alter_tokenproxy_options', '2025-07-03 03:44:52.940515'); -INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (78, 'sessions', '0001_initial', '2025-07-03 03:44:52.941917'); +INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (80, 'contenttypes', '0001_initial', '2025-07-03 08:43:50.800575'); +INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (81, 'contenttypes', '0002_remove_content_type_name', '2025-07-03 08:43:50.802755'); +INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (82, 'auth', '0001_initial', '2025-07-03 08:43:50.804008'); +INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (83, 'auth', '0002_alter_permission_name_max_length', '2025-07-03 08:43:50.805150'); +INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (84, 'auth', '0003_alter_user_email_max_length', '2025-07-03 08:43:50.806629'); +INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (85, 'auth', '0004_alter_user_username_opts', '2025-07-03 08:43:50.807732'); +INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (86, 'auth', '0005_alter_user_last_login_null', '2025-07-03 08:43:50.808717'); +INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (87, 'auth', '0006_require_contenttypes_0002', '2025-07-03 08:43:50.809664'); +INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (88, 'auth', '0007_alter_validators_add_error_messages', '2025-07-03 08:43:50.810639'); +INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (89, 'auth', '0008_alter_user_username_max_length', '2025-07-03 08:43:50.811612'); +INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (90, 'auth', '0009_alter_user_last_name_max_length', '2025-07-03 08:43:50.812666'); +INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (91, 'auth', '0010_alter_group_name_max_length', '2025-07-03 08:43:50.813459'); +INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (92, 'auth', '0011_update_proxy_permissions', '2025-07-03 08:43:50.814294'); +INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (93, 'auth', '0012_alter_user_first_name_max_length', '2025-07-03 08:43:50.815294'); +INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (94, 'system', '0001_initial', '2025-07-03 08:43:50.815957'); +INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (95, 'admin', '0001_initial', '2025-07-03 08:43:50.816615'); +INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (96, 'admin', '0002_logentry_remove_auto_add', '2025-07-03 08:43:50.817213'); +INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (97, 'admin', '0003_logentry_add_action_flag_choices', '2025-07-03 08:43:50.817800'); +INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (98, 'authtoken', '0001_initial', '2025-07-03 08:43:50.818352'); +INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (99, 'authtoken', '0002_auto_20160226_1747', '2025-07-03 08:43:50.818924'); +INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (100, 'authtoken', '0003_tokenproxy', '2025-07-03 08:43:50.819477'); +INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (101, 'authtoken', '0004_alter_tokenproxy_options', '2025-07-03 08:43:50.820040'); +INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (102, 'sessions', '0001_initial', '2025-07-03 08:43:50.820534'); COMMIT; -- ---------------------------- @@ -369,18 +369,18 @@ CREATE TABLE `system_dict_type` ( `create_time` datetime(6) DEFAULT NULL COMMENT '创建时间', `is_deleted` tinyint(1) NOT NULL COMMENT '是否软删除', `name` varchar(100) NOT NULL, - `type` varchar(100) NOT NULL, + `value` varchar(100) NOT NULL, `status` int NOT NULL, `deleted_time` datetime(6) DEFAULT NULL, PRIMARY KEY (`id`), - KEY `system_dict_type_type_b3b2d8f5` (`type`) + KEY `system_dict_type_type_b3b2d8f5` (`value`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; -- ---------------------------- -- Records of system_dict_type -- ---------------------------- BEGIN; -INSERT INTO `system_dict_type` (`id`, `remark`, `creator`, `modifier`, `update_time`, `create_time`, `is_deleted`, `name`, `type`, `status`, `deleted_time`) VALUES (1, NULL, NULL, NULL, '2025-07-01 04:58:37.679182', '2025-06-29 13:32:51.050675', 0, 'jdjkhj', 'sad_ds', 1, NULL); +INSERT INTO `system_dict_type` (`id`, `remark`, `creator`, `modifier`, `update_time`, `create_time`, `is_deleted`, `name`, `value`, `status`, `deleted_time`) VALUES (1, NULL, NULL, NULL, '2025-07-01 04:58:37.679182', '2025-06-29 13:32:51.050675', 0, 'jdjkhj', 'sad_ds', 1, NULL); COMMIT; -- ---------------------------- diff --git a/web/apps/web-antd/src/locales/langs/en-US/system.json b/web/apps/web-antd/src/locales/langs/en-US/system.json index 9b16e49..1f62321 100644 --- a/web/apps/web-antd/src/locales/langs/en-US/system.json +++ b/web/apps/web-antd/src/locales/langs/en-US/system.json @@ -85,12 +85,12 @@ "dict_type": { "name": "Dictionary Name", "title": "Dictionary Name", - "type": "Dictionary Type" + "value": "Dictionary Type" }, "dict_data": { "name": "Dictionary Label", "title": "Dictionary Data", - "type": "Dictionary Value" + "value": "Dictionary Value" }, "post": { "name": "Post", diff --git a/web/apps/web-antd/src/locales/langs/zh-CN/system.json b/web/apps/web-antd/src/locales/langs/zh-CN/system.json index 86cacd5..4b13f14 100644 --- a/web/apps/web-antd/src/locales/langs/zh-CN/system.json +++ b/web/apps/web-antd/src/locales/langs/zh-CN/system.json @@ -86,12 +86,12 @@ "dict_type": { "name": "字典名称", "title": "字典名称", - "type": "字典类型" + "value": "字典类型" }, "dict_data": { "name": "字典数据", "title": "字典数据", - "type": "字典键值" + "value": "字典键值" }, "post": { "name": "岗位", diff --git a/web/apps/web-antd/src/views/dashboard/workspace/index.vue b/web/apps/web-antd/src/views/dashboard/workspace/index.vue index b95d613..631dae3 100644 --- a/web/apps/web-antd/src/views/dashboard/workspace/index.vue +++ b/web/apps/web-antd/src/views/dashboard/workspace/index.vue @@ -239,7 +239,7 @@ function navTo(nav: WorkbenchProjectItem | WorkbenchQuickNavItem) { :avatar="userStore.userInfo?.avatar || preferences.app.defaultAvatar" > diff --git a/web/apps/web-antd/src/views/system/dict_type/data.ts b/web/apps/web-antd/src/views/system/dict_type/data.ts index 1ac5fc4..9a070b9 100644 --- a/web/apps/web-antd/src/views/system/dict_type/data.ts +++ b/web/apps/web-antd/src/views/system/dict_type/data.ts @@ -27,14 +27,14 @@ export function useSchema(): VbenFormSchema[] { }, { component: 'Input', - fieldName: 'type', + fieldName: 'value', label: '字典类型', rules: z .string() - .min(2, $t('ui.formRules.minLength', [$t('system.dict_type.type'), 2])) + .min(2, $t('ui.formRules.minLength', [$t('system.dict_type.value'), 2])) .max( 20, - $t('ui.formRules.maxLength', [$t('system.dict_type.type'), 20]), + $t('ui.formRules.maxLength', [$t('system.dict_type.value'), 20]), ), }, { @@ -90,7 +90,7 @@ export function useColumns( title: '字典名称', }, { - field: 'type', + field: 'value', title: '字典类型', width: 180, }, @@ -145,3 +145,32 @@ export function useColumns( }, ]; } + +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + component: 'Input', + fieldName: 'name', + label: '字典名称', + componentProps: { allowClear: true }, + }, + { + component: 'Input', + fieldName: 'value', + label: '字典类型', + componentProps: { allowClear: true }, + }, + { + component: 'Select', + fieldName: 'status', + label: '状态', + componentProps: { + allowClear: true, + options: [ + { label: '启用', value: 1 }, + { label: '禁用', value: 0 }, + ], + }, + }, + ]; +} diff --git a/web/apps/web-antd/src/views/system/dict_type/list.vue b/web/apps/web-antd/src/views/system/dict_type/list.vue index 835d42a..06bace6 100644 --- a/web/apps/web-antd/src/views/system/dict_type/list.vue +++ b/web/apps/web-antd/src/views/system/dict_type/list.vue @@ -15,6 +15,7 @@ import { Button, message } from 'ant-design-vue'; import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { deleteDictType, getDictTypeList } from '#/api/system/dict_type'; import { $t } from '#/locales'; +import { useGridFormSchema } from '#/views/system/dict_type/data'; import { useColumns } from './data'; import Form from './modules/form.vue'; @@ -95,6 +96,10 @@ function onActionClick({ } const [Grid, gridApi] = useVbenVxeGrid({ + formOptions: { + schema: useGridFormSchema(), + submitOnChange: true, + }, gridEvents: {}, gridOptions: { columns: useColumns(onActionClick), @@ -119,6 +124,7 @@ const [Grid, gridApi] = useVbenVxeGrid({ export: false, refresh: { code: 'query' }, zoom: true, + search: true, }, treeConfig: { parentField: 'pid', diff --git a/web/apps/web-antd/src/views/system/login_log/data.ts b/web/apps/web-antd/src/views/system/login_log/data.ts index be38c54..9d82f3a 100644 --- a/web/apps/web-antd/src/views/system/login_log/data.ts +++ b/web/apps/web-antd/src/views/system/login_log/data.ts @@ -93,3 +93,24 @@ export function useColumns(): VxeTableGridOptions { - return await formModel.list({ + const { create_time, ...rest } = formValues; + const params = { page: page.currentPage, pageSize: page.pageSize, - ...formValues, - }); + ...rest, + }; + if (Array.isArray(create_time) && create_time.length === 2) { + params.create_time_after = create_time[0]; + params.create_time_before = create_time[1]; + } + return await formModel.list(params); }, }, }, @@ -35,6 +45,7 @@ const [Grid] = useVbenVxeGrid({ export: false, refresh: { code: 'query' }, zoom: true, + search: true, }, } as VxeTableGridOptions, }); diff --git a/web/apps/web-antd/src/views/system/post/data.ts b/web/apps/web-antd/src/views/system/post/data.ts index c719fd7..bef9705 100644 --- a/web/apps/web-antd/src/views/system/post/data.ts +++ b/web/apps/web-antd/src/views/system/post/data.ts @@ -122,3 +122,32 @@ export function useColumns( }, ]; } + +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + component: 'Input', + fieldName: 'name', + label: '岗位名称', + componentProps: { allowClear: true }, + }, + { + component: 'Input', + fieldName: 'code', + label: '岗位编码', + componentProps: { allowClear: true }, + }, + { + component: 'Select', + fieldName: 'status', + label: '状态', + componentProps: { + allowClear: true, + options: [ + { label: '启用', value: 1 }, + { label: '禁用', value: 0 }, + ], + }, + }, + ]; +} diff --git a/web/apps/web-antd/src/views/system/post/list.vue b/web/apps/web-antd/src/views/system/post/list.vue index 68699af..2e9d968 100644 --- a/web/apps/web-antd/src/views/system/post/list.vue +++ b/web/apps/web-antd/src/views/system/post/list.vue @@ -13,6 +13,7 @@ import { Button, message } from 'ant-design-vue'; import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { $t } from '#/locales'; import { SystemPostModel } from '#/models/system/post'; +import { useGridFormSchema } from '#/views/system/post/data'; import { useColumns } from './data'; import Form from './modules/form.vue'; @@ -81,6 +82,10 @@ function onActionClick({ } const [Grid, gridApi] = useVbenVxeGrid({ + formOptions: { + schema: useGridFormSchema(), + submitOnChange: true, + }, gridEvents: {}, gridOptions: { columns: useColumns(onActionClick), @@ -105,6 +110,7 @@ const [Grid, gridApi] = useVbenVxeGrid({ export: false, refresh: { code: 'query' }, zoom: true, + search: true, }, } as VxeTableGridOptions, }); diff --git a/web/apps/web-antd/src/views/system/user/data.ts b/web/apps/web-antd/src/views/system/user/data.ts index 8886be2..188513f 100644 --- a/web/apps/web-antd/src/views/system/user/data.ts +++ b/web/apps/web-antd/src/views/system/user/data.ts @@ -198,18 +198,18 @@ export function useColumns( title: $t('system.modifier'), width: 80, }, - { - field: 'update_time', - title: $t('system.updateTime'), - width: 150, - formatter: ({ cellValue }) => format_datetime(cellValue), - }, - { - field: 'create_time', - title: $t('system.createTime'), - width: 150, - formatter: ({ cellValue }) => format_datetime(cellValue), - }, + // { + // field: 'update_time', + // title: $t('system.updateTime'), + // width: 150, + // formatter: ({ cellValue }) => format_datetime(cellValue), + // }, + // { + // field: 'create_time', + // title: $t('system.createTime'), + // width: 150, + // formatter: ({ cellValue }) => format_datetime(cellValue), + // }, { align: 'center', cellRender: {