更新根视图显示未入库物品

This commit is contained in:
无闻风
2026-06-16 15:06:08 +08:00
parent 5ffd77bf28
commit e7e6129367
3 changed files with 9 additions and 3 deletions
+3
View File
@@ -945,6 +945,7 @@ func ApiWarehouse(r *gin.RouterGroup) {
type FromList struct {
Search string `json:"search"`
ContainerID *uint `json:"container_id"`
Unstored bool `json:"unstored"` // 仅返回未入库(container_id IS NULL)的物品
Entries int `json:"entries"`
Page int `json:"page"`
}
@@ -968,6 +969,8 @@ func ApiWarehouse(r *gin.RouterGroup) {
}
if from.ContainerID != nil {
query = query.Where("container_id = ?", *from.ContainerID)
} else if from.Unstored {
query = query.Where("container_id IS NULL")
}
query.Count(&count)
@@ -49,7 +49,7 @@ const notFound = ref(false)
// ═══════════════════════════════════════════════════════
// 合并列表(子容器 + 物品,类似文件管理器)
// ═══════════════════════════════════════════════════════
const FETCH_LIMIT = 500
const FETCH_LIMIT = 300
const subContainers = ref([])
const items = ref([])
@@ -42,8 +42,8 @@ const stats = reactive({
// 在前端合并为统一的 entries 列表(容器在前、物品在后),
// 共用一个搜索框 + 一个分页器。
// 一次性向后端取的最大条数(足够覆盖大多数前端分页场景
const FETCH_LIMIT = 500
// 一次性向后端取的最大条数(后端上限 300
const FETCH_LIMIT = 300
const containers = ref([]) // 原始容器列表
const items = ref([]) // 原始物品列表
@@ -102,6 +102,7 @@ async function fetchAll() {
}),
warehouseApi.getItems({
search: search.value.trim(),
unstored: true,
entries: FETCH_LIMIT,
page: 1,
}),
@@ -114,6 +115,8 @@ async function fetchAll() {
containerTotal.value = 0
}
if (iRes.errCode === 0) {
// 根目录类比文件管理器:只显示「未入库」的物品(unstored=true 由后端过滤);
// 已归入容器的物品在对应容器详情页里显示。
items.value = iRes.data.items ?? []
itemTotal.value = iRes.data.all_count ?? 0
} else {