{% extends "base.html" %} {% block content %}

{{ task.title }}

{# 审批按钮(待审批状态) #} {% if task.status == 'pending' and current_user.is_approver() %} {% set current_approver_role = '' %} {% if template and template.approver_roles and task.current_level < template.approver_roles|length %} {% set current_approver_role = template.approver_roles[task.current_level] %} {% elif template and template.roles and task.current_level < template.roles|length %} {% set current_approver_role = template.roles[task.current_level] %} {% endif %} {% if current_approver_role != '经办人' %} 审批 {% else %} ⏳ 等待发起人确认 {% endif %} {% endif %} {# 重新提交按钮(已驳回状态) #} {% if task.status == 'rejected' %} 重新提交 {% endif %} {# 弃置按钮(待审批或已驳回状态,发起人本人或管理员可见) #} {% if task.status in ['pending', 'rejected'] %} {% if task.applicant_id == current_user.id or current_user.is_admin() %} {% endif %} {% endif %} 返回
申请人
{{ task.applicant }}
状态
{% if task.status == 'pending' %} ⏳ 待审批 {% elif task.status == 'approved' %} ✅ 已通过 {% elif task.status == 'rejected' %} ❌ 已驳回 {% else %} 🗑️ 已弃置 {% endif %}
提交时间
{{ task.created_at }}
{% if task.finished_at %}
完成时间
{{ task.finished_at }}
{% endif %}
当前层级
{% if task.status == 'pending' %} 第 {{ task.current_level + 1 }} 级 {% if template %} / 共 {{ template.level }} 级 {% endif %} {% else %} ✅ 已完成全部审批 {% endif %}
内容
{{ task.content }}
{% if task.parent_task_id %}
原任务
#{{ task.parent_task_id }} (重新提交)
{% endif %} {% if task.attachment_path %} {% endif %}
{% if template %}
审批链预览
{% for i in range(template.level) %}
第{{ i+1 }}级
{{ template.roles[i] }}
{{ template.persons[i] }}
{% if task.status == 'approved' %} ✅ 已完成 {% elif i < task.current_level %} ✅ 已完成 {% elif i == task.current_level and task.status == 'pending' %} ⏳ 待审批 {% endif %}
{% if i < template.level - 1 %}
{% endif %} {% endfor %}
{% endif %}
审批记录
{% for log in logs %}
{{ log.person }} {{ log.created_at }}
{% if log.action == 'submit' %} 📤 提交 {% elif log.action == 'approved' %} ✅ 通过 {% elif log.action == 'rejected' %} ❌ 驳回 {% elif log.action == 'reapply' %} 🔄 重提 {% elif log.action == 'notify' %} 📋 通知 {% elif log.action == 'discard' %} 🗑️ 弃置 {% else %} {{ log.action }} {% endif %} {{ log.role }}
{% if log.comment %}
💬 {{ log.comment }}
{% endif %}
{% else %}
暂无审批记录
{% endfor %}
{% endblock %}