Files
fzjg_local/fzjgact/huodong/templates/branch_detail.html

269 lines
15 KiB
HTML
Raw Normal View History

2025-12-03 15:42:35 +08:00
{% extends 'base.html' %}
{% block content %}
<!-- Component starts here -->
<h2 class="flex flex-row flex-nowrap items-center my-8">
<span class="flex-grow block border-t border-black" aria-hidden="true" role="presentation"></span>
<span class="flex-none block mx-4 px-4 py-2.5 text-base leading-none font-medium uppercase bg-black text-white">
{{ branch.name }}
</span>
<span class="flex-grow block border-t border-black" aria-hidden="true" role="presentation"></span>
</h2>
<!-- Component ends here -->
2025-12-03 17:17:17 +08:00
<!-- 投入预算表 -->
<div class="bg-white rounded-lg shadow-md p-4 mb-6">
<h2 class="text-2xl font-bold mb-4">投入预算表</h2>
<p class="text-gray-700 mb-4">分支机构项目的预算表,包括设备和基础设施明细</p>
<!-- 预算模板导入功能 -->
{% if budget_templates %} <!-- 只有当有模板时才显示导入功能 -->
<div class="mb-6 p-4 bg-blue-50 rounded-lg">
<h3 class="text-lg font-semibold mb-2">预算模板导入</h3>
<p class="text-sm text-gray-600 mb-3">从模板一键导入预算,快速生成预算表</p>
<form method="POST" action="{% url 'import-budget-template' branch.id %}">
{% csrf_token %}
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
<div>
<label for="template" class="block text-sm font-medium text-gray-700 mb-1">选择模板</label>
<select id="template" name="template" class="w-full p-2 border border-gray-300 rounded-md">
{% for template in budget_templates %}
<option value="{{ template.id }}">{{ template.name }}{% if template.is_default %} (默认){% endif %}</option>
{% endfor %}
</select>
</div>
<div>
<label for="budget_name" class="block text-sm font-medium text-gray-700 mb-1">预算名称</label>
<input type="text" id="budget_name" name="budget_name" placeholder="请输入预算名称" class="w-full p-2 border border-gray-300 rounded-md">
</div>
<div class="flex items-end">
<button type="submit" class="bg-blue-500 hover:bg-blue-600 text-white px-4 py-2 rounded-md">
一键导入
</button>
</div>
</div>
</form>
</div>
{% endif %}
{% if budgets %}
{% for budget in budgets %}
<div class="mb-6">
<h3 class="text-lg font-semibold mb-3">{{ budget.activity.name }} - 总预算: ¥{{ budget.total_budget }}</h3>
<!-- 设备预算部分 -->
<div class="mb-4">
<h4 class="text-md font-semibold mb-2">设备预算明细</h4>
{% if budget.equipment_budgets.all %}
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">项目</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">型号</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">单价</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">采购方式</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">数量</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">小计</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
{% for equipment in budget.equipment_budgets.all %}
<tr>
<td class="px-6 py-4 whitespace-nowrap">{{ equipment.project }}</td>
<td class="px-6 py-4 whitespace-nowrap">{{ equipment.model }}</td>
<td class="px-6 py-4 whitespace-nowrap">¥{{ equipment.unit_price }}</td>
<td class="px-6 py-4 whitespace-nowrap">{{ equipment.get_procurement_method_display }}</td>
<td class="px-6 py-4 whitespace-nowrap">{{ equipment.quantity }}</td>
<td class="px-6 py-4 whitespace-nowrap">¥{{ equipment.subtotal }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<p class="text-gray-500 italic">暂无设备预算明细</p>
{% endif %}
</div>
<!-- 基础设施预算部分 -->
<div>
<h4 class="text-md font-semibold mb-2">基础设施预算明细</h4>
{% if budget.infrastructure_budgets.all %}
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">名称</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">备注</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">单价</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">单位</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">数量</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">小计</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">说明</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
{% for infrastructure in budget.infrastructure_budgets.all %}
<tr>
<td class="px-6 py-4 whitespace-nowrap">{{ infrastructure.name }}</td>
<td class="px-6 py-4 whitespace-nowrap">{{ infrastructure.remarks }}</td>
<td class="px-6 py-4 whitespace-nowrap">¥{{ infrastructure.unit_price }}</td>
<td class="px-6 py-4 whitespace-nowrap">{{ infrastructure.unit }}</td>
<td class="px-6 py-4 whitespace-nowrap">{{ infrastructure.quantity }}</td>
<td class="px-6 py-4 whitespace-nowrap">¥{{ infrastructure.subtotal }}</td>
<td class="px-6 py-4 whitespace-nowrap">{{ infrastructure.description }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<p class="text-gray-500 italic">暂无基础设施预算明细</p>
{% endif %}
</div>
</div>
{% endfor %}
{% else %}
<p class="text-gray-500 italic">暂无预算信息</p>
{% endif %}
</div>
2025-12-03 15:42:35 +08:00
<div class="bg-white rounded-lg shadow-md p-4 mb-6">
<h2 class="text-2xl font-bold mb-4">基本信息</h2>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div>
<p class="text-gray-700"><strong>信息系统分类:</strong> {{ branch.category|default:"暂无" }}</p>
<p class="text-gray-700"><strong>联系人:</strong> {{ branch.contact_person|default:"暂无" }}</p>
<p class="text-gray-700"><strong>联系电话:</strong> {{ branch.contact_phone|default:"暂无" }}</p>
</div>
<div>
<p class="text-gray-700"><strong>地址:</strong> {{ branch.address|default:"暂无" }}</p>
<p class="text-gray-700"><strong>成立时间:</strong> {{ branch.established_date|date:"Y-m-d"|default:"暂无" }}</p>
</div>
</div>
</div>
<!-- 事件信息 -->
<div class="bg-white rounded-lg shadow-md p-4 mb-6">
<h2 class="text-2xl font-bold mb-4">关联事件</h2>
{% if events %}
<div class="space-y-3">
{% for event in events %}
<div class="border-l-4 border-blue-500 pl-4 py-2 bg-blue-50 rounded">
<h3 class="font-semibold text-lg">{{ event.name }}</h3>
<p class="text-sm text-gray-600">
{% if event.end_time %}
开始日期{{ event.start_time|date:"Y年m月d日" }} 结束日期{{ event.end_time|date:"Y年m月d日" }}
{% else %}
开始日期{{ event.start_time|date:"Y年m月d日" }},现在进行中
{% endif %}
</p>
<p class="mt-1 text-gray-700">{{ event.description|truncatechars:100 }}</p>
</div>
{% endfor %}
</div>
{% else %}
<p class="text-gray-500 italic">暂无事件记录</p>
{% endif %}
</div>
<!-- 设备间图片 -->
<div class="bg-white rounded-lg shadow-md p-4 mb-6">
<h2 class="text-2xl font-bold mb-4">设备间图片</h2>
{% if equipment_images %}
<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4">
{% for image in equipment_images %}
<div class="overflow-hidden rounded-lg shadow">
<img src="{{ image.image.url }}" alt="设备间图片" class="w-full h-48 object-cover">
<div class="p-2 bg-gray-50">
<p class="text-sm text-gray-700">{{ image.description|default:"无描述" }}</p>
<p class="text-xs text-gray-500 mt-1">{{ image.upload_date|date:"Y-m-d" }}</p>
</div>
</div>
{% endfor %}
</div>
{% else %}
<p class="text-gray-500 italic">暂无设备间图片</p>
{% endif %}
</div>
<!-- 公共电子屏 -->
<div class="bg-white rounded-lg shadow-md p-4 mb-6">
<h2 class="text-2xl font-bold mb-4">公共电子屏</h2>
{% if public_screens %}
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">类型</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">描述</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">最后演练</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">更新时间</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
{% for screen in public_screens %}
<tr>
<td class="px-6 py-4 whitespace-nowrap">{{ screen.get_screen_type_display }}</td>
<td class="px-6 py-4">{{ screen.description|default:"无" }}</td>
<td class="px-6 py-4 whitespace-nowrap">{{ screen.last_drill.date|date:"Y-m-d"|default:"未演练" }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">{{ screen.updated_at|date:"Y-m-d H:i" }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<p class="text-gray-500 italic">暂无公共电子屏信息</p>
{% endif %}
</div>
{% for scope, activities in grouped_activities.items %}
<div class="p-5 border border-gray-100 rounded-lg bg-gray-50 dark:bg-gray-800 dark:border-gray-700">
<time class="text-lg font-semibold text-gray-900 dark:text-white">{{ scope }}</time>
<ol class="mt-3 divide-y divider-gray-200 dark:divide-gray-700">
{% for huodong in activities %}
<li style="background-color: {{ huodong.branch.background_color }};">
<div class="items-center block p-3 sm:flex hover:bg-gray-100 dark:hover:bg-gray-700">
<div class="text-gray-600 dark:text-gray-400">
<span class="inline-flex items-center text-xs font-normal text-gray-400 dark:text-gray-400">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-2.5 h-2.5 text-blue-800 dark:text-blue-300">
<path stroke-linecap="round" stroke-linejoin="round" d="M15.75 9V5.25A2.25 2.25 0 0 0 13.5 3h-6a2.25 2.25 0 0 0-2.25 2.25v13.5A2.25 2.25 0 0 0 7.5 21h6a2.25 2.25 0 0 0 2.25-2.25V15m3 0 3-3m0 0-3-3m3 3H9" />
</svg>
开始时间 {{ huodong.start_time| date:"Y年m月d日" }}
</span>
<div class="text-base font-normal">
<span class="font-medium text-gray-900 dark:text-white">
{% if not huodong.end_time %}
<span class="text-lg font-semibold text-red-900 dark:text-white">
{{ huodong.name }}-未完成
</span>
{% else %}
<span class="text-lg font-semibold text-gray-900 dark:text-white">
{{ huodong.name }}
</span>
{% endif %}
</span>
</div>
<div class="text-sm font-normal">
{{ huodong.description }}
</div>
<span class="inline-flex items-center text-xs font-normal text-gray-400 dark:text-gray-400">
<svg class="w-2.5 h-2.5 text-blue-800 dark:text-blue-300" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
<path d="M20 4a2 2 0 0 0-2-2h-2V1a1 1 0 0 0-2 0v1h-3V1a1 1 0 0 0-2 0v1H6V1a1 1 0 0 0-2 0v1H2a2 2 0 0 0-2 2v2h20V4ZM0 18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8H0v10Zm5-8h10a1 1 0 0 1 0 2H5a1 1 0 0 1 0-2Z"/>
</svg>
结束时间 {{ huodong.end_time| date:"Y年m月d日" }}
</span>
</div>
</div>
</li>
{% endfor %}
</ol>
</div>
<hr class="h-px my-8 bg-gray-200 border-0 dark:bg-gray-700">
{% endfor %}
{% endblock %}