From 9be415bfad53deaaaaf2a759ceb62c5db16663cf Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Fri, 26 Apr 2024 12:13:35 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=E0=B9=84=E0=B8=82?= =?UTF-8?q?=E0=B9=82=E0=B8=84=E0=B8=A3=E0=B8=87=E0=B8=81=E0=B8=B2=E0=B8=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../indicatorByPlan/IndicatorByPlan.vue | 82 +++++++++---------- src/modules/14_KPI/views/indicatorByPlan.vue | 21 +++-- src/modules/14_KPI/views/indicatorByRole.vue | 56 ++++++++----- .../15_development/components/BasicInfo.vue | 39 +++++---- .../components/ProjectDetail.vue | 25 +++++- 5 files changed, 138 insertions(+), 85 deletions(-) diff --git a/src/modules/14_KPI/components/indicatorByPlan/IndicatorByPlan.vue b/src/modules/14_KPI/components/indicatorByPlan/IndicatorByPlan.vue index 590dbfdd6..261800d3e 100644 --- a/src/modules/14_KPI/components/indicatorByPlan/IndicatorByPlan.vue +++ b/src/modules/14_KPI/components/indicatorByPlan/IndicatorByPlan.vue @@ -126,22 +126,6 @@ function fetchTreeAgency(id: string) { const data = res.data.result; nodeAgency.value = data; store.treeId = ""; - - if (nodeAgency.value && planData.nodeId) { - const nodeTree = await searchAndReplace( - nodeAgency.value, - planData.nodeId - ); - if (nodeTree) { - expandedAgency.value = []; - const parts = nodeTree?.orgName.split("/"); - for (let i = 1; i < parts.length; i++) { - const arrangedParts = parts[i]; - expandedAgency.value.push(arrangedParts); - } - updateSelectedAgency(nodeTree, true); - } - } }) .catch((err) => { messageError($q, err); @@ -175,6 +159,30 @@ function fetchDataById(id: string) { planData.strategy = data.strategy; planData.strategyId = data.strategyId; + // หน่วยงาน/ส่วนราชการ + const arrayexpandedAgency = [ + data.root, + data.child1, + data.child2, + data.child3, + data.child4, + ]; + expandedAgency.value = arrayexpandedAgency + .filter((e) => e !== null) + .slice(0, -1); + + // ยุทธศาสตร์ / แผน + const arrayexpandedPlan = [ + data.strategyChild1, + data.strategyChild2, + data.strategyChild3, + data.strategyChild4, + data.strategyChild5, + ]; + expandedPlan.value = arrayexpandedPlan + .filter((e) => e !== null) + .slice(0, -1); + fetchRoundOption(); }) .catch((err) => { @@ -237,26 +245,6 @@ function onSubmit() { ); } -/** - * function หาหน่วยงานที่รับผิดชอบ - * @param orgTreeData ข้อมูล nodeTree - * @param treeId tree ID - */ -async function searchAndReplace(orgTreeData: any, treeId: string | null) { - if (orgTreeData) { - for (let orgTree of orgTreeData) { - if (orgTree.orgTreeId === treeId) { - return orgTree; - } - let foundOrg: any = await searchAndReplace(orgTree.children, treeId); - if (foundOrg) { - return foundOrg; - } - } - return false; - } -} - onMounted(() => { fetchOrganizationActive(); if (id.value) { @@ -525,7 +513,13 @@ onMounted(() => { - +