diff --git a/src/modules/02_users/stores/permissions.ts b/src/modules/02_users/stores/permissions.ts index 8ced0821..b6b5c3ea 100644 --- a/src/modules/02_users/stores/permissions.ts +++ b/src/modules/02_users/stores/permissions.ts @@ -1,8 +1,45 @@ import { defineStore } from "pinia"; import { ref } from "vue"; +import type { NodeTree } from "../interface/response/Main"; export const usePermissionsStore = defineStore("permissions", () => { const typeOrganizational = ref("current"); + const defaultOrganizationalNode = { + labelName: "หน่วยงานทั้งหมด", + orgCode: "", + orgLevel: 0, + orgName: "", + orgRevisionId: "", + orgRootName: "", + orgTreeCode: "", + orgTreeFax: "", + orgTreeId: "", + orgTreeName: "หน่วยงานทั้งหมด", + orgTreeOrder: 0, + orgTreePhoneEx: "", + orgTreePhoneIn: "", + orgTreeRank: "", + orgTreeRankSub: "", + orgTreeShortName: "", + responsibility: "", + totalPosition: 0, + totalPositionCurrentUse: 0, + totalPositionCurrentVacant: 0, + totalPositionNextUse: 0, + totalPositionNextVacant: 0, + totalRootPosition: 0, + totalRootPositionCurrentUse: 0, + totalRootPositionCurrentVacant: 0, + totalRootPositionNextUse: 0, + totalRootPositionNextVacant: 0, + children: [] as NodeTree[], + isOfficer: false, + orgRootDnaId: "", + orgChild1DnaId: "", + orgChild2DnaId: "", + orgChild3DnaId: "", + orgChild4DnaId: "", + }; const activeId = ref(""); const draftId = ref(""); @@ -10,5 +47,6 @@ export const usePermissionsStore = defineStore("permissions", () => { typeOrganizational, activeId, draftId, + defaultOrganizationalNode, }; }); diff --git a/src/modules/02_users/views/03_permissionsView.vue b/src/modules/02_users/views/03_permissionsView.vue index ca1b5412..4626ffa3 100644 --- a/src/modules/02_users/views/03_permissionsView.vue +++ b/src/modules/02_users/views/03_permissionsView.vue @@ -33,44 +33,7 @@ const { showLoader, hideLoader, messageError, success, dialogRemove } = /** Tree*/ const filter = ref(""); // ค้นหาข้อมูลโครงาสร้าง -const nodes = ref>([ - { - labelName: "หน่วยงานทั้งหมด", - orgCode: "", - orgLevel: 0, - orgName: "", - orgRevisionId: "", - orgRootName: "", - orgTreeCode: "", - orgTreeFax: "", - orgTreeId: "", - orgTreeName: "หน่วยงานทั้งหมด", - orgTreeOrder: 0, - orgTreePhoneEx: "", - orgTreePhoneIn: "", - orgTreeRank: "", - orgTreeRankSub: "", - orgTreeShortName: "", - responsibility: "", - totalPosition: 0, - totalPositionCurrentUse: 0, - totalPositionCurrentVacant: 0, - totalPositionNextUse: 0, - totalPositionNextVacant: 0, - totalRootPosition: 0, - totalRootPositionCurrentUse: 0, - totalRootPositionCurrentVacant: 0, - totalRootPositionNextUse: 0, - totalRootPositionNextVacant: 0, - children: [] as NodeTree[], - isOfficer: false, - orgRootDnaId: "", - orgChild1DnaId: "", - orgChild2DnaId: "", - orgChild3DnaId: "", - orgChild4DnaId: "", - }, -]); // ข้อมูลโครงสร้าง +const nodes = ref>([store.defaultOrganizationalNode]); // ข้อมูลโครงสร้าง const lazy = ref(nodes); const expanded = ref([]); // แสดงข้อมูลในโหนดที่เลือก const nodeId = ref(""); // id โหนด @@ -295,6 +258,8 @@ async function fetchDataTree(id: string) { const isSuperAdmin = tokenParsedData.value.includes("SUPER_ADMIN"); if (!isSuperAdmin) { nodes.value = []; + } else { + nodes.value = [store.defaultOrganizationalNode]; } showLoader(); await http @@ -626,7 +591,7 @@ onMounted(async () => {
{ table-class="text-grey-9" row-key="id" dense - hide-bottom bordered separator="vertical" class="custom-header-table-expand" @@ -847,6 +811,15 @@ onMounted(async () => {
{{ props.rowIndex + 1 }}
+ +
+ {{ col.value ? col.value : "-" }} + +
{ reqMaster.page = 1; fetchDataTable(reqMaster.id, reqMaster.revisionId, reqMaster.type); - } + }, ); onMounted(async () => { @@ -559,7 +559,7 @@ onMounted(async () => {
{ fetchDataTable( reqMaster.id, reqMaster.revisionId, - reqMaster.type + reqMaster.type, ) " > @@ -681,7 +681,7 @@ onMounted(async () => { round @click.prevent=" onOpenModalPersonal( - props.row.profileIdCurrentHolder + props.row.profileIdCurrentHolder, ) " > @@ -758,7 +758,6 @@ onMounted(async () => { table-class="text-grey-9" row-key="id" dense - hide-bottom bordered separator="vertical" class="custom-header-table-expand" @@ -786,6 +785,14 @@ onMounted(async () => {
{{ props.rowIndex + 1 }}
+
+ {{ col.value ? col.value : "-" }} + +
{ fetchDataTable( reqMaster.id, reqMaster.revisionId, - reqMaster.type + reqMaster.type, ) " > diff --git a/src/views/MainLayout.vue b/src/views/MainLayout.vue index 0907b056..6aea2a37 100644 --- a/src/views/MainLayout.vue +++ b/src/views/MainLayout.vue @@ -114,7 +114,7 @@ async function getDataNotification(index: number, type: string) { .get(config.API.msgNotificate + `?page=${index}&pageSize=${15}`) .then((res) => { const response = res.data.result.data; - totalInbox.value = res.data.result.total; + totalInbox.value = res.data.result.total || 0; let list: notiType[] = []; if (type === "DEL") { notiList.value = []; @@ -405,6 +405,26 @@ onBeforeMount(async () => { } }); +function handleDeleteNotification() { + dialogRemove( + $q, + async () => { + try { + showLoader(); + await http.delete(config.API.msgNotificate); + await getDataNotification(1, "DEL"); + success($q, "ลบข้อมูลสำเร็จ"); + } catch (error) { + messageError($q, error); + } finally { + hideLoader(); + } + }, + "ยืนยันการล้างการแจ้งเตือนทั้งหมด", + `ต้องการล้างการแจ้งเตือนทั้งหมด (${totalInbox.value} รายการ) ใช่หรือไม่? การกระทำนี้ไม่สามารถย้อนกลับได้`, + ); +} + /** * เมื่อเริ่มต้นโปรแกรมให้ฟัง event resize และ function myEventHandler * set function myEventHandler เพราะ state ยังไม่เซ็ท , state เซ็ทเมื่อ หน้าจอเริ่ม ขยับหน้าจอ @@ -510,6 +530,21 @@ onUnmounted(() => {
ทั้งหมด {{ totalInbox }} ข้อความ
+ + ล้างการแจ้งเตือนทั้งหมด +