From 377a82b9dd0cdcfdd504b4b89d69e894ef436128 Mon Sep 17 00:00:00 2001 From: Net Date: Wed, 24 Jul 2024 14:44:57 +0700 Subject: [PATCH] refacrot: (01) edit path --- src/pages/01_branch-management/MainPage.vue | 25 +++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/pages/01_branch-management/MainPage.vue b/src/pages/01_branch-management/MainPage.vue index f6657265..1ed8ca5a 100644 --- a/src/pages/01_branch-management/MainPage.vue +++ b/src/pages/01_branch-management/MainPage.vue @@ -164,6 +164,8 @@ onMounted(async () => { }; }, }, + // track of the currently selected HQ branch, so when we reset it to an empty + // object, we are effectively unselecting any HQ branch. ]; await branchStore.fetchList({ pageSize: 99999 }); @@ -539,6 +541,29 @@ watch( if (v) modeView.value = true; }, ); + +watch(currentHq, () => { + const tmp: typeof utilsStore.currentTitle.path = [ + { + text: 'branchManagementCaption', + handler: () => { + fieldSelectedBranch.value.value = 'branchHQLabel'; + currentHq.value = { + id: '', + code: '', + }; + }, + }, + ]; + + if (currentHq.value.id !== '') { + tmp.push({ + text: currentHq.value.code, + }); + } + + utilsStore.currentTitle.path = tmp; +});