From 59e02756cccdf92c93b485e1783bdae4b78283ce Mon Sep 17 00:00:00 2001 From: insistence <3055204202@qq.com> Date: Mon, 30 Oct 2023 21:44:04 +0800 Subject: [PATCH 1/7] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=97=A0=E9=83=A8=E9=97=A8=E3=80=81=E8=A7=92=E8=89=B2=E6=88=96?= =?UTF-8?q?=E5=B2=97=E4=BD=8D=E6=97=B6=E6=97=A0=E6=B3=95=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=8F=8A=E6=97=A0=E6=B3=95=E7=99=BB=E5=BD=95=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module_admin/annotation/log_annotation.py | 2 +- .../controller/login_controller.py | 2 +- .../module_admin/dao/user_dao.py | 18 +++++++++--------- .../module_admin/entity/vo/user_vo.py | 4 ++-- .../module_admin/service/login_service.py | 4 ++-- .../module_admin/service/user_service.py | 6 +++--- .../views/system/user/profile/__init__.py | 3 ++- 7 files changed, 20 insertions(+), 19 deletions(-) diff --git a/dash-fastapi-backend/module_admin/annotation/log_annotation.py b/dash-fastapi-backend/module_admin/annotation/log_annotation.py index 37dc894..c2d88a6 100644 --- a/dash-fastapi-backend/module_admin/annotation/log_annotation.py +++ b/dash-fastapi-backend/module_admin/annotation/log_annotation.py @@ -136,7 +136,7 @@ def log_decorator(title: str, business_type: int, log_type: Optional[str] = 'ope else: current_user = await get_current_user(request, token, query_db) oper_name = current_user.user.user_name - dept_name = current_user.dept.dept_name + dept_name = current_user.dept.dept_name if current_user.dept else None operation_log = dict( title=title, business_type=business_type, diff --git a/dash-fastapi-backend/module_admin/controller/login_controller.py b/dash-fastapi-backend/module_admin/controller/login_controller.py index e9a000b..19ff188 100644 --- a/dash-fastapi-backend/module_admin/controller/login_controller.py +++ b/dash-fastapi-backend/module_admin/controller/login_controller.py @@ -38,7 +38,7 @@ async def login(request: Request, form_data: CustomOAuth2PasswordRequestForm = D data={ "user_id": str(result[0].user_id), "user_name": result[0].user_name, - "dept_name": result[1].dept_name, + "dept_name": result[1].dept_name if result[1] else None, "session_id": session_id, "login_info": user.login_info }, diff --git a/dash-fastapi-backend/module_admin/dao/user_dao.py b/dash-fastapi-backend/module_admin/dao/user_dao.py index d7a0a50..c68b5db 100644 --- a/dash-fastapi-backend/module_admin/dao/user_dao.py +++ b/dash-fastapi-backend/module_admin/dao/user_dao.py @@ -6,7 +6,7 @@ from module_admin.entity.do.dept_do import SysDept from module_admin.entity.do.post_do import SysPost from module_admin.entity.do.menu_do import SysMenu from module_admin.entity.vo.user_vo import UserModel, UserRoleModel, UserPostModel, CurrentUserInfo, UserQueryModel, UserRoleQueryModel -from utils.time_format_util import list_format_datetime, format_datetime_dict_list +from utils.time_format_util import object_format_datetime, list_format_datetime, format_datetime_dict_list from datetime import datetime, time from typing import Union, List @@ -55,11 +55,11 @@ class UserDao: """ query_user_basic_info = db.query(SysUser) \ .filter(SysUser.status == 0, SysUser.del_flag == 0, SysUser.user_id == user_id) \ - .distinct().all() + .distinct().first() query_user_dept_info = db.query(SysDept).select_from(SysUser) \ .filter(SysUser.status == 0, SysUser.del_flag == 0, SysUser.user_id == user_id) \ .join(SysDept, and_(SysUser.dept_id == SysDept.dept_id, SysDept.status == 0, SysDept.del_flag == 0)) \ - .distinct().all() + .distinct().first() query_user_role_info = db.query(SysRole).select_from(SysUser) \ .filter(SysUser.status == 0, SysUser.del_flag == 0, SysUser.user_id == user_id) \ .outerjoin(SysUserRole, SysUser.user_id == SysUserRole.user_id) \ @@ -85,8 +85,8 @@ class UserDao: .order_by(SysMenu.order_num) \ .distinct().all() results = dict( - user_basic_info=list_format_datetime(query_user_basic_info), - user_dept_info=list_format_datetime(query_user_dept_info), + user_basic_info=object_format_datetime(query_user_basic_info), + user_dept_info=object_format_datetime(query_user_dept_info), user_role_info=list_format_datetime(query_user_role_info), user_post_info=list_format_datetime(query_user_post_info), user_menu_info=list_format_datetime(query_user_menu_info) @@ -104,11 +104,11 @@ class UserDao: """ query_user_basic_info = db.query(SysUser) \ .filter(SysUser.del_flag == 0, SysUser.user_id == user_id) \ - .distinct().all() + .distinct().first() query_user_dept_info = db.query(SysDept).select_from(SysUser) \ .filter(SysUser.del_flag == 0, SysUser.user_id == user_id) \ .join(SysDept, and_(SysUser.dept_id == SysDept.dept_id, SysDept.status == 0, SysDept.del_flag == 0)) \ - .distinct().all() + .distinct().first() query_user_role_info = db.query(SysRole).select_from(SysUser) \ .filter(SysUser.del_flag == 0, SysUser.user_id == user_id) \ .outerjoin(SysUserRole, SysUser.user_id == SysUserRole.user_id) \ @@ -127,8 +127,8 @@ class UserDao: .join(SysMenu, and_(SysRoleMenu.menu_id == SysMenu.menu_id, SysMenu.status == 0)) \ .distinct().all() results = dict( - user_basic_info=list_format_datetime(query_user_basic_info), - user_dept_info=list_format_datetime(query_user_dept_info), + user_basic_info=object_format_datetime(query_user_basic_info), + user_dept_info=object_format_datetime(query_user_dept_info), user_role_info=list_format_datetime(query_user_role_info), user_post_info=list_format_datetime(query_user_post_info), user_menu_info=list_format_datetime(query_user_menu_info) diff --git a/dash-fastapi-backend/module_admin/entity/vo/user_vo.py b/dash-fastapi-backend/module_admin/entity/vo/user_vo.py index 21310f7..ba79c0d 100644 --- a/dash-fastapi-backend/module_admin/entity/vo/user_vo.py +++ b/dash-fastapi-backend/module_admin/entity/vo/user_vo.py @@ -128,8 +128,8 @@ class CurrentUserInfo(BaseModel): """ 数据库返回当前用户信息 """ - user_basic_info: List[Union[UserModel, None]] - user_dept_info: List[Union[DeptModel, None]] + user_basic_info: Union[UserModel, None] + user_dept_info: Union[DeptModel, None] user_role_info: List[Union[RoleModel, None]] user_post_info: List[Union[PostModel, None]] user_menu_info: Union[List, None] diff --git a/dash-fastapi-backend/module_admin/service/login_service.py b/dash-fastapi-backend/module_admin/service/login_service.py index 7a2f71b..a437b9e 100644 --- a/dash-fastapi-backend/module_admin/service/login_service.py +++ b/dash-fastapi-backend/module_admin/service/login_service.py @@ -83,8 +83,8 @@ async def get_current_user(request: Request = Request, token: str = Depends(oaut # ex=timedelta(minutes=JwtConfig.REDIS_TOKEN_EXPIRE_MINUTES)) return CurrentUserInfoServiceResponse( - user=user.user_basic_info[0], - dept=user.user_dept_info[0], + user=user.user_basic_info, + dept=user.user_dept_info, role=user.user_role_info, post=user.user_post_info, menu=user.user_menu_info diff --git a/dash-fastapi-backend/module_admin/service/user_service.py b/dash-fastapi-backend/module_admin/service/user_service.py index 1d8260e..eef7ed4 100644 --- a/dash-fastapi-backend/module_admin/service/user_service.py +++ b/dash-fastapi-backend/module_admin/service/user_service.py @@ -139,8 +139,8 @@ class UserService: user = UserDao.get_user_detail_by_id(result_db, user_id=user_id) return UserDetailModel( - user=user.user_basic_info[0], - dept=user.user_dept_info[0], + user=user.user_basic_info, + dept=user.user_dept_info, role=user.user_role_info, post=user.user_post_info ) @@ -155,7 +155,7 @@ class UserService: """ reset_user = page_object.dict(exclude_unset=True) if page_object.old_password: - user = UserDao.get_user_detail_by_id(result_db, user_id=page_object.user_id).user_basic_info[0] + user = UserDao.get_user_detail_by_id(result_db, user_id=page_object.user_id).user_basic_info if not PwdUtil.verify_password(page_object.old_password, user.password): result = dict(is_success=False, message='旧密码不正确') return CrudUserResponse(**result) diff --git a/dash-fastapi-frontend/views/system/user/profile/__init__.py b/dash-fastapi-frontend/views/system/user/profile/__init__.py index b6fca1d..74eafbf 100644 --- a/dash-fastapi-frontend/views/system/user/profile/__init__.py +++ b/dash-fastapi-frontend/views/system/user/profile/__init__.py @@ -65,7 +65,8 @@ def render(button_perms): fac.AntdIcon(icon='antd-cluster'), fac.AntdText('所属部门'), html.Div( - session.get('dept_info').get('dept_name') + "/" + ','.join( + session.get('dept_info').get('dept_name') if session.get( + 'dept_info') else "" + "/" + ','.join( [item.get('post_name') for item in session.get('post_info')]), id='profile_c-dept', -- Gitee From 8b465573131dc245951e5e54fa2706f0ae69d62d Mon Sep 17 00:00:00 2001 From: insistence <3055204202@qq.com> Date: Tue, 31 Oct 2023 16:19:39 +0800 Subject: [PATCH 2/7] =?UTF-8?q?fix:=E5=90=8C=E6=AD=A5=E6=9C=80=E6=96=B0use?= =?UTF-8?q?r=E5=9C=A8=E8=B4=A6=E5=8F=B7=E5=90=8C=E6=97=B6=E5=8F=AA?= =?UTF-8?q?=E8=83=BD=E7=99=BB=E5=BD=95=E4=B8=80=E6=AC=A1=E7=9A=84=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dash-fastapi-backend/module_admin/service/login_service.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dash-fastapi-backend/module_admin/service/login_service.py b/dash-fastapi-backend/module_admin/service/login_service.py index a437b9e..ca6f8db 100644 --- a/dash-fastapi-backend/module_admin/service/login_service.py +++ b/dash-fastapi-backend/module_admin/service/login_service.py @@ -75,11 +75,11 @@ async def get_current_user(request: Request = Request, token: str = Depends(oaut raise AuthException(data="", message="用户token不合法") redis_token = await request.app.state.redis.get(f"{RedisInitKeyConfig.ACCESS_TOKEN.get('key')}:{session_id}") # 此方法可实现同一账号同一时间只能登录一次 - # redis_token = await request.app.state.redis.get(f"{RedisInitKeyConfig.ACCESS_TOKEN.get('key')}:{user.user_basic_info[0].user_id}") + # redis_token = await request.app.state.redis.get(f"{RedisInitKeyConfig.ACCESS_TOKEN.get('key')}:{user.user_basic_info.user_id}") if token == redis_token: await request.app.state.redis.set(f"{RedisInitKeyConfig.ACCESS_TOKEN.get('key')}:{session_id}", redis_token, ex=timedelta(minutes=JwtConfig.REDIS_TOKEN_EXPIRE_MINUTES)) - # await request.app.state.redis.set(f"{RedisInitKeyConfig.ACCESS_TOKEN.get('key')}:{user.user_basic_info[0].user_id}", redis_token, + # await request.app.state.redis.set(f"{RedisInitKeyConfig.ACCESS_TOKEN.get('key')}:{user.user_basic_info.user_id}", redis_token, # ex=timedelta(minutes=JwtConfig.REDIS_TOKEN_EXPIRE_MINUTES)) return CurrentUserInfoServiceResponse( -- Gitee From 6b86151903fbbcd2b7e713af3eb4ea291a5eb499 Mon Sep 17 00:00:00 2001 From: insistence <3055204202@qq.com> Date: Wed, 1 Nov 2023 18:08:06 +0800 Subject: [PATCH 3/7] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E8=A1=A8=E5=8D=95?= =?UTF-8?q?=E9=9D=9E=E7=A9=BA=E6=A0=A1=E9=AA=8C=E6=97=B6=E4=BC=9A=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E8=A7=A6=E5=8F=91api=E6=8B=A6=E6=88=AA=E5=99=A8?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dash-fastapi-frontend/callbacks/monitor_c/job_c/job_c.py | 2 +- dash-fastapi-frontend/callbacks/system_c/config_c.py | 2 +- dash-fastapi-frontend/callbacks/system_c/dept_c.py | 2 +- dash-fastapi-frontend/callbacks/system_c/dict_c/dict_c.py | 2 +- .../callbacks/system_c/dict_c/dict_data_c.py | 2 +- .../callbacks/system_c/menu_c/components_c/button_type_c.py | 2 +- .../callbacks/system_c/menu_c/components_c/content_type_c.py | 2 +- .../callbacks/system_c/menu_c/components_c/menu_type_c.py | 2 +- dash-fastapi-frontend/callbacks/system_c/notice_c.py | 2 +- dash-fastapi-frontend/callbacks/system_c/post_c.py | 2 +- dash-fastapi-frontend/callbacks/system_c/role_c/role_c.py | 2 +- .../callbacks/system_c/user_c/profile_c/reset_pwd_c.py | 2 +- .../callbacks/system_c/user_c/profile_c/user_info_c.py | 2 +- dash-fastapi-frontend/callbacks/system_c/user_c/user_c.py | 4 ++-- 14 files changed, 15 insertions(+), 15 deletions(-) diff --git a/dash-fastapi-frontend/callbacks/monitor_c/job_c/job_c.py b/dash-fastapi-frontend/callbacks/monitor_c/job_c/job_c.py index d0eb60a..a7aa458 100644 --- a/dash-fastapi-frontend/callbacks/monitor_c/job_c/job_c.py +++ b/dash-fastapi-frontend/callbacks/monitor_c/job_c/job_c.py @@ -378,7 +378,7 @@ def job_confirm(confirm_trigger, modal_type, edit_row_info, form_value, form_lab form_label_validate_info=[None if form_value_state.get(k) else f'{form_label_state.get(k)}不能为空!' for k in form_label_output_list], modal_visible=dash.no_update, operations=dash.no_update, - api_check_token_trigger={'timestamp': time.time()}, + api_check_token_trigger=dash.no_update, global_message_container=fuc.FefferyFancyMessage('处理失败', type='error') ) diff --git a/dash-fastapi-frontend/callbacks/system_c/config_c.py b/dash-fastapi-frontend/callbacks/system_c/config_c.py index 47bf411..b133059 100644 --- a/dash-fastapi-frontend/callbacks/system_c/config_c.py +++ b/dash-fastapi-frontend/callbacks/system_c/config_c.py @@ -351,7 +351,7 @@ def dict_type_confirm(confirm_trigger, modal_type, edit_row_info, form_value, fo form_label_validate_info=[None if form_value_state.get(k) else f'{form_label_state.get(k)}不能为空!' for k in form_label_output_list], modal_visible=dash.no_update, operations=dash.no_update, - api_check_token_trigger={'timestamp': time.time()}, + api_check_token_trigger=dash.no_update, global_message_container=fuc.FefferyFancyMessage('处理失败', type='error') ) diff --git a/dash-fastapi-frontend/callbacks/system_c/dept_c.py b/dash-fastapi-frontend/callbacks/system_c/dept_c.py index 41645cd..57eb787 100644 --- a/dash-fastapi-frontend/callbacks/system_c/dept_c.py +++ b/dash-fastapi-frontend/callbacks/system_c/dept_c.py @@ -348,7 +348,7 @@ def dept_confirm(confirm_trigger, modal_type, edit_row_info, form_value, form_la form_label_validate_info=[None if form_value_state.get(k) else f'{form_label_state.get(k)}不能为空!' for k in form_label_output_list], modal_visible=dash.no_update, operations=dash.no_update, - api_check_token_trigger={'timestamp': time.time()}, + api_check_token_trigger=dash.no_update, global_message_container=fuc.FefferyFancyMessage('处理失败', type='error') ) diff --git a/dash-fastapi-frontend/callbacks/system_c/dict_c/dict_c.py b/dash-fastapi-frontend/callbacks/system_c/dict_c/dict_c.py index a2b87cc..b557feb 100644 --- a/dash-fastapi-frontend/callbacks/system_c/dict_c/dict_c.py +++ b/dash-fastapi-frontend/callbacks/system_c/dict_c/dict_c.py @@ -355,7 +355,7 @@ def dict_type_confirm(confirm_trigger, modal_type, edit_row_info, form_value, fo form_label_validate_info=[None if form_value_state.get(k) else f'{form_label_state.get(k)}不能为空!' for k in form_label_output_list], modal_visible=dash.no_update, operations=dash.no_update, - api_check_token_trigger={'timestamp': time.time()}, + api_check_token_trigger=dash.no_update, global_message_container=fuc.FefferyFancyMessage('处理失败', type='error') ) diff --git a/dash-fastapi-frontend/callbacks/system_c/dict_c/dict_data_c.py b/dash-fastapi-frontend/callbacks/system_c/dict_c/dict_data_c.py index f5c98bc..795cf07 100644 --- a/dash-fastapi-frontend/callbacks/system_c/dict_c/dict_data_c.py +++ b/dash-fastapi-frontend/callbacks/system_c/dict_c/dict_data_c.py @@ -350,7 +350,7 @@ def dict_data_confirm(confirm_trigger, modal_type, edit_row_info, form_value, fo form_label_validate_info=[None if form_value_state.get(k) else f'{form_label_state.get(k)}不能为空!' for k in form_label_output_list], modal_visible=dash.no_update, operations=dash.no_update, - api_check_token_trigger={'timestamp': time.time()}, + api_check_token_trigger=dash.no_update, global_message_container=fuc.FefferyFancyMessage('处理失败', type='error') ) diff --git a/dash-fastapi-frontend/callbacks/system_c/menu_c/components_c/button_type_c.py b/dash-fastapi-frontend/callbacks/system_c/menu_c/components_c/button_type_c.py index 53da181..7116953 100644 --- a/dash-fastapi-frontend/callbacks/system_c/menu_c/components_c/button_type_c.py +++ b/dash-fastapi-frontend/callbacks/system_c/menu_c/components_c/button_type_c.py @@ -90,7 +90,7 @@ def menu_confirm_button(confirm_trigger, modal_type, edit_row_info, parent_id, m ], modal_visible=dash.no_update, operations=dash.no_update, - api_check_token_trigger={'timestamp': time.time()}, + api_check_token_trigger=dash.no_update, global_message_container=fuc.FefferyFancyMessage('处理失败', type='error') ) diff --git a/dash-fastapi-frontend/callbacks/system_c/menu_c/components_c/content_type_c.py b/dash-fastapi-frontend/callbacks/system_c/menu_c/components_c/content_type_c.py index d18c716..967ba75 100644 --- a/dash-fastapi-frontend/callbacks/system_c/menu_c/components_c/content_type_c.py +++ b/dash-fastapi-frontend/callbacks/system_c/menu_c/components_c/content_type_c.py @@ -98,7 +98,7 @@ def menu_confirm_content(confirm_trigger, modal_type, edit_row_info, parent_id, ], modal_visible=dash.no_update, operations=dash.no_update, - api_check_token_trigger={'timestamp': time.time()}, + api_check_token_trigger=dash.no_update, global_message_container=fuc.FefferyFancyMessage('处理失败', type='error') ) diff --git a/dash-fastapi-frontend/callbacks/system_c/menu_c/components_c/menu_type_c.py b/dash-fastapi-frontend/callbacks/system_c/menu_c/components_c/menu_type_c.py index f37b792..8242bb2 100644 --- a/dash-fastapi-frontend/callbacks/system_c/menu_c/components_c/menu_type_c.py +++ b/dash-fastapi-frontend/callbacks/system_c/menu_c/components_c/menu_type_c.py @@ -104,7 +104,7 @@ def menu_confirm_menu(confirm_trigger, modal_type, edit_row_info, parent_id, men ], modal_visible=dash.no_update, operations=dash.no_update, - api_check_token_trigger={'timestamp': time.time()}, + api_check_token_trigger=dash.no_update, global_message_container=fuc.FefferyFancyMessage('处理失败', type='error') ) diff --git a/dash-fastapi-frontend/callbacks/system_c/notice_c.py b/dash-fastapi-frontend/callbacks/system_c/notice_c.py index 310fb80..a0910f4 100644 --- a/dash-fastapi-frontend/callbacks/system_c/notice_c.py +++ b/dash-fastapi-frontend/callbacks/system_c/notice_c.py @@ -500,7 +500,7 @@ def notice_confirm(confirm_trigger, modal_type, edit_row_info, notice_title, not notice_type_form_help=None if notice_type else '请输入公告类型!', modal_visible=dash.no_update, operations=dash.no_update, - api_check_token_trigger={'timestamp': time.time()}, + api_check_token_trigger=dash.no_update, global_message_container=fuc.FefferyFancyMessage('处理失败', type='error') ) diff --git a/dash-fastapi-frontend/callbacks/system_c/post_c.py b/dash-fastapi-frontend/callbacks/system_c/post_c.py index 1f8985a..07712ab 100644 --- a/dash-fastapi-frontend/callbacks/system_c/post_c.py +++ b/dash-fastapi-frontend/callbacks/system_c/post_c.py @@ -339,7 +339,7 @@ def post_confirm(confirm_trigger, modal_type, edit_row_info, form_value, form_la form_label_validate_info=[None if form_value_state.get(k) else f'{form_label_state.get(k)}不能为空!' for k in form_label_output_list], modal_visible=dash.no_update, operations=dash.no_update, - api_check_token_trigger={'timestamp': time.time()}, + api_check_token_trigger=dash.no_update, global_message_container=fuc.FefferyFancyMessage('处理失败', type='error') ) diff --git a/dash-fastapi-frontend/callbacks/system_c/role_c/role_c.py b/dash-fastapi-frontend/callbacks/system_c/role_c/role_c.py index e382657..1d75146 100644 --- a/dash-fastapi-frontend/callbacks/system_c/role_c/role_c.py +++ b/dash-fastapi-frontend/callbacks/system_c/role_c/role_c.py @@ -554,7 +554,7 @@ def role_confirm(confirm_trigger, modal_type, edit_row_info, form_value, form_la form_label_validate_info=[None if form_value_state.get(k) else form_label_state.get(k) for k in form_label_output_list], modal_visible=dash.no_update, operations=dash.no_update, - api_check_token_trigger={'timestamp': time.time()}, + api_check_token_trigger=dash.no_update, global_message_container=fuc.FefferyFancyMessage('处理失败', type='error') ) diff --git a/dash-fastapi-frontend/callbacks/system_c/user_c/profile_c/reset_pwd_c.py b/dash-fastapi-frontend/callbacks/system_c/user_c/profile_c/reset_pwd_c.py index a33a812..7fe7237 100644 --- a/dash-fastapi-frontend/callbacks/system_c/user_c/profile_c/reset_pwd_c.py +++ b/dash-fastapi-frontend/callbacks/system_c/user_c/profile_c/reset_pwd_c.py @@ -76,7 +76,7 @@ def reset_submit_user_info(reset_click, old_password, new_password, confirm_pass None if old_password else '请输入旧密码!', None if new_password else '请输入新密码!', None if confirm_password else '请输入确认密码!', - {'timestamp': time.time()}, + dash.no_update, fuc.FefferyFancyMessage('修改失败', type='error'), ] diff --git a/dash-fastapi-frontend/callbacks/system_c/user_c/profile_c/user_info_c.py b/dash-fastapi-frontend/callbacks/system_c/user_c/profile_c/user_info_c.py index 14a882b..087434d 100644 --- a/dash-fastapi-frontend/callbacks/system_c/user_c/profile_c/user_info_c.py +++ b/dash-fastapi-frontend/callbacks/system_c/user_c/profile_c/user_info_c.py @@ -64,7 +64,7 @@ def reset_submit_user_info(reset_click, nick_name, phonenumber, email, sex): None if nick_name else '请输入用户昵称!', None if phonenumber else '请输入手机号码!', None if email else '请输入邮箱!', - {'timestamp': time.time()}, + dash.no_update, fuc.FefferyFancyMessage('修改失败', type='error'), ] diff --git a/dash-fastapi-frontend/callbacks/system_c/user_c/user_c.py b/dash-fastapi-frontend/callbacks/system_c/user_c/user_c.py index b5c03cc..d521334 100644 --- a/dash-fastapi-frontend/callbacks/system_c/user_c/user_c.py +++ b/dash-fastapi-frontend/callbacks/system_c/user_c/user_c.py @@ -358,7 +358,7 @@ def usr_add_confirm(add_confirm, post, role, form_value, form_label): form_label_validate_info=[None if form_value_state.get(k) else f'{form_label_state.get(k)}不能为空!' for k in form_label_output_list], modal_visible=dash.no_update, operations=dash.no_update, - api_check_token_trigger={'timestamp': time.time()}, + api_check_token_trigger=dash.no_update, global_message_container=fuc.FefferyFancyMessage('新增失败', type='error') ) @@ -513,7 +513,7 @@ def usr_edit_confirm(edit_confirm, edit_row_info, post, role, form_value, form_l form_label_validate_info=[None if form_value_state.get(k) else f'{form_label_state.get(k)}不能为空!' for k in form_label_output_list], modal_visible=dash.no_update, operations=dash.no_update, - api_check_token_trigger={'timestamp': time.time()}, + api_check_token_trigger=dash.no_update, global_message_container=fuc.FefferyFancyMessage('编辑失败', type='error') ) -- Gitee From 5d26b33d931ef0192ab38a776a25650544447b97 Mon Sep 17 00:00:00 2001 From: insistence <3055204202@qq.com> Date: Sat, 4 Nov 2023 19:21:42 +0800 Subject: [PATCH 4/7] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E5=BC=82=E5=B8=B8=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module_admin/controller/user_controller.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dash-fastapi-backend/module_admin/controller/user_controller.py b/dash-fastapi-backend/module_admin/controller/user_controller.py index 88433ff..27bc11b 100644 --- a/dash-fastapi-backend/module_admin/controller/user_controller.py +++ b/dash-fastapi-backend/module_admin/controller/user_controller.py @@ -201,10 +201,10 @@ async def export_system_user_template(request: Request, query_db: Session = Depe @userController.post("/user/export", dependencies=[Depends(CheckUserInterfaceAuth('system:user:export'))]) @log_decorator(title='用户管理', business_type=5) -async def export_system_user_list(request: Request, user_query: UserQueryModel, query_db: Session = Depends(get_db)): +async def export_system_user_list(request: Request, user_query: UserQueryModel, query_db: Session = Depends(get_db), data_scope_sql: str = Depends(GetDataScope('SysUser'))): try: # 获取全量数据 - user_query_result = UserService.get_user_list_services(query_db, user_query) + user_query_result = UserService.get_user_list_services(query_db, user_query, data_scope_sql) user_export_result = UserService.export_user_list_services(user_query_result) logger.info('导出成功') return streaming_response_200(data=bytes2file_response(user_export_result)) -- Gitee From d6be55a66cb5274f4487cd25866fe2d1eb5d3efe Mon Sep 17 00:00:00 2001 From: insistence <3055204202@qq.com> Date: Sat, 4 Nov 2023 19:23:41 +0800 Subject: [PATCH 5/7] =?UTF-8?q?perf:=E4=BC=98=E5=8C=96=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=A4=B1=E6=95=88=E6=97=B6=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E7=A7=BB=E9=99=A4sessionStorage=E7=9A=84token=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dash-fastapi-frontend/callbacks/app_c.py | 8 +++++--- dash-fastapi-frontend/callbacks/layout_c/head_c.py | 6 ++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/dash-fastapi-frontend/callbacks/app_c.py b/dash-fastapi-frontend/callbacks/app_c.py index 0210e43..be94265 100644 --- a/dash-fastapi-frontend/callbacks/app_c.py +++ b/dash-fastapi-frontend/callbacks/app_c.py @@ -28,7 +28,8 @@ def check_api_response(data): # api拦截器——退出登录二次确认 @app.callback( - Output('redirect-container', 'children', allow_duplicate=True), + [Output('redirect-container', 'children', allow_duplicate=True), + Output('token-container', 'data', allow_duplicate=True)], Input('token-invalid-modal', 'okCounts'), prevent_initial_call=True ) @@ -41,10 +42,11 @@ def redirect_page(okCounts): dcc.Location( pathname='/login', id='index-redirect' - ) + ), + None ] - return dash.no_update + return [dash.no_update] * 2 # 应用初始化主题颜色 diff --git a/dash-fastapi-frontend/callbacks/layout_c/head_c.py b/dash-fastapi-frontend/callbacks/layout_c/head_c.py index f462f7c..a64910c 100644 --- a/dash-fastapi-frontend/callbacks/layout_c/head_c.py +++ b/dash-fastapi-frontend/callbacks/layout_c/head_c.py @@ -45,7 +45,8 @@ app.clientside_callback( # 退出登录回调 @app.callback( - Output('redirect-container', 'children', allow_duplicate=True), + [Output('redirect-container', 'children', allow_duplicate=True), + Output('token-container', 'data', allow_duplicate=True)], Input('logout-modal', 'okCounts'), prevent_initial_call=True ) @@ -60,9 +61,10 @@ def logout_confirm(okCounts): pathname='/login', id='index-redirect' ), + None ] - return dash.no_update + return [dash.no_update] * 2 # 全局页面重载回调 -- Gitee From 49c3823ef1c84f2e908e4fe09ef68710d423ea43 Mon Sep 17 00:00:00 2001 From: insistence <3055204202@qq.com> Date: Sat, 4 Nov 2023 19:24:23 +0800 Subject: [PATCH 6/7] =?UTF-8?q?feat:=E9=A6=96=E9=A1=B5=E5=A4=B4=E9=83=A8?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=BC=80=E6=BA=90=E9=A1=B9=E7=9B=AE=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/layout/components/head.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/dash-fastapi-frontend/views/layout/components/head.py b/dash-fastapi-frontend/views/layout/components/head.py index 95efcf8..5f1e7fd 100644 --- a/dash-fastapi-frontend/views/layout/components/head.py +++ b/dash-fastapi-frontend/views/layout/components/head.py @@ -50,7 +50,7 @@ def render_head_content(): 'display': 'flex', 'alignItems': 'center' }, - flex='24' + flex='21' ), # 页首中部搜索区域 @@ -87,6 +87,23 @@ def render_head_content(): flex='6' ), + # 页首开源项目地址 + fac.AntdCol( + html.A( + html.Img( + src='https://gitee.com/insistence2022/dash-fastapi-admin/badge/star.svg?theme=dark' + ), + href='https://gitee.com/insistence2022/dash-fastapi-admin', + target='_blank' + ), + style={ + 'height': '100%', + 'display': 'flex', + 'alignItems': 'center' + }, + flex='3' + ), + # 页首右侧用户信息区域 fac.AntdCol( fac.AntdSpace( -- Gitee From ff393065397b6e1fbd08cb6847a26d1f17e43b33 Mon Sep 17 00:00:00 2001 From: insistence <3055204202@qq.com> Date: Sat, 4 Nov 2023 19:42:05 +0800 Subject: [PATCH 7/7] =?UTF-8?q?docs:=E6=9B=B4=E6=96=B0README=E6=96=87?= =?UTF-8?q?=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b96177e..3e2227f 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@
-
- + @@ -85,6 +85,11 @@ Dash-FastAPI-Admin是一套全部开源的快速开发平台,毫无保留给 +## 在线体验 +- *账号:admin* +- *密码:admin123* +- 演示地址:dfadmin管理系统 + ## 项目运行相关 ```bash -- Gitee