From cd2342661a8fc35f3a54c3d910a0744cd1b60f40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BD=AD=E6=A3=AE?= Date: Wed, 19 Jun 2024 00:23:33 +0800 Subject: [PATCH] =?UTF-8?q?commit=201.=20=E7=BB=A7=E6=89=BFitems=5Flist?= =?UTF-8?q?=E7=9A=84html?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/hrm_mgnt/views.py | 17 +- application/org_mgnt/templates/ce_list.html | 939 ------------------ .../org_mgnt/templates/ce_list_inherit.html | 611 ++++++++++++ application/org_mgnt/views.py | 6 +- common/views.py | 7 +- templates/items_list.html | 298 +++--- 6 files changed, 783 insertions(+), 1095 deletions(-) delete mode 100644 application/org_mgnt/templates/ce_list.html create mode 100644 application/org_mgnt/templates/ce_list_inherit.html diff --git a/application/hrm_mgnt/views.py b/application/hrm_mgnt/views.py index 9c4b972..8e3e3ce 100644 --- a/application/hrm_mgnt/views.py +++ b/application/hrm_mgnt/views.py @@ -101,7 +101,7 @@ def emp_list_view(request): # 表格显示排除配置 "table_exclude_field_name": ['employee_id'], # 筛选表单提交链接 - "form_action_url": "emp_list", + "form_action_url": reverse('emp_list'), # 修改对象提交链接 "modify_url": reverse("emp_list_modify"), # 新增对象提交链接 @@ -109,9 +109,10 @@ def emp_list_view(request): # 删除对象提交链接 "delete_url": reverse("emp_list_delete"), "add_button": True, + "import_excel_button": True } - return render(request, 'emp_list_2.html', context) + return render(request, 'emp_list.html', context) @login_required @@ -174,7 +175,9 @@ def emp_list_modify(request): try: instance = EmployeeInformation.objects.get(employee_id=request.GET['id']) form = EmployeeInformationEditForm(instance=instance) - form.fields['secondary_department'].queryset = SecondaryDepartment.objects.filter(primary_department=instance.primary_department).order_by('secondary_department_name') + primary_department = PrimaryDepartment.objects.get(department_name=instance.primary_department) + form.fields['secondary_department'].queryset = SecondaryDepartment.objects.filter( + primary_department=primary_department.primary_department_id).order_by('secondary_department_name') except EmployeeInformation.DoesNotExist: raise Http404("对象不存在") else: @@ -881,8 +884,6 @@ def performance_delete(request): return JsonResponse({"message": "无效的请求方法"}, status=405) - - @csrf_protect @login_required def save_excel_table_data(request): @@ -940,9 +941,3 @@ def save_excel_table_data(request): except Exception as e: return JsonResponse({'error': f'服务器内部错误: {str(e)}'}, status=500) return JsonResponse({'error': '无效的请求方法'}, status=400) - - - - - - diff --git a/application/org_mgnt/templates/ce_list.html b/application/org_mgnt/templates/ce_list.html deleted file mode 100644 index cb22949..0000000 --- a/application/org_mgnt/templates/ce_list.html +++ /dev/null @@ -1,939 +0,0 @@ -{% extends 'base.html' %} -{% load static tags %} - -{% block content %} -
-
-
-
-
-
- {% include 'breadcrumb.html' %} -
-
-
-
-
-
- -
- {% csrf_token %} -
- {% for filter in filters %} - {% if filter.type == 'text' %} -
- - -
- {% elif filter.type == 'select' %} -
- - -
- {% elif filter.type == 'date' %} -
- - -
- {% elif filter.type == 'month' %} -
- - -
- {% endif %} - {% endfor %} -
- -
-
-
- -
- -
- {% render_button 'modify_records_button' %} - {% render_button 'add_button' %} - {% render_button 'report_excel_button' %} - {# {% render_button 'import_excel_button' %}#} - -
- -
-
-
-
-
-
-
-
-
-
- - - {% get_verbose_field_names_from_model model_config table_exclude_field_name as columns %} - - - {% for column in columns %} - - {% endfor %} - - - - - {% for item in items %} - - {% for field in item|get_fields:table_exclude_field_name %} - {% if field.verbose_name|is_in_list:"营业范围,注册地址" %} - - {% elif field.verbose_name == '股东姓名及持股比例' %} - - {% elif field.verbose_name == '历史沿革' %} - - {% elif field.verbose_name == '相关银行账户信息' %} - - {% else %} - {% if '(元)' in field.verbose_name %} - - {% else %} - - {% endif %} - {% endif %} - {% endfor %} - - - {% empty %} - - - - {% endfor %} - -
{{ column }}操作
{{ field.value|truncatechars:10 }} - 详情 - - 查看 - - 查看 - {{ field.value|thousands_separator }}{{ field.value }} - 编辑 - 删除 -
暂无数据 -
- -
-
-
-
-
- {% include 'pagination_ps.html' with page_obj=items query_params=query_params %} -
-
-
-
-
-
- - - - - - - - - - - - - - - - - {% include 'modify_record_modal.html' with modify_records_url=modify_records_url %} - - {% block item_list_custom_content %} - {% endblock %} - - - -{% endblock %} diff --git a/application/org_mgnt/templates/ce_list_inherit.html b/application/org_mgnt/templates/ce_list_inherit.html new file mode 100644 index 0000000..8030d40 --- /dev/null +++ b/application/org_mgnt/templates/ce_list_inherit.html @@ -0,0 +1,611 @@ +{% extends 'items_List.html' %} +{% load static tags %} + +{% block fields_list_content %} +
+
+
+
+
+ + + {% get_verbose_field_names_from_model model_config table_exclude_field_name as columns %} + + + {% for column in columns %} + + {% endfor %} + + + + + {% for item in items %} + + {% for field in item|get_fields:table_exclude_field_name %} + {% if field.verbose_name|is_in_list:"营业范围,注册地址" %} + + {% elif field.verbose_name == '股东姓名及持股比例' %} + + {% elif field.verbose_name == '历史沿革' %} + + {% elif field.verbose_name == '相关银行账户信息' %} + + {% else %} + {% if '(元)' in field.verbose_name %} + + {% else %} + + {% endif %} + {% endif %} + {% endfor %} + + + {% empty %} + + + + {% endfor %} + +
{{ column }}操作
{{ field.value|truncatechars:10 }} + 详情 + + 查看 + + 查看 + {{ field.value|thousands_separator }}{{ field.value }} + 编辑 + 删除 +
暂无数据 +
+ +
+
+
+
+
+{% endblock %} + +{% block item_list_custom_content %} + + + + + + +{% endblock %} + +{% block js_content %} + +{% endblock %} diff --git a/application/org_mgnt/views.py b/application/org_mgnt/views.py index e3da23c..65aaf52 100644 --- a/application/org_mgnt/views.py +++ b/application/org_mgnt/views.py @@ -103,13 +103,15 @@ def eir_list_view(request): "save_url": reverse("save_excel_table_data") }, "query_params": query_params, - "form_action_url": 'eir_list', + "form_action_url": reverse('eir_list'), "modify_url": reverse("eir_list_modify"), "add_url": reverse("eir_list_add"), "delete_url": reverse("eir_list_delete"), + "add_button": True, + "import_excel_button": True } - return render(request, 'ce_list.html', context) + return render(request, 'ce_list_inherit.html', context) @custom_permission_required('org_mgnt.add_companyentity') diff --git a/common/views.py b/common/views.py index cfa5db5..c69c351 100644 --- a/common/views.py +++ b/common/views.py @@ -19,7 +19,7 @@ from rest_framework.serializers import ModelSerializer from application import fac_mgnt from application.fac_mgnt.models import InvoiceRecord -from application.org_mgnt.models import SecondaryDepartment +from application.org_mgnt.models import SecondaryDepartment, PrimaryDepartment from application.pjt_mgnt.models import ProjectLedger @@ -234,8 +234,9 @@ def save_excel_table_data(request): @login_required def load_secondary_departments(request): - primary_department_id = request.GET.get('primary_department_id') - secondary_departments = SecondaryDepartment.objects.filter(primary_department_id=primary_department_id).order_by( + primary_department_name = request.GET.get('primary_department_name') + primary_department = PrimaryDepartment.objects.get(department_name=primary_department_name) + secondary_departments = SecondaryDepartment.objects.filter(primary_department_id=primary_department.primary_department_id).order_by( 'secondary_department_name') return JsonResponse(list(secondary_departments.values('secondary_department_id', 'secondary_department_name')), safe=False) diff --git a/templates/items_list.html b/templates/items_list.html index 5012248..9935c7e 100644 --- a/templates/items_list.html +++ b/templates/items_list.html @@ -4,147 +4,158 @@ {% block content %} {% block table_list_content %} -
-
-
-
-
-
- {% include 'breadcrumb.html' %} -
-
-
-
-
-
-
- {% csrf_token %} -
- {% for filter in filters %} - {% if filter.type == 'text' %} -
- - -
- {% elif filter.type == 'select' %} -
- - -
- {% elif filter.type == 'date' %} -
- - -
- {% elif filter.type == 'month' %} -
- - +
+
+
+
+
+
+ {% include 'breadcrumb.html' %} +
+
+
+
+
+
+ + {% csrf_token %} +
+ {% for filter in filters %} + {% if filter.type == 'text' %} +
+ + +
+ {% elif filter.type == 'select' %} +
+ + +
+ {% elif filter.type == 'date' %} +
+ + +
+ {% elif filter.type == 'month' %} +
+ + +
+ {% endif %} + {% endfor %} + {% if filters %} +
+
{% endif %} - {% endfor %} - {% if filters %} -
-
- {% endif %} -
- -
-
- {% render_button 'modify_records_button' %} - {% render_button 'add_button' %} - {% render_button 'report_excel_button' %} -{# {% render_button 'import_excel_button' %}#} - + +
+
+ {% render_button 'modify_records_button' %} + {% render_button 'add_button' %} + {% render_button 'report_excel_button' %} + {# {% render_button 'import_excel_button' %}#} + +
-
-
-
-
-
-
- - {% get_verbose_field_names_from_model model_config table_exclude_field_name as columns %} - - - {% for column in columns %} - - {% endfor %} - - - - - {% for item in items %} - - {% for field in item|get_fields:table_exclude_field_name %} - {% if '(元)' in field.verbose_name %} - - {% else %} - - {% endif %} + {% block fields_list_content %} +
+
+
+
+
+
{{ column }}操作
{{ field.value|thousands_separator }}{{ field.value }}
+ {% get_verbose_field_names_from_model model_config table_exclude_field_name as columns %} + + + {% for column in columns %} + + {% endfor %} + + + + + {% for item in items %} + + {% for field in item|get_fields:table_exclude_field_name %} + {% if '(元)' in field.verbose_name %} + + {% else %} + + {% endif %} + {% endfor %} + + + {% empty %} + + + {% endfor %} - - - {% empty %} - - - - {% endfor %} - -
{{ column }}操作
{{ field.value|thousands_separator }}{{ field.value }} + 编辑 + 删除 +
暂无数据 +
- 编辑 - 删除 -
暂无数据 -
+ + +
+
-
+ {% endblock %} + {% include 'pagination_ps.html' with page_obj=items query_params=query_params %}
- {% include 'pagination_ps.html' with page_obj=items query_params=query_params %}
-
-
+ {% endblock %} -