diff --git a/src/views/modules/warehouse/countingReport.vue b/src/views/modules/warehouse/countingReport.vue index a2b152b..32bbd21 100644 --- a/src/views/modules/warehouse/countingReport.vue +++ b/src/views/modules/warehouse/countingReport.vue @@ -197,7 +197,7 @@ - 查询 + 查询 @@ -205,7 +205,7 @@
标签总数:{{ detailStatistics.totalCount }} 物料总数:{{ detailStatistics.totalQty }} - 已盘点数:{{ detailStatistics.checkedQty }} + 已盘点标签数:{{ detailStatistics.checkedQty }}
@@ -229,7 +229,19 @@ - + + + + + 关闭 @@ -337,6 +349,9 @@ export default { detailFlag: false, detailLoading: false, detailList: [], + detailPageIndex: 1, + detailPageSize: 50, + detailTotal: 0, detailSearchData: { site: '', buNo: '', @@ -346,9 +361,9 @@ export default { checkedFlag: '' }, detailStatistics: { - totalCount: 0, // 标签总数 - totalQty: 0, // 物料总数(所有标签数量总和) - checkedQty: 0 // 已盘点数(已盘点标签数量总和) + totalCount: 0, + totalQty: 0, + checkedQty: 0 } } }, @@ -456,17 +471,17 @@ export default { this.modalFlag = true this.modalTitle = '修改盘点任务' this.modalDisableFlag = true - + // 将逗号分隔的字符串转换为数组 const warehouseIds = row.warehouseId ? row.warehouseId.split(',') : [] const locationIds = row.locationId ? row.locationId.split(',') : [] const partNos = row.partNo ? row.partNo.split(',') : [] - + // 构建显示文本(显示名称) const warehouseDisplay = row.warehouseName || '' const locationDisplay = row.locationName || '' const partDisplay = row.partDesc || '' - + this.modalData = { flag: 'update', bu: row.site + '_' + row.buNo, @@ -559,7 +574,7 @@ export default { this.$refs.modalForm.validate((valid) => { if (valid) { this.saveLoading = true - + // 将数组转换为逗号分隔的字符串 const saveData = { ...this.modalData, @@ -567,7 +582,7 @@ export default { locationId: this.modalData.locationIds.length > 0 ? this.modalData.locationIds.join(',') : '', partNo: this.modalData.partNos.length > 0 ? this.modalData.partNos.join(',') : '' } - + const apiMethod = this.modalData.flag === 'add' ? countingReportSave : countingReportUpdate apiMethod(saveData).then(({data}) => { if (data && data.code === 0) { @@ -669,6 +684,9 @@ export default { // 查看盘点清单 viewDetail(row) { this.detailFlag = true + this.detailPageIndex = 1 + this.detailPageSize = 50 + this.detailTotal = 0 this.detailSearchData = { site: row.site, buNo: row.buNo, @@ -680,16 +698,33 @@ export default { this.getDetailList() }, + // 盘点清单查询按钮(重置页码) + detailSearch() { + this.detailPageIndex = 1 + this.getDetailList() + }, + // 获取盘点清单列表 getDetailList() { this.detailLoading = true - countingReportDetailList(this.detailSearchData).then(({data}) => { + const params = { + ...this.detailSearchData, + page: this.detailPageIndex, + limit: this.detailPageSize + } + countingReportDetailList(params).then(({data}) => { if (data && data.code === 0) { - this.detailList = data.detailList || [] - // 计算统计数据 - this.calculateStatistics() + this.detailList = data.page.list || [] + this.detailTotal = data.page.totalCount || 0 + // 统计信息来自后端全量聚合,不受分页/查询条件影响 + if (data.statistics) { + this.detailStatistics.totalCount = data.statistics.totalCount || 0 + this.detailStatistics.totalQty = data.statistics.totalQty || 0 + this.detailStatistics.checkedQty = data.statistics.checkedQty || 0 + } } else { this.detailList = [] + this.detailTotal = 0 this.$message.error(data.msg || '查询失败') } this.detailLoading = false @@ -698,13 +733,17 @@ export default { }) }, - // 计算统计数据 - calculateStatistics() { - this.detailStatistics.totalCount = this.detailList.length - this.detailStatistics.totalQty = this.detailList.reduce((sum, item) => sum + (item.rollQty || 0), 0) - this.detailStatistics.checkedQty = this.detailList - .filter(item => item.checkedFlag === 'Y') - .reduce((sum, item) => sum + (item.rollQty || 0), 0) + // 盘点清单每页数变化 + detailSizeChangeHandle(val) { + this.detailPageSize = val + this.detailPageIndex = 1 + this.getDetailList() + }, + + // 盘点清单当前页变化 + detailCurrentChangeHandle(val) { + this.detailPageIndex = val + this.getDetailList() }, // 打开多选对话框 @@ -713,10 +752,10 @@ export default { this.$message.warning('请先选择BU') return } - + const [site, buNo] = this.modalData.bu.split('_') let selectedIds = [] - + if (type === 'warehouse') { selectedIds = this.modalData.warehouseIds } else if (type === 'location') { @@ -724,7 +763,7 @@ export default { } else if (type === 'part') { selectedIds = this.modalData.partNos } - + this.$refs.multiSelectDialog.init(type, site, buNo, selectedIds) },