From 701d82e7a70c8c7d10de50421b7a29e6cbac8412 Mon Sep 17 00:00:00 2001 From: puriphatt Date: Fri, 5 Jul 2024 11:01:40 +0000 Subject: [PATCH] fix: new 02 ui & layout --- .../02_personnel-management/MainPage.vue | 386 +++++++++++++----- src/stores/user/types.ts | 1 + 2 files changed, 296 insertions(+), 91 deletions(-) diff --git a/src/pages/02_personnel-management/MainPage.vue b/src/pages/02_personnel-management/MainPage.vue index c00d6310..d6cc1641 100644 --- a/src/pages/02_personnel-management/MainPage.vue +++ b/src/pages/02_personnel-management/MainPage.vue @@ -76,6 +76,9 @@ const defaultFormData = { checkpointEN: null, }; +const modeView = ref(true); +const fieldSelected = ref(); +const fieldDisplay = ref(); const hideStat = ref(false); const userCode = ref(); const currentUser = ref(); @@ -91,7 +94,7 @@ const statusToggle = ref(true); const statusFilter = ref<'all' | 'statusACTIVE' | 'statusINACTIVE'>('all'); const inputSearch = ref(''); const userId = ref(); -const selectorLabel = ref('MESSENGER'); +const selectorLabel = ref('ALL'); const hqId = ref(); const brId = ref(); const formDialogRef = ref(); @@ -459,11 +462,11 @@ onMounted(async () => { : ''; typeStats.value = await userStore.typeStats(); - const firstTypeIncludeUser = Object.entries(typeStats.value || {}).find( - (v) => v[1] > 0, - ); + // const firstTypeIncludeUser = Object.entries(typeStats.value || {}).find( + // (v) => v[1] > 0, + // ); - firstTypeIncludeUser && (selectorLabel.value = firstTypeIncludeUser[0]); + // firstTypeIncludeUser && (selectorLabel.value = firstTypeIncludeUser[0]); const res = await branchStore.userStats(formData.value.userType); if (res) { @@ -513,7 +516,7 @@ async function fetchUserList() { pageSize: pageSize.value, page: currentPage.value, query: !!inputSearch.value ? inputSearch.value : undefined, - userType: selectorLabel.value ?? undefined, + userType: selectorLabel.value === 'ALL' ? undefined : selectorLabel.value, }); } @@ -538,8 +541,23 @@ watch(inputSearch, async () => await fetchUserList());
{{ $t('personnelStatTitle') }} + + {{ + selectorLabel === 'ALL' + ? Object.values(typeStats).reduce((acc, val) => acc + val, 0) + : typeStats[selectorLabel] + }} + await fetchUserList());
@@ -584,65 +619,234 @@ watch(inputSearch, async () => await fetchUserList()); class="col surface-1 rounded justify-between column no-wrap" style="overflow: hidden" > -
-
- +
+
+ + + + +
+ + + + + + + + +
+
+
+ +
+ - - - - - {{ $t('all') }} - - - {{ $t('statusACTIVE') }} - - - {{ $t('statusINACTIVE') }} - - - - + +
+ {{ $t('all') }} +
+
+ +
+ {{ $t('USER') }} +
+
+ +
+ {{ $t('MESSENGER') }} +
+
+ +
+ {{ $t('DELEGATE') }} +
+
+ +
+ {{ $t('AGENCY') }} +
+
+
-
-
+ +
+
-
-
- -
+ +
+
+
-
+ +
- +
diff --git a/src/stores/user/types.ts b/src/stores/user/types.ts index 754e7d84..cbc45b57 100644 --- a/src/stores/user/types.ts +++ b/src/stores/user/types.ts @@ -97,6 +97,7 @@ export type UserAttachmentDelete = { }; export type UserTypeStats = { + [x: string]: number; USER: number; MESSENGER: number; DELEGATE: number;