添加岗位、登录日志过滤
This commit is contained in:
16
README.md
16
README.md
@@ -8,12 +8,24 @@
|
|||||||
它是一个完全开源的快速开发平台,个人、团体使用免费,Django-Vue3-Admin 是一个基于 RBAC(基于角色的访问控制)模型进行权限控制的全面基础开发平台,权限控制粒度达到列级。它遵循前后端分离的架构,后端使用 Django 和 Django Rest Framework,前端使用 Vue3、Composition API、TypeScript、Vite 和 vben-admin(Ant Design Vue)。
|
它是一个完全开源的快速开发平台,个人、团体使用免费,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. 修改数据库配置:
|
0. 修改数据库配置:
|
||||||
打开 backend/backend/settings.py,找到 DATABASES,根据实际情况修改数据库连接信息(如主机、端口、用户名、密码、数据库名等)。
|
打开 backend/backend/settings.py,找到 DATABASES,根据实际情况修改数据库连接信息(如主机、端口、用户名、密码、数据库名等)。
|
||||||
|
```python
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': 'django.db.backends.mysql',
|
||||||
|
'NAME': 'django_vue',
|
||||||
|
'USER': 'root',
|
||||||
|
'PASSWORD': '',
|
||||||
|
'HOST': 'localhost',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
1. 进入 backend 目录:
|
1. 进入 backend 目录:
|
||||||
```bash
|
```bash
|
||||||
cd backend
|
cd backend
|
||||||
@@ -38,6 +50,8 @@
|
|||||||
|
|
||||||
## 前端启动(以 web-antd 为例)
|
## 前端启动(以 web-antd 为例)
|
||||||
|
|
||||||
|
> 说明:web-ele 目前暂不支持,待 InputPassword 等组件开发完毕后再兼容。
|
||||||
|
|
||||||
1. 进入前端目录:
|
1. 进入前端目录:
|
||||||
```bash
|
```bash
|
||||||
cd web/apps/web-antd
|
cd web/apps/web-antd
|
||||||
|
|||||||
@@ -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.models
|
||||||
import django.contrib.auth.validators
|
import django.contrib.auth.validators
|
||||||
@@ -88,7 +88,7 @@ class Migration(migrations.Migration):
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"type",
|
"value",
|
||||||
models.CharField(
|
models.CharField(
|
||||||
db_index=True,
|
db_index=True,
|
||||||
default="",
|
default="",
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ class RolePermission(CoreModel):
|
|||||||
class DictType(CoreModel):
|
class DictType(CoreModel):
|
||||||
"""字典类型表"""
|
"""字典类型表"""
|
||||||
name = models.CharField(max_length=100, default='', verbose_name='字典名称')
|
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(
|
status = models.IntegerField(
|
||||||
choices=CommonStatus.choices,
|
choices=CommonStatus.choices,
|
||||||
default=CommonStatus.ENABLED,
|
default=CommonStatus.ENABLED,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
from rest_framework import serializers, viewsets
|
from rest_framework import serializers, viewsets
|
||||||
from system.models import DictType
|
from system.models import DictType
|
||||||
from utils.custom_model_viewSet import CustomModelViewSet
|
from utils.custom_model_viewSet import CustomModelViewSet
|
||||||
|
from django_filters import rest_framework as filters
|
||||||
|
|
||||||
|
|
||||||
class DictTypeSerializer(serializers.ModelSerializer):
|
class DictTypeSerializer(serializers.ModelSerializer):
|
||||||
@@ -10,6 +11,20 @@ class DictTypeSerializer(serializers.ModelSerializer):
|
|||||||
fields = '__all__'
|
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):
|
class DictTypeViewSet(CustomModelViewSet):
|
||||||
queryset = DictType.objects.filter(is_deleted=False)
|
queryset = DictType.objects.all()
|
||||||
serializer_class = DictTypeSerializer
|
serializer_class = DictTypeSerializer
|
||||||
|
filterset_class = DictTypeFilter
|
||||||
|
search_fields = ['name', 'type']
|
||||||
|
ordering_fields = ['create_time', 'id']
|
||||||
|
ordering = ['-create_time']
|
||||||
@@ -3,6 +3,7 @@ from utils.serializers import CustomModelSerializer
|
|||||||
from utils.custom_model_viewSet import CustomModelViewSet
|
from utils.custom_model_viewSet import CustomModelViewSet
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
from utils.permissions import HasButtonPermission
|
from utils.permissions import HasButtonPermission
|
||||||
|
from django_filters import rest_framework as filters
|
||||||
|
|
||||||
class LoginLogSerializer(CustomModelSerializer):
|
class LoginLogSerializer(CustomModelSerializer):
|
||||||
"""
|
"""
|
||||||
@@ -19,14 +20,23 @@ class LoginLogSerializer(CustomModelSerializer):
|
|||||||
return obj.get_result_display()
|
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):
|
class LoginLogViewSet(CustomModelViewSet):
|
||||||
"""
|
"""
|
||||||
系统访问记录 视图集
|
系统访问记录 视图集
|
||||||
"""
|
"""
|
||||||
queryset = LoginLog.objects.filter(is_deleted=False).order_by('-id')
|
queryset = LoginLog.objects.filter(is_deleted=False).order_by('-id')
|
||||||
serializer_class = LoginLogSerializer
|
serializer_class = LoginLogSerializer
|
||||||
filterset_fields = ['id', 'remark', 'creator', 'modifier', 'is_deleted', 'username', 'result', 'user_ip', 'user_agent']
|
filterset_class = LoginLogFilter
|
||||||
search_fields = ['name'] # 根据实际字段调整
|
search_fields = ['username']
|
||||||
ordering_fields = ['create_time', 'id']
|
ordering_fields = ['create_time', 'id']
|
||||||
ordering = ['-create_time']
|
ordering = ['-create_time']
|
||||||
permission_classes = [HasButtonPermission]
|
permission_classes = [HasButtonPermission]
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
from system.models import Post
|
from system.models import Post
|
||||||
from utils.serializers import CustomModelSerializer
|
from utils.serializers import CustomModelSerializer
|
||||||
from utils.custom_model_viewSet import CustomModelViewSet
|
from utils.custom_model_viewSet import CustomModelViewSet
|
||||||
|
from django_filters import rest_framework as filters
|
||||||
|
|
||||||
class PostSerializer(CustomModelSerializer):
|
class PostSerializer(CustomModelSerializer):
|
||||||
"""
|
"""
|
||||||
@@ -12,13 +13,23 @@ class PostSerializer(CustomModelSerializer):
|
|||||||
read_only_fields = ['id', 'create_time', 'update_time']
|
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):
|
class PostViewSet(CustomModelViewSet):
|
||||||
"""
|
"""
|
||||||
岗位信息表 视图集
|
岗位信息表 视图集
|
||||||
"""
|
"""
|
||||||
queryset = Post.objects.filter(is_deleted=False)
|
queryset = Post.objects.filter(is_deleted=False)
|
||||||
serializer_class = PostSerializer
|
serializer_class = PostSerializer
|
||||||
filterset_fields = ['id', 'remark', 'creator', 'modifier', 'is_deleted', 'code', 'name', 'sort', 'status']
|
filterset_class = PostFilter
|
||||||
search_fields = ['name'] # 根据实际字段调整
|
search_fields = ['name', 'code']
|
||||||
ordering_fields = ['create_time', 'id', 'sort']
|
ordering_fields = ['create_time', 'id']
|
||||||
ordering = ['sort']
|
ordering = ['-create_time']
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
Target Server Version : 90300 (9.3.0)
|
Target Server Version : 90300 (9.3.0)
|
||||||
File Encoding : 65001
|
File Encoding : 65001
|
||||||
|
|
||||||
Date: 03/07/2025 11:45:13
|
Date: 03/07/2025 16:53:14
|
||||||
*/
|
*/
|
||||||
|
|
||||||
SET NAMES utf8mb4;
|
SET NAMES utf8mb4;
|
||||||
@@ -241,35 +241,35 @@ CREATE TABLE `django_migrations` (
|
|||||||
`name` varchar(255) NOT NULL,
|
`name` varchar(255) NOT NULL,
|
||||||
`applied` datetime(6) NOT NULL,
|
`applied` datetime(6) NOT NULL,
|
||||||
PRIMARY KEY (`id`)
|
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
|
-- Records of django_migrations
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
BEGIN;
|
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 (80, 'contenttypes', '0001_initial', '2025-07-03 08:43:50.800575');
|
||||||
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 (81, 'contenttypes', '0002_remove_content_type_name', '2025-07-03 08:43:50.802755');
|
||||||
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 (82, 'auth', '0001_initial', '2025-07-03 08:43:50.804008');
|
||||||
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 (83, 'auth', '0002_alter_permission_name_max_length', '2025-07-03 08:43:50.805150');
|
||||||
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 (84, 'auth', '0003_alter_user_email_max_length', '2025-07-03 08:43:50.806629');
|
||||||
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 (85, 'auth', '0004_alter_user_username_opts', '2025-07-03 08:43:50.807732');
|
||||||
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 (86, 'auth', '0005_alter_user_last_login_null', '2025-07-03 08:43:50.808717');
|
||||||
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 (87, 'auth', '0006_require_contenttypes_0002', '2025-07-03 08:43:50.809664');
|
||||||
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 (88, 'auth', '0007_alter_validators_add_error_messages', '2025-07-03 08:43:50.810639');
|
||||||
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 (89, 'auth', '0008_alter_user_username_max_length', '2025-07-03 08:43:50.811612');
|
||||||
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 (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 (67, 'auth', '0010_alter_group_name_max_length', '2025-07-03 03:44:52.927191');
|
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 (68, 'auth', '0011_update_proxy_permissions', '2025-07-03 03:44:52.928422');
|
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 (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 (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 (70, 'system', '0001_initial', '2025-07-03 03:44:52.931096');
|
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 (71, 'admin', '0001_initial', '2025-07-03 03:44:52.932402');
|
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 (72, 'admin', '0002_logentry_remove_auto_add', '2025-07-03 03:44:52.933654');
|
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 (73, 'admin', '0003_logentry_add_action_flag_choices', '2025-07-03 03:44:52.934944');
|
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 (74, 'authtoken', '0001_initial', '2025-07-03 03:44:52.936279');
|
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 (75, 'authtoken', '0002_auto_20160226_1747', '2025-07-03 03:44:52.937883');
|
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 (76, 'authtoken', '0003_tokenproxy', '2025-07-03 03:44:52.939255');
|
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 (77, 'authtoken', '0004_alter_tokenproxy_options', '2025-07-03 03:44:52.940515');
|
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 (78, 'sessions', '0001_initial', '2025-07-03 03:44:52.941917');
|
INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES (102, 'sessions', '0001_initial', '2025-07-03 08:43:50.820534');
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
@@ -369,18 +369,18 @@ CREATE TABLE `system_dict_type` (
|
|||||||
`create_time` datetime(6) DEFAULT NULL COMMENT '创建时间',
|
`create_time` datetime(6) DEFAULT NULL COMMENT '创建时间',
|
||||||
`is_deleted` tinyint(1) NOT NULL COMMENT '是否软删除',
|
`is_deleted` tinyint(1) NOT NULL COMMENT '是否软删除',
|
||||||
`name` varchar(100) NOT NULL,
|
`name` varchar(100) NOT NULL,
|
||||||
`type` varchar(100) NOT NULL,
|
`value` varchar(100) NOT NULL,
|
||||||
`status` int NOT NULL,
|
`status` int NOT NULL,
|
||||||
`deleted_time` datetime(6) DEFAULT NULL,
|
`deleted_time` datetime(6) DEFAULT NULL,
|
||||||
PRIMARY KEY (`id`),
|
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;
|
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Records of system_dict_type
|
-- Records of system_dict_type
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
BEGIN;
|
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;
|
COMMIT;
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
|
|||||||
@@ -85,12 +85,12 @@
|
|||||||
"dict_type": {
|
"dict_type": {
|
||||||
"name": "Dictionary Name",
|
"name": "Dictionary Name",
|
||||||
"title": "Dictionary Name",
|
"title": "Dictionary Name",
|
||||||
"type": "Dictionary Type"
|
"value": "Dictionary Type"
|
||||||
},
|
},
|
||||||
"dict_data": {
|
"dict_data": {
|
||||||
"name": "Dictionary Label",
|
"name": "Dictionary Label",
|
||||||
"title": "Dictionary Data",
|
"title": "Dictionary Data",
|
||||||
"type": "Dictionary Value"
|
"value": "Dictionary Value"
|
||||||
},
|
},
|
||||||
"post": {
|
"post": {
|
||||||
"name": "Post",
|
"name": "Post",
|
||||||
|
|||||||
@@ -86,12 +86,12 @@
|
|||||||
"dict_type": {
|
"dict_type": {
|
||||||
"name": "字典名称",
|
"name": "字典名称",
|
||||||
"title": "字典名称",
|
"title": "字典名称",
|
||||||
"type": "字典类型"
|
"value": "字典类型"
|
||||||
},
|
},
|
||||||
"dict_data": {
|
"dict_data": {
|
||||||
"name": "字典数据",
|
"name": "字典数据",
|
||||||
"title": "字典数据",
|
"title": "字典数据",
|
||||||
"type": "字典键值"
|
"value": "字典键值"
|
||||||
},
|
},
|
||||||
"post": {
|
"post": {
|
||||||
"name": "岗位",
|
"name": "岗位",
|
||||||
|
|||||||
@@ -239,7 +239,7 @@ function navTo(nav: WorkbenchProjectItem | WorkbenchQuickNavItem) {
|
|||||||
:avatar="userStore.userInfo?.avatar || preferences.app.defaultAvatar"
|
:avatar="userStore.userInfo?.avatar || preferences.app.defaultAvatar"
|
||||||
>
|
>
|
||||||
<template #title>
|
<template #title>
|
||||||
早安, {{ userStore.userInfo?.realName }}, 开始您一天的工作吧!
|
早安, {{ userStore.userInfo?.username }}, 开始您一天的工作吧!
|
||||||
</template>
|
</template>
|
||||||
<template #description> 今日晴,20℃ - 32℃! </template>
|
<template #description> 今日晴,20℃ - 32℃! </template>
|
||||||
</WorkbenchHeader>
|
</WorkbenchHeader>
|
||||||
|
|||||||
@@ -27,14 +27,14 @@ export function useSchema(): VbenFormSchema[] {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
fieldName: 'type',
|
fieldName: 'value',
|
||||||
label: '字典类型',
|
label: '字典类型',
|
||||||
rules: z
|
rules: z
|
||||||
.string()
|
.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(
|
.max(
|
||||||
20,
|
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: '字典名称',
|
title: '字典名称',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'type',
|
field: 'value',
|
||||||
title: '字典类型',
|
title: '字典类型',
|
||||||
width: 180,
|
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 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import { Button, message } from 'ant-design-vue';
|
|||||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
import { deleteDictType, getDictTypeList } from '#/api/system/dict_type';
|
import { deleteDictType, getDictTypeList } from '#/api/system/dict_type';
|
||||||
import { $t } from '#/locales';
|
import { $t } from '#/locales';
|
||||||
|
import { useGridFormSchema } from '#/views/system/dict_type/data';
|
||||||
|
|
||||||
import { useColumns } from './data';
|
import { useColumns } from './data';
|
||||||
import Form from './modules/form.vue';
|
import Form from './modules/form.vue';
|
||||||
@@ -95,6 +96,10 @@ function onActionClick({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const [Grid, gridApi] = useVbenVxeGrid({
|
const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
|
formOptions: {
|
||||||
|
schema: useGridFormSchema(),
|
||||||
|
submitOnChange: true,
|
||||||
|
},
|
||||||
gridEvents: {},
|
gridEvents: {},
|
||||||
gridOptions: {
|
gridOptions: {
|
||||||
columns: useColumns(onActionClick),
|
columns: useColumns(onActionClick),
|
||||||
@@ -119,6 +124,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
export: false,
|
export: false,
|
||||||
refresh: { code: 'query' },
|
refresh: { code: 'query' },
|
||||||
zoom: true,
|
zoom: true,
|
||||||
|
search: true,
|
||||||
},
|
},
|
||||||
treeConfig: {
|
treeConfig: {
|
||||||
parentField: 'pid',
|
parentField: 'pid',
|
||||||
|
|||||||
@@ -93,3 +93,24 @@ export function useColumns(): VxeTableGridOptions<SystemLoginLogApi.SystemLoginL
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function useGridFormSchema(): VbenFormSchema[] {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
component: 'Input',
|
||||||
|
fieldName: 'username',
|
||||||
|
label: '用户名',
|
||||||
|
componentProps: { allowClear: true },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
component: 'RangePicker',
|
||||||
|
fieldName: 'create_time',
|
||||||
|
label: '创建时间',
|
||||||
|
componentProps: {
|
||||||
|
allowClear: true,
|
||||||
|
format: 'YYYY-MM-DD',
|
||||||
|
valueFormat: 'YYYY-MM-DD',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|||||||
@@ -6,11 +6,15 @@ import { Page } from '@vben/common-ui';
|
|||||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
import { SystemLoginLogModel } from '#/models/system/login_log';
|
import { SystemLoginLogModel } from '#/models/system/login_log';
|
||||||
|
|
||||||
import { useColumns } from './data';
|
import { useColumns, useGridFormSchema } from './data';
|
||||||
|
|
||||||
const formModel = new SystemLoginLogModel();
|
const formModel = new SystemLoginLogModel();
|
||||||
|
|
||||||
const [Grid] = useVbenVxeGrid({
|
const [Grid] = useVbenVxeGrid({
|
||||||
|
formOptions: {
|
||||||
|
schema: useGridFormSchema(),
|
||||||
|
submitOnChange: true,
|
||||||
|
},
|
||||||
gridEvents: {},
|
gridEvents: {},
|
||||||
gridOptions: {
|
gridOptions: {
|
||||||
columns: useColumns(),
|
columns: useColumns(),
|
||||||
@@ -22,11 +26,17 @@ const [Grid] = useVbenVxeGrid({
|
|||||||
proxyConfig: {
|
proxyConfig: {
|
||||||
ajax: {
|
ajax: {
|
||||||
query: async ({ page }, formValues) => {
|
query: async ({ page }, formValues) => {
|
||||||
return await formModel.list({
|
const { create_time, ...rest } = formValues;
|
||||||
|
const params = {
|
||||||
page: page.currentPage,
|
page: page.currentPage,
|
||||||
pageSize: page.pageSize,
|
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,
|
export: false,
|
||||||
refresh: { code: 'query' },
|
refresh: { code: 'query' },
|
||||||
zoom: true,
|
zoom: true,
|
||||||
|
search: true,
|
||||||
},
|
},
|
||||||
} as VxeTableGridOptions,
|
} as VxeTableGridOptions,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -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 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import { Button, message } from 'ant-design-vue';
|
|||||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
import { $t } from '#/locales';
|
import { $t } from '#/locales';
|
||||||
import { SystemPostModel } from '#/models/system/post';
|
import { SystemPostModel } from '#/models/system/post';
|
||||||
|
import { useGridFormSchema } from '#/views/system/post/data';
|
||||||
|
|
||||||
import { useColumns } from './data';
|
import { useColumns } from './data';
|
||||||
import Form from './modules/form.vue';
|
import Form from './modules/form.vue';
|
||||||
@@ -81,6 +82,10 @@ function onActionClick({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const [Grid, gridApi] = useVbenVxeGrid({
|
const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
|
formOptions: {
|
||||||
|
schema: useGridFormSchema(),
|
||||||
|
submitOnChange: true,
|
||||||
|
},
|
||||||
gridEvents: {},
|
gridEvents: {},
|
||||||
gridOptions: {
|
gridOptions: {
|
||||||
columns: useColumns(onActionClick),
|
columns: useColumns(onActionClick),
|
||||||
@@ -105,6 +110,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
export: false,
|
export: false,
|
||||||
refresh: { code: 'query' },
|
refresh: { code: 'query' },
|
||||||
zoom: true,
|
zoom: true,
|
||||||
|
search: true,
|
||||||
},
|
},
|
||||||
} as VxeTableGridOptions,
|
} as VxeTableGridOptions,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -198,18 +198,18 @@ export function useColumns(
|
|||||||
title: $t('system.modifier'),
|
title: $t('system.modifier'),
|
||||||
width: 80,
|
width: 80,
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
field: 'update_time',
|
// field: 'update_time',
|
||||||
title: $t('system.updateTime'),
|
// title: $t('system.updateTime'),
|
||||||
width: 150,
|
// width: 150,
|
||||||
formatter: ({ cellValue }) => format_datetime(cellValue),
|
// formatter: ({ cellValue }) => format_datetime(cellValue),
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
field: 'create_time',
|
// field: 'create_time',
|
||||||
title: $t('system.createTime'),
|
// title: $t('system.createTime'),
|
||||||
width: 150,
|
// width: 150,
|
||||||
formatter: ({ cellValue }) => format_datetime(cellValue),
|
// formatter: ({ cellValue }) => format_datetime(cellValue),
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
align: 'center',
|
align: 'center',
|
||||||
cellRender: {
|
cellRender: {
|
||||||
|
|||||||
Reference in New Issue
Block a user