diff --git a/src/components/DialogDebug.vue b/src/components/DialogDebug.vue index 04c2d1e..1c76b87 100644 --- a/src/components/DialogDebug.vue +++ b/src/components/DialogDebug.vue @@ -17,11 +17,9 @@ import DialogHeader from "@/components/DialogHeader.vue"; const $q = useQuasar(); const store = usePositionKeycloakStore(); const dataStore = useDataStore(); -const { menuData } = storeToRefs(store); const { findOrgName } = store; -const { dataprofilePosition } = storeToRefs(dataStore); +const { dataprofilePosition, menuList } = storeToRefs(dataStore); -// const { menuList } = storeToRefs(useMenuDataStore()); const { dialogConfirm, showLoader, hideLoader, messageError, success } = useCounterMixin(); @@ -37,7 +35,7 @@ interface OptionSelect { const title = computed(() => "แจ้งปัญหาการใช้งานระบบ"); const orgName = computed(() => findOrgName(dataprofilePosition.value) || ""); const optionData = computed(() => { - return menuData.value.map((menu: MenuMainList) => ({ + return menuList.value.map((menu: MenuMainList) => ({ label: menu.title, value: menu.title, })); diff --git a/src/modules/01_dashboard/views/Dashboard.vue b/src/modules/01_dashboard/views/Dashboard.vue index 2479fe9..cfb19c2 100644 --- a/src/modules/01_dashboard/views/Dashboard.vue +++ b/src/modules/01_dashboard/views/Dashboard.vue @@ -30,125 +30,6 @@ const inboxList = ref([]); // รายการกล่อง const idInboxActive = ref(); // Id ข้อความที่เลือก const isLoadingInbox = ref(true); // สถานะการโหลดกล่องข้อความ -// รายการเมนูหลักของระบบ -const filteredItems = computed(() => { - const isOfficer = dataStore.officerType === "OFFICER"; - const conditions: Record = { - ทดลองปฏิบัติหน้าที่ราชการ: dataStore.isProbation, - ประเมินบุคคล: isOfficer, - ผลงาน: isOfficer, - ขอโอน: isOfficer, - "ผู้ขอรับการประเมิน (KPI)": isOfficer, - "ผู้ประเมิน (KPI)": isOfficer, - "ทุนการศึกษา/ฝึกอบรม": isOfficer, - การพัฒนารายบุคคล: isOfficer, - }; - - const data = items.value.filter((item) => conditions[item.title] ?? true); - positionKeycloakStore.menuData = data; - return data; -}); - -const items = ref([ - { - icon: "mdi-account-group-outline", - title: "แผนผังองค์กร", - sub: "ดูแผนผังองค์กร", - // color: "blue-3", - color: "grey-3", - path: "/organization-chart", - active: false, - }, - { - icon: "mdi-clipboard-account-outline", - title: "ทะเบียนประวัติ", - sub: "ข้อมูลทะเบียนประวัติ", - color: "blue-4", - path: "/registry", - active: false, - }, - { - icon: "mdi-clipboard-account-outline", - title: "ประเมินบุคคล", - sub: "ข้อมูลการประเมินบุคคล", - color: "lime-4", - path: "/evaluate", - active: false, - }, - { - icon: "mdi-calendar-account-outline", - title: "การลา", - sub: "ดู/ลงเวลา ทำเรื่องลา", - color: "cyan-3", - path: "/leave", - active: false, - }, - { - icon: "mdi-folder-account-outline", - title: "ผลงาน", - sub: "ดูผลงาน", - color: "light-green-3", - path: "/portfolio", - active: false, - }, - { - icon: "mdi-account-arrow-right-outline", - title: "ขอโอน", - sub: "ทำเรื่องขอโอนย้าย", - color: "deep-purple-3", - path: "/transfer", - active: false, - }, - { - icon: "mdi-scale-balance", - title: "อุทธรณ์/ร้องทุกข์", - sub: "ทำเรื่องขออุทธรณ์ หรือร้องทุกข์", - color: "green-3", - path: "/appeal-complain", - active: false, - }, - { - icon: "mdi-account-box-outline", - title: "ผู้ขอรับการประเมิน (KPI)", - sub: "ประเมินผลการปฏิบัติหน้าที่ราชการ", - color: "red-2", - path: "/KPI", - active: false, - }, - { - icon: "mdi-elevator", - title: "ผู้ประเมิน (KPI)", - sub: "ประเมินผลการปฏิบัติหน้าที่ราชการ", - color: "red-2", - path: "/KPI-evaluator", - active: false, - }, - { - icon: "mdi-school", - title: "ทุนการศึกษา/ฝึกอบรม", - sub: "รายการทุนการศึกษา/ฝึกอบรม", - color: "teal-2", - path: "/scholarship", - active: false, - }, - { - icon: "mdi-human-handsup", - title: "การพัฒนารายบุคคล", - sub: "Individual Development Plan", - color: "orange-3", - path: "/IDP", - active: false, - }, - { - icon: "mdi-poll", - title: "ทดลองปฏิบัติหน้าที่ราชการ", - sub: "ผลการทดลองปฏิบัติหน้าที่ราชการและแบบสำรวจความคิดเห็น", - color: "yellow-3", - path: "/probation-report", - active: false, - }, -]); - /** * ฟังก์ชั่นดึงข้อมูลกล่องข้อความ * @param index หน้าที่โหลดข้อมูล @@ -296,7 +177,7 @@ onMounted(async () => {
diff --git a/src/stores/data.ts b/src/stores/data.ts index f24c77e..fbd4e61 100644 --- a/src/stores/data.ts +++ b/src/stores/data.ts @@ -7,6 +7,7 @@ import { useQuasar } from "quasar"; import { useRegistryInFormationStore } from "@/modules/10_registry/store/registry"; import { useCounterMixin } from "./mixin"; import type { ProfileData, DataProfile } from "@/interface/Main"; +import type { MenuMainList } from "@/modules/01_dashboard/interface/Main"; export const useDataStore = defineStore("dataMain", () => { const isLoadingMenu = ref(false); @@ -154,6 +155,127 @@ export const useDataStore = defineStore("dataMain", () => { return convertEmType(officerType.value); } + // รายการเมนูหลักของระบบ + const menuDataMain = ref([ + { + icon: "mdi-account-group-outline", + title: "แผนผังองค์กร", + sub: "ดูแผนผังองค์กร", + // color: "blue-3", + color: "grey-3", + path: "/organization-chart", + active: false, + }, + { + icon: "mdi-clipboard-account-outline", + title: "ทะเบียนประวัติ", + sub: "ข้อมูลทะเบียนประวัติ", + color: "blue-4", + path: "/registry", + active: false, + }, + { + icon: "mdi-clipboard-account-outline", + title: "ประเมินบุคคล", + sub: "ข้อมูลการประเมินบุคคล", + color: "lime-4", + path: "/evaluate", + active: false, + }, + { + icon: "mdi-calendar-account-outline", + title: "การลา", + sub: "ดู/ลงเวลา ทำเรื่องลา", + color: "cyan-3", + path: "/leave", + active: false, + }, + { + icon: "mdi-folder-account-outline", + title: "ผลงาน", + sub: "ดูผลงาน", + color: "light-green-3", + path: "/portfolio", + active: false, + }, + { + icon: "mdi-account-arrow-right-outline", + title: "ขอโอน", + sub: "ทำเรื่องขอโอนย้าย", + color: "deep-purple-3", + path: "/transfer", + active: false, + }, + { + icon: "mdi-scale-balance", + title: "อุทธรณ์/ร้องทุกข์", + sub: "ทำเรื่องขออุทธรณ์ หรือร้องทุกข์", + color: "green-3", + path: "/appeal-complain", + active: false, + }, + { + icon: "mdi-account-box-outline", + title: "ผู้ขอรับการประเมิน (KPI)", + sub: "ประเมินผลการปฏิบัติหน้าที่ราชการ", + color: "red-2", + path: "/KPI", + active: false, + }, + { + icon: "mdi-elevator", + title: "ผู้ประเมิน (KPI)", + sub: "ประเมินผลการปฏิบัติหน้าที่ราชการ", + color: "red-2", + path: "/KPI-evaluator", + active: false, + }, + { + icon: "mdi-school", + title: "ทุนการศึกษา/ฝึกอบรม", + sub: "รายการทุนการศึกษา/ฝึกอบรม", + color: "teal-2", + path: "/scholarship", + active: false, + }, + { + icon: "mdi-human-handsup", + title: "การพัฒนารายบุคคล", + sub: "Individual Development Plan", + color: "orange-3", + path: "/IDP", + active: false, + }, + { + icon: "mdi-poll", + title: "ทดลองปฏิบัติหน้าที่ราชการ", + sub: "ผลการทดลองปฏิบัติหน้าที่ราชการและแบบสำรวจความคิดเห็น", + color: "yellow-3", + path: "/probation-report", + active: false, + }, + ]); + + // กรองเมนู ตามประเภทบุคลากร + const menuList = computed(() => { + const isOfficer = officerType.value === "OFFICER"; + const conditions: Record = { + ทดลองปฏิบัติหน้าที่ราชการ: isProbation.value, + ประเมินบุคคล: isOfficer, + ผลงาน: isOfficer, + ขอโอน: isOfficer, + "ผู้ขอรับการประเมิน (KPI)": isOfficer, + "ผู้ประเมิน (KPI)": isOfficer, + "ทุนการศึกษา/ฝึกอบรม": isOfficer, + การพัฒนารายบุคคล: isOfficer, + }; + + const data = menuDataMain.value.filter( + (item: MenuMainList) => conditions[item.title] ?? true, + ); + return data; + }); + return { count, doubleCount, @@ -181,6 +303,8 @@ export const useDataStore = defineStore("dataMain", () => { dataprofilePosition, isLoadingMenu, isLoadingProfile, + + menuList, }; }); diff --git a/src/stores/positionKeycloak.ts b/src/stores/positionKeycloak.ts index 945f8b2..a4c4464 100644 --- a/src/stores/positionKeycloak.ts +++ b/src/stores/positionKeycloak.ts @@ -1,9 +1,6 @@ -import { ref } from "vue"; import { defineStore } from "pinia"; export const usePositionKeycloakStore = defineStore("positionKeycloak", () => { - const menuData = ref([]); - function findOrgName(obj: any) { if (obj) { let name = @@ -52,5 +49,5 @@ export const usePositionKeycloakStore = defineStore("positionKeycloak", () => { } } - return { findOrgName, menuData }; + return { findOrgName }; });