This can be handled via the Display Conditions of the HUD. Since you only want the combatants in battle, you can use a status condition (Combatant Requirements) that checks for In Battle. This naturally also applies for the player group combatants, so that'd only display while they are in battle.
You can also separate player and enemy display, the shared layout will group them together anyway. So, you can have the player display always and the enemy with the display condition to only have those in battle added.