diff --git a/.gitignore b/.gitignore index 3bc1785..23d8f0f 100644 Binary files a/.gitignore and b/.gitignore differ diff --git a/frontend/ops_vue_js/.gitignore b/frontend/ops_vue_js/.gitignore index 32258b0..b6c2e4b 100644 --- a/frontend/ops_vue_js/.gitignore +++ b/frontend/ops_vue_js/.gitignore @@ -7,32 +7,65 @@ yarn-error.log* pnpm-debug.log* lerna-debug.log* +# Dependencies node_modules -.DS_Store +.pnp +.pnp.js + +# Build output dist dist-ssr -coverage *.local -# Editor directories and files -.vscode/* -!.vscode/extensions.json -.idea -*.suo -*.ntvs* -*.njsproj -*.sln -*.sw? - -*.tsbuildinfo - -.eslintcache +# Testing +coverage +.nyc_output +__screenshots__/ # Cypress /cypress/videos/ /cypress/screenshots/ -# Vitest -__screenshots__/ +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? +*.swp +*.swo +*~ +# TypeScript +*.tsbuildinfo + +# ESLint +.eslintcache + +# Environment variables +.env +.env.local +.env.development.local +.env.test.local +.env.production.local + +# Temporary files +*.tmp +*.temp +.cache +.parcel-cache + +# OS files +Thumbs.db +Desktop.ini + +# Documentation (temporary/generated) +*_SUMMARY.md +SEARCH_FIX_SUMMARY.md + +# Project specific .workbuddy diff --git a/frontend/ops_vue_js/src/i18n/en.json b/frontend/ops_vue_js/src/i18n/en.json index d1f1d6f..cf80f6f 100644 --- a/frontend/ops_vue_js/src/i18n/en.json +++ b/frontend/ops_vue_js/src/i18n/en.json @@ -356,6 +356,8 @@ "no_contents": "No contents", "type_container": "Container", "type_item": "Item", + "item": "Item", + "view_detail": "View Detail", "linked_customers": "Linked Customers", "linked_customer_placeholder": "Search customer by name or phone...", "linked_customer_not_found": "No matching customers found", diff --git a/frontend/ops_vue_js/src/i18n/zh-CN.json b/frontend/ops_vue_js/src/i18n/zh-CN.json index b30d9d7..a0a5ada 100644 --- a/frontend/ops_vue_js/src/i18n/zh-CN.json +++ b/frontend/ops_vue_js/src/i18n/zh-CN.json @@ -356,6 +356,8 @@ "no_contents": "暂无内容", "type_container": "容器", "type_item": "物品", + "item": "物品", + "view_detail": "查看详情", "linked_customers": "关联客户", "linked_customer_placeholder": "搜索客户姓名或电话...", "linked_customer_not_found": "未找到匹配的客户", diff --git a/frontend/ops_vue_js/src/views/warehouse/WarehouseContainerList.vue b/frontend/ops_vue_js/src/views/warehouse/WarehouseContainerList.vue index c244c16..69c87a5 100644 --- a/frontend/ops_vue_js/src/views/warehouse/WarehouseContainerList.vue +++ b/frontend/ops_vue_js/src/views/warehouse/WarehouseContainerList.vue @@ -68,16 +68,53 @@ const pageRange = computed(() => { 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(() => {