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; } // 恢复选中状态