feat: 完善文档和界面,增加盒子类型支持及批量新增功能
This commit is contained in:
@@ -3,12 +3,12 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{{ box.name }} - 28宫格</title>
|
||||
<title>{{ box.name }} - 容器详情</title>
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
|
||||
</head>
|
||||
<body>
|
||||
<header class="hero slim">
|
||||
<h1>{{ box.name }} - 28 宫格</h1>
|
||||
<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>
|
||||
@@ -16,7 +16,97 @@
|
||||
</header>
|
||||
|
||||
<main class="container">
|
||||
<section class="grid-28">
|
||||
{% 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>
|
||||
@@ -30,6 +120,7 @@
|
||||
</a>
|
||||
{% endfor %}
|
||||
</section>
|
||||
{% endif %}
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -13,19 +13,36 @@
|
||||
</header>
|
||||
|
||||
<main class="container">
|
||||
<h2>大盒列表</h2>
|
||||
<section class="box-list">
|
||||
{% for item in box_cards %}
|
||||
<article class="box-card">
|
||||
<h3>{{ item.box.name }}</h3>
|
||||
<p>{{ item.box.description or '暂无描述' }}</p>
|
||||
<p>已使用: {{ item.used_count }}/28</p>
|
||||
<a class="btn" href="{{ url_for('view_box', box_id=item.box.id) }}">进入 28 宫格</a>
|
||||
</article>
|
||||
{% else %}
|
||||
<p>暂无大盒数据,请先初始化数据库。</p>
|
||||
{% endfor %}
|
||||
<h2>容器列表</h2>
|
||||
|
||||
{% for key, meta in box_types.items() %}
|
||||
<section class="group-panel panel">
|
||||
<div class="group-title-row">
|
||||
<h3>{{ meta.label }}</h3>
|
||||
<span class="group-desc">{{ meta.default_desc }}</span>
|
||||
</div>
|
||||
|
||||
<form class="new-box-form" method="post" action="{{ url_for('create_box') }}">
|
||||
<input type="hidden" name="box_type" value="{{ key }}">
|
||||
<input type="text" name="name" placeholder="新增盒子名称" required>
|
||||
<input type="text" name="description" placeholder="备注(可选)">
|
||||
<button class="btn" type="submit">新增盒子</button>
|
||||
</form>
|
||||
|
||||
<section class="box-list">
|
||||
{% for item in groups[key] %}
|
||||
<article class="box-card">
|
||||
<h4>{{ item.box.name }}</h4>
|
||||
<p>{{ item.box.description or '暂无描述' }}</p>
|
||||
<p>已使用: {{ item.used_count }}/{{ item.box.slot_capacity }}</p>
|
||||
<a class="btn" href="{{ url_for('view_box', box_id=item.box.id) }}">进入列表</a>
|
||||
</article>
|
||||
{% else %}
|
||||
<p>当前分类还没有盒子,先新增一个。</p>
|
||||
{% endfor %}
|
||||
</section>
|
||||
</section>
|
||||
{% endfor %}
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user