diff --git a/src/modules/02_users/components/RoleOrganization/DialogPersonal.vue b/src/modules/02_users/components/RoleOrganization/DialogPersonal.vue index 7fde64ff..7077acc7 100644 --- a/src/modules/02_users/components/RoleOrganization/DialogPersonal.vue +++ b/src/modules/02_users/components/RoleOrganization/DialogPersonal.vue @@ -104,7 +104,7 @@ async function fetchInformation(id: string) { ) .then(async (res) => { const data = await res.data.result; - imformation.prefix = data.rank ? data.rank : data.prefix; + imformation.prefix = data.prefix ? data.prefix : "-"; imformation.citizenId = data.citizenId ? data.citizenId : "-"; imformation.firstName = data.firstName ? data.firstName : "-"; imformation.lastName = data.lastName ? data.lastName : "-"; @@ -112,7 +112,7 @@ async function fetchInformation(id: string) { imformation.age = data.birthDate ? calculateAge(data.birthDate) : "-"; imformation.gender = data.gender ?? "-"; - avatar.fullname = `${data.rank ? data.rank : data.prefix}${data.firstName} ${data.lastName}`; + avatar.fullname = `${data.prefix}${data.firstName} ${data.lastName}`; avatar.position = data.position ? data.position : "-"; if (data.avatarName) { diff --git a/src/modules/02_users/interface/request/Main.ts b/src/modules/02_users/interface/request/Main.ts index e694a69a..8215b7cf 100644 --- a/src/modules/02_users/interface/request/Main.ts +++ b/src/modules/02_users/interface/request/Main.ts @@ -19,7 +19,7 @@ interface Roles { } interface FilterReqMaster { - id: string; + id: string | null; type: number; isAll: boolean; isBlank: boolean; diff --git a/src/modules/02_users/interface/response/Main.ts b/src/modules/02_users/interface/response/Main.ts index f4bd6e3e..e9777198 100644 --- a/src/modules/02_users/interface/response/Main.ts +++ b/src/modules/02_users/interface/response/Main.ts @@ -47,13 +47,15 @@ interface NodeTree { totalRootPositionCurrentVacant: number; totalRootPositionNextUse: number; totalRootPositionNextVacant: number; - children: NodeTree; + children: NodeTree[]; isOfficer: boolean; } interface PosMaster { fullNameCurrentHolder: null | string; fullNameNextHolder: string; + profileIdCurrentHolder: string; + profileIdNextHolder: string; id: string; isSit: boolean; isSpecial: boolean; diff --git a/src/modules/02_users/views/03_permissionsView.vue b/src/modules/02_users/views/03_permissionsView.vue index 0f81ecd2..7878ae15 100644 --- a/src/modules/02_users/views/03_permissionsView.vue +++ b/src/modules/02_users/views/03_permissionsView.vue @@ -19,6 +19,7 @@ import type { /** importComponents*/ import DialogAdd from "@/modules/02_users/components/Permissions/DialogAdd.vue"; +import PopupPersonal from "@/modules/02_users/components/RoleOrganization/DialogPersonal.vue"; /** * use @@ -30,7 +31,39 @@ const { showLoader, hideLoader, messageError, success, dialogRemove } = /** Tree*/ const filter = ref(""); // ค้นหาข้อมูลโครงาสร้าง -const nodes = 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, + }, +]); // ข้อมูลโครงสร้าง const lazy = ref(nodes); const expanded = ref([]); // แสดงข้อมูลในโหนดที่เลือก const nodeId = ref(""); // id โหนด @@ -191,7 +224,7 @@ const columnsExpand = ref([ ]); // ฟอร์มค้นหาตำแหน่ง const reqMaster = reactive({ - id: "", + id: null, type: 0, isAll: false, isBlank: false, @@ -249,7 +282,9 @@ async function fetchDataTree(id: string) { .get(config.API.orgByid(id.toString())) .then(async (res) => { const data = await res.data.result; - nodes.value = data; + nodes.value.push(...data); + nodes.value[0].orgRevisionId = id; + await fetchDataTable(reqMaster.id, id, reqMaster.type); }) .catch((err) => { messageError($q, err); @@ -264,9 +299,13 @@ async function fetchDataTree(id: string) { * @param id idTree * @param level levelTree */ -async function fetchDataTable(id: string, revisionId: string, level: number) { +async function fetchDataTable( + id: string | null, + revisionId: string, + level: number +) { showLoader(); - reqMaster.id = id; + reqMaster.id = id === "" ? null : id; reqMaster.revisionId = revisionId; reqMaster.type = level; await http @@ -354,22 +393,34 @@ function onDeleteRole(id: string) { ); } +const modalPersonal = ref(false); +const personId = ref(""); + +function onOpenModalPersonal(id: string) { + personId.value = id; + modalPersonal.value = true; +} + +function updatemodalPersonal(modal: boolean) { + modalPersonal.value = modal; +} + /** callblck function ทำการ fetch ข้อมูล tree เมื่อมีการเปลี่ยน Tab ปัจจับัน,แบบร่าง*/ watch( () => store.typeOrganizational, - () => { + async () => { const id = store.typeOrganizational === "current" ? store.activeId : store.draftId; nodeId.value = ""; posMaster.value = []; - reqMaster.id = ""; + reqMaster.id = null; reqMaster.type = 0; reqMaster.isAll = false; reqMaster.page = 1; reqMaster.pageSize = 10; reqMaster.keyword = ""; reqMaster.revisionId = ""; - fetchDataTree(id); + await fetchDataTree(id); } ); @@ -613,7 +664,27 @@ onMounted(() => { :key="col.name" :props="props" > -
+
+ {{ col.value ? col.value : "-" }} + + ดูข้อมูล + +
+
{{ col.value ? col.value : "-" }}
@@ -774,6 +845,12 @@ onMounted(() => { :dataPosMaster="dataPosMaster as PosMaster" :fetchDataTable="fetchDataTable" /> + +