From ae9e989a1442088a01d6a7f758f73f1a4aaa05d0 Mon Sep 17 00:00:00 2001 From: waruneeauy Date: Wed, 14 May 2025 21:02:56 +0700 Subject: [PATCH] fixing insignia deputy --- .../07_insignia/components/2_Manage/Tab1.vue | 14 ++++++++++---- .../07_insignia/components/2_Manage/Tab2.vue | 4 +++- .../07_insignia/components/2_Manage/Tab3.vue | 10 ++++++---- src/modules/07_insignia/store.ts | 4 ++++ src/modules/07_insignia/views/02_ManageMain.vue | 12 ++++++++---- 5 files changed, 31 insertions(+), 13 deletions(-) diff --git a/src/modules/07_insignia/components/2_Manage/Tab1.vue b/src/modules/07_insignia/components/2_Manage/Tab1.vue index 1b7b44fe0..c022c0c1c 100644 --- a/src/modules/07_insignia/components/2_Manage/Tab1.vue +++ b/src/modules/07_insignia/components/2_Manage/Tab1.vue @@ -308,7 +308,11 @@ const person = ref(); /** เช็คสถานนะแสดงปุ่มเพิ่ม*/ const checkStatus = computed(() => { if ( - DataStore.isStaff && + ((DataStore.isOfficer && + DataStore.optionsTypeOc.findIndex( + (v: OptionData) => v.id === organization.value && v.isDeputy === true + ) > -1) || + DataStore.isStaff) && (DataStore.requestStatus == "st1" || DataStore.requestStatus == "st4") ) { return true; @@ -846,9 +850,10 @@ function clearInsigniaFilters(name: string) { watch( () => DataStore.typeOc, - async () => { - filterOrganizationOP.value = await DataStore.optionsTypeOc; - organization.value = await DataStore.typeOc; + () => { + filterOrganizationOP.value = DataStore.optionsTypeOc; + organization.value = DataStore.typeOc; + DataStore.selectOrganization = DataStore.typeOc; } ); @@ -890,6 +895,7 @@ function onClickViewInfo(type: string, id: string, empClass: string) { onMounted(async () => { filterOrganizationOP.value = await DataStore.optionsTypeOc; organization.value = DataStore.typeOc; + DataStore.selectOrganization = DataStore.typeOc; if (organization.value !== "" || organization.value !== undefined) { if (props.fecthInsigniaByOc) { diff --git a/src/modules/07_insignia/components/2_Manage/Tab2.vue b/src/modules/07_insignia/components/2_Manage/Tab2.vue index e1fe5db83..dcd530901 100644 --- a/src/modules/07_insignia/components/2_Manage/Tab2.vue +++ b/src/modules/07_insignia/components/2_Manage/Tab2.vue @@ -269,7 +269,8 @@ function onSearch() { /*** Hook*/ onMounted(async () => { filterOrganizationOP.value = await DataStore.optionsTypeOc; - organization.value = await DataStore.typeOc; + organization.value = DataStore.typeOc; + DataStore.selectOrganization = DataStore.typeOc; if (organization.value !== "" || organization.value !== undefined) { if (props.fecthInsigniaByOc) { isDeputy.value = await (DataStore.optionsTypeOc.findIndex( @@ -293,6 +294,7 @@ watch( async () => { filterOrganizationOP.value = await DataStore.optionsTypeOc; organization.value = await DataStore.typeOc; + DataStore.selectOrganization = DataStore.typeOc; } ); diff --git a/src/modules/07_insignia/components/2_Manage/Tab3.vue b/src/modules/07_insignia/components/2_Manage/Tab3.vue index e5efde690..2654f15b1 100644 --- a/src/modules/07_insignia/components/2_Manage/Tab3.vue +++ b/src/modules/07_insignia/components/2_Manage/Tab3.vue @@ -271,15 +271,17 @@ function onSearch() { watch( () => DataStore.typeOc, async () => { - filterOrganizationOP.value = await DataStore.optionsTypeOc; - organization.value = await DataStore.typeOc; + filterOrganizationOP.value = DataStore.optionsTypeOc; + organization.value = DataStore.typeOc; + DataStore.selectOrganization = DataStore.typeOc; } ); /** Hook*/ onMounted(async () => { - filterOrganizationOP.value = await DataStore.optionsTypeOc; - organization.value = await DataStore.typeOc; + filterOrganizationOP.value = DataStore.optionsTypeOc; + organization.value = DataStore.typeOc; + DataStore.selectOrganization = DataStore.typeOc; if (organization.value !== "" || organization.value !== undefined) { if (props.fecthInsigniaByOc) { isDeputy.value = await (DataStore.optionsTypeOc.findIndex( diff --git a/src/modules/07_insignia/store.ts b/src/modules/07_insignia/store.ts index d6a99c582..c1b8892f5 100644 --- a/src/modules/07_insignia/store.ts +++ b/src/modules/07_insignia/store.ts @@ -47,6 +47,8 @@ export const useInsigniaDataStore = defineStore("insignia", () => { const isOfficer = ref(false); const isStaff = ref(false); const isDirector = ref(false); + const isDeputy = ref(false); + const selectOrganization = ref(""); /** option รายงาน */ const optionReport = ref([ @@ -285,5 +287,7 @@ export const useInsigniaDataStore = defineStore("insignia", () => { isStaff, isOfficer, isDirector, + isDeputy, + selectOrganization, }; }); diff --git a/src/modules/07_insignia/views/02_ManageMain.vue b/src/modules/07_insignia/views/02_ManageMain.vue index 9d3cdec7c..0de4d28d8 100644 --- a/src/modules/07_insignia/views/02_ManageMain.vue +++ b/src/modules/07_insignia/views/02_ManageMain.vue @@ -158,6 +158,7 @@ async function fecthAgency(id: string) { }) .then((res) => { DataStore.agency = res.data.result.rootId; + DataStore.selectOrganization = res.data.result.rootId; DataStore.typeOc = DataStore.agency; }) .catch((err) => { @@ -190,6 +191,7 @@ async function fetchCheckIsofficer() { DataStore.isStaff = data.isStaff; DataStore.isOfficer = data.isOfficer; DataStore.isDirector = data.isDirector; + DataStore.isDeputy = data.isDeputy; }) .catch((err) => { messageError($q, err); @@ -556,7 +558,7 @@ onUnmounted(() => { >
{ { flat round color="primary" - v-if="DataStore.isStaff && checkPermission($route)?.attrIsGet" + v-if="checkPermission($route)?.attrIsGet" :href="document" target="_blank" > @@ -684,9 +686,11 @@ onUnmounted(() => { >
+