ปรับ code รายการโครงการ

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-04-04 13:33:41 +07:00
parent f8304abfc4
commit 93a5d53df2
5 changed files with 106 additions and 26 deletions

View file

@ -5,6 +5,13 @@ import { useRouter, useRoute } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
import type {
ResDataProject,
ResPlannedGoals,
ResActualGoals,
ResPeople,
} from "@/modules/15_development/interface/response/Main";
import BasicInfo from "@/modules/15_development/components/BasicInfo.vue";
import Target from "@/modules/15_development/components/Target.vue";
import ProjectDetail from "@/modules/15_development/components/ProjectDetail.vue";
@ -38,7 +45,7 @@ function fetchDataProject(id: string) {
http
.get(config.API.developmentMainById(id))
.then((res) => {
const data = res.data.result;
const data: ResDataProject = res.data.result;
console.log(data);
/** ข้อมูลเบื้องต้น*/
store.formAddProject.year = data.year;
@ -47,7 +54,7 @@ function fetchDataProject(id: string) {
store.formAddProject.objective = data.objective;
/**เป้าหมาย*/
const plannedGoals = data.plannedGoals.map((e: any) => ({
const plannedGoals = data.plannedGoals.map((e: ResPlannedGoals) => ({
groupTarget: e.groupTarget,
groupTargetSub: e.groupTargetSub,
position: e.position,
@ -56,14 +63,14 @@ function fetchDataProject(id: string) {
type: e.type,
amount: e.amount,
}));
const plannedPeoples = data.plannedPeoples.map((e: any) => ({
const plannedPeoples = data.plannedPeoples.map((e: ResPeople) => ({
groupTarget: e.groupTarget,
amount: e.amount,
}));
store.formAddProject.plannedGoals = plannedGoals;
store.formAddProject.plannedPeoples = plannedPeoples;
const actualGoals = data.actualGoals.map((e: any) => ({
const actualGoals = data.actualGoals.map((e: ResActualGoals) => ({
groupTarget: e.groupTarget,
groupTargetSub: e.groupTargetSub,
position: e.position,
@ -72,7 +79,7 @@ function fetchDataProject(id: string) {
type: e.type,
amount: e.amount,
}));
const actualPeoples = data.actualPeoples.map((e: any) => ({
const actualPeoples = data.actualPeoples.map((e: ResPeople) => ({
groupTarget: e.groupTarget,
amount: e.amount,
}));