From 2714d78f561cab9e7b9744cb0083539c6483b566 Mon Sep 17 00:00:00 2001 From: xiaji Date: Mon, 27 Apr 2026 15:27:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0README=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=B9=B6=E6=B7=BB=E5=8A=A0=E6=9C=BA=E6=9E=84=E6=95=B0=E9=87=8F?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- fzjgact/huodong/templates/branch_all.html | 1 - fzjgact/huodong/templates/branch_info.html | 62 ++++++++++++++++++++++ fzjgact/huodong/views.py | 12 +++++ 4 files changed, 75 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 23592cd..3d9f425 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ fzjgact/ 1. **克隆项目** ```bash - git clone <项目地址> + git clone http://124.223.26.33:3000/xiaji/fzjg_local.git cd 分支机构活动 ``` diff --git a/fzjgact/huodong/templates/branch_all.html b/fzjgact/huodong/templates/branch_all.html index 1973787..9761be1 100644 --- a/fzjgact/huodong/templates/branch_all.html +++ b/fzjgact/huodong/templates/branch_all.html @@ -170,7 +170,6 @@ -
diff --git a/fzjgact/huodong/templates/branch_info.html b/fzjgact/huodong/templates/branch_info.html index a1b770f..ab98023 100644 --- a/fzjgact/huodong/templates/branch_info.html +++ b/fzjgact/huodong/templates/branch_info.html @@ -17,6 +17,68 @@ + +
+
+
+

+ + + + 机构数量统计 +

+
+
+
+
+ + + + + + 分支机构总数 + {{ all_branch_count }} + +
+ | +
+ + + + + + 分公司数量 + {{ fen_company_count }} + +
+ | +
+ + + + + + 营业部数量 + {{ yingyebu_count }} + +
+
+ {% if preparing_count > 0 %} +
+ + + + + + 筹建中的分公司或营业部数量 + {{ preparing_count }} + +
+ {% endif %} +
+
+
+
diff --git a/fzjgact/huodong/views.py b/fzjgact/huodong/views.py index 5178861..caf6ee3 100644 --- a/fzjgact/huodong/views.py +++ b/fzjgact/huodong/views.py @@ -135,6 +135,8 @@ def BranchAll(request): total_branch_count = len(branches_with_counts) # 获取所有分支机构总数(包括没有活动的) all_branch_count = Branch.objects.count() + fen_company_count = Branch.objects.filter(name__contains='分公司').count() + yingyebu_count = Branch.objects.filter(name__contains='营业部').count() # 比如说end_time()的year是2024年,但是now()是2025年的2月,fileter出来,但是如果now()是2025年3月,则不显示 now = datetime.now() print(f"当前月份是{now.month},年是{now.year}") @@ -215,6 +217,8 @@ def BranchAll(request): 'latest_act': latest_act, 'total_branch_count':total_branch_count, 'all_branch_count': all_branch_count, + 'fen_company_count': fen_company_count, + 'yingyebu_count': yingyebu_count, 'branch_count': branch_count, 'ongoing_activities': ongoing_activities, 'total_activities': total_activities, @@ -237,11 +241,19 @@ def Branchinfo(request): type_a_count = branches.filter(category='A型').count() type_b_count = branches.filter(category='B型').count() type_c_count = branches.filter(category='C型').count() + all_branch_count = branches.count() + fen_company_count = branches.filter(name__contains='分公司').exclude(name__contains='(筹)').count() + yingyebu_count = branches.filter(name__contains='营业部').exclude(name__contains='(筹)').count() + preparing_count = branches.filter(name__contains='(筹)').count() context = { 'branches_by_province': branches_by_province, 'type_a_count': type_a_count, 'type_b_count': type_b_count, 'type_c_count': type_c_count, + 'all_branch_count': all_branch_count, + 'fen_company_count': fen_company_count, + 'yingyebu_count': yingyebu_count, + 'preparing_count': preparing_count, } return render(request, 'branch_info.html', context)