diff --git a/application/accounts/templates/accounts/login.html b/application/accounts/templates/accounts/login.html index c26bb11..761ad7a 100644 --- a/application/accounts/templates/accounts/login.html +++ b/application/accounts/templates/accounts/login.html @@ -39,6 +39,7 @@
{% csrf_token %}
+

欢迎登录 星环集团 数字化管理系统

diff --git a/application/accounts/templates/accounts/user_permissions_list.html b/application/accounts/templates/accounts/user_permissions_list.html index 023730c..9ad3fa5 100644 --- a/application/accounts/templates/accounts/user_permissions_list.html +++ b/application/accounts/templates/accounts/user_permissions_list.html @@ -538,11 +538,11 @@ function fetchEmployeeList() { `; }); } else { - alert("获取员工列表失败:" + data.message); + showAlert('danger', '获取员工列表失败'); } }) .catch(error => { - console.error('Error:', error); + showAlert('danger', '获取员工列表时出错:' + error); }); } @@ -565,16 +565,16 @@ document.getElementById('createAccountProfiles').addEventListener('click', funct .then(data => { if(data.success) { // 处理成功逻辑 - alert(data.message); + showAlert('success', '账户创建成功'); $('#createAccountProfileModal').modal('hide'); fetchEmployeeList(); // 刷新员工列表 } else { // 处理失败逻辑 - alert(data.message); + showAlert('danger', '账户创建失败'); } }) .catch(error => { - console.error('Error:', error); + showAlert('danger', '账户创建时出错:' + error); }); }); diff --git a/application/accounts/views.py b/application/accounts/views.py index f51c509..60172bf 100644 --- a/application/accounts/views.py +++ b/application/accounts/views.py @@ -525,7 +525,7 @@ def user_homepage_view(request): on_duty_days = (date.today() - employee_information.entry_date).days # 查询年假使用表中的年假剩余天数 try: - annual_leave_records = AnnualLeaveRecord.objects.get(employee_name__icontains=employee_information.name) + annual_leave_records = AnnualLeaveRecord.objects.get(employee=employee_information) remaining_annual_leave = annual_leave_records.remaining_annual_leave used_annual_leave = annual_leave_records.used_annual_leave except AnnualLeaveRecord.DoesNotExist: @@ -534,7 +534,7 @@ def user_homepage_view(request): # 查询员工业绩目标表的sales_target,和项目台账的关于这个人今年状态为已完成所有项目的标的金额,用标的金额除以目标表的sales_target得到完成率 try: - employee_performance = EmployeePerformanceTarget.objects.get(name=employee_information.name) + employee_performance = EmployeePerformanceTarget.objects.get(name=employee_information.employee_id) performance_target = employee_performance.sales_target except EmployeePerformanceTarget.DoesNotExist: performance_target = 0 @@ -545,18 +545,19 @@ def user_homepage_view(request): end_date = f"{current_year}-12-31" try: - # 查询今年完成的项目 + # 查询今年进行中的项目 ongoing_projects = ProjectLedger.objects.filter( - Q(project_leader=employee_information.name) | Q(project_members__contains=employee_information.name), + Q(project_leader=employee_information) | Q(project_members=employee_information), project_status='进行中', end_date__range=[start_date, end_date] - ) + ).distinct() + # 查询今年已完成的项目 completed_projects = ProjectLedger.objects.filter( - Q(project_leader=employee_information.name) | Q(project_members__contains=employee_information.name), + Q(project_leader=employee_information) | Q(project_members=employee_information), project_status='完成', end_date__range=[start_date, end_date] - ) + ).distinct() ongoing_project_count = ongoing_projects.count() completed_project_count = completed_projects.count() @@ -648,7 +649,8 @@ def create_account_profile(request): user = User.objects.create_user( username=username, email=employee_information.email, - password=password + password=password, + last_name=employee_information.name ) # 创建新的AccountProfile实例 diff --git a/application/hrm_mgnt/views.py b/application/hrm_mgnt/views.py index e0239c2..d4a8d85 100644 --- a/application/hrm_mgnt/views.py +++ b/application/hrm_mgnt/views.py @@ -769,9 +769,17 @@ def emp_list_for_create_account_profile(request): page_obj = paginator.get_page(page_number) # 创建员工信息的列表,包含需要的字段 - employees = list(page_obj.object_list.values( - 'employee_id', 'name', 'email', 'mobile_number', 'primary_department', 'position' - )) + employees = [ + { + 'employee_id': emp.employee_id, + 'name': emp.name, + 'email': emp.email, + 'mobile_number': emp.mobile_number, + 'primary_department': emp.primary_department.department_name if emp.primary_department else '', + 'position': emp.position.position_name if emp.position else '' + } + for emp in page_obj.object_list + ] # 返回JSON响应 return JsonResponse({ diff --git a/assets/images/login-bg-01.png b/assets/images/login-bg-01.png deleted file mode 100644 index 66a023f..0000000 Binary files a/assets/images/login-bg-01.png and /dev/null differ diff --git a/static/images/logos/Galaxy Logo Dark.png b/static/images/logos/Galaxy Logo Dark.png new file mode 100644 index 0000000..98b9d42 Binary files /dev/null and b/static/images/logos/Galaxy Logo Dark.png differ diff --git a/static/images/logos/Galaxy Logo White.png b/static/images/logos/Galaxy Logo White.png new file mode 100644 index 0000000..33fefb0 Binary files /dev/null and b/static/images/logos/Galaxy Logo White.png differ diff --git a/templates/base.html b/templates/base.html index e42ae79..25c1d82 100644 --- a/templates/base.html +++ b/templates/base.html @@ -83,6 +83,27 @@ .pcoded-navbar .pcoded-inner-navbar > li> a.active:after { background: linear-gradient(-45deg, #19BCBF, #149698); } + + .navbar-brand { + display: flex; + align-items: center; /* 垂直居中对齐 */ + } + + .brand-container { + display: flex; + align-items: center; /* 垂直居中对齐 */ + margin-right: 10px; /* 根据需要调整间距 */ + } + + .logo, .logo-thumb { + width: 50px; + height: 50px; + } + + .brand-title { + color: white; + margin: 0; /* 移除默认的外边距 */ + } @@ -103,19 +124,27 @@