From 0d19d4b74836d5594164a114085068f73fc39852 Mon Sep 17 00:00:00 2001 From: dlpuzcl Date: Sat, 29 Jul 2023 23:02:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BB=A3=E7=A0=81=E7=94=9F?= =?UTF-8?q?=E6=88=90=E5=99=A8BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/system/apis/code_generator.py | 23 +++++++++---------- .../system/code_template/web/data_template.py | 1 + 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/backend/system/apis/code_generator.py b/backend/system/apis/code_generator.py index 16a5551..5d1bdaf 100644 --- a/backend/system/apis/code_generator.py +++ b/backend/system/apis/code_generator.py @@ -185,18 +185,17 @@ def generate_code(request, generator_template_id: int): ] batch_create(request, button_list, MenuButton) - # 添加列表字段 - table_info = json.loads(instance.table_info) - column_info = table_info.get('columnInfo') - column_list = [] - for item in column_info: - column_list.append({ - 'code': item['field_name'], - 'name': item['column_name'], - 'menu_id': 45, - }) - batch_create(request, column_list, MenuColumnField) - + # 添加列表字段 + table_info = json.loads(instance.table_info) + column_info = table_info.get('columnInfo') + column_list = [] + for item in column_info: + column_list.append({ + 'code': instance.code + ':' + item['field_name'], + 'name': item['column_name'], + 'menu_id': menu_qr.id, + }) + batch_create(request, column_list, MenuColumnField) # 生成后端代码 backend_model_txt = generator_backend_model(instance) diff --git a/backend/system/code_template/web/data_template.py b/backend/system/code_template/web/data_template.py index 23f6ffe..0a86801 100644 --- a/backend/system/code_template/web/data_template.py +++ b/backend/system/code_template/web/data_template.py @@ -35,6 +35,7 @@ import {{ FormSchema }} from '/@/components/Table'; width: '{item['width']}', fixed: '{item['freeze']}', align: '{item['align']}', + auth: [{data_info.code + ':' + item['field_name']}] resizable: {str(item['resizable']).lower()}, }}, ''' -- Gitee