feat: 添加低库存预警功能,优化盒子和容器列表界面
This commit is contained in:
@@ -13,74 +13,87 @@
|
||||
</header>
|
||||
|
||||
<main class="container">
|
||||
<h2>容器列表</h2>
|
||||
<div class="layout-shell">
|
||||
<aside class="catalog-sidebar panel">
|
||||
<h2>容器导航</h2>
|
||||
<nav class="catalog-nav">
|
||||
{% for key, meta in box_types.items() %}
|
||||
<a href="#group-{{ key }}">{{ meta.label }} ({{ groups[key]|length }})</a>
|
||||
{% endfor %}
|
||||
</nav>
|
||||
</aside>
|
||||
|
||||
{% for key, meta in box_types.items() %}
|
||||
<section class="group-panel panel" id="group-{{ key }}">
|
||||
<div class="group-title-row">
|
||||
<h3>{{ meta.label }}</h3>
|
||||
<span class="group-desc">{{ meta.default_desc }}</span>
|
||||
</div>
|
||||
<section class="catalog-content">
|
||||
<h2>容器列表</h2>
|
||||
|
||||
<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="slot_prefix" placeholder="前缀(如A/B/C)">
|
||||
<input type="number" name="start_number" min="0" value="1" placeholder="起始序号">
|
||||
<input type="text" name="description" placeholder="备注(可选)">
|
||||
<button class="btn btn-light suggest-start-btn" type="button" data-box-type="{{ key }}">建议起始号</button>
|
||||
<button class="btn" type="submit">新增盒子</button>
|
||||
<span class="hint suggest-preview"></span>
|
||||
</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.box.slot_prefix }} | 范围: {{ item.slot_range }}</p>
|
||||
<p>已启用: {{ item.used_count }}/{{ item.box.slot_capacity }}</p>
|
||||
|
||||
<div class="card-actions">
|
||||
<a class="btn" href="{{ url_for('view_box', box_id=item.box.id) }}">进入列表</a>
|
||||
<form method="post" action="{{ url_for('delete_box', box_id=item.box.id) }}" onsubmit="return confirm('确认删除盒子及内部全部记录吗?')">
|
||||
<button class="btn btn-danger" type="submit">删除</button>
|
||||
</form>
|
||||
{% for key, meta in box_types.items() %}
|
||||
<section class="group-panel panel" id="group-{{ key }}">
|
||||
<div class="group-title-row">
|
||||
<h3>{{ meta.label }}</h3>
|
||||
<span class="group-desc">{{ meta.default_desc }}</span>
|
||||
</div>
|
||||
|
||||
<details class="box-overview">
|
||||
<summary>概览(已启用序号和名称)</summary>
|
||||
{% if item.overview_rows %}
|
||||
<ul>
|
||||
{% for row in item.overview_rows %}
|
||||
<li>{{ row.slot_code }} - {{ row.name }} ({{ row.part_no }})</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
<p>暂无启用记录</p>
|
||||
{% endif %}
|
||||
</details>
|
||||
<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="slot_prefix" placeholder="前缀(如A/B/C)">
|
||||
<input type="number" name="start_number" min="0" value="1" placeholder="起始序号">
|
||||
<input type="text" name="description" placeholder="备注(可选)">
|
||||
<button class="btn btn-light suggest-start-btn" type="button" data-box-type="{{ key }}">建议起始号</button>
|
||||
<button class="btn" type="submit">新增盒子</button>
|
||||
<span class="hint suggest-preview"></span>
|
||||
</form>
|
||||
|
||||
<details class="box-overview">
|
||||
<summary>设置(改名/前缀/起始号)</summary>
|
||||
<p class="hint">输入基础名称后,系统会自动生成: 基础名称 + 编号范围。</p>
|
||||
<form class="new-box-form compact" method="post" action="{{ url_for('update_box', box_id=item.box.id) }}">
|
||||
<input type="text" name="name" value="{{ item.base_name }}" required>
|
||||
<input type="text" name="slot_prefix" value="{{ item.box.slot_prefix }}" required>
|
||||
<input type="number" name="start_number" min="0" value="{{ item.box.start_number }}" required>
|
||||
<input type="text" name="description" value="{{ item.box.description or '' }}">
|
||||
<button class="btn btn-light suggest-start-btn" type="button" data-box-id="{{ item.box.id }}" data-box-type="{{ item.box.box_type }}">建议起始号</button>
|
||||
<button class="btn" type="submit">保存设置</button>
|
||||
<span class="hint suggest-preview"></span>
|
||||
</form>
|
||||
</details>
|
||||
</article>
|
||||
{% else %}
|
||||
<p>当前分类还没有盒子,先新增一个。</p>
|
||||
<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.box.slot_prefix }} | 范围: {{ item.slot_range }}</p>
|
||||
<p>已启用: {{ item.used_count }}/{{ item.box.slot_capacity }}</p>
|
||||
|
||||
<div class="card-actions">
|
||||
<a class="btn" href="{{ url_for('view_box', box_id=item.box.id) }}">进入列表</a>
|
||||
<form method="post" action="{{ url_for('delete_box', box_id=item.box.id) }}" onsubmit="return confirm('确认删除盒子及内部全部记录吗?')">
|
||||
<button class="btn btn-danger" type="submit">删除</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<details class="box-overview">
|
||||
<summary>概览(已启用序号和名称)</summary>
|
||||
{% if item.overview_rows %}
|
||||
<ul>
|
||||
{% for row in item.overview_rows %}
|
||||
<li>{{ row.slot_code }} - {{ row.name }} ({{ row.part_no }})</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
<p>暂无启用记录</p>
|
||||
{% endif %}
|
||||
</details>
|
||||
|
||||
<details class="box-overview">
|
||||
<summary>设置(改名/前缀/起始号)</summary>
|
||||
<p class="hint">输入基础名称后,系统会自动生成: 基础名称 + 编号范围。</p>
|
||||
<form class="new-box-form compact" method="post" action="{{ url_for('update_box', box_id=item.box.id) }}">
|
||||
<input type="text" name="name" value="{{ item.base_name }}" required>
|
||||
<input type="text" name="slot_prefix" value="{{ item.box.slot_prefix }}" required>
|
||||
<input type="number" name="start_number" min="0" value="{{ item.box.start_number }}" required>
|
||||
<input type="text" name="description" value="{{ item.box.description or '' }}">
|
||||
<button class="btn btn-light suggest-start-btn" type="button" data-box-id="{{ item.box.id }}" data-box-type="{{ item.box.box_type }}">建议起始号</button>
|
||||
<button class="btn" type="submit">保存设置</button>
|
||||
<span class="hint suggest-preview"></span>
|
||||
</form>
|
||||
</details>
|
||||
</article>
|
||||
{% else %}
|
||||
<p>当前分类还没有盒子,先新增一个。</p>
|
||||
{% endfor %}
|
||||
</section>
|
||||
</section>
|
||||
{% endfor %}
|
||||
</section>
|
||||
</section>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<script>
|
||||
|
||||
Reference in New Issue
Block a user