Merge branch 'develop' into dev-tee

This commit is contained in:
setthawutttty 2023-08-09 18:04:20 +07:00
commit 4ad6243f66
3 changed files with 117 additions and 45 deletions

View file

@ -77,7 +77,7 @@ const nextStep = async () => {
};
const previousStep = async () => {
stepper.value!.previous();
// localStorage.setItem("currentStep", step.value.toString());
localStorage.setItem("currentStep", step.value.toString());
if (orderId.value) {
await http
.put(config.API.prevStep(orderId.value))

View file

@ -405,6 +405,7 @@ const getData = async (id: string) => {
personalId: r.personalId ?? "",
selectStatus: r.selectStatus !== null ? r.selectStatus : false,
sequence: r.sequence !== null ? r.sequence : 0,
refRecordId: r.refRecordId,
});
});
// console.log("list", list);
@ -418,21 +419,21 @@ const getData = async (id: string) => {
});
};
const saveSalary = async (id: string) => {
await http
.put(config.API.salaryOrder(id))
.then((res) => {
// const data = res.data.result;
// console.log(res);
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
};
// const saveSalary = async (id: string) => {
// await http
// .put(config.API.salaryOrder(id))
// .then((res) => {
// // const data = res.data.result;
// // console.log(res);
// success($q, "");
// })
// .catch((e) => {
// messageError($q, e);
// })
// .finally(() => {
// hideLoader();
// });
// };
const dialogDeleteData = async (id: string) => {
dialogMessage(
@ -501,11 +502,11 @@ const swapDown = async (id: string) => {
const upDown = async (value: any, up: boolean = true) => {
const indexCurrent = value.rowIndex;
if (up) {
await swapUp(value.row.personId);
await swapUp(value.row.personalId);
// rows.value[indexCurrent] = rows.value[indexCurrent - 1];
// rows.value[indexCurrent - 1] = value.row;
} else {
await swapDown(value.row.personId);
await swapDown(value.row.personalId);
// rows.value[indexCurrent] = rows.value[indexCurrent + 1];
// rows.value[indexCurrent + 1] = value.row;
}
@ -515,27 +516,86 @@ const saveModal = () => {
if (myForm.value !== null) {
myForm.value.validate().then(async (result: boolean) => {
if (result) {
modalOpenClose();
putSalary(modalData.value);
}
});
}
};
const personalId = ref<string>("");
const selectModal = (e: any) => {
console.log(e);
titleName.value = e.name;
modalData.value = {
salaryAmount: 0,
positionSalaryAmount: 0,
mouthSalaryAmount: 0,
};
modalOpenClose();
personalId.value = e.personalId;
// modalData.value = {
// salaryAmount: 0,
// positionSalaryAmount: 0,
// mouthSalaryAmount: 0,
// };
modalOpenClose(e.personalId);
};
const modalOpenClose = () => {
const modalOpenClose = async (personalId: string) => {
modal.value = !modal.value;
if (!modal.value) {
titleName.value = "";
}
if (modal.value == true) {
await fetchSalary(personalId);
}
};
const fetchSalary = async (personalId: string) => {
console.log(personalId);
showLoader();
await http
.get(config.API.salaryOrder(personalId))
.then((res: any) => {
console.log(res);
let salary = res.data.result;
modalData.value = {
salaryAmount: salary.salaryAmount,
positionSalaryAmount: salary.positionSalaryAmount,
mouthSalaryAmount: salary.monthSalaryAmount,
};
})
.catch((e) => {
console.log(e);
messageError($q, e);
})
.finally(() => {
hideLoader();
});
};
const putSalary = async (salary: any) => {
modalData.value = {
salaryAmount: Number(salary.salaryAmount),
positionSalaryAmount: Number(salary.positionSalaryAmount),
mouthSalaryAmount: Number(salary.mouthSalaryAmount),
};
$q.dialog({
title: "ยืนยันการบันทึกข้อมูล",
message: "ต้องการยืนยันการบันทึกข้อมูลนี้ใช่หรือไม่?",
cancel: {
flat: true,
color: "negative",
},
persistent: true,
}).onOk(async () => {
await http
.put(config.API.salaryOrder(personalId.value), modalData.value)
.then((res: any) => {
console.log(res);
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((e) => {
console.log(e);
messageError($q, e);
})
.finally(async () => {
await conditionData();
modal.value = false;
});
});
};
const modalAddChange = async () => {
@ -559,6 +619,7 @@ const fetchaddlist = async (id: string) => {
personalId: r.personalId ?? "",
selectStatus: r.selectStatus !== null ? r.selectStatus : false,
sequence: r.sequence !== null ? r.sequence : 0,
refRecordId: r.refRecordId,
}));
rows2.value = list.filter((e: any) => e.selectStatus === false);
})
@ -583,7 +644,7 @@ const saveModalAdd = () => {
persistent: true,
}).onOk(async () => {
let data = [];
data.push(...selected.value.map((e: any) => e.personalId));
data.push(...selected.value.map((e: any) => e.refRecordId));
// console.log(data);
addlist(data);
});
@ -595,7 +656,6 @@ const addlist = async (data: Object) => {
await http
.post(config.API.personsOrder(orderId.value), data)
.then(() => {
// console.log(res);
success($q, "บันทึกสำเร็จ");
})
.catch((e: any) => {
@ -613,22 +673,33 @@ const click = (e: any) => {
};
const save = () => {
// if (selected.value.length > 0) {
// next();
// } else {
// dialogMessage(
// $q,
// "",
// "",
// "warning",
// undefined,
// "orange",
// undefined,
// undefined,
// true
// );
// }
next();
$q.dialog({
title: "ยืนยันการบันทึกข้อมูล",
message: "ต้องการยืนยันการบันทึกข้อมูลนี้ใช่หรือไม่?",
cancel: {
flat: true,
color: "negative",
},
persistent: true,
}).onOk(async () => {
success($q, "บันทึกข้อมูลสำเร็จ");
next();
});
// if (selected.value.length > 0) {
// next();
// } else {
// dialogMessage(
// $q,
// "",
// "",
// "warning",
// undefined,
// "orange",
// undefined,
// undefined,
// true
// );
// }
};
const selectData = (row: any) => {};

View file

@ -5,6 +5,7 @@ interface ResponseData {
personalId: string;
selectStatus: boolean;
sequence: number;
refRecordId: string
}
interface ResponseOrganiz {