From 77b2bbe722d299f373118b08e9d52c3c2e43b3e2 Mon Sep 17 00:00:00 2001 From: 13507605001 Date: Fri, 25 Nov 2022 13:36:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/power/views.py | 17 +++++++++++------ db_logic/module.py | 46 +++++++++++++++++++++++++++++++-------------- 2 files changed, 43 insertions(+), 20 deletions(-) diff --git a/apps/power/views.py b/apps/power/views.py index a237cdd..c5ad7ea 100644 --- a/apps/power/views.py +++ b/apps/power/views.py @@ -44,13 +44,13 @@ def add_user_power_list(): drug_module = request.values.get("drug_module_id") standard_module = request.values.get("standard_module_id") consumables_module = request.values.get("consumables_module_id") - instrument_modulet = request.values.get("instrument_module_id") + # instrument_modulet = request.values.get("instrument_module_id") inster_dic = { "1": eval(client_module) if client_module else [], "2": eval(drug_module) if drug_module else [], "3": eval(standard_module) if standard_module else [], "4": eval(consumables_module) if consumables_module else [], - "5": eval(instrument_modulet) if instrument_modulet else [], + # "5": eval(instrument_modulet) if instrument_modulet else [], } # 删除除去柜子权限外的所有权限 BllModuleRelation().delete( @@ -138,14 +138,19 @@ def add_role(): client_module = request.values.get("client_module_id") drug_module = request.values.get("drug_module_id") standard_module = request.values.get("standard_module_id") - consumables_module = request.values.get("consumables_module_id") - instrument_modulet = request.values.get("instrument_module_id") + dangerous_module = request.values.get("dangerous_module_id") + # consumables_module = request.values.get("consumables_module_id") + # instrument_modulet = request.values.get("instrument_module_id") inster_dic = { "1": eval(client_module) if client_module else [], "2": eval(drug_module) if drug_module else [], "3": eval(standard_module) if standard_module else [], - "4": eval(consumables_module) if consumables_module else [], - "5": eval(instrument_modulet) if instrument_modulet else [], + "4": eval(dangerous_module) if dangerous_module else [], + # "1": eval(client_module) if client_module else [], + # "2": eval(drug_module) if drug_module else [], + # "3": eval(standard_module) if standard_module else [], + # "4": eval(consumables_module) if consumables_module else [], + # "5": eval(instrument_modulet) if instrument_modulet else [], } description = request.values.get("description") # 获取角色代码或者角色名的角色信息 diff --git a/db_logic/module.py b/db_logic/module.py index 9538b01..3550725 100644 --- a/db_logic/module.py +++ b/db_logic/module.py @@ -19,28 +19,46 @@ class BllModule(Repository): sql_all = """ select module_id, module_type, module_name, sort_index, description from rms_module where is_enabled=1 """ - data = { + # data = { - # "client_list":[] - "client_manage": [], - "sys_manage": [], + # # "client_list":[] + # "client_manage": [], + # "sys_manage": [], + # "standard_manage": [], + # "consumables_manage": [], + # "instrument_manage": [] + # } + # sql_data = Utils.msyql_table_model(self.execute(sql_all).fetchall()) + # for i in sql_data: + # if i["module_type"] == "1": + # data["client_manage"].append(i) + # elif i["module_type"] == "2": + # data["sys_manage"].append(i) + # elif i["module_type"] == "3": + # data["standard_manage"].append(i) + # elif i["module_type"] == "4": + # data["consumables_manage"].append(i) + # elif i["module_type"] == "5": + # data["instrument_manage"].append(i) + # return data + sql_data = Utils.msyql_table_model(self.execute(sql_all).fetchall()) + data_dict = { + "client_manage":[], + "drug_manage": [], "standard_manage": [], - "consumables_manage": [], - "instrument_manage": [] + "dangerous_manage": [], } - sql_data = Utils.msyql_table_model(self.execute(sql_all).fetchall()) for i in sql_data: if i["module_type"] == "1": - data["client_manage"].append(i) + data_dict["client_manage"].append(i) elif i["module_type"] == "2": - data["sys_manage"].append(i) + data_dict["drug_manage"].append(i) elif i["module_type"] == "3": - data["standard_manage"].append(i) + data_dict["standard_manage"].append(i) elif i["module_type"] == "4": - data["consumables_manage"].append(i) - elif i["module_type"] == "5": - data["instrument_manage"].append(i) - return data + data_dict["dangerous_manage"].append(i) + + return data_dict def inster_info_list(self): obj_list = []