Files
inventory/templates/box.html
wangbeihong 22147a1c03 feat:增强箱子管理功能与界面优化
- 新增箱子重命名与删除功能
- 引入新箱子前缀与起始编号配置
- 在首页展示箱子编号范围
- 添加概览按钮,快速查看已启用的物品及其名称
- 实现组件的启用/禁用功能
- 更新数据库结构,新增箱子与组件字段
- 优化箱子与组件管理界面,改进表单与表格展示
- 在索引页面增加箱子详细信息概览区域
- 增强扫描与搜索功能,优化结果显示效果
2026-03-08 02:48:24 +08:00

130 lines
4.0 KiB
HTML

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ box.name }} - 容器详情</title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
</head>
<body>
<header class="hero slim">
<h1>{{ box.name }} - {{ box_types.get(box.box_type, box_types['small_28']).label }}</h1>
<nav>
<a class="btn btn-light" href="{{ url_for('index') }}">返回首页</a>
<a class="btn" href="{{ url_for('scan_page') }}">扫码/搜索</a>
</nav>
</header>
<main class="container">
{% if error %}
<p class="alert">{{ error }}</p>
{% endif %}
{% if notice %}
<p class="notice">{{ notice }}</p>
{% endif %}
{% if box.box_type == 'bag' %}
<section class="panel">
<h2>袋装记录</h2>
<p class="group-desc">编号范围: {{ slot_range }} | 每行一个袋位</p>
<div class="table-wrap">
<table>
<thead>
<tr>
<th>袋位编号</th>
<th>料号</th>
<th>名称</th>
<th>数量</th>
<th>状态</th>
<th>规格</th>
<th>位置备注</th>
<th>操作</th>
</tr>
</thead>
<tbody>
{% for row in bag_rows %}
{% set c = row.component %}
<tr>
<td>{{ row.slot_code }}</td>
<td>{{ c.part_no }}</td>
<td>{{ c.name }}</td>
<td>{{ c.quantity }}</td>
<td>{% if c.is_enabled %}启用{% else %}停用{% endif %}</td>
<td>{{ c.specification or '-' }}</td>
<td>{{ c.location or '-' }}</td>
<td><a href="{{ url_for('edit_component', box_id=box.id, slot=c.slot_index) }}">编辑</a></td>
</tr>
{% else %}
<tr>
<td colspan="7">当前没有袋装记录,请先新增。</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</section>
<section class="panel">
<h2>新增单条</h2>
<form class="form-grid" method="post" action="{{ url_for('add_bag_item', box_id=box.id) }}">
<label>
料号 *
<input type="text" name="part_no" required>
</label>
<label>
名称 *
<input type="text" name="name" required>
</label>
<label>
数量
<input type="number" min="0" name="quantity" value="0">
</label>
<label>
规格
<input type="text" name="specification">
</label>
<label>
位置备注
<input type="text" name="location">
</label>
<label class="full">
备注
<input type="text" name="note">
</label>
<div class="actions full">
<button class="btn" type="submit">新增记录</button>
</div>
</form>
</section>
<section class="panel">
<h2>批量新增</h2>
<p class="hint">每行一条, 格式: 料号, 名称, 数量, 规格, 位置备注, 备注。可用英文逗号或 Tab 分隔。</p>
<form method="post" action="{{ url_for('add_bag_items_batch', box_id=box.id) }}">
<textarea class="batch-input" name="lines" rows="8" placeholder="10K-0603, 贴片电阻10K, 500, 0603, A袋, 常用\n100nF-0603, 电容100nF, 300, 0603, B袋, X7R"></textarea>
<div class="actions">
<button class="btn" type="submit">批量导入</button>
</div>
</form>
</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 %}">
{% for item in slots %}
<a class="slot {% if item.component %}filled{% endif %}" href="{{ url_for('edit_component', box_id=box.id, slot=item.slot) }}">
<span class="slot-no">{{ item.slot_code }}</span>
{% 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>
{% else %}
<small>空位</small>
{% endif %}
</a>
{% endfor %}
</section>
{% endif %}
</main>
</body>
</html>