From 5406b14b5c2203e9b60574b070d5921f5907c0ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=97=A0=E9=97=BB=E9=A3=8E?= Date: Wed, 24 Jun 2026 13:09:29 +0800 Subject: [PATCH] up --- .gitignore | Bin 94 -> 214 bytes frontend/ops_vue_js/.gitignore | 67 +++++++++--- frontend/ops_vue_js/src/i18n/en.json | 2 + frontend/ops_vue_js/src/i18n/zh-CN.json | 2 + .../warehouse/WarehouseContainerList.vue | 100 ++++++++++++++---- 5 files changed, 133 insertions(+), 38 deletions(-) diff --git a/.gitignore b/.gitignore index 3bc1785debb43cdb33670b3dd69d52fb2bd47848..23d8f0f39f53ee8856e842d61e40a24b8319d049 100644 GIT binary patch literal 214 zcmYLDK?=e!5WMdz0^R~{>kGW-O;AYjTH0jWL|Zl_siha+ZYokQ!_4dqvpaEBqH_a9 zz>}&~;y@r}@fRCA0@e~xc}|1tZQ9=tWeHe?CfZylo9r~U5lsu##$YFIfghxkh@Q0T zoCcgZJln~b1@if9Tpk5{Ma_l^Kxe2aKw_Nz7a8Px4PLm9*%-KARYjxc(1hjpy~H%G I`ILS501FjDT>t<8 literal 94 zcmezWPmiITA)ld$A)6tIp_Cy72rC(Q8Mqj { async function fetchContainers() { loading.value = true try { - const { errCode, data } = await warehouseApi.getContainers({ - search: search.value, - entries: pageSize.value, - page: currentPage.value, - }) - if (errCode === 0) { - containers.value = data.containers ?? [] - totalCount.value = data.all_count ?? 0 + // 如果有搜索词,同时搜索容器和物品 + if (search.value.trim()) { + const [containersRes, itemsRes] = await Promise.all([ + warehouseApi.getContainers({ + search: search.value, + entries: pageSize.value, + page: currentPage.value, + }), + warehouseApi.getItems({ + search: search.value, + entries: pageSize.value, + page: currentPage.value, + }) + ]) + + if (containersRes.errCode === 0 && itemsRes.errCode === 0) { + // 合并容器和物品结果,添加类型标识 + const containerList = (containersRes.data.containers ?? []).map(c => ({ + ...c, + _type: 'container' + })) + const itemList = (itemsRes.data.items ?? []).map(i => ({ + ...i, + _type: 'item' + })) + + containers.value = [...containerList, ...itemList] + totalCount.value = (containersRes.data.all_count ?? 0) + (itemsRes.data.all_count ?? 0) + } else { + toast.error(t('message.server_error')) + } } else { - toast.error(t('message.server_error')) + // 没有搜索词时,只显示容器 + const { errCode, data } = await warehouseApi.getContainers({ + search: search.value, + entries: pageSize.value, + page: currentPage.value, + }) + if (errCode === 0) { + containers.value = (data.containers ?? []).map(c => ({ + ...c, + _type: 'container' + })) + totalCount.value = data.all_count ?? 0 + } else { + toast.error(t('message.server_error')) + } } } catch { // 拦截器已处理 @@ -121,9 +158,13 @@ function handleSearch() { fetchContainers() } -// ── 跳转到子容器 ── -function jumpToContainer(id) { - router.push(`/warehouse/container/${id}`) +// ── 跳转到容器或物品详情 ── +function jumpToDetail(item) { + if (item._type === 'item') { + router.push(`/warehouse/item/${item.ID}`) + } else { + router.push(`/warehouse/container/${item.ID}`) + } } // ── 打开新增 ── @@ -323,41 +364,49 @@ onMounted(() => { {{ c.ID }}
- - {{ c.Title }} + + +
+ {{ c.Title }} + {{ t('warehouse.item') }} +
{{ c.Remark || '—' }} - {{ c.ChildCount }} + - {{ c.ItemCount }} + x{{ c.Quantity }} + - {{ c.WorkOrderCount }} +
@@ -376,7 +425,7 @@ onMounted(() => { -
+
+
+
+