From 88911a273ffdb0effa9ea894e1d14ce1566f2237 Mon Sep 17 00:00:00 2001 From: insistence <3055204202@qq.com> Date: Tue, 27 Feb 2024 10:47:57 +0800 Subject: [PATCH 1/3] =?UTF-8?q?refactor:=20=E9=87=8D=E6=9E=84=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E5=8A=A0=E8=BD=BD=E7=9A=84=E9=A1=B5=E9=9D=A2=E5=85=A5?= =?UTF-8?q?=E5=8F=82=EF=BC=8C=E6=94=B9=E7=94=A8=E4=BD=8D=E7=BD=AE=E5=8F=82?= =?UTF-8?q?=E6=95=B0args=E5=92=8C=E5=85=B3=E9=94=AE=E5=AD=97=E5=8F=82?= =?UTF-8?q?=E6=95=B0kwargs=E6=8E=A5=E6=94=B6=E4=BC=A0=E5=85=A5=E7=9A=84?= =?UTF-8?q?=E5=8F=82=E6=95=B0=EF=BC=8C=E4=B8=8D=E5=86=8D=E6=8C=87=E5=AE=9A?= =?UTF-8?q?=E5=85=B7=E4=BD=93=E7=9A=84=E5=85=A5=E5=8F=82=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dash-fastapi-frontend/callbacks/layout_c/index_c.py | 6 ++++-- .../views/monitor/cache/control/__init__.py | 3 ++- dash-fastapi-frontend/views/monitor/cache/list/__init__.py | 2 +- dash-fastapi-frontend/views/monitor/druid/__init__.py | 2 +- dash-fastapi-frontend/views/monitor/job/__init__.py | 3 ++- dash-fastapi-frontend/views/monitor/logininfor/__init__.py | 3 ++- dash-fastapi-frontend/views/monitor/online/__init__.py | 3 ++- dash-fastapi-frontend/views/monitor/operlog/__init__.py | 3 ++- dash-fastapi-frontend/views/monitor/server/__init__.py | 3 ++- dash-fastapi-frontend/views/system/config/__init__.py | 3 ++- dash-fastapi-frontend/views/system/dept/__init__.py | 3 ++- dash-fastapi-frontend/views/system/dict/__init__.py | 3 ++- dash-fastapi-frontend/views/system/menu/__init__.py | 3 ++- dash-fastapi-frontend/views/system/notice/__init__.py | 3 ++- dash-fastapi-frontend/views/system/post/__init__.py | 3 ++- dash-fastapi-frontend/views/system/role/__init__.py | 3 ++- dash-fastapi-frontend/views/system/user/__init__.py | 3 ++- dash-fastapi-frontend/views/system/user/profile/__init__.py | 2 +- dash-fastapi-frontend/views/tool/build/__init__.py | 2 +- dash-fastapi-frontend/views/tool/gen/__init__.py | 2 +- dash-fastapi-frontend/views/tool/swagger/__init__.py | 2 +- 21 files changed, 38 insertions(+), 22 deletions(-) diff --git a/dash-fastapi-frontend/callbacks/layout_c/index_c.py b/dash-fastapi-frontend/callbacks/layout_c/index_c.py index 82b8cd4..d966cf8 100644 --- a/dash-fastapi-frontend/callbacks/layout_c/index_c.py +++ b/dash-fastapi-frontend/callbacks/layout_c/index_c.py @@ -3,7 +3,7 @@ from dash.exceptions import PreventUpdate import feffery_antd_components as fac from jsonpath_ng import parse -from flask import json +from flask import json, session from collections import OrderedDict from server import app @@ -53,10 +53,12 @@ def handle_tab_switch_and_create(currentKey, tabCloseCounts, latestDeletePane, o if currentKey == '个人资料': menu_title = '个人资料' button_perms = [] + role_perms = [] menu_modules = 'system.user.profile' else: menu_title = find_title_by_key(menu_info.get('menu_info'), currentKey) button_perms = [item.get('perms') for item in menu_list.get('menu_list') if str(item.get('parent_id')) == currentKey] + role_perms = [item.get('role_key') for item in session.get('role_info')] # 判断当前选中的菜单栏项是否存在module,如果有,则动态导入module,否则返回404页面 menu_modules = find_modules_by_key(menu_info.get('menu_info'), currentKey) @@ -106,7 +108,7 @@ def handle_tab_switch_and_create(currentKey, tabCloseCounts, latestDeletePane, o { 'label': menu_title, 'key': currentKey, - 'children': eval('views.' + menu_modules + '.render(button_perms)'), + 'children': eval('views.' + menu_modules + '.render(button_perms=button_perms, role_perms=role_perms)'), 'contextMenu': context_menu } ) diff --git a/dash-fastapi-frontend/views/monitor/cache/control/__init__.py b/dash-fastapi-frontend/views/monitor/cache/control/__init__.py index e19d887..08dd3fb 100644 --- a/dash-fastapi-frontend/views/monitor/cache/control/__init__.py +++ b/dash-fastapi-frontend/views/monitor/cache/control/__init__.py @@ -5,7 +5,8 @@ from api.cache import get_cache_statistical_info_api -def render(button_perms): +def render(*args, **kwargs): + button_perms = kwargs.get('button_perms') command_stats = [] db_size = '' info = {} diff --git a/dash-fastapi-frontend/views/monitor/cache/list/__init__.py b/dash-fastapi-frontend/views/monitor/cache/list/__init__.py index 7db8b26..015739c 100644 --- a/dash-fastapi-frontend/views/monitor/cache/list/__init__.py +++ b/dash-fastapi-frontend/views/monitor/cache/list/__init__.py @@ -5,7 +5,7 @@ import callbacks.monitor_c.cache_c.list_c -def render(button_perms): +def render(*args, **kwargs): cache_name_data = [] cache_name_res = get_cache_name_list_api() if cache_name_res.get('code') == 200: diff --git a/dash-fastapi-frontend/views/monitor/druid/__init__.py b/dash-fastapi-frontend/views/monitor/druid/__init__.py index 67faba2..a79fa8c 100644 --- a/dash-fastapi-frontend/views/monitor/druid/__init__.py +++ b/dash-fastapi-frontend/views/monitor/druid/__init__.py @@ -3,6 +3,6 @@ import feffery_antd_components as fac -def render(button_perms): +def render(*args, **kwargs): return html.Div('我是数据监控') diff --git a/dash-fastapi-frontend/views/monitor/job/__init__.py b/dash-fastapi-frontend/views/monitor/job/__init__.py index 7785e34..03dec39 100644 --- a/dash-fastapi-frontend/views/monitor/job/__init__.py +++ b/dash-fastapi-frontend/views/monitor/job/__init__.py @@ -8,7 +8,8 @@ from api.dict import query_dict_data_list_api -def render(button_perms): +def render(*args, **kwargs): + button_perms = kwargs.get('button_perms') option = [] option_table = [] diff --git a/dash-fastapi-frontend/views/monitor/logininfor/__init__.py b/dash-fastapi-frontend/views/monitor/logininfor/__init__.py index 55c9b37..ebe85e5 100644 --- a/dash-fastapi-frontend/views/monitor/logininfor/__init__.py +++ b/dash-fastapi-frontend/views/monitor/logininfor/__init__.py @@ -5,7 +5,8 @@ from api.log import get_login_log_list_api -def render(button_perms): +def render(*args, **kwargs): + button_perms = kwargs.get('button_perms') login_log_params = dict(page_num=1, page_size=10) table_info = get_login_log_list_api(login_log_params) diff --git a/dash-fastapi-frontend/views/monitor/online/__init__.py b/dash-fastapi-frontend/views/monitor/online/__init__.py index 9560c1b..db80ae5 100644 --- a/dash-fastapi-frontend/views/monitor/online/__init__.py +++ b/dash-fastapi-frontend/views/monitor/online/__init__.py @@ -5,7 +5,8 @@ from api.online import get_online_list_api -def render(button_perms): +def render(*args, **kwargs): + button_perms = kwargs.get('button_perms') online_params = dict(page_num=1, page_size=10) table_info = get_online_list_api(online_params) diff --git a/dash-fastapi-frontend/views/monitor/operlog/__init__.py b/dash-fastapi-frontend/views/monitor/operlog/__init__.py index 8c1f3a7..6e77157 100644 --- a/dash-fastapi-frontend/views/monitor/operlog/__init__.py +++ b/dash-fastapi-frontend/views/monitor/operlog/__init__.py @@ -7,7 +7,8 @@ from api.dict import query_dict_data_list_api -def render(button_perms): +def render(*args, **kwargs): + button_perms = kwargs.get('button_perms') option = [] option_table = [] diff --git a/dash-fastapi-frontend/views/monitor/server/__init__.py b/dash-fastapi-frontend/views/monitor/server/__init__.py index 324a03b..b88944e 100644 --- a/dash-fastapi-frontend/views/monitor/server/__init__.py +++ b/dash-fastapi-frontend/views/monitor/server/__init__.py @@ -4,7 +4,8 @@ from api.server import get_server_statistical_info_api -def render(button_perms): +def render(*args, **kwargs): + button_perms = kwargs.get('button_perms') cpu = {} mem = {} sys = {} diff --git a/dash-fastapi-frontend/views/system/config/__init__.py b/dash-fastapi-frontend/views/system/config/__init__.py index 9a34575..2b5093c 100644 --- a/dash-fastapi-frontend/views/system/config/__init__.py +++ b/dash-fastapi-frontend/views/system/config/__init__.py @@ -5,7 +5,8 @@ from api.config import get_config_list_api -def render(button_perms): +def render(*args, **kwargs): + button_perms = kwargs.get('button_perms') config_params = dict(page_num=1, page_size=10) table_info = get_config_list_api(config_params) diff --git a/dash-fastapi-frontend/views/system/dept/__init__.py b/dash-fastapi-frontend/views/system/dept/__init__.py index 354bb6e..5983d03 100644 --- a/dash-fastapi-frontend/views/system/dept/__init__.py +++ b/dash-fastapi-frontend/views/system/dept/__init__.py @@ -6,7 +6,8 @@ from utils.tree_tool import list_to_tree -def render(button_perms): +def render(*args, **kwargs): + button_perms = kwargs.get('button_perms') table_data_new = [] default_expanded_row_keys = [] table_info = get_dept_list_api({}) diff --git a/dash-fastapi-frontend/views/system/dict/__init__.py b/dash-fastapi-frontend/views/system/dict/__init__.py index 608f59e..ac8824a 100644 --- a/dash-fastapi-frontend/views/system/dict/__init__.py +++ b/dash-fastapi-frontend/views/system/dict/__init__.py @@ -6,7 +6,8 @@ from api.dict import get_dict_type_list_api -def render(button_perms): +def render(*args, **kwargs): + button_perms = kwargs.get('button_perms') dict_type_params = dict(page_num=1, page_size=10) table_info = get_dict_type_list_api(dict_type_params) diff --git a/dash-fastapi-frontend/views/system/menu/__init__.py b/dash-fastapi-frontend/views/system/menu/__init__.py index 12f0f2a..0e8988d 100644 --- a/dash-fastapi-frontend/views/system/menu/__init__.py +++ b/dash-fastapi-frontend/views/system/menu/__init__.py @@ -7,7 +7,8 @@ import callbacks.system_c.menu_c.menu_c -def render(button_perms): +def render(*args, **kwargs): + button_perms = kwargs.get('button_perms') table_data_new = [] table_info = get_menu_list_api({}) if table_info['code'] == 200: diff --git a/dash-fastapi-frontend/views/system/notice/__init__.py b/dash-fastapi-frontend/views/system/notice/__init__.py index 04cb68d..dea0047 100644 --- a/dash-fastapi-frontend/views/system/notice/__init__.py +++ b/dash-fastapi-frontend/views/system/notice/__init__.py @@ -11,7 +11,8 @@ from api.dict import query_dict_data_list_api -def render(button_perms): +def render(*args, **kwargs): + button_perms = kwargs.get('button_perms') option = [] option_table = [] diff --git a/dash-fastapi-frontend/views/system/post/__init__.py b/dash-fastapi-frontend/views/system/post/__init__.py index af668e8..b19207b 100644 --- a/dash-fastapi-frontend/views/system/post/__init__.py +++ b/dash-fastapi-frontend/views/system/post/__init__.py @@ -5,7 +5,8 @@ from api.post import get_post_list_api -def render(button_perms): +def render(*args, **kwargs): + button_perms = kwargs.get('button_perms') post_params = dict(page_num=1, page_size=10) table_info = get_post_list_api(post_params) diff --git a/dash-fastapi-frontend/views/system/role/__init__.py b/dash-fastapi-frontend/views/system/role/__init__.py index 27fba42..715045e 100644 --- a/dash-fastapi-frontend/views/system/role/__init__.py +++ b/dash-fastapi-frontend/views/system/role/__init__.py @@ -6,7 +6,8 @@ from api.role import get_role_list_api -def render(button_perms): +def render(*args, **kwargs): + button_perms = kwargs.get('button_perms') role_params = dict(page_num=1, page_size=10) table_info = get_role_list_api(role_params) diff --git a/dash-fastapi-frontend/views/system/user/__init__.py b/dash-fastapi-frontend/views/system/user/__init__.py index 646878e..934d9b6 100644 --- a/dash-fastapi-frontend/views/system/user/__init__.py +++ b/dash-fastapi-frontend/views/system/user/__init__.py @@ -10,7 +10,8 @@ import callbacks.system_c.user_c.user_c -def render(button_perms): +def render(*args, **kwargs): + button_perms = kwargs.get('button_perms') dept_params = dict(dept_name='') user_params = dict(page_num=1, page_size=10) tree_info = get_dept_tree_api(dept_params) diff --git a/dash-fastapi-frontend/views/system/user/profile/__init__.py b/dash-fastapi-frontend/views/system/user/profile/__init__.py index 74eafbf..4d73f63 100644 --- a/dash-fastapi-frontend/views/system/user/profile/__init__.py +++ b/dash-fastapi-frontend/views/system/user/profile/__init__.py @@ -5,7 +5,7 @@ from . import user_avatar, user_info, reset_pwd -def render(button_perms): +def render(*args, **kwargs): return [ fac.AntdRow( diff --git a/dash-fastapi-frontend/views/tool/build/__init__.py b/dash-fastapi-frontend/views/tool/build/__init__.py index f510659..eed12cc 100644 --- a/dash-fastapi-frontend/views/tool/build/__init__.py +++ b/dash-fastapi-frontend/views/tool/build/__init__.py @@ -3,6 +3,6 @@ import feffery_antd_components as fac -def render(button_perms): +def render(*args, **kwargs): return html.Div('我是表单构建') diff --git a/dash-fastapi-frontend/views/tool/gen/__init__.py b/dash-fastapi-frontend/views/tool/gen/__init__.py index db8cbf6..3b7564a 100644 --- a/dash-fastapi-frontend/views/tool/gen/__init__.py +++ b/dash-fastapi-frontend/views/tool/gen/__init__.py @@ -3,6 +3,6 @@ import feffery_antd_components as fac -def render(button_perms): +def render(*args, **kwargs): return html.Div('我是代码生成') diff --git a/dash-fastapi-frontend/views/tool/swagger/__init__.py b/dash-fastapi-frontend/views/tool/swagger/__init__.py index ef7d13d..aeafa30 100644 --- a/dash-fastapi-frontend/views/tool/swagger/__init__.py +++ b/dash-fastapi-frontend/views/tool/swagger/__init__.py @@ -3,7 +3,7 @@ from config.global_config import ApiBaseUrlConfig -def render(button_perms): +def render(*args, **kwargs): return [ html.Div( From 38d21da6a218e3a36284a4b5f0ea0dcb99ac2c97 Mon Sep 17 00:00:00 2001 From: insistence <3055204202@qq.com> Date: Tue, 27 Feb 2024 10:51:30 +0800 Subject: [PATCH 2/3] =?UTF-8?q?chore:=20=E5=8D=87=E7=BA=A7=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E8=87=B31.3.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dash-fastapi-backend/.env.dev | 2 +- dash-fastapi-backend/.env.prod | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dash-fastapi-backend/.env.dev b/dash-fastapi-backend/.env.dev index 7dfa817..993f83b 100644 --- a/dash-fastapi-backend/.env.dev +++ b/dash-fastapi-backend/.env.dev @@ -10,7 +10,7 @@ APP_HOST = '0.0.0.0' # 应用端口 APP_PORT = 9099 # 应用版本 -APP_VERSION= '1.2.1' +APP_VERSION= '1.3.0' # 应用是否开启热重载 APP_RELOAD = true diff --git a/dash-fastapi-backend/.env.prod b/dash-fastapi-backend/.env.prod index b496d9f..3ec163c 100644 --- a/dash-fastapi-backend/.env.prod +++ b/dash-fastapi-backend/.env.prod @@ -10,7 +10,7 @@ APP_HOST = '0.0.0.0' # 应用端口 APP_PORT = 9099 # 应用版本 -APP_VERSION= '1.2.1' +APP_VERSION= '1.3.0' # 应用是否开启热重载 APP_RELOAD = false From 3ee2cec477ab5e84d0e032a6f81f6e5cf8b9e916 Mon Sep 17 00:00:00 2001 From: insistence <3055204202@qq.com> Date: Tue, 27 Feb 2024 10:51:55 +0800 Subject: [PATCH 3/3] =?UTF-8?q?docs:=20=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 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5599e94..5fdcafd 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@
-
+
@@ -14,6 +14,7 @@
+
## 平台简介
Dash-FastAPI-Admin是一套全部开源的快速开发平台,毫无保留给个人及企业免费使用。