feat: เพิ่ม แก้ไขรอบการปฏิบัติงานของลูกจ้าง

This commit is contained in:
setthawutttty 2025-07-11 14:18:52 +07:00
parent 8d42f39bb5
commit cb65cdb737
5 changed files with 438 additions and 11 deletions

View file

@ -36,6 +36,10 @@ const props = defineProps({
editCheck: String,
DataRow: Object,
personId: String,
type: {
type: String,
default: "",
},
});
/**FormData */
@ -114,9 +118,11 @@ function onSubmit() {
async function changeRound() {
const formattedDateForAPI = await convertDateToAPI(formData.effectiveDate);
const url =
props.type == "emp" ? config.API.leaveRoundEMP() : config.API.leaveRound();
showLoader();
await http
.post(config.API.leaveRound(), {
.post(url, {
profileId: props.personId,
roundId: formData.round,
effectiveDate: formattedDateForAPI,
@ -140,8 +146,14 @@ async function changeRound() {
*/
async function fetchDataOption() {
props.editCheck !== "history" && showLoader();
const url =
props.editCheck == "edit"
? config.API.leaveRound()
: props.type == "emp"
? config.API.leaveRoundEMP()
: config.API.leaveRound();
await http
.get(config.API.leaveRound())
.get(url)
.then((res) => {
const data = res.data.result;
let option: DataOption[] = [];
@ -202,7 +214,11 @@ watch(
formData.reson = "";
formData.effectiveDate = null;
}
if (props.modal === true && dataStore.roundOp.length == 0) {
if (
props.modal === true &&
dataStore.roundOp.length == 0 &&
props.editCheck !== "history"
) {
currentPage.value = 1;
await fetchDataOption();
} else {