From b9dd4c853380467283b47c4075d2db890788d210 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Wed, 17 Apr 2024 15:07:21 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=82=E0=B8=84=E0=B8=A3=E0=B8=87=E0=B8=B2?= =?UTF-8?q?=E0=B8=81=E0=B8=B2=E0=B8=A3=20=3D>=20=E0=B8=A5=E0=B8=B1?= =?UTF-8?q?=E0=B8=81=E0=B8=A9=E0=B8=93=E0=B8=B0=E0=B9=82=E0=B8=84=E0=B8=A3?= =?UTF-8?q?=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 --- .../components/ProjectDetail.vue | 95 ++++++++++--------- .../15_development/interface/index/Main.ts | 4 + .../15_development/views/Strategic.vue | 29 +----- 3 files changed, 60 insertions(+), 68 deletions(-) diff --git a/src/modules/15_development/components/ProjectDetail.vue b/src/modules/15_development/components/ProjectDetail.vue index 579de44b6..5efda6cb6 100644 --- a/src/modules/15_development/components/ProjectDetail.vue +++ b/src/modules/15_development/components/ProjectDetail.vue @@ -66,43 +66,22 @@ const formData = reactive({ developmentProjectTechniqueActuals: [], projectModalActual: null, projectModalPlanneds: null, + strategyChildPlannedId: null, //id ยุทธศาสตร์เป้าหมายตามแผน + strategyChildPlannedNode: 0, //node ยุทธศาสตร์เป้าหมายตามแผน + strategyChildActualId: null, //id ยุทธศาสตร์เป้าหมายตามจริง + strategyChildActualNode: 0, //node ยุทธศาสตร์เป้าหมายตามจริง }); -const nodes = ref([ - { - orgTreeName: " แผนพัฒนากรุงเทพมหานคร ระยะ 20 ปี ระยะที่ 3", - level: "0", - children: [ - { - orgTreeName: "ยุทธศาสตร์ที่ 1", - level: "1", - children: [ - { - orgTreeName: "ยุทธศาสตร์ที่ 2", - level: "2", - children: [ - { - orgTreeName: "ยุทธศาสตร์ที่ 3", - level: "3", - }, - ], - }, - ], - }, - ], - }, -]); +const nodes = ref([]); const filter = ref(""); const filter2 = ref(""); const notFound = ref("ไม่พบข้อมูลที่ค้นหา"); const noData = ref("ไม่มีข้อมูล"); const expanded = ref>([]); const expanded2 = ref>([]); -const nodeId = ref(""); -const nodeId2 = ref(""); -async function fetchData() { +function fetchData() { showLoader(); - await http + http .get(config.API.developmentMainTab("tab3", projectId.value)) .then((res) => { const data = res.data.result; @@ -123,6 +102,26 @@ async function fetchData() { formData.projectNigthHoldActual = data.projectNigthHoldActual; formData.developmentProjectTechniqueActuals = data.developmentProjectTechniqueActuals; + formData.strategyChildPlannedId = data.strategyChildPlannedId; + formData.strategyChildPlannedNode = data.strategyChildPlannedNode; + formData.strategyChildActualId = data.strategyChildActualId; + formData.strategyChildActualNode = data.strategyChildActualNode; + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); +} + +function fetchTree() { + showLoader(); + http + .get(config.API.devStrategy) + .then((res) => { + const data = res.data.result; + nodes.value = data; }) .catch((err) => { messageError($q, err); @@ -135,10 +134,9 @@ async function fetchData() { async function onSubmit() { dialogConfirm($q, async () => { showLoader(); - await http .put(config.API.developmentMainTab("tab3", projectId.value), formData) - .then((res) => { + .then(() => { success($q, "บันทึกข้อมูลสำเร็จ"); fetchData(); }) @@ -151,14 +149,17 @@ async function onSubmit() { function updateSelected(data: any, type: string) { if (type === "1") { - nodeId.value = data.orgTreeName; + formData.strategyChildPlannedId = data.id; + formData.strategyChildPlannedNode = data.level; } else if (type === "2") { - nodeId2.value = data.orgTreeName; + formData.strategyChildActualId = data.id; + formData.strategyChildActualNode = data.level; } } onMounted(() => { fetchData(); + fetchTree(); }); @@ -216,8 +217,8 @@ onMounted(() => { dense :nodes="nodes" selected-color="primary" - node-key="orgTreeName" - label-key="orgTreeName" + node-key="id" + label-key="id" :filter="filter" :no-results-label="notFound" :no-nodes-label="noData" @@ -227,13 +228,13 @@ onMounted(() => {
- {{ prop.node.orgTreeName }} + {{ prop.node.name }}
@@ -266,8 +267,8 @@ onMounted(() => { {
- {{ prop.node.orgTreeName }} + {{ prop.node.name }}
@@ -498,4 +499,12 @@ onMounted(() => { - + diff --git a/src/modules/15_development/interface/index/Main.ts b/src/modules/15_development/interface/index/Main.ts index 85250e452..1d179fe89 100644 --- a/src/modules/15_development/interface/index/Main.ts +++ b/src/modules/15_development/interface/index/Main.ts @@ -79,6 +79,10 @@ interface FormProjectDetail { developmentProjectTechniqueActuals: []; projectModalActual?: string | null; projectModalPlanneds?: string | null; + strategyChildPlannedId: string | null; //id ยุทธศาสตร์เป้าหมายตามแผน + strategyChildPlannedNode: number; //node ยุทธศาสตร์เป้าหมายตามแผน + strategyChildActualId: string | null; //id ยุทธศาสตร์เป้าหมายตามจริง + strategyChildActualNode: number; //node ยุทธศาสตร์เป้าหมายตามจริง } export type { diff --git a/src/modules/15_development/views/Strategic.vue b/src/modules/15_development/views/Strategic.vue index 719b4ef8a..dce36070b 100644 --- a/src/modules/15_development/views/Strategic.vue +++ b/src/modules/15_development/views/Strategic.vue @@ -40,30 +40,7 @@ const ListMenu = ref([ }, ]); -const nodes = ref([ - // { - // orgTreeName: " แผนพัฒนากรุงเทพมหานคร ระยะ 20 ปี ระยะที่ 3", - // level: "0", - // children: [ - // { - // orgTreeName: "ยุทธศาสตร์ที่ 1", - // level: "1", - // children: [ - // { - // orgTreeName: "ยุทธศาสตร์ที่ 2", - // level: "2", - // children: [ - // { - // orgTreeName: "ยุทธศาสตร์ที่ 3", - // level: "3", - // }, - // ], - // }, - // ], - // }, - // ], - // }, -]); +const nodes = ref([]); const filter = ref(""); const notFound = ref("ไม่พบข้อมูลที่ค้นหา"); const noData = ref("ไม่มีข้อมูล"); @@ -78,7 +55,9 @@ function fetchDataTree() { const data = res.data.result; nodes.value = data; }) - .catch((err) => {}) + .catch((err) => { + messageError($q, err); + }) .finally(() => { hideLoader(); });