动态页面完成
parent
1fc497fba0
commit
b65a5bdf6d
|
@ -12,7 +12,6 @@ logger = logging.getLogger(__name__)
|
|||
class Command(BaseCommand):
|
||||
"""
|
||||
项目初始化命令: python manage.py initialization
|
||||
创建管理员命令: python manage.py initialization
|
||||
"""
|
||||
|
||||
def customSql(self, sql_list):
|
||||
|
|
|
@ -4,23 +4,23 @@ from apps.op_drf.models import CoreModel
|
|||
|
||||
|
||||
class Menu(CoreModel):
|
||||
MENU_TYPE_CHOICES = (
|
||||
("0", "目录"),
|
||||
("1", "菜单"),
|
||||
("2", "按钮"),
|
||||
)
|
||||
METHOD_CHOICE = (
|
||||
('GET', 'GET'),
|
||||
('POST', 'POST'),
|
||||
('PUT', 'PUT'),
|
||||
('PATCH', 'PATCH'),
|
||||
('DELETE', 'DELETE'),
|
||||
('HEAD', 'HEAD'),
|
||||
('OPTIONS', 'OPTIONS'),
|
||||
('TRACE', 'TRACE'),
|
||||
)
|
||||
# MENU_TYPE_CHOICES = (
|
||||
# ("0", "目录"),
|
||||
# ("1", "菜单"),
|
||||
# ("2", "按钮"),
|
||||
# )
|
||||
# METHOD_CHOICE = (
|
||||
# ('GET', 'GET'),
|
||||
# ('POST', 'POST'),
|
||||
# ('PUT', 'PUT'),
|
||||
# ('PATCH', 'PATCH'),
|
||||
# ('DELETE', 'DELETE'),
|
||||
# ('HEAD', 'HEAD'),
|
||||
# ('OPTIONS', 'OPTIONS'),
|
||||
# ('TRACE', 'TRACE'),
|
||||
# )
|
||||
parentId = ForeignKey(to='Menu', on_delete=CASCADE, verbose_name="上级菜单", null=True, blank=True, )
|
||||
menuType = CharField(max_length=8, choices=MENU_TYPE_CHOICES, verbose_name="菜单类型")
|
||||
menuType = CharField(max_length=8, verbose_name="菜单类型")
|
||||
icon = CharField(max_length=64, verbose_name="菜单图标", null=True, blank=True)
|
||||
name = CharField(max_length=64, verbose_name="菜单名称")
|
||||
orderNum = IntegerField(verbose_name="显示排序")
|
||||
|
@ -28,7 +28,7 @@ class Menu(CoreModel):
|
|||
web_path = CharField(max_length=128, verbose_name="前端路由地址", null=True, blank=True)
|
||||
component_path = CharField(max_length=128, verbose_name="前端组件路径", null=True, blank=True)
|
||||
interface_path = CharField(max_length=256, verbose_name="后端接口路径", null=True, blank=True)
|
||||
interface_method = CharField(choices=METHOD_CHOICE, max_length=16, default='GET', verbose_name="接口请求方式")
|
||||
interface_method = CharField(max_length=16, default='GET', verbose_name="接口请求方式")
|
||||
perms = CharField(max_length=256, verbose_name="权限标识", null=True, blank=True)
|
||||
status = CharField(max_length=8, verbose_name="菜单状态")
|
||||
visible = CharField(max_length=8, verbose_name="显示状态")
|
||||
|
|
|
@ -20,7 +20,7 @@ class UserProfile(AbstractUser):
|
|||
name = CharField(max_length=40, verbose_name="姓名")
|
||||
gender = CharField(max_length=8, verbose_name="性别", null=True, blank=True)
|
||||
remark = TextField(verbose_name="备注", null=True)
|
||||
user_type = IntegerField(default=2, choices=USER_TYPE_CHOICES, verbose_name="用户类型")
|
||||
user_type = IntegerField(default=0, verbose_name="用户类型")
|
||||
post = ManyToManyField(to='Post', verbose_name='关联岗位', db_constraint=False)
|
||||
role = ManyToManyField(to='Role', verbose_name='关联角色', db_constraint=False)
|
||||
dept = ForeignKey(to='Dept', verbose_name='归属部门', on_delete=CASCADE, db_constraint=False, null=True, blank=True)
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
import json
|
||||
|
||||
from rest_framework.request import Request
|
||||
from rest_framework.response import Response
|
||||
from rest_framework.views import APIView
|
||||
|
||||
from apps.op_drf.viewsets import CustomModelViewSet
|
||||
|
@ -21,26 +18,52 @@ class GetUserProfileView(APIView):
|
|||
|
||||
def get(self, request, format=None):
|
||||
user_dict = UserProfileSerializer(request.user).data
|
||||
|
||||
permissions_list = ["*:*:*"] if user_dict.get('admin') else Menu.objects.filter(
|
||||
role__userprofile=request.user).values_list('perms', flat=True)
|
||||
return SuccessResponse({
|
||||
'permissions': ["*:*:*"] if not user_dict.get('admin') else Menu.objects.filter(
|
||||
role__userprofile=request.user).values_list('perms', flat=True),
|
||||
# 'roles': Role.objects.filter(userprofile=request.user).values_list('roleKey', flat=True),
|
||||
'roles': ['admin'],
|
||||
'permissions': [ele for ele in permissions_list if ele],
|
||||
'roles': Role.objects.filter(userprofile=request.user).values_list('roleKey', flat=True),
|
||||
'user': user_dict
|
||||
})
|
||||
|
||||
|
||||
class GetRouters(APIView):
|
||||
"""
|
||||
获取用户详细信息
|
||||
获取路由详细信息
|
||||
"""
|
||||
|
||||
def depth_menu(self, menus):
|
||||
"""
|
||||
获取菜单(通过前端递归值)
|
||||
:param menus:
|
||||
:return:
|
||||
"""
|
||||
|
||||
return dict
|
||||
|
||||
def get(self, request, format=None):
|
||||
# data = GetUserInfoSerializer(request.user).data
|
||||
data = '{"msg":"操作成功","code":200,"data":[{"name":"System","path":"/system","hidden":false,"redirect":"noRedirect","component":"Layout","alwaysShow":true,"meta":{"title":"系统管理","icon":"system","noCache":false},"children":[{"name":"User","path":"user","hidden":false,"component":"permission/user/index","meta":{"title":"用户管理","icon":"user","noCache":false}},{"name":"Role","path":"role","hidden":false,"component":"permission/role/index","meta":{"title":"角色管理","icon":"peoples","noCache":false}},{"name":"Menu","path":"menu","hidden":false,"component":"permission/menu/index","meta":{"title":"菜单管理","icon":"tree-table","noCache":false}},{"name":"Dept","path":"dept","hidden":false,"component":"permission/dept/index","meta":{"title":"部门管理","icon":"tree","noCache":false}},{"name":"Post","path":"post","hidden":false,"component":"permission/post/index","meta":{"title":"岗位管理","icon":"post","noCache":false}},{"name":"Dict","path":"dict","hidden":false,"component":"system/dict/index","meta":{"title":"字典管理","icon":"dict","noCache":false}},{"name":"Config","path":"config","hidden":false,"component":"system/config/index","meta":{"title":"参数设置","icon":"edit","noCache":false}},{"name":"Notice","path":"notice","hidden":false,"component":"system/notice/index","meta":{"title":"通知公告","icon":"message","noCache":false}},{"name":"Log","path":"log","hidden":false,"redirect":"noRedirect","component":"ParentView","alwaysShow":true,"meta":{"title":"日志管理","icon":"log","noCache":false},"children":[{"name":"Operlog","path":"operlog","hidden":false,"component":"monitor/operlog/index","meta":{"title":"操作日志","icon":"form","noCache":false}},{"name":"Logininfor","path":"logininfor","hidden":false,"component":"monitor/logininfor/index","meta":{"title":"登录日志","icon":"logininfor","noCache":false}}]}]},{"name":"Monitor","path":"/monitor","hidden":false,"redirect":"noRedirect","component":"Layout","alwaysShow":true,"meta":{"title":"系统监控","icon":"monitor","noCache":false},"children":[{"name":"Online","path":"online","hidden":false,"component":"monitor/online/index","meta":{"title":"在线用户","icon":"online","noCache":false}},{"name":"Job","path":"job","hidden":false,"component":"monitor/job/index","meta":{"title":"定时任务","icon":"job","noCache":false}},{"name":"Druid","path":"druid","hidden":false,"component":"monitor/druid/index","meta":{"title":"数据监控","icon":"druid","noCache":false}},{"name":"Server","path":"server","hidden":false,"component":"monitor/server/index","meta":{"title":"服务监控","icon":"server","noCache":false}},{"name":"Cache","path":"cache","hidden":false,"component":"monitor/cache/index","meta":{"title":"缓存监控","icon":"redis","noCache":false}}]},{"name":"Tool","path":"/tool","hidden":false,"redirect":"noRedirect","component":"Layout","alwaysShow":true,"meta":{"title":"系统工具","icon":"tool","noCache":false},"children":[{"name":"Build","path":"build","hidden":false,"component":"tool/build/index","meta":{"title":"表单构建","icon":"build","noCache":false}},{"name":"Gen","path":"gen","hidden":false,"component":"tool/gen/index","meta":{"title":"代码生成","icon":"code","noCache":false}},{"name":"Swagger","path":"swagger","hidden":false,"component":"tool/swagger/index","meta":{"title":"系统接口","icon":"swagger","noCache":false}}]},{"name":"Http://ruoyi.vip","path":"http://ruoyi.vip","hidden":false,"component":"Layout","meta":{"title":"若依官网","icon":"guide","noCache":false}}]}'
|
||||
data = json.loads(data)
|
||||
return Response(data)
|
||||
menus = Menu.objects.filter(role__userprofile=request.user).exclude(menuType="2").values('id','name', 'web_path',
|
||||
'visible', 'status',
|
||||
'isFrame',
|
||||
'component_path',
|
||||
'icon', 'parentId',
|
||||
'isCache')
|
||||
# data = '{"msg":"操作成功","code":200,"data":[{"name":"System","path":"/system","hidden":false,"redirect":"noRedirect","component":"Layout","alwaysShow":true,"meta":{"title":"系统管理","icon":"system","noCache":false},"children":[{"name":"User","path":"user","hidden":false,"component":"permission/user/index","meta":{"title":"用户管理","icon":"user","noCache":false}},{"name":"Role","path":"role","hidden":false,"component":"permission/role/index","meta":{"title":"角色管理","icon":"peoples","noCache":false}},{"name":"Menu","path":"menu","hidden":false,"component":"permission/menu/index","meta":{"title":"菜单管理","icon":"tree-table","noCache":false}},{"name":"Dept","path":"dept","hidden":false,"component":"permission/dept/index","meta":{"title":"部门管理","icon":"tree","noCache":false}},{"name":"Post","path":"post","hidden":false,"component":"permission/post/index","meta":{"title":"岗位管理","icon":"post","noCache":false}},{"name":"Dict","path":"dict","hidden":false,"component":"system/dict/index","meta":{"title":"字典管理","icon":"dict","noCache":false}},{"name":"Config","path":"config","hidden":false,"component":"system/config/index","meta":{"title":"参数设置","icon":"edit","noCache":false}},{"name":"Notice","path":"notice","hidden":false,"component":"system/notice/index","meta":{"title":"通知公告","icon":"message","noCache":false}},{"name":"Log","path":"log","hidden":false,"redirect":"noRedirect","component":"ParentView","alwaysShow":true,"meta":{"title":"日志管理","icon":"log","noCache":false},"children":[{"name":"Operlog","path":"operlog","hidden":false,"component":"monitor/operlog/index","meta":{"title":"操作日志","icon":"form","noCache":false}},{"name":"Logininfor","path":"logininfor","hidden":false,"component":"monitor/logininfor/index","meta":{"title":"登录日志","icon":"logininfor","noCache":false}}]}]},{"name":"Monitor","path":"/monitor","hidden":false,"redirect":"noRedirect","component":"Layout","alwaysShow":true,"meta":{"title":"系统监控","icon":"monitor","noCache":false},"children":[{"name":"Online","path":"online","hidden":false,"component":"monitor/online/index","meta":{"title":"在线用户","icon":"online","noCache":false}},{"name":"Job","path":"job","hidden":false,"component":"monitor/job/index","meta":{"title":"定时任务","icon":"job","noCache":false}},{"name":"Druid","path":"druid","hidden":false,"component":"monitor/druid/index","meta":{"title":"数据监控","icon":"druid","noCache":false}},{"name":"Server","path":"server","hidden":false,"component":"monitor/server/index","meta":{"title":"服务监控","icon":"server","noCache":false}},{"name":"Cache","path":"cache","hidden":false,"component":"monitor/cache/index","meta":{"title":"缓存监控","icon":"redis","noCache":false}}]},{"name":"Tool","path":"/tool","hidden":false,"redirect":"noRedirect","component":"Layout","alwaysShow":true,"meta":{"title":"系统工具","icon":"tool","noCache":false},"children":[{"name":"Build","path":"build","hidden":false,"component":"tool/build/index","meta":{"title":"表单构建","icon":"build","noCache":false}},{"name":"Gen","path":"gen","hidden":false,"component":"tool/gen/index","meta":{"title":"代码生成","icon":"code","noCache":false}},{"name":"Swagger","path":"swagger","hidden":false,"component":"tool/swagger/index","meta":{"title":"系统接口","icon":"swagger","noCache":false}}]},{"name":"Http://ruoyi.vip","path":"http://ruoyi.vip","hidden":false,"component":"Layout","meta":{"title":"若依官网","icon":"guide","noCache":false}}]}'
|
||||
# data = json.loads(data)
|
||||
data = []
|
||||
for ele in menus:
|
||||
data.append({
|
||||
'id': ele.get('id'),
|
||||
'name': ''.join([i.capitalize() for i in ele.get('web_path','').split('/')]),
|
||||
'path': ele.get('web_path'),
|
||||
'hidden': True if ele.get('visible') != '1' else False,
|
||||
'redirect': ele.get('web_path') if ele.get('isFrame') == '1' else 'noRedirect',
|
||||
'component': ele.get('component_path') or 'Layout',
|
||||
'meta': {"title": ele.get('name'), "icon": ele.get('icon'), "noCache": ele.get('isCache')},
|
||||
'parentId': ele.get('parentId')
|
||||
})
|
||||
return SuccessResponse(data)
|
||||
|
||||
|
||||
class MenuModelViewSet(CustomModelViewSet):
|
||||
|
@ -254,5 +277,5 @@ class UserProfileModelViewSet(CustomModelViewSet):
|
|||
instance.set_password(request.data.get('password'))
|
||||
instance.save()
|
||||
if hasattr(self, 'handle_logging'):
|
||||
self.handle_logging(request, instance=instance, *args,**kwargs)
|
||||
self.handle_logging(request, instance=instance, *args, **kwargs)
|
||||
return SuccessResponse(serializer.data)
|
||||
|
|
|
@ -32,13 +32,13 @@
|
|||
-- ----------------------------
|
||||
-- Records of permission_menu
|
||||
-- ----------------------------
|
||||
INSERT INTO `permission_menu` VALUES (1, '', 'admin', 'admin', '2021-02-27 07:50:00.410101', '2021-02-27 07:41:28.660364', '0', 'system', '系统管理', 1, '1', 'system', '', '', 'GET', NULL, '1', '1', '1', NULL);
|
||||
INSERT INTO `permission_menu` VALUES (2, '', 'admin', 'admin', '2021-02-27 07:51:14.500722', '2021-02-27 07:51:14.500768', '0', 'peoples', '权限管理', 2, '1', 'permission', '', '', 'GET', NULL, '1', '1', '1', NULL);
|
||||
INSERT INTO `permission_menu` VALUES (3, '', 'admin', 'admin', '2021-02-27 08:20:40.164651', '2021-02-27 07:54:38.630670', '1', 'dict', '字典管理', 1, '1', 'system/dict', 'system/dict/index', 'system/dict/type', 'GET', 'system:dict:type:get', '1', '1', '1', 1);
|
||||
INSERT INTO `permission_menu` VALUES (4, '', 'admin', 'admin', '2021-02-27 08:24:03.776515', '2021-02-27 08:06:51.019173', '1', 'edit', '参数管理', 2, '1', 'system/config', 'system/config/index', 'system/config/', 'GET', 'system:config:get', '1', '1', '1', 1);
|
||||
INSERT INTO `permission_menu` VALUES (5, '', 'admin', 'admin', '2021-02-27 08:26:56.407590', '2021-02-27 08:25:37.339270', '1', 'post', '岗位管理', 1, '1', 'permission/post', 'permission/post/index', 'permission/post', 'GET', 'permission:post:get', '1', '1', '1', 2);
|
||||
INSERT INTO `permission_menu` VALUES (6, '', 'admin', 'admin', '2021-02-27 08:26:48.454509', '2021-02-27 08:26:48.454553', '1', 'tree', '部门管理', 2, '1', 'permission/dept', 'permission/dept/index', 'permission/dept', 'GET', 'permission:dept:get', '1', '1', '1', 2);
|
||||
INSERT INTO `permission_menu` VALUES (7, '', 'admin', 'admin', '2021-02-27 08:28:20.411115', '2021-02-27 08:28:20.411164', '1', 'tree-table', '菜单管理', 3, '1', 'permission/menu', 'permission/menu/index', 'permission/menus', 'GET', 'permission:menus:get', '1', '1', '1', 2);
|
||||
INSERT INTO `permission_menu` VALUES (8, '', 'admin', 'admin', '2021-02-27 08:29:30.153322', '2021-02-27 08:29:30.153361', '1', 'peoples', '角色管理', 4, '1', 'permission/role', 'permission/role/index', 'permission/role', 'GET', 'permission:role:get', '1', '1', '1', 2);
|
||||
INSERT INTO `permission_menu` VALUES (9, '', 'admin', 'admin', '2021-02-27 08:30:14.030845', '2021-02-27 08:30:14.030888', '1', 'user', '用户管理', 5, '1', 'permission/user', 'permission/user/index', 'permission/user', 'GET', 'permission:user:get', '1', '1', '1', 2);
|
||||
INSERT INTO `permission_menu` VALUES (1, '', 'admin', 'admin', '2021-02-27 07:50:00.410101', '2021-02-27 07:41:28.660364', '0', 'system', '系统管理', 1, '1', '/system', '', '', 'GET', NULL, '1', '1', '1', NULL);
|
||||
INSERT INTO `permission_menu` VALUES (2, '', 'admin', 'admin', '2021-02-27 07:51:14.500722', '2021-02-27 07:51:14.500768', '0', 'peoples', '权限管理', 2, '1', '/permission', '', '', 'GET', NULL, '1', '1', '1', NULL);
|
||||
INSERT INTO `permission_menu` VALUES (3, '', 'admin', 'admin', '2021-02-27 08:20:40.164651', '2021-02-27 07:54:38.630670', '1', 'dict', '字典管理', 1, '1', '/system/dict', 'system/dict/index', 'system/dict/type', 'GET', 'system:dict:type:get', '1', '1', '1', 1);
|
||||
INSERT INTO `permission_menu` VALUES (4, '', 'admin', 'admin', '2021-02-27 08:24:03.776515', '2021-02-27 08:06:51.019173', '1', 'edit', '参数管理', 2, '1', '/system/config', 'system/config/index', 'system/config/', 'GET', 'system:config:get', '1', '1', '1', 1);
|
||||
INSERT INTO `permission_menu` VALUES (5, '', 'admin', 'admin', '2021-02-27 08:26:56.407590', '2021-02-27 08:25:37.339270', '1', 'post', '岗位管理', 1, '1', '/permission/post', 'permission/post/index', 'permission/post', 'GET', 'permission:post:get', '1', '1', '1', 2);
|
||||
INSERT INTO `permission_menu` VALUES (6, '', 'admin', 'admin', '2021-02-27 08:26:48.454509', '2021-02-27 08:26:48.454553', '1', 'tree', '部门管理', 2, '1', '/permission/dept', 'permission/dept/index', 'permission/dept', 'GET', 'permission:dept:get', '1', '1', '1', 2);
|
||||
INSERT INTO `permission_menu` VALUES (7, '', 'admin', 'admin', '2021-02-27 08:28:20.411115', '2021-02-27 08:28:20.411164', '1', 'tree-table', '菜单管理', 3, '1', '/permission/menu', 'permission/menu/index', 'permission/menus', 'GET', 'permission:menus:get', '1', '1', '1', 2);
|
||||
INSERT INTO `permission_menu` VALUES (8, '', 'admin', 'admin', '2021-02-27 08:29:30.153322', '2021-02-27 08:29:30.153361', '1', 'peoples', '角色管理', 4, '1', '/permission/role', 'permission/role/index', 'permission/role', 'GET', 'permission:role:get', '1', '1', '1', 2);
|
||||
INSERT INTO `permission_menu` VALUES (9, '', 'admin', 'admin', '2021-02-27 08:30:14.030845', '2021-02-27 08:30:14.030888', '1', 'user', '用户管理', 5, '1', '/permission/user', 'permission/user/index', 'permission/user', 'GET', 'permission:user:get', '1', '1', '1', 2);
|
||||
INSERT INTO `permission_menu` VALUES (10, '', 'admin', 'admin', '2021-02-27 08:37:24.948235', '2021-02-27 08:36:04.824117', '0', 'guide', 'dvAdmin官网', 9, '0', 'https://django-vue-admin.com', '', NULL, 'GET', NULL, '1', '1', '1', NULL);
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
-- ----------------------------
|
||||
-- Records of permission_role
|
||||
-- ----------------------------
|
||||
INSERT INTO `permission_role` VALUES (1, '', 'admin', 'admin', '2021-02-27 08:48:23.225361', '2021-02-27 08:48:08.064911', '超级管理员', 'admin', 1, '1', 0, '2', NULL);
|
||||
INSERT INTO `permission_role` VALUES (1, '', 'admin', 'admin', '2021-02-27 08:48:23.225361', '2021-02-27 08:48:08.064911', '超级管理员', 'admin', 1, '1', 1, '2', NULL);
|
||||
INSERT INTO `permission_role` VALUES (2, '', 'admin', 'admin', '2021-02-27 08:49:05.149632', '2021-02-27 08:48:47.317214', '普通角色', 'common', 2, '1', 0, '2', NULL);
|
||||
|
||||
-- ----------------------------
|
||||
|
|
|
@ -33,4 +33,41 @@
|
|||
-- ----------------------------
|
||||
-- Records of permission_userprofile
|
||||
-- ----------------------------
|
||||
INSERT INTO `permission_userprofile` VALUES (1, 'pbkdf2_sha256$150000$9Fs0I0yoaQ4s$cCe7ynmDuZMgDs1W9kNl7kGb6sBj+92UiF10n291Hq4=', '2021-02-27 06:20:28.214775', 1, '', '', 1, 1, '2021-02-27 06:20:09.188689', 'demo', '3704adf3-380f-4c27-a8da-60420e8cb4ab', 'demo@qq.com', NULL, NULL, '测试账号', '2', '1', 2, '2021-02-27 06:20:09.263192', '2021-02-27 09:14:30.009998', 8);
|
||||
INSERT INTO `permission_userprofile` VALUES (1, 'pbkdf2_sha256$150000$OjTMSXJgkzrE$jEQCjWbIbXwpN4k2z0o8Yvou1UQGuoJALyL/kGDZFd4=', '2021-02-27 06:20:28.214775', 1, '', '', 1, 1, '2021-02-27 06:20:09.188689', 'demo', '3704adf3-380f-4c27-a8da-60420e8cb4ab', 'demo@qq.com', NULL, NULL, '测试账号', '2', '1', 2, '2021-02-27 06:20:09.263192', '2021-02-27 09:14:30.009998', 8);
|
||||
-- ----------------------------
|
||||
-- Table structure for permission_userprofile_post
|
||||
-- ----------------------------
|
||||
-- DROP TABLE IF EXISTS `permission_userprofile_post`;
|
||||
-- CREATE TABLE `permission_userprofile_post` (
|
||||
-- `id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
-- `userprofile_id` int(11) NOT NULL,
|
||||
-- `post_id` int(11) NOT NULL,
|
||||
-- PRIMARY KEY (`id`),
|
||||
-- UNIQUE KEY `permission_userprofile_post_userprofile_id_post_id_b9fb91e9_uniq` (`userprofile_id`,`post_id`),
|
||||
-- KEY `permission_userprofile_post_userprofile_id_229fe756` (`userprofile_id`) USING BTREE,
|
||||
-- KEY `permission_userprofile_post_post_id_dda441c3` (`post_id`) USING BTREE
|
||||
-- ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of permission_userprofile_post
|
||||
-- ----------------------------
|
||||
INSERT INTO `permission_userprofile_post` VALUES (1, 1, 1);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for permission_userprofile_role
|
||||
-- ----------------------------
|
||||
-- DROP TABLE IF EXISTS `permission_userprofile_role`;
|
||||
-- CREATE TABLE `permission_userprofile_role` (
|
||||
-- `id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
-- `userprofile_id` int(11) NOT NULL,
|
||||
-- `role_id` int(11) NOT NULL,
|
||||
-- PRIMARY KEY (`id`),
|
||||
-- UNIQUE KEY `permission_userprofile_role_userprofile_id_role_id_70affc5e_uniq` (`userprofile_id`,`role_id`),
|
||||
-- KEY `permission_userprofile_role_userprofile_id_66835002` (`userprofile_id`) USING BTREE,
|
||||
-- KEY `permission_userprofile_role_role_id_e91fd02e` (`role_id`) USING BTREE
|
||||
-- ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of permission_userprofile_role
|
||||
-- ----------------------------
|
||||
INSERT INTO `permission_userprofile_role` VALUES (1, 1, 1);
|
||||
|
|
|
@ -2,7 +2,7 @@ import { constantRoutes } from '@/router'
|
|||
import { getRouters } from '@/api/menu'
|
||||
import Layout from '@/layout/index'
|
||||
import ParentView from '@/components/ParentView';
|
||||
|
||||
import { handleTree } from "@/utils/ruoyi";
|
||||
const permission = {
|
||||
state: {
|
||||
routes: [],
|
||||
|
@ -24,8 +24,9 @@ const permission = {
|
|||
return new Promise(resolve => {
|
||||
// 向后端请求路由数据
|
||||
getRouters().then(res => {
|
||||
const sdata = JSON.parse(JSON.stringify(res.data))
|
||||
const rdata = JSON.parse(JSON.stringify(res.data))
|
||||
const data = handleTree(res.data, "id");
|
||||
const sdata = JSON.parse(JSON.stringify(data))
|
||||
const rdata = JSON.parse(JSON.stringify(data))
|
||||
const sidebarRoutes = filterAsyncRouter(sdata)
|
||||
const rewriteRoutes = filterAsyncRouter(rdata, false, true)
|
||||
rewriteRoutes.push({ path: '*', redirect: '/404', hidden: true })
|
||||
|
|
|
@ -140,7 +140,6 @@ export function handleTree(data, id, parentId, children, rootId) {
|
|||
//数字比较函数
|
||||
return a.orderNum - b.orderNum;
|
||||
}
|
||||
console.log(1,data)
|
||||
rootId = rootId || Math.min.apply(Math, data.map(item => { return item[parentId] })) || 0
|
||||
//对源数据深度克隆
|
||||
const cloneData = JSON.parse(JSON.stringify(data))
|
||||
|
|
|
@ -155,7 +155,7 @@
|
|||
</el-table-column>
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" v-if="columns[6].visible" width="160">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
<span>{{ parseTime(scope.row.create_datetime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
|
|
|
@ -1,53 +1,6 @@
|
|||
<template>
|
||||
<div>
|
||||
<el-row :gutter="15">
|
||||
<el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-width="100px">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="手机号" prop="mobile">
|
||||
<el-input v-model="formData.mobile" placeholder="请输入手机号" :maxlength="11" show-word-limit clearable
|
||||
prefix-icon='el-icon-mobile' :style="{width: '100%'}"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="多行文本" prop="field101">
|
||||
<el-input v-model="formData.field101" type="textarea" placeholder="请输入多行文本"
|
||||
:autosize="{minRows: 4, maxRows: 4}" :style="{width: '100%'}"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="滑块" prop="field102" required>
|
||||
<el-slider :max='100' :step='1' v-model="formData.field102"></el-slider>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="时间范围" prop="field103">
|
||||
<el-time-picker v-model="formData.field103" is-range format="HH:mm:ss" value-format="HH:mm:ss"
|
||||
:style="{width: '100%'}" start-placeholder="开始时间" end-placeholder="结束时间" range-separator="至"
|
||||
clearable></el-time-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-row gutter="15">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="评分" prop="field105">
|
||||
<el-rate v-model="formData.field105"></el-rate>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="颜色选择" prop="field106" required>
|
||||
<el-color-picker v-model="formData.field106" size="medium"></el-color-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item size="large">
|
||||
<el-button type="primary" @click="submitForm">提交</el-button>
|
||||
<el-button @click="resetForm">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-form>
|
||||
</el-row>
|
||||
无内容
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
|
@ -55,58 +8,15 @@
|
|||
components: {},
|
||||
props: [],
|
||||
data() {
|
||||
return {
|
||||
formData: {
|
||||
mobile: '',
|
||||
field101: undefined,
|
||||
field102: 0,
|
||||
field103: null,
|
||||
field105: 0,
|
||||
field106: null,
|
||||
},
|
||||
rules: {
|
||||
mobile: [{
|
||||
required: true,
|
||||
message: '请输入手机号',
|
||||
trigger: 'blur'
|
||||
}, {
|
||||
pattern: /^1(3|4|5|7|8|9)\d{9}$/,
|
||||
message: '手机号格式错误',
|
||||
trigger: 'blur'
|
||||
}],
|
||||
field101: [{
|
||||
required: true,
|
||||
message: '请输入多行文本',
|
||||
trigger: 'blur'
|
||||
}],
|
||||
field103: [{
|
||||
required: true,
|
||||
message: '时间范围不能为空',
|
||||
trigger: 'change'
|
||||
}],
|
||||
field105: [{
|
||||
required: true,
|
||||
message: '评分不能为空',
|
||||
trigger: 'change'
|
||||
}],
|
||||
},
|
||||
}
|
||||
return {}
|
||||
},
|
||||
computed: {},
|
||||
watch: {},
|
||||
created() {},
|
||||
mounted() {},
|
||||
methods: {
|
||||
submitForm() {
|
||||
this.$refs['elForm'].validate(valid => {
|
||||
if (!valid) return
|
||||
// TODO 提交表单
|
||||
})
|
||||
},
|
||||
resetForm() {
|
||||
this.$refs['elForm'].resetFields()
|
||||
},
|
||||
}
|
||||
created() {
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
methods: {}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
|
|
@ -102,9 +102,9 @@
|
|||
<el-table-column label="系统内置" align="center" prop="configType" :formatter="typeFormat" />
|
||||
<el-table-column label="状态" align="center" prop="status" :formatter="statusFormat" />
|
||||
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||
<el-table-column label="创建时间" align="center" prop="create_datetime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
<span>{{ parseTime(scope.row.create_datetime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
|
|
|
@ -95,9 +95,9 @@
|
|||
width="100"
|
||||
/>
|
||||
<el-table-column label="创建者" align="center" prop="createBy" width="100" />
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="100">
|
||||
<el-table-column label="创建时间" align="center" prop="create_datetime" width="100">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
|
||||
<span>{{ parseTime(scope.row.create_datetime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
|
@ -340,4 +340,4 @@ export default {
|
|||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
</script>
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
<el-table-column type="selection" width="55"></el-table-column>
|
||||
<el-table-column prop="tableName" label="表名称" :show-overflow-tooltip="true"></el-table-column>
|
||||
<el-table-column prop="tableComment" label="表描述" :show-overflow-tooltip="true"></el-table-column>
|
||||
<el-table-column prop="createTime" label="创建时间"></el-table-column>
|
||||
<el-table-column prop="updateTime" label="更新时间"></el-table-column>
|
||||
<el-table-column prop="create_datetime" label="创建时间"></el-table-column>
|
||||
<el-table-column prop="create_datetime" label="更新时间"></el-table-column>
|
||||
</el-table>
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
|
|
|
@ -111,8 +111,8 @@
|
|||
:show-overflow-tooltip="true"
|
||||
width="120"
|
||||
/>
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="160" />
|
||||
<el-table-column label="更新时间" align="center" prop="updateTime" width="160" />
|
||||
<el-table-column label="创建时间" align="center" prop="create_datetime" width="160" />
|
||||
<el-table-column label="更新时间" align="center" prop="create_datetime" width="160" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
|
@ -337,4 +337,4 @@ export default {
|
|||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue