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, ) " > @@ -786,6 +786,14 @@ onMounted(async () => {
{{ props.rowIndex + 1 }}
+
+ {{ col.value ? col.value : "-" }} + +
{ fetchDataTable( reqMaster.id, reqMaster.revisionId, - reqMaster.type + reqMaster.type, ) " >