From 6d02a00862860fd61c3ff5c30d66c5b24523836f Mon Sep 17 00:00:00 2001 From: WUSIJIAN <13825895+wsj0228@user.noreply.gitee.com> Date: Thu, 26 Feb 2026 17:42:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=9B=98=E7=82=B9=E8=8C=83?= =?UTF-8?q?=E5=9B=B4=E9=80=89=E6=8B=A9=E6=95=B0=E6=8D=AE=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E9=80=BB=E8=BE=91,=E5=B0=86=E5=BA=93=E5=8C=BA=E5=92=8C?= =?UTF-8?q?=E5=BA=93=E4=BD=8D=E7=9A=84=E5=BE=AA=E7=8E=AF=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E6=89=B9=E9=87=8F=E6=9F=A5=E8=AF=A2,?= =?UTF-8?q?=E6=96=B0=E5=A2=9EwarehouseIds=E5=92=8CzoneIds=E6=95=B0?= =?UTF-8?q?=E7=BB=84=E5=8F=82=E6=95=B0=E6=94=AF=E6=8C=81,=E7=A7=BB?= =?UTF-8?q?=E9=99=A4=E5=BA=93=E5=8C=BA=E5=AE=B9=E9=87=8F=E5=AD=97=E6=AE=B5?= =?UTF-8?q?,=E4=BF=AE=E6=AD=A3=E7=9B=98=E7=82=B9=E7=AE=A1=E7=90=86API?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E5=89=8D=E7=BC=80=E4=B8=BAassets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/assets/location/index.ts | 1 + src/api/assets/operation/count/index.ts | 18 +++---- src/api/assets/zone/index.ts | 2 +- .../count/component/scopeSelectDialog.vue | 50 +++++++------------ 4 files changed, 29 insertions(+), 42 deletions(-) diff --git a/src/api/assets/location/index.ts b/src/api/assets/location/index.ts index 65040c6..1906259 100644 --- a/src/api/assets/location/index.ts +++ b/src/api/assets/location/index.ts @@ -5,6 +5,7 @@ export interface LocationQueryParams { keyword?: string; warehouseId?: string; zoneId?: string; + zoneIds?: string[]; status?: string; pageNum?: number; pageSize?: number; diff --git a/src/api/assets/operation/count/index.ts b/src/api/assets/operation/count/index.ts index 7768f77..b7d98a8 100644 --- a/src/api/assets/operation/count/index.ts +++ b/src/api/assets/operation/count/index.ts @@ -31,7 +31,7 @@ export interface InventoryCountParams { // 获取盘点任务列表 export function listInventoryCounts(params?: InventoryCountQueryParams) { return newService({ - url: '/inventory/count/listInventoryCounts', + url: 'assets/inventory/count/listInventoryCounts', method: 'get', params, }); @@ -40,7 +40,7 @@ export function listInventoryCounts(params?: InventoryCountQueryParams) { // 获取盘点任务详情 export function getInventoryCount(id: string) { return newService({ - url: '/inventory/count/getInventoryCount', + url: 'assets/inventory/count/getInventoryCount', method: 'get', params: { id }, }); @@ -49,7 +49,7 @@ export function getInventoryCount(id: string) { // 创建盘点任务 export function createInventoryCount(data: InventoryCountParams) { return newService({ - url: '/inventory/count/createInventoryCount', + url: 'assets/inventory/count/createInventoryCount', method: 'post', data, }); @@ -58,7 +58,7 @@ export function createInventoryCount(data: InventoryCountParams) { // 更新盘点任务 export function updateInventoryCount(data: InventoryCountParams) { return newService({ - url: '/inventory/count/updateInventoryCount', + url: 'assets/inventory/count/updateInventoryCount', method: 'put', data, }); @@ -67,7 +67,7 @@ export function updateInventoryCount(data: InventoryCountParams) { // 删除盘点任务 export function deleteInventoryCount(id: string) { return newService({ - url: '/inventory/count/deleteInventoryCount', + url: 'assets/inventory/count/deleteInventoryCount', method: 'delete', params: { id }, }); @@ -76,7 +76,7 @@ export function deleteInventoryCount(id: string) { // 完成盘点 export function completeInventoryCount(id: string) { return newService({ - url: '/inventory/count/completeInventoryCount', + url: 'assets/inventory/count/completeInventoryCount', method: 'post', data: { id }, }); @@ -85,7 +85,7 @@ export function completeInventoryCount(id: string) { // 取消盘点 export function cancelInventoryCount(id: string[], reason?: string) { return newService({ - url: '/inventory/count/cancelInventoryCount', + url: 'assets/inventory/count/cancelInventoryCount', method: 'post', data: { id, reason }, }); @@ -94,7 +94,7 @@ export function cancelInventoryCount(id: string[], reason?: string) { // 导出盘点模板 export function exportInventoryCountTemplate() { return newService({ - url: '/inventory/count/exportInventoryCountTemplate', + url: 'assets/inventory/count/exportInventoryCountTemplate', method: 'get', responseType: 'blob', }); @@ -105,7 +105,7 @@ export function importInventoryCount(file: File) { const formData = new FormData(); formData.append('file', file); return newService({ - url: '/inventory/count/importInventoryCount', + url: 'assets/inventory/count/importInventoryCount', method: 'post', data: formData, headers: { diff --git a/src/api/assets/zone/index.ts b/src/api/assets/zone/index.ts index 982053b..04cfdcf 100644 --- a/src/api/assets/zone/index.ts +++ b/src/api/assets/zone/index.ts @@ -4,6 +4,7 @@ import { newService } from '/@/utils/request'; export interface ZoneQueryParams { keyword?: string; warehouseId?: string; + warehouseIds?: string[]; status?: string; pageNum?: number; pageSize?: number; @@ -16,7 +17,6 @@ export interface ZoneData { zoneCode?: string; zoneType?: string; warehouseId: string; - capacity?: number; status?: string; remark?: string; } diff --git a/src/views/assets/operation/count/component/scopeSelectDialog.vue b/src/views/assets/operation/count/component/scopeSelectDialog.vue index 90d9858..36f56a1 100644 --- a/src/views/assets/operation/count/component/scopeSelectDialog.vue +++ b/src/views/assets/operation/count/component/scopeSelectDialog.vue @@ -165,49 +165,35 @@ const loadData = async () => { })); total.value = res.data?.total || 0; } else if (scope.value === 2) { - // 加载库区 + // 加载库区 - 使用warehouseIds数组一次性查询 if (parentWarehouseIds.value.length === 0) { tableData.value = []; total.value = 0; return; } - const allZones: any[] = []; - let totalCount = 0; - for (const warehouseId of parentWarehouseIds.value) { - res = await listZones({ ...params, warehouseId }); - const list = res.data?.list || res.data?.items || res.data || []; - const zones = (Array.isArray(list) ? list : []).map((item: any) => ({ - id: item.id || item._id, - name: item.zoneName || item.name, - code: item.zoneCode || item.code, - })); - allZones.push(...zones); - totalCount += res.data?.total || zones.length; - } - tableData.value = allZones; - total.value = totalCount; + res = await listZones({ ...params, warehouseIds: parentWarehouseIds.value }); + const list = res.data?.list || res.data?.items || res.data || []; + tableData.value = (Array.isArray(list) ? list : []).map((item: any) => ({ + id: item.id || item._id, + name: item.zoneName || item.name, + code: item.zoneCode || item.code, + })); + total.value = res.data?.total || tableData.value.length; } else if (scope.value === 3) { - // 加载库位 + // 加载库位 - 使用zoneIds数组一次性查询 if (parentZoneIds.value.length === 0) { tableData.value = []; total.value = 0; return; } - const allLocations: any[] = []; - let totalCount = 0; - for (const zoneId of parentZoneIds.value) { - res = await listLocations({ ...params, zoneId }); - const list = res.data?.list || res.data?.items || res.data || []; - const locations = (Array.isArray(list) ? list : []).map((item: any) => ({ - id: item.id || item._id, - name: item.locationName || item.name, - code: item.locationCode || item.code, - })); - allLocations.push(...locations); - totalCount += res.data?.total || locations.length; - } - tableData.value = allLocations; - total.value = totalCount; + res = await listLocations({ ...params, zoneIds: parentZoneIds.value }); + const list = res.data?.list || res.data?.items || res.data || []; + tableData.value = (Array.isArray(list) ? list : []).map((item: any) => ({ + id: item.id || item._id, + name: item.locationName || item.name, + code: item.locationCode || item.code, + })); + total.value = res.data?.total || tableData.value.length; } // 恢复选中状态