From dc9bb836d5364817c5b2b5c8f59d0ef7bda5bb9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BD=AD=E6=A3=AE?= Date: Tue, 18 Jun 2024 09:58:03 +0800 Subject: [PATCH] =?UTF-8?q?commit=201.=E5=AE=8C=E6=88=90=E8=A7=86=E5=9B=BE?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=A1=B5=E9=9D=A2=E5=92=8Cbase.html=E6=9D=83?= =?UTF-8?q?=E9=99=90=E6=A0=A1=E9=AA=8C=202.=20=E4=BF=AE=E5=A4=8D=E8=B4=A6?= =?UTF-8?q?=E5=8F=B7=E6=9D=83=E9=99=90=E8=A1=A8=E4=B8=8E=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=9D=83=E9=99=90=E8=A1=A8=E6=9D=83=E9=99=90=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E5=90=8E=E7=BF=BB=E9=A1=B5=E6=9C=AA=E8=AE=B0=E5=BD=95=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E6=A1=86=E7=8A=B6=E6=80=81=203.=20=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=9B=9E=E6=AC=BE=E8=AE=B0=E5=BD=95table=E4=B8=8D=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=BC=80=E7=A5=A8=E8=AE=B0=E5=BD=95=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=204.=20=E5=85=AC=E5=8F=B8=E4=B8=BB=E4=BD=93=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E7=99=BB=E8=AE=B0=E8=A1=A8-=E9=93=B6=E8=A1=8C=E8=B4=A6?= =?UTF-8?q?=E6=88=B7=E6=96=B0=E5=A2=9E=E8=B4=A6=E6=88=B7=E7=8A=B6=E6=80=81?= =?UTF-8?q?=205.=20=E4=BA=BA=E5=91=98=E5=9F=BA=E6=9C=AC=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E8=A1=A8-=E6=B7=BB=E5=8A=A0=E6=95=B0=E6=8D=AE=E6=A0=B9?= =?UTF-8?q?=E6=8D=AE=E7=94=9F=E6=97=A5=E8=87=AA=E5=8A=A8=E7=AE=97=E5=87=BA?= =?UTF-8?q?=E5=B9=B4=E9=BE=84=206.=20=E5=A4=84=E7=90=86=E4=BA=86=E4=B8=80?= =?UTF-8?q?=E4=BA=9B=E9=A1=B5=E9=9D=A2=E4=B8=8D=E9=9C=80=E8=A6=81=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E7=AD=9B=E9=80=89=E5=92=8C=E7=BC=96=E8=BE=91=E5=92=8C?= =?UTF-8?q?ID=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/accounts/group_perm_list.html | 22 ++ .../accounts/user_permissions_list.html | 23 ++ application/fac_mgnt/templates/exp_list.html | 235 ++++++++++++++++++ application/fac_mgnt/views.py | 11 +- application/hrm_mgnt/templates/emp_list.html | 29 ++- application/hrm_mgnt/views.py | 7 +- application/org_mgnt/models.py | 13 +- application/org_mgnt/templates/ce_list.html | 34 ++- application/org_mgnt/views.py | 28 ++- .../pjt_mgnt/templates/project_list.html | 2 - templates/base.html | 102 +++++--- templates/items_list.html | 2 + templates/modify_record_modal.html | 1 + 13 files changed, 459 insertions(+), 50 deletions(-) create mode 100644 application/fac_mgnt/templates/exp_list.html diff --git a/application/accounts/templates/accounts/group_perm_list.html b/application/accounts/templates/accounts/group_perm_list.html index 26dbd10..4c48f98 100644 --- a/application/accounts/templates/accounts/group_perm_list.html +++ b/application/accounts/templates/accounts/group_perm_list.html @@ -210,6 +210,20 @@ $(document).ready(function() { }); $('#pageInfo').text('第 ' + currentPage + ' 页, 共 ' + Math.ceil(permissionsData.length / itemsPerPage) + ' 页'); + + // 更新复选框的状态 + updateCheckboxStates(); + } + + // 用户权限-更新复选框的状态 + function updateCheckboxStates() { + $('#permissionsTable input[type="checkbox"]').each(function() { + const permId = $(this).data('id'); + const permType = $(this).attr('name'); + if (modifiedPermissions[permId] && modifiedPermissions[permId][permType] !== undefined) { + $(this).prop('checked', modifiedPermissions[permId][permType]); + } + }); } // 渲染分页 @@ -307,6 +321,14 @@ $(document).ready(function() { } }); }); + + $('#userPermissionModal').on('hidden.bs.modal', function () { + permissionsData = []; + modifiedPermissions = {}; + $('#permissionsTable tbody').empty(); + $('#u-totalData').text(''); + $('#u-pageInfo').text(''); + }); }); document.getElementById('createGroupButton').addEventListener('click', function() { diff --git a/application/accounts/templates/accounts/user_permissions_list.html b/application/accounts/templates/accounts/user_permissions_list.html index 28034d3..cb333d5 100644 --- a/application/accounts/templates/accounts/user_permissions_list.html +++ b/application/accounts/templates/accounts/user_permissions_list.html @@ -377,6 +377,21 @@ $(document).ready(function() { }); $('#u-pageInfo').text('第 ' + currentPage + ' 页, 共 ' + Math.ceil(permissionsData.length / itemsPerPage) + ' 页'); + + // 更新复选框的状态 + updateCheckboxStates(); + } + + + // 用户权限-更新复选框的状态 + function updateCheckboxStates() { + $('#permissionsTable input[type="checkbox"]').each(function() { + const permId = $(this).data('id'); + const permType = $(this).attr('name'); + if (modifiedPermissions[permId] && modifiedPermissions[permId][permType] !== undefined) { + $(this).prop('checked', modifiedPermissions[permId][permType]); + } + }); } // 用户权限-渲染分页 @@ -507,6 +522,14 @@ $(document).ready(function() { }); }); + $('#userPermissionModal').on('hidden.bs.modal', function () { + permissionsData = []; + modifiedPermissions = {}; + $('#permissionsTable tbody').empty(); + $('#u-totalData').text(''); + $('#u-pageInfo').text(''); + }); + }); diff --git a/application/fac_mgnt/templates/exp_list.html b/application/fac_mgnt/templates/exp_list.html new file mode 100644 index 0000000..26094c3 --- /dev/null +++ b/application/fac_mgnt/templates/exp_list.html @@ -0,0 +1,235 @@ +{% extends 'base.html' %} +{% load static tags %} + +{% block content %} +
+
+
+
+
+
+ {% include 'breadcrumb.html' %} +
+
+
+
+
+
+
+
+ {% 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 %} + + {% endfor %} + + + {% empty %} + + + + {% endfor %} + +
{{ column }}操作
{{ 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 %} + {% include 'upload_excel_modal.html' with excel_upload_config=excel_upload_config %} + + + +{% endblock %} diff --git a/application/fac_mgnt/views.py b/application/fac_mgnt/views.py index a0c09d1..1b25edc 100644 --- a/application/fac_mgnt/views.py +++ b/application/fac_mgnt/views.py @@ -44,10 +44,7 @@ def exp_type_list_view(request): {"title": "财会管理", "name": "index"}, {"title": "费用类型", "name": "exp_type_list"} ], - "filters": [ - {"type": "select", "id": "expense_type", "name": "expense_type", "label": "费用类型", - "options": [{"value": "差旅费", "display": "差旅费"}, {"value": "办公费", "display": "办公费"}]} - ], + "filters": [], "table_exclude_field_name": ['type_id'], "excel_upload_config": { "template_url": reverse("download_template", kwargs={'template_name': template_name}), @@ -65,7 +62,7 @@ def exp_type_list_view(request): "add_button": True, "import_excel_button": True } - return render(request, 'items_list.html', context) + return render(request, 'exp_list.html', context) @login_required @@ -168,7 +165,7 @@ def exp_detail_list_view(request): "add_button": True, "import_excel_button": True } - return render(request, 'items_list.html', context) + return render(request, 'exp_list.html', context) @login_required @@ -1252,7 +1249,7 @@ def rep_rec_list_view(request): "repayment_amount": {"type": "number", "width": "100px"}, } }, - "table_exclude_field_name": ['record_id'], + "table_exclude_field_name": ['record_id', 'invoice'], "query_params": query_params, "form_action_url": 'rep_rec_list', "modify_url": reverse("rep_rec_list_modify"), diff --git a/application/hrm_mgnt/templates/emp_list.html b/application/hrm_mgnt/templates/emp_list.html index af6931b..96b16ea 100644 --- a/application/hrm_mgnt/templates/emp_list.html +++ b/application/hrm_mgnt/templates/emp_list.html @@ -98,7 +98,7 @@ {% for column in columns %} - {% if column|is_in_list:"离职类型,离职原因,离职时间" %} + {% if column|is_in_list:"离职类型,离职原因,离职日期" %} {# Skip these columns #} {% else %} {{ column }} @@ -116,12 +116,12 @@ 离职 - {% elif field.verbose_name == '基础工资' %} + {% elif field.verbose_name == '基础工资(元)' %} {{ item.base_salary }} - {% elif field.verbose_name|is_in_list:"离职类型,离职原因,离职时间" %} + {% elif field.verbose_name|is_in_list:"离职类型,离职原因,离职日期" %} {# Skip these columns #} {% else %} {{ field.value }} @@ -246,6 +246,18 @@ const add_url = "{{ add_url }}"; const modify_url = "{{ modify_url }}"; + function calculateAge(birthday) { + var birthDate = new Date(birthday); + var today = new Date(); + var age = today.getFullYear() - birthDate.getFullYear(); + var m = today.getMonth() - birthDate.getMonth(); + if (m < 0 || (m === 0 && today.getDate() < birthDate.getDate())) { + age--; + } + return age; + } + + $(document).ready(function () { // 处理添加按钮点击事件 $('#addItemBtn').click(function () { @@ -318,6 +330,16 @@ }); }); } + + $(document).on('change', '#id_birthday', function () { + var birthday = $(this).val(); + if (birthday) { + var age = calculateAge(birthday); + $('#id_age').val(age); + } else { + $('#id_age').val(''); + } + }); }); function showResignationModal(resignation_type, resignation_reason, resignation_date) { @@ -374,7 +396,6 @@ .catch(error => console.error('Error fetching salary change records:', error)); } - {% endblock %} diff --git a/application/hrm_mgnt/views.py b/application/hrm_mgnt/views.py index 00ff675..aa5999e 100644 --- a/application/hrm_mgnt/views.py +++ b/application/hrm_mgnt/views.py @@ -177,7 +177,7 @@ def emp_list_modify(request): if 'id' in request.POST: instance = EmployeeInformation.objects.get(employee_id=request.POST['id']) current_base_salary = instance.base_salary # 获取当前基本工资 - form = EmployeeInformationForm(request.POST, instance=instance) + form = EmployeeInformationEditForm(request.POST, instance=instance) else: form = EmployeeInformationEditForm(request.POST) @@ -195,6 +195,11 @@ def emp_list_modify(request): approved_by=request.user.username ) + employee.resignation_type = form.cleaned_data.get('resignation_type') + employee.resignation_date = form.cleaned_data.get('resignation_date') + employee.resignation_description = form.cleaned_data.get('resignation_description') + employee.save() + return JsonResponse({"message": "保存成功"}) else: form_html = render_to_string('form_partial.html', {'form': form}, request) diff --git a/application/org_mgnt/models.py b/application/org_mgnt/models.py index 2df5a25..cec813f 100644 --- a/application/org_mgnt/models.py +++ b/application/org_mgnt/models.py @@ -72,19 +72,30 @@ class CompanyBankAccount(models.Model): ('一般户', '一般户'), ) + ACCOUNT_STATUS_CHOICES = ( + ('活跃', '活跃'), + ('不活跃', '不活跃'), + ('已关闭', '已关闭'), + ('暂停', '暂停'), + ('待处理', '待处理'), + ('冻结', '冻结'), + ) + account_id = models.AutoField(primary_key=True, verbose_name='账户ID') company_entity = models.ForeignKey(CompanyEntity, on_delete=models.CASCADE, related_name='bank_accounts', verbose_name='公司ID', default=1) bank_name = models.CharField(max_length=255, verbose_name='开户行名称') account_number = models.CharField(max_length=255, verbose_name='账号') account_type = models.CharField(max_length=10, choices=ACCOUNT_TYPE_CHOICES, verbose_name='账户类型') + account_status = models.CharField(max_length=10, choices=ACCOUNT_STATUS_CHOICES, verbose_name='账户状态', + default='active') class Meta: verbose_name = '公司银行账户' verbose_name_plural = '公司银行账户表' def __str__(self): - return f"{self.bank_name} - {self.account_number}" + return f"{self.company_entity.company_name} - {self.bank_name} - {self.account_number}" class PrimaryDepartment(models.Model): diff --git a/application/org_mgnt/templates/ce_list.html b/application/org_mgnt/templates/ce_list.html index e0a3d70..59e1dc5 100644 --- a/application/org_mgnt/templates/ce_list.html +++ b/application/org_mgnt/templates/ce_list.html @@ -242,6 +242,7 @@ 开户行名称 账号 账户类型 + 账户状态 操作 @@ -286,6 +287,17 @@ +
+ + +
@@ -340,6 +352,17 @@ +
+ + +
@@ -535,6 +558,7 @@ row.appendChild(createCell(account.bank_name)); row.appendChild(createCell(account.account_number)); row.appendChild(createCell(account.account_type)); + row.appendChild(createCell(account.account_status)); const actionsCell = document.createElement('td'); actionsCell.className = 'text-center'; @@ -612,7 +636,8 @@ const data = { bank_name: document.getElementById('addBankName').value, account_number: document.getElementById('addAccountNumber').value, - account_type: document.getElementById('addAccountType').value + account_type: document.getElementById('addAccountType').value, + account_status: document.getElementById('addAccountStatus').value }; fetch(`/basic_data/om/entities/${entityId}/bank_accounts/add/`, { @@ -648,7 +673,6 @@ fetch(`/basic_data/om/bank_account/${accountId}/`) .then(response => response.json()) .then(data => { - debugger; document.getElementById('editBankName').value = data.bank_name; document.getElementById('editAccountNumber').value = data.account_number; document.getElementById('editAccountType').value = data.account_type; @@ -663,6 +687,7 @@ const bankName = document.getElementById('editBankName').value; const accountNumber = document.getElementById('editAccountNumber').value; const accountType = document.getElementById('editAccountType').value; + const accountStatus= document.getElementById('editAccountStatus').value; fetch(`/basic_data/om/bank_accounts/${accountIdToEdit}/update/`, { method: 'PUT', @@ -673,7 +698,8 @@ body: JSON.stringify({ bank_name: bankName, account_number: accountNumber, - account_type: accountType + account_type: accountType, + account_status: accountStatus, }) }) .then(response => { @@ -738,7 +764,7 @@ } - \ No newline at end of file