初次提交项目
This commit is contained in:
35
templates/box.html
Normal file
35
templates/box.html
Normal file
@@ -0,0 +1,35 @@
|
||||
<!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 }} - 28宫格</title>
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
|
||||
</head>
|
||||
<body>
|
||||
<header class="hero slim">
|
||||
<h1>{{ box.name }} - 28 宫格</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">
|
||||
<section class="grid-28">
|
||||
{% 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>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
55
templates/edit.html
Normal file
55
templates/edit.html
Normal file
@@ -0,0 +1,55 @@
|
||||
<!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">
|
||||
<h1>{{ box.name }} - 格子 #{{ slot }}</h1>
|
||||
<a class="btn btn-light" href="{{ url_for('view_box', box_id=box.id) }}">返回宫格</a>
|
||||
</header>
|
||||
|
||||
<main class="container">
|
||||
{% if error %}
|
||||
<p class="alert">{{ error }}</p>
|
||||
{% endif %}
|
||||
|
||||
<form class="panel form-grid" method="post">
|
||||
<label>
|
||||
料号 *
|
||||
<input type="text" name="part_no" required value="{{ component.part_no if component else '' }}">
|
||||
</label>
|
||||
<label>
|
||||
名称 *
|
||||
<input type="text" name="name" required value="{{ component.name if component else '' }}">
|
||||
</label>
|
||||
<label>
|
||||
规格
|
||||
<input type="text" name="specification" value="{{ component.specification if component else '' }}">
|
||||
</label>
|
||||
<label>
|
||||
数量
|
||||
<input type="number" name="quantity" min="0" value="{{ component.quantity if component else 0 }}">
|
||||
</label>
|
||||
<label>
|
||||
位置备注
|
||||
<input type="text" name="location" value="{{ component.location if component else '' }}">
|
||||
</label>
|
||||
<label class="full">
|
||||
备注
|
||||
<textarea name="note" rows="3">{{ component.note if component else '' }}</textarea>
|
||||
</label>
|
||||
|
||||
<div class="actions full">
|
||||
<button class="btn" type="submit" name="action" value="save">保存</button>
|
||||
{% if component %}
|
||||
<button class="btn btn-danger" type="submit" name="action" value="delete" onclick="return confirm('确认清空该格子吗?')">删除</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
</form>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
31
templates/index.html
Normal file
31
templates/index.html
Normal file
@@ -0,0 +1,31 @@
|
||||
<!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">
|
||||
<h1>电子元件库存管理 v1.0</h1>
|
||||
<a class="btn" href="{{ url_for('scan_page') }}">扫码/搜索</a>
|
||||
</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 %}
|
||||
</section>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
61
templates/scan.html
Normal file
61
templates/scan.html
Normal file
@@ -0,0 +1,61 @@
|
||||
<!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">
|
||||
<h1>扫码/搜索元件</h1>
|
||||
<a class="btn btn-light" href="{{ url_for('index') }}">返回首页</a>
|
||||
</header>
|
||||
|
||||
<main class="container">
|
||||
<section class="panel">
|
||||
<form method="get" action="{{ url_for('scan_page') }}" class="search-row" id="scan-search-form">
|
||||
<input id="scan-input" type="text" name="q" placeholder="输入或扫码料号/名称" value="{{ keyword }}">
|
||||
<button class="btn" type="submit">搜索</button>
|
||||
</form>
|
||||
<p class="hint">扫码枪通常会自动输入后回车,可直接触发搜索。</p>
|
||||
</section>
|
||||
|
||||
<section class="panel">
|
||||
<h2>搜索结果</h2>
|
||||
{% if keyword and results %}
|
||||
<div class="table-wrap">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>料号</th>
|
||||
<th>名称</th>
|
||||
<th>库存</th>
|
||||
<th>位置</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for c in results %}
|
||||
<tr>
|
||||
<td>{{ c.part_no }}</td>
|
||||
<td>{{ c.name }}</td>
|
||||
<td>{{ c.quantity }}</td>
|
||||
<td>盒 {{ c.box_id }} / 格 {{ c.slot_index }}</td>
|
||||
<td><a href="{{ url_for('edit_component', box_id=c.box_id, slot=c.slot_index) }}">编辑</a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% elif keyword %}
|
||||
<p>未找到关键词 "{{ keyword }}" 的元件。</p>
|
||||
{% else %}
|
||||
<p>请输入关键词开始搜索。</p>
|
||||
{% endif %}
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<script src="{{ url_for('static', filename='js/scanner.js') }}"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user