diff --git a/src/api/02_organizational/api.organization.ts b/src/api/02_organizational/api.organization.ts index 74d20d111..e716d3e44 100644 --- a/src/api/02_organizational/api.organization.ts +++ b/src/api/02_organizational/api.organization.ts @@ -21,4 +21,5 @@ export default { orgPosType: `${orgPos}/type`, orgPosLevel: `${orgPos}/level`, orgPosMaster: `${orgPos}/master`, + organizationShortName: `${organization}/sort`, }; diff --git a/src/modules/02_organizationalNew/components/DialogSortAgency.vue b/src/modules/02_organizationalNew/components/DialogSortAgency.vue new file mode 100644 index 000000000..4d21409e8 --- /dev/null +++ b/src/modules/02_organizationalNew/components/DialogSortAgency.vue @@ -0,0 +1,127 @@ + + diff --git a/src/modules/02_organizationalNew/components/StructureDetail.vue b/src/modules/02_organizationalNew/components/StructureDetail.vue index 06b4be766..5dcaed506 100644 --- a/src/modules/02_organizationalNew/components/StructureDetail.vue +++ b/src/modules/02_organizationalNew/components/StructureDetail.vue @@ -4,8 +4,6 @@ import { useQuasar } from "quasar"; import http from "@/plugins/http"; import config from "@/app.config"; -import type { HistoryType } from "@/modules/02_organizationalNew/interface/index/Main"; - import DialogHeader from "@/components/DialogHeader.vue"; import { useCounterMixin } from "@/stores/mixin"; diff --git a/src/modules/02_organizationalNew/components/mainTree.vue b/src/modules/02_organizationalNew/components/mainTree.vue index 467121833..f8007ffed 100644 --- a/src/modules/02_organizationalNew/components/mainTree.vue +++ b/src/modules/02_organizationalNew/components/mainTree.vue @@ -10,6 +10,7 @@ import type { OrgTree } from "@/modules/02_organizationalNew/interface/response/ /** importComponents*/ import DialogAgency from "@/modules/02_organizationalNew/components/DialogFormAgency.vue"; import DialogStructureDetail from "@/modules/02_organizationalNew/components/StructureDetail.vue"; +import DialogSortAgency from "@/modules/02_organizationalNew/components/DialogSortAgency.vue"; /** importStore*/ import { useOrganizational } from "@/modules/02_organizationalNew/store/organizational"; @@ -86,7 +87,9 @@ const nodeTEST = defineModel("nodeTree", { default: [] }); const nodeId = defineModel("nodeId", { require: true }); const isLoad = defineModel("isLoad", { require: true }); const filter = ref(""); +const level = ref(0); const nodes = ref>([]); +const dataSort = ref>([]); const lazy = ref(nodes); const expanded = ref>([]); const notFound = ref("ไม่พบข้อมูลที่ค้นหา"); @@ -176,6 +179,7 @@ function deleteNode(treeNode: any, organizationId: any): boolean { return false; } +const modalSortAgency = ref(false); const dialogAgency = ref(false); const actionType = ref(""); const dataNode = ref(); @@ -225,6 +229,42 @@ async function onClickDel(type: number, id: string) { }); } +async function onClickSort(id: string) { + modalSortAgency.value = true; + if (id) { + breakLoop.value = false; + + const orgId = id; + + for (let index = 0; index < nodes.value.length; index++) { + const data = nodes.value[index]; + searchAndReplace(data, orgId); + if (breakLoop.value) break; + } + } else { + const dataList = nodes.value; + const dataMap = dataList.map((item: any) => ({ + orgTreeId: item.orgTreeId, + orgLevel: item.orgLevel, + orgTreeName: item.orgTreeName, + orgTreeShortName: item.orgTreeShortName, + orgRevisionId: item.orgRevisionId, + })); + + dataSort.value = dataMap; + } + + function searchAndReplace(data: any, id: string) { + if (data.orgTreeId === id) { + dataSort.value = data.children; + breakLoop.value = true; + } else if (data.children) { + for (const child of data.children) { + searchAndReplace(child, id); + } + } + } +} watch( () => nodeTEST.value, () => { @@ -341,6 +381,8 @@ onMounted(async () => {}); ? onClickDetail(prop.node.orgTreeId, prop.node.orgLevel) : item.type === 'DEL' ? onClickDel(prop.node.orgLevel, prop.node.orgTreeId) + : item.type === 'SORT' + ? onClickSort(prop.node.orgRootId) : null " > @@ -464,6 +506,11 @@ onMounted(async () => {}); v-model:treeId="treeId" v-model:orgLevel="orgLevel" /> + + diff --git a/src/modules/02_organizationalNew/router.ts b/src/modules/02_organizationalNew/router.ts index 32b16995e..22793bd7f 100644 --- a/src/modules/02_organizationalNew/router.ts +++ b/src/modules/02_organizationalNew/router.ts @@ -1,4 +1,5 @@ const mainPage = () => import("@/modules/02_organizationalNew/views/main.vue"); +const testPage = () => import("@/modules/02_organizationalNew/views/ExampleSearchTree.vue"); export default [ { @@ -11,4 +12,15 @@ export default [ Role: "organization", }, }, + { + path: "/organization-new/test", + name: "organizationalNewTest", + component: testPage, + meta: { + Auth: true, + Key: [7], + Role: "organization", + }, + }, + ]; diff --git a/src/modules/02_organizationalNew/views/ExampleSearchTree.vue b/src/modules/02_organizationalNew/views/ExampleSearchTree.vue new file mode 100644 index 000000000..49bebd881 --- /dev/null +++ b/src/modules/02_organizationalNew/views/ExampleSearchTree.vue @@ -0,0 +1,165 @@ + + + + + diff --git a/src/modules/06_retirement/components/resign/ResignByid.vue b/src/modules/06_retirement/components/resign/ResignByid.vue index 5542de9b3..2ffe37424 100644 --- a/src/modules/06_retirement/components/resign/ResignByid.vue +++ b/src/modules/06_retirement/components/resign/ResignByid.vue @@ -17,6 +17,7 @@ import type { import type { QTableProps } from "quasar"; import PopupPersonal from "@/components/Dialogs/PopupPersonal.vue"; +const avatar = ref('') const modalPersonal = ref(false); const personId = ref(""); /** Use */ @@ -179,6 +180,7 @@ const fetchData = async (id: string) => { location.value = data.location ?? ""; status.value = data.status ?? ""; remarkHorizontal.value = data.remarkHorizontal ?? "-"; + getAvatar(data.profileId) }) .catch((e) => { messageError($q, e); @@ -187,6 +189,23 @@ const fetchData = async (id: string) => { hideLoader(); }); }; + +function getAvatar(id:string){ + if(id){ + http + .get(config.API.profileAvaId(id)) + .then((res)=>{ + console.log(res) + const dataList = res.data.result + avatar.value = dataList.avatar + }).catch((e)=>{ + + }).finally(()=>{ + + }) + } +} + // const downloadFile = (response: any, filename: string) => { // const link = document.createElement("a"); // var fileName = filename; @@ -435,7 +454,8 @@ function updatemodalPersonal(modal: boolean) {
- + +