feat: 添加低库存预警功能,优化盒子和容器列表界面

This commit is contained in:
2026-03-08 13:00:47 +08:00
parent 99d002e188
commit 859f92cdf0
4 changed files with 167 additions and 97 deletions

View File

@@ -109,14 +109,20 @@
</section>
{% else %}
<p class="group-desc">容量: {{ box.slot_capacity }} 位 | 编号范围: {{ slot_range }}</p>
<section class="slot-grid{% if box.slot_capacity <= 14 %} slot-grid-14{% endif %}{% if box.slot_capacity <= 4 %} slot-grid-bag{% endif %}">
<section class="slot-grid{% if box.box_type == 'small_28' %} slot-grid-28-fixed{% endif %}{% if box.box_type == 'medium_14' %} slot-grid-14-fixed{% endif %}{% if box.slot_capacity <= 4 %} slot-grid-bag{% endif %}">
{% for item in slots %}
<a class="slot {% if item.component %}filled{% endif %}" href="{{ url_for('edit_component', box_id=box.id, slot=item.slot) }}">
<a class="slot {% if item.component %}filled{% endif %}{% if item.component and item.component.quantity < low_stock_threshold %} low-stock{% endif %}" href="{{ url_for('edit_component', box_id=box.id, slot=item.slot) }}">
{% if box.box_type in ['small_28', 'medium_14'] %}
<span class="slot-no">位置 {{ '%02d'|format(item.slot) }}</span>
{% else %}
<span class="slot-no">{{ item.slot_code }}</span>
{% endif %}
{% if item.component %}
<strong>{{ item.component.part_no }}</strong>
<small>{{ item.component.name }}</small>
<small>库存: {{ item.component.quantity }} | {% if item.component.is_enabled %}启用{% else %}停用{% endif %}</small>
<small>数量: {{ item.component.quantity }}</small>
{% if item.component.quantity < low_stock_threshold %}
<small>低库存预警</small>
{% endif %}
{% else %}
<small>空位</small>
{% endif %}