Files
inventory/templates/edit.html
wangbeihong 0a54bfd5aa feat:增强模板的用户界面和功能
- 在 scanner.js 中为用户操作添加了 toast 通知。
- 更新 box.html 以包含额外的导航选项和改进的布局。
- 增强 edit.html,提供更清晰的说明和改进表单的可访问性。
- 修改了 error.html,以提供有关输入错误的用户指导。
- 改进了 index.html,以优化导航并添加了关键指标显示。
- 增强了 scan.html,优化了搜索输入和操作按钮。
- 引入了 stats.html,用于详细的库存统计和趋势。
- 创建了 types.html,用于分类概述库存类型。
2026-03-10 01:34:02 +08:00

84 lines
3.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>编辑元件</title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
</head>
<body>
<header class="hero slim">
<div>
<h1>{{ box.name }} - 编号 {{ slot_code }}</h1>
<p>步骤: 填写核心字段 -> 检查数量 -> 保存</p>
</div>
<div class="hero-actions">
<a class="btn btn-light" href="{{ url_for('stats_page') }}">统计页</a>
<a class="btn btn-light" href="{{ url_for('view_box', box_id=box.id) }}">返回宫格</a>
</div>
</header>
<main class="container">
{% if error %}
<p class="alert">{{ error }}</p>
{% endif %}
<div class="entry-shell">
<section class="entry-main">
<form class="panel form-grid" method="post">
<label>
料号 *
<input type="text" name="part_no" required value="{{ component.part_no if component else '' }}" aria-label="料号" placeholder="如 STM32F103C8T6">
</label>
<label>
名称 *
<input type="text" name="name" required value="{{ component.name if component else '' }}" aria-label="名称" placeholder="如 MCU STM32F103C8T6">
</label>
<label>
规格
<input type="text" name="specification" value="{{ component.specification if component else '' }}" placeholder="如 Cortex-M3 / LQFP-48">
</label>
<label>
数量
<input type="number" name="quantity" min="0" value="{{ component.quantity if component else 0 }}">
</label>
<label class="full">
备注
<textarea name="note" rows="3" placeholder="如 LCSC item 9243">{{ component.note if component else '' }}</textarea>
</label>
<div class="actions full">
<button class="btn" type="submit" name="action" value="save">保存</button>
{% if component %}
{% if component.is_enabled %}
<button class="btn btn-light" type="submit" name="action" value="toggle_disable">停用</button>
{% else %}
<button class="btn btn-light" type="submit" name="action" value="toggle_enable">启用</button>
{% endif %}
<button class="btn btn-danger" type="submit" name="action" value="delete" onclick="return confirm('确认删除这个元件记录吗?')">删除</button>
{% endif %}
</div>
</form>
</section>
<aside class="entry-sidebar">
<section class="panel entry-guide">
<h2>轻量入库规范</h2>
<p class="hint">先保证可检索,再补充关键参数,不追求一次填很全。</p>
<ul class="guide-list">
<li>必填: 料号(part_no) + 名称(name) + 数量(quantity)</li>
<li>建议: 规格(specification)写 2-4 个关键参数</li>
<li>备注(note): 来源编号或链接,如 LCSC item 9243</li>
</ul>
<pre class="guide-code">料号: STM32F103C8T6
名称: MCU STM32F103C8T6
规格: Cortex-M3 / 64KB Flash / LQFP-48
数量: 10
备注: LCSC item 9243</pre>
</section>
</aside>
</div>
</main>
</body>
</html>