展示未分配数量
This commit is contained in:
@@ -21,6 +21,9 @@
|
|||||||
{{ formatRFC3339(batch.end_date) }}
|
{{ formatRFC3339(batch.end_date) }}
|
||||||
</template>
|
</template>
|
||||||
</span>
|
</span>
|
||||||
|
<span v-if="batch.unassigned_pig_count !== undefined && batch.unassigned_pig_count > 0" class="red-text">
|
||||||
|
未分配数量: {{ batch.unassigned_pig_count }}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="batch-actions">
|
<div class="batch-actions">
|
||||||
@@ -221,4 +224,8 @@ export default {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
padding: 20px 0;
|
padding: 20px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.batch-info-line .red-text {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -144,12 +144,18 @@ export default {
|
|||||||
const penWithDetails = {
|
const penWithDetails = {
|
||||||
...pen,
|
...pen,
|
||||||
house_name: this.houseMap.get(pen.house_id) || '未知猪舍',
|
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);
|
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() {
|
handleAddBatch() {
|
||||||
|
|||||||
Reference in New Issue
Block a user