展示未分配数量
This commit is contained in:
		@@ -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() {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user