From 33f887f7927be03b2db6aac57f48629bdf377875 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Wed, 31 Jan 2024 10:34:03 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=9B=E0=B8=A3=E0=B8=B1=E0=B8=A2=20UI=20?= =?UTF-8?q?=E0=B9=82=E0=B8=84=E0=B8=A3=E0=B8=87=E0=B8=AA=E0=B8=A3=E0=B9=89?= =?UTF-8?q?=E0=B8=B2=E0=B8=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/listView.vue | 50 +++++++----- .../components/mainTree.vue | 42 +++++++++- .../interface/response/organizational.ts | 12 ++- .../02_organizationalNew/views/main.vue | 78 +++++++++++++++---- 4 files changed, 143 insertions(+), 39 deletions(-) diff --git a/src/modules/02_organizationalNew/components/listView.vue b/src/modules/02_organizationalNew/components/listView.vue index a0d0916eb..eb2333ce5 100644 --- a/src/modules/02_organizationalNew/components/listView.vue +++ b/src/modules/02_organizationalNew/components/listView.vue @@ -19,38 +19,50 @@ const { showLoader, hideLoader, messageError } = useCounterMixin(); const showData = ref(false); const nodeTree = ref(); +const historyId = defineModel("historyId", { required: true }); +const count = defineModel("count", { required: true }); // defineProps<{ dataActive: DataActive }>(); -async function fetchDataTree() { +async function fetchDataTree(id: string) { showLoader(); - const id = - store.typeOrganizational === "current" ? store.activeId : store.draftId; - id && - (await http - .get(config.API.orgByid(id.toString())) - .then((res) => { - const data = res.data.result; - nodeTree.value = data; - console.log(res); - }) - .catch((err) => { - messageError($q, err); - }) - .finally(() => { - hideLoader(); - })); + // const id = + // store.typeOrganizational === "current" ? store.activeId : store.draftId; + // id && + await http + .get(config.API.orgByid(id.toString())) + .then((res) => { + const data = res.data.result; + nodeTree.value = data; + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); // console.log(nodeTree.value); } onMounted(async () => { - await fetchDataTree(); + const id = + store.typeOrganizational === "current" ? store.activeId : store.draftId; + id && (await fetchDataTree(id)); }); +watch( + () => count.value, + () => { + fetchDataTree(historyId.value); + } +); + watch( () => store.typeOrganizational, () => { - fetchDataTree(); + const id = + store.typeOrganizational === "current" ? store.activeId : store.draftId; + id && store.typeOrganizational !== "old" && fetchDataTree(id); } ); diff --git a/src/modules/02_organizationalNew/components/mainTree.vue b/src/modules/02_organizationalNew/components/mainTree.vue index 2a0b97978..f6f0504aa 100644 --- a/src/modules/02_organizationalNew/components/mainTree.vue +++ b/src/modules/02_organizationalNew/components/mainTree.vue @@ -149,9 +149,6 @@ function deleteNode(treeNode: any, organizationId: any): boolean { // console.log("tttttttttttttt", treeNode.orgTreeId, organizationId); if (treeNode.orgTreeId === organizationId) { - console.log(treeNode); - - // ลบ Node โดยการไม่ส่งผลลบ Node ทั้งหมดภายใต้ treeNode.children = []; breakLoop.value = true; @@ -351,6 +348,45 @@ onMounted(async () => {}); + + + + + + + + + {{ item.label }} + + + +