From ab658c482d1be6fdc1dca9b1b3e801e7f046c037 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BD=AD=E6=A3=AE?= Date: Wed, 19 Jun 2024 16:58:27 +0800 Subject: [PATCH] =?UTF-8?q?commit=201.=20=E4=BF=AE=E5=A4=8D=E4=B8=9A?= =?UTF-8?q?=E7=BB=A9=E7=AE=A1=E7=90=86bug=202.=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E7=BB=84=E7=BB=87=E7=AE=A1=E7=90=86bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/org_mgnt/serializers.py | 17 ++++- .../org_mgnt/templates/ce_list_inherit.html | 20 +++-- application/org_mgnt/views.py | 6 +- application/perf_mgnt/forms.py | 22 +++--- application/perf_mgnt/models.py | 56 ++++++++++---- application/perf_mgnt/serializers.py | 25 +++++- application/perf_mgnt/views.py | 76 +++++++++++++++---- templates/modify_record_modal.html | 5 +- 8 files changed, 167 insertions(+), 60 deletions(-) diff --git a/application/org_mgnt/serializers.py b/application/org_mgnt/serializers.py index 2c51f49..997ad3f 100644 --- a/application/org_mgnt/serializers.py +++ b/application/org_mgnt/serializers.py @@ -15,9 +15,24 @@ class SecondaryDepartmentSerializer(serializers.ModelSerializer): class EntityChangeRecordSerializer(serializers.ModelSerializer): + change_date = serializers.DateField(format='%Y-%m-%d') + modified_obj = serializers.SerializerMethodField() + modified_field_verbose = serializers.SerializerMethodField() + class Meta: model = EntityChangeRecord - fields = '__all__' + fields = ('modified_obj', 'modified_field_verbose', 'content_before_change', 'content_after_change', 'change_date', 'change_executed_by') + + def get_modified_obj(self, obj): + company_entity = obj.company_entity + return f"{company_entity.company_name}" + + def get_modified_field_verbose(self, obj): + # 获取模型类 + model_class = obj.company_entity._meta.model + # 获取字段的 verbose_name + field = model_class._meta.get_field(obj.change_type) + return field.verbose_name class CompanyBankAccountSerializer(serializers.ModelSerializer): diff --git a/application/org_mgnt/templates/ce_list_inherit.html b/application/org_mgnt/templates/ce_list_inherit.html index 8030d40..669917a 100644 --- a/application/org_mgnt/templates/ce_list_inherit.html +++ b/application/org_mgnt/templates/ce_list_inherit.html @@ -58,7 +58,7 @@ data-bs-target="#addEditModal">编辑 + 变更主体 变更日期 变更类型 变更前内容 变更后内容 - 变更原因 变更执行人 @@ -215,7 +215,7 @@ -