更新README文件并添加机构数量统计功能

This commit is contained in:
2026-04-27 15:27:32 +08:00
parent 0a35884a09
commit 2714d78f56
4 changed files with 75 additions and 2 deletions

View File

@@ -63,7 +63,7 @@ fzjgact/
1. **克隆项目**
```bash
git clone <项目地址>
git clone http://124.223.26.33:3000/xiaji/fzjg_local.git
cd 分支机构活动
```

View File

@@ -170,7 +170,6 @@
</table>
</div>
</div>
</div>
<!-- 分隔线 -->
<div class="h-1 my-8 rounded-full bg-gradient-to-r from-transparent via-purple-400 to-transparent"></div>

View File

@@ -17,6 +17,68 @@
</div>
</div>
<!-- 分公司/营业部数量统计 -->
<div class="w-full max-w-6xl mx-auto px-6 mt-2 mb-6">
<div class="bg-white rounded-2xl shadow-lg overflow-hidden border border-indigo-100">
<div class="px-6 py-4 bg-gradient-to-r from-indigo-600 via-indigo-700 to-purple-700">
<h2 class="text-lg font-bold text-white flex items-center gap-2">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z" />
</svg>
机构数量统计
</h2>
</div>
<div class="p-6">
<div class="flex flex-wrap items-center gap-x-6 gap-y-3 text-base">
<div class="flex items-center gap-2">
<span class="inline-flex items-center justify-center w-8 h-8 rounded-lg bg-gradient-to-br from-blue-500 to-indigo-600 shadow-sm">
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4" />
</svg>
</span>
<span class="text-gray-600">分支机构总数</span>
<span class="text-xl font-bold text-gray-800">{{ all_branch_count }}</span>
<span class="text-gray-500"></span>
</div>
<span class="text-gray-300">|</span>
<div class="flex items-center gap-2">
<span class="inline-flex items-center justify-center w-8 h-8 rounded-lg bg-gradient-to-br from-emerald-500 to-teal-600 shadow-sm">
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 14v3m4-3v3m4-3v3M3 21h18M3 10h18M3 7l9-4 9 4M4 10h16v11H4V10z" />
</svg>
</span>
<span class="text-gray-600">分公司数量</span>
<span class="text-xl font-bold text-emerald-700">{{ fen_company_count }}</span>
<span class="text-gray-500"></span>
</div>
<span class="text-gray-300">|</span>
<div class="flex items-center gap-2">
<span class="inline-flex items-center justify-center w-8 h-8 rounded-lg bg-gradient-to-br from-amber-500 to-orange-600 shadow-sm">
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6" />
</svg>
</span>
<span class="text-gray-600">营业部数量</span>
<span class="text-xl font-bold text-amber-700">{{ yingyebu_count }}</span>
<span class="text-gray-500"></span>
</div>
</div>
{% if preparing_count > 0 %}
<div class="mt-4 pt-4 border-t border-gray-100 flex items-center gap-2">
<span class="inline-flex items-center justify-center w-8 h-8 rounded-lg bg-gradient-to-br from-rose-400 to-pink-500 shadow-sm">
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
</span>
<span class="text-gray-600">筹建中的分公司或营业部数量</span>
<span class="text-xl font-bold text-rose-600">{{ preparing_count }}</span>
<span class="text-gray-500"></span>
</div>
{% endif %}
</div>
</div>
</div>
<!-- 分支机构列表 -->
<div class="w-full max-w-6xl mx-auto p-6">
<div class="bg-white rounded-2xl shadow-lg overflow-hidden border border-indigo-100">

View File

@@ -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)