เป้าหมาย แก้ไขบัค

This commit is contained in:
oat_dev 2024-04-10 14:29:48 +07:00
parent d35ab5c48b
commit 3a974e84cb
4 changed files with 41 additions and 12 deletions

View file

@ -53,15 +53,16 @@ function fetchDataProject(id: string) {
store.formAddProject.projectName = data.projectName; store.formAddProject.projectName = data.projectName;
store.formAddProject.reason = data.reason; store.formAddProject.reason = data.reason;
store.formAddProject.objective = data.objective; store.formAddProject.objective = data.objective;
/**เป้าหมาย*/ /**เป้าหมาย*/
const plannedGoals = data.plannedGoals.map((e: ResPlannedGoals) => ({ const plannedGoals = data.plannedGoals.map((e: ResPlannedGoals) => ({
groupTarget: e.groupTarget, groupTarget: e.groupTarget,
groupTargetSub: e.groupTargetSub, groupTargetSub: e.groupTargetSub,
position: e.position, positions: e.plannedGoalPositions.map((v: any) => ({
posTypePlannedId: e.posTypePlannedId, position: v.position,
posLevelPlannedId: e.posLevelPlannedId, posTypePlannedId: v.posTypePlannedId,
type: e.type, posLevelPlannedId: v.posLevelPlannedId,
})),
type: e.type ? e.type : null,
amount: e.amount, amount: e.amount,
})); }));
const plannedPeoples = data.plannedPeoples.map((e: ResPeople) => ({ const plannedPeoples = data.plannedPeoples.map((e: ResPeople) => ({

View file

@ -158,7 +158,7 @@ const formGroupTarget = reactive<FormGroupTargetPlannedGoal>({
position: "", position: "",
posType: "", posType: "",
level: "", level: "",
type: "", type: null,
amount: null, amount: null,
// positions: { // positions: {
// position: "", // position: "",
@ -222,11 +222,14 @@ function onSubmitGroup() {
const list = data.map((e: FormGroupTargetPlannedGoal) => ({ const list = data.map((e: FormGroupTargetPlannedGoal) => ({
groupTarget: e.groupTarget, groupTarget: e.groupTarget,
groupTargetSub: e.groupTargetSub, 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, type: e.type ? e.type : null,
amount: Number(e.amount), amount: Number(e.amount),
})); }));
console.log(list);
if (isEdit.value) { if (isEdit.value) {
plannedGoals.value.splice(rowIndex.value, 1, ...list); plannedGoals.value.splice(rowIndex.value, 1, ...list);
} else { } else {
@ -376,7 +379,6 @@ onMounted(() => {
plannedGoals.value = store.formAddProject.plannedGoals plannedGoals.value = store.formAddProject.plannedGoals
? store.formAddProject.plannedGoals ? store.formAddProject.plannedGoals
: []; : [];
plannedPeoples.value = store.formAddProject.plannedPeoples plannedPeoples.value = store.formAddProject.plannedPeoples
? store.formAddProject.plannedPeoples ? store.formAddProject.plannedPeoples
: []; : [];
@ -401,7 +403,10 @@ onMounted(() => {
<q-item <q-item
clickable clickable
v-close-popup v-close-popup
@click="onClickOpenDialog('group', 'planned')" @click="
cleanFormData();
onClickOpenDialog('group', 'planned');
"
> >
<q-item-section>กลมเปาหมาย</q-item-section> <q-item-section>กลมเปาหมาย</q-item-section>
</q-item> </q-item>
@ -464,6 +469,7 @@ onMounted(() => {
formGroupTarget.groupTarget = props.row.groupTarget; formGroupTarget.groupTarget = props.row.groupTarget;
formGroupTarget.groupTargetSub = props.row.groupTargetSub; formGroupTarget.groupTargetSub = props.row.groupTargetSub;
formGroupTarget.amount = props.row.amount; formGroupTarget.amount = props.row.amount;
formGroupTarget.positions = props.row.positions;
newModalGroupTarget = true; newModalGroupTarget = true;
} }
" "

View file

@ -32,6 +32,14 @@ interface FormGroupTargetPlannedGoal {
posLevelPlannedId: string; posLevelPlannedId: string;
} }
]; ];
plannedGoalPositions?: [
{
position: string;
posTypePlannedId: string;
posLevelPlannedId: string;
}
];
groupTarget: string; groupTarget: string;
groupTargetSub: string; groupTargetSub: string;
position: string; position: string;
@ -202,7 +210,14 @@ interface actualGoals {
interface PlannedGoals { interface PlannedGoals {
groupTarget: string; groupTarget: string;
groupTargetSub: string; groupTargetSub: string;
positions: [ positions?: [
{
position: string;
posTypePlannedId: string;
posLevelPlannedId: string;
}
];
plannedGoalPositions?: [
{ {
position: string; position: string;
posTypePlannedId: string; posTypePlannedId: string;

View file

@ -88,7 +88,14 @@ interface ResActualGoals {
interface ResPlannedGoals { interface ResPlannedGoals {
groupTarget: string; groupTarget: string;
groupTargetSub: string; groupTargetSub: string;
position: [ plannedGoalPositions?: [
{
position: string;
posTypePlannedId: string;
posLevelPlannedId: string;
}
];
positions?: [
{ {
position: string; position: string;
posTypePlannedId: string; posTypePlannedId: string;