fix(frontend): pre-select active unit when opening new equipment modal

When a unit is selected in the sidebar, the create-equipment modal now
pre-fills the unit dropdown with that unit. Previously it always reset
to empty, so newly created equipment got unit_id=null and was hidden by
the unit filter after save.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
caoqianming 2026-03-24 16:35:33 +08:00
parent d1131c4e2d
commit d88d8375fd
1 changed files with 3 additions and 0 deletions

View File

@ -94,6 +94,9 @@ export function closeEquipmentModal() {
export function openCreateEquipmentModal() { export function openCreateEquipmentModal() {
resetEquipmentForm(); resetEquipmentForm();
if (state.selectedUnitId && dom.equipmentUnitId) {
dom.equipmentUnitId.value = state.selectedUnitId;
}
openEquipmentModal(); openEquipmentModal();
} }