展示未分配数量

This commit is contained in:
2025-10-23 14:42:00 +08:00
parent 2fe6f0c576
commit 2e5c04d2d4
2 changed files with 15 additions and 2 deletions

View File

@@ -144,12 +144,18 @@ export default {
const penWithDetails = {
...pen,
house_name: this.houseMap.get(pen.house_id) || '未知猪舍',
batch_number: batchMap.get(pen.pig_batch_id)?.batch_number || null // 添加这一行
batch_number: batchMap.get(pen.pig_batch_id)?.batch_number || null
};
batchMap.get(pen.pig_batch_id).pens.push(penWithDetails);
}
}
return Array.from(batchMap.values());
// Calculate unassigned_pig_count for each batch using currentTotalQuantity and currentTotalPigsInPens
const assembledBatches = Array.from(batchMap.values());
assembledBatches.forEach(batch => {
// Use currentTotalQuantity and currentTotalPigsInPens directly from the batch object
batch.unassigned_pig_count = (batch.currentTotalQuantity || 0) - (batch.currentTotalPigsInPens || 0);
});
return assembledBatches;
},
// --- 猪群操作 ---
handleAddBatch() {