Files
inventory/templates/box.html

127 lines
3.7 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">每行一个袋位,按序号自动编号</p>
<div class="table-wrap">
<table>
<thead>
<tr>
<th>袋位</th>
<th>料号</th>
<th>名称</th>
<th>数量</th>
<th>规格</th>
<th>位置备注</th>
<th>操作</th>
</tr>
</thead>
<tbody>
{% for c in bag_items %}
<tr>
<td>#{{ c.slot_index }}</td>
<td>{{ c.part_no }}</td>
<td>{{ c.name }}</td>
<td>{{ c.quantity }}</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 }} 位</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 }}</span>
{% if item.component %}
<strong>{{ item.component.part_no }}</strong>
<small>{{ item.component.name }}</small>
<small>库存: {{ item.component.quantity }}</small>
{% else %}
<small>空位</small>
{% endif %}
</a>
{% endfor %}
</section>
{% endif %}
</main>
</body>
</html>