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