From 3a974e84cbbe43b82fed076103d1a0d217e85360 Mon Sep 17 00:00:00 2001 From: oat_dev Date: Wed, 10 Apr 2024 14:29:48 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=80=E0=B8=9B=E0=B9=89=E0=B8=B2=E0=B8=AB?= =?UTF-8?q?=E0=B8=A1=E0=B8=B2=E0=B8=A2=20=E0=B9=81=E0=B8=81=E0=B9=89?= =?UTF-8?q?=E0=B9=84=E0=B8=82=E0=B8=9A=E0=B8=B1=E0=B8=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../15_development/components/MainTab.vue | 11 ++++++----- .../15_development/components/Target.vue | 16 +++++++++++----- .../15_development/interface/request/Main.ts | 17 ++++++++++++++++- .../15_development/interface/response/Main.ts | 9 ++++++++- 4 files changed, 41 insertions(+), 12 deletions(-) diff --git a/src/modules/15_development/components/MainTab.vue b/src/modules/15_development/components/MainTab.vue index 0d5fd5193..e0dbba93f 100644 --- a/src/modules/15_development/components/MainTab.vue +++ b/src/modules/15_development/components/MainTab.vue @@ -53,15 +53,16 @@ function fetchDataProject(id: string) { store.formAddProject.projectName = data.projectName; store.formAddProject.reason = data.reason; store.formAddProject.objective = data.objective; - /**เป้าหมาย*/ const plannedGoals = data.plannedGoals.map((e: ResPlannedGoals) => ({ groupTarget: e.groupTarget, groupTargetSub: e.groupTargetSub, - position: e.position, - posTypePlannedId: e.posTypePlannedId, - posLevelPlannedId: e.posLevelPlannedId, - type: e.type, + positions: e.plannedGoalPositions.map((v: any) => ({ + position: v.position, + posTypePlannedId: v.posTypePlannedId, + posLevelPlannedId: v.posLevelPlannedId, + })), + type: e.type ? e.type : null, amount: e.amount, })); const plannedPeoples = data.plannedPeoples.map((e: ResPeople) => ({ diff --git a/src/modules/15_development/components/Target.vue b/src/modules/15_development/components/Target.vue index 10ba8cfd7..10dd8b547 100644 --- a/src/modules/15_development/components/Target.vue +++ b/src/modules/15_development/components/Target.vue @@ -158,7 +158,7 @@ const formGroupTarget = reactive({ position: "", posType: "", level: "", - type: "", + type: null, amount: null, // positions: { // position: "", @@ -222,11 +222,14 @@ function onSubmitGroup() { const list = data.map((e: FormGroupTargetPlannedGoal) => ({ groupTarget: e.groupTarget, groupTargetSub: e.groupTargetSub, - positions: e.positions, + positions: e.positions.map((v: any) => ({ + position: v.position, + posTypePlannedId: v.posTypePlannedId, + posLevelPlannedId: v.posLevelPlannedId, + })), type: e.type ? e.type : null, amount: Number(e.amount), })); - console.log(list); if (isEdit.value) { plannedGoals.value.splice(rowIndex.value, 1, ...list); } else { @@ -376,7 +379,6 @@ onMounted(() => { plannedGoals.value = store.formAddProject.plannedGoals ? store.formAddProject.plannedGoals : []; - plannedPeoples.value = store.formAddProject.plannedPeoples ? store.formAddProject.plannedPeoples : []; @@ -401,7 +403,10 @@ onMounted(() => { กลุ่มเป้าหมาย @@ -464,6 +469,7 @@ onMounted(() => { formGroupTarget.groupTarget = props.row.groupTarget; formGroupTarget.groupTargetSub = props.row.groupTargetSub; formGroupTarget.amount = props.row.amount; + formGroupTarget.positions = props.row.positions; newModalGroupTarget = true; } " diff --git a/src/modules/15_development/interface/request/Main.ts b/src/modules/15_development/interface/request/Main.ts index b8d3a7e23..3d262f021 100644 --- a/src/modules/15_development/interface/request/Main.ts +++ b/src/modules/15_development/interface/request/Main.ts @@ -32,6 +32,14 @@ interface FormGroupTargetPlannedGoal { posLevelPlannedId: string; } ]; + plannedGoalPositions?: [ + { + position: string; + posTypePlannedId: string; + posLevelPlannedId: string; + } + ]; + groupTarget: string; groupTargetSub: string; position: string; @@ -202,7 +210,14 @@ interface actualGoals { interface PlannedGoals { groupTarget: string; groupTargetSub: string; - positions: [ + positions?: [ + { + position: string; + posTypePlannedId: string; + posLevelPlannedId: string; + } + ]; + plannedGoalPositions?: [ { position: string; posTypePlannedId: string; diff --git a/src/modules/15_development/interface/response/Main.ts b/src/modules/15_development/interface/response/Main.ts index 55346e830..392510085 100644 --- a/src/modules/15_development/interface/response/Main.ts +++ b/src/modules/15_development/interface/response/Main.ts @@ -88,7 +88,14 @@ interface ResActualGoals { interface ResPlannedGoals { groupTarget: string; groupTargetSub: string; - position: [ + plannedGoalPositions?: [ + { + position: string; + posTypePlannedId: string; + posLevelPlannedId: string; + } + ]; + positions?: [ { position: string; posTypePlannedId: string;