From 115455cc8f0a4202cfa0d79b71320479d3329b3d Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Wed, 31 Jan 2024 11:02:24 +0700 Subject: [PATCH 1/5] =?UTF-8?q?pop=20up=20=E0=B8=AA=E0=B8=B3=E0=B8=AB?= =?UTF-8?q?=E0=B8=A3=E0=B8=B1=E0=B8=9A=E0=B8=88=E0=B8=B1=E0=B8=94=E0=B8=A5?= =?UTF-8?q?=E0=B8=B3=E0=B8=94=E0=B8=B1=E0=B8=9A=E0=B9=82=E0=B8=84=E0=B8=A3?= =?UTF-8?q?=E0=B8=87=E0=B8=AA=E0=B8=A3=E0=B9=89=E0=B8=B2=E0=B8=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/DialogSortAgency.vue | 130 ++++++++++++++++++ .../components/StructureDetail.vue | 2 - 2 files changed, 130 insertions(+), 2 deletions(-) create mode 100644 src/modules/02_organizationalNew/components/DialogSortAgency.vue diff --git a/src/modules/02_organizationalNew/components/DialogSortAgency.vue b/src/modules/02_organizationalNew/components/DialogSortAgency.vue new file mode 100644 index 000000000..bed77d4e5 --- /dev/null +++ b/src/modules/02_organizationalNew/components/DialogSortAgency.vue @@ -0,0 +1,130 @@ + + diff --git a/src/modules/02_organizationalNew/components/StructureDetail.vue b/src/modules/02_organizationalNew/components/StructureDetail.vue index bf30060de..c3e2e84ce 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"; From 5fc78f8090d2d6727aba4597cc2d55e8e9d86205 Mon Sep 17 00:00:00 2001 From: waruneeta Date: Wed, 31 Jan 2024 15:32:35 +0700 Subject: [PATCH 2/5] example search tree --- src/modules/02_organizationalNew/router.ts | 12 ++ .../views/ExampleSearchTree.vue | 165 ++++++++++++++++++ 2 files changed, 177 insertions(+) create mode 100644 src/modules/02_organizationalNew/views/ExampleSearchTree.vue 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 @@ + + + + + From 9355b54882e34efb04653ddefb61b3024473501b Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Wed, 31 Jan 2024 15:33:22 +0700 Subject: [PATCH 3/5] no message --- .../components/DialogSortAgency.vue | 65 +++++++++---------- .../components/mainTree.vue | 60 +++++++++++++++++ 2 files changed, 92 insertions(+), 33 deletions(-) diff --git a/src/modules/02_organizationalNew/components/DialogSortAgency.vue b/src/modules/02_organizationalNew/components/DialogSortAgency.vue index bed77d4e5..3abe050da 100644 --- a/src/modules/02_organizationalNew/components/DialogSortAgency.vue +++ b/src/modules/02_organizationalNew/components/DialogSortAgency.vue @@ -23,29 +23,16 @@ const { dialogConfirm, showLoader, success, hideLoader, messageError } = useCounterMixin(); const modal = defineModel("sortAgency", { required: true }); +const modalSort = defineModel>("data", { required: true }); +const modalType = defineModel("type", { required: true }); const rows = ref([]); const columns = ref([ { - name: "id", + name: "name", required: true, - label: "ชื่อเครื่องราชฯ", + label: "ชื่อ", align: "left", - field: "id", - sortable: true, - }, - { - name: "shortName", - align: "center", - label: "ชื่อย่อ", - field: "shortName", - }, - { - name: "insigniaType", - align: "left", - label: "ลำดับชั้นเครื่องราชฯ", - field: "insigniaType", - headerStyle: "font-size: 14px", - style: "font-size: 14px", + field: "name", sortable: true, }, ]); @@ -61,7 +48,7 @@ function onDropRow(from: any, to: any) { function save() { dialogConfirm($q, () => { const data = rows.value; - const dataId = data.map((item: any) => item.id); + const dataId = data.map((item: any) => item.orgTreeId); console.log(dataId); }); } @@ -69,20 +56,32 @@ watch( () => modal.value, () => { if (modal.value == true) { - const dataList = [ - { - id: "x1", - shortName: "test1", - insigniaType: "test1", - }, - { - id: "x2", - shortName: "test2", - insigniaType: "test2", - }, - ]; + const dataStandant = modalSort.value; + if (modalType.value === 0) { + const mappedData = dataStandant.map((item: any) => ({ + orgLevel: item.orgLevel, + name: `${item.orgTreeName} (${item.orgTreeShortName})`, + orgRevisionId: item.orgRevisionId, + orgTreeId: item.orgTreeId, + orgTreeName: item.orgTreeName, + orgTreeShortName: item.orgTreeShortName, + })); + rows.value = mappedData; + console.log("row", rows.value); + } else if (modalType.value === 1) { + const mappedData = dataStandant.map((item: any) => ({ + name: `${item.orgTreeName} (${item.orgTreeShortName})`, + orgRootId: item.orgRootId, + orgTreeId: item.orgTreeId, + orgLevel: item.orgLevel, + orgTreeName: item.orgTreeName, + orgTreeShortName: item.orgTreeShortName, + orgRevisionId: item.orgRevisionId, + })); + rows.value = mappedData; - rows.value = dataList; + console.log("row", dataStandant); + } } } ); @@ -113,7 +112,7 @@ watch( :rows="rows" :columns="columns" :rows-per-page-options="[100]" - row-key="name" + row-key="orgTreeId" hide-bottom hide-pagination hide-header diff --git a/src/modules/02_organizationalNew/components/mainTree.vue b/src/modules/02_organizationalNew/components/mainTree.vue index 84afe164a..4b059f2f6 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"; @@ -80,7 +81,9 @@ const listAdd = ref([ const nodeTEST = defineModel("nodeTree", { default: [] }); const filter = ref(""); +const level = ref(0); const nodes = ref>([]); +const dataSort = ref>([]); const lazy = ref(nodes); const expanded = ref>([]); const notFound = ref("ไม่พบข้อมูลที่ค้นหา"); @@ -165,6 +168,7 @@ function deleteNode(treeNode: any, organizationId: any): boolean { return false; } +const modalSortAgency = ref(false); const dialogAgency = ref(false); const actionType = ref(""); const dataNode = ref(); @@ -214,6 +218,54 @@ async function onClickDel(type: number, id: string) { }); } +function onClickSort(type: number, id: string) { + modalSortAgency.value = true; + level.value = type; + if (type === 0) { + 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; + } else if (type === 1) { + const dataList = nodes.value; + const dataMap = dataList.map((item: any) => ({ + orgTreeId: item.orgTreeId, + orgRevisionId: item.orgRevisionId, + children: item.children, + })); + const dataChild = dataMap + .filter((item: any) => item.orgTreeId === id) + .reduce((acc: any, item: any) => { + return acc.concat( + item.children.map((child: any) => ({ + orgRootId: child.orgRootId, + orgTreeId: child.orgTreeId, + orgLevel: child.orgLevel, + orgTreeName: child.orgTreeName, + orgTreeShortName: child.orgTreeShortName, + orgRevisionId: child.orgRevisionId, + })) + ); + }, []); + dataSort.value = dataChild; + } else if (type === 2) { + + const dataList = nodes.value; + const dataMap = dataList.map((item: any) => ({ + orgTreeId: item.orgTreeId, + children: item.children, + })) + + console.log(dataMap) + + } +} watch( () => nodeTEST.value, () => { @@ -328,6 +380,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.orgLevel, prop.node.orgRootId) : null " > @@ -451,6 +505,12 @@ onMounted(async () => {}); v-model:treeId="treeId" v-model:orgLevel="orgLevel" /> + + From 3eb1a41bdb91dbaa1db7b62afba330aeaaf217d9 Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Wed, 31 Jan 2024 16:10:07 +0700 Subject: [PATCH 4/5] =?UTF-8?q?pop=20up=20=E0=B8=88=E0=B8=B1=E0=B8=94?= =?UTF-8?q?=E0=B8=A5=E0=B8=B3=E0=B8=94=E0=B8=B1=E0=B8=9A=E0=B8=81=E0=B8=B2?= =?UTF-8?q?=E0=B8=A3=E0=B9=81=E0=B8=AA=E0=B8=94=E0=B8=87=E0=B8=9C=E0=B8=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/02_organizational/api.organization.ts | 1 + .../components/DialogSortAgency.vue | 52 ++++++++------- .../components/mainTree.vue | 63 ++++++++----------- 3 files changed, 51 insertions(+), 65 deletions(-) diff --git a/src/api/02_organizational/api.organization.ts b/src/api/02_organizational/api.organization.ts index 25ee73b01..f9a7faf4b 100644 --- a/src/api/02_organizational/api.organization.ts +++ b/src/api/02_organizational/api.organization.ts @@ -12,4 +12,5 @@ export default { orgSetDateTime:(id:string) => `${organization}/set/publish/${id}`, organizationHistoryNew: `${organization}/history`, + organizationShortName: `${organization}/sort`, }; diff --git a/src/modules/02_organizationalNew/components/DialogSortAgency.vue b/src/modules/02_organizationalNew/components/DialogSortAgency.vue index 3abe050da..4d21409e8 100644 --- a/src/modules/02_organizationalNew/components/DialogSortAgency.vue +++ b/src/modules/02_organizationalNew/components/DialogSortAgency.vue @@ -24,7 +24,6 @@ const { dialogConfirm, showLoader, success, hideLoader, messageError } = const modal = defineModel("sortAgency", { required: true }); const modalSort = defineModel>("data", { required: true }); -const modalType = defineModel("type", { required: true }); const rows = ref([]); const columns = ref([ { @@ -49,39 +48,38 @@ function save() { dialogConfirm($q, () => { const data = rows.value; const dataId = data.map((item: any) => item.orgTreeId); - console.log(dataId); + http + .put(config.API.organizationShortName, { + id: data[0].orgLevel === 0 ? data[0].orgRevisionId : data[0].orgRootId, + type: data[0].orgLevel, + sortId: dataId, + }) + .then((res) => { + modal.value = false; + success($q, "บันทึกข้อมูลสำเร็จ"); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => {}); }); } watch( () => modal.value, () => { if (modal.value == true) { + rows.value = []; const dataStandant = modalSort.value; - if (modalType.value === 0) { - const mappedData = dataStandant.map((item: any) => ({ - orgLevel: item.orgLevel, - name: `${item.orgTreeName} (${item.orgTreeShortName})`, - orgRevisionId: item.orgRevisionId, - orgTreeId: item.orgTreeId, - orgTreeName: item.orgTreeName, - orgTreeShortName: item.orgTreeShortName, - })); - rows.value = mappedData; - console.log("row", rows.value); - } else if (modalType.value === 1) { - const mappedData = dataStandant.map((item: any) => ({ - name: `${item.orgTreeName} (${item.orgTreeShortName})`, - orgRootId: item.orgRootId, - orgTreeId: item.orgTreeId, - orgLevel: item.orgLevel, - orgTreeName: item.orgTreeName, - orgTreeShortName: item.orgTreeShortName, - orgRevisionId: item.orgRevisionId, - })); - rows.value = mappedData; - - console.log("row", dataStandant); - } + const mappedData = dataStandant.map((item: any) => ({ + name: `${item.orgTreeName} (${item.orgTreeShortName})`, + orgRootId: item.orgRootId, + orgTreeId: item.orgTreeId, + orgLevel: item.orgLevel, + orgTreeName: item.orgTreeName, + orgTreeShortName: item.orgTreeShortName, + orgRevisionId: item.orgRevisionId, + })); + rows.value = mappedData; } } ); diff --git a/src/modules/02_organizationalNew/components/mainTree.vue b/src/modules/02_organizationalNew/components/mainTree.vue index cb0dab00f..6f3f388ae 100644 --- a/src/modules/02_organizationalNew/components/mainTree.vue +++ b/src/modules/02_organizationalNew/components/mainTree.vue @@ -212,16 +212,25 @@ async function onClickDel(type: number, id: string) { messageError($q, err); }) .finally(async () => { - props.fetchDataTree?.(); - hideLoader(); + props.fetchDataTree?.(); + hideLoader(); }); }); } -function onClickSort(type: number, id: string) { +async function onClickSort(id: string) { modalSortAgency.value = true; - level.value = type; - if (type === 0) { + 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, @@ -232,38 +241,17 @@ function onClickSort(type: number, id: string) { })); dataSort.value = dataMap; - } else if (type === 1) { - const dataList = nodes.value; - const dataMap = dataList.map((item: any) => ({ - orgTreeId: item.orgTreeId, - orgRevisionId: item.orgRevisionId, - children: item.children, - })); - const dataChild = dataMap - .filter((item: any) => item.orgTreeId === id) - .reduce((acc: any, item: any) => { - return acc.concat( - item.children.map((child: any) => ({ - orgRootId: child.orgRootId, - orgTreeId: child.orgTreeId, - orgLevel: child.orgLevel, - orgTreeName: child.orgTreeName, - orgTreeShortName: child.orgTreeShortName, - orgRevisionId: child.orgRevisionId, - })) - ); - }, []); - dataSort.value = dataChild; - } else if (type === 2) { - - const dataList = nodes.value; - const dataMap = dataList.map((item: any) => ({ - orgTreeId: item.orgTreeId, - children: item.children, - })) - - console.log(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( @@ -381,7 +369,7 @@ onMounted(async () => {}); : item.type === 'DEL' ? onClickDel(prop.node.orgLevel, prop.node.orgTreeId) : item.type === 'SORT' - ? onClickSort(prop.node.orgLevel, prop.node.orgRootId) + ? onClickSort(prop.node.orgRootId) : null " > @@ -509,7 +497,6 @@ onMounted(async () => {}); From 80b40ead8517540ea4f92b39d7271af8b9a3fd49 Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Wed, 31 Jan 2024 16:23:21 +0700 Subject: [PATCH 5/5] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=E0=B8=A3?= =?UTF-8?q?=E0=B8=B9=E0=B8=9B=E0=B9=84=E0=B8=A1=E0=B9=88=E0=B8=82=E0=B8=B6?= =?UTF-8?q?=E0=B9=89=E0=B8=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/resign/ResignByid.vue | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) 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) {
- + +