Merge branch 'develop' into warunee-dev

This commit is contained in:
Warunee Tamkoo 2023-08-09 21:00:13 +07:00
commit 940dd882bc
4 changed files with 122 additions and 50 deletions

View file

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

View file

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

View file

@ -1599,6 +1599,7 @@ interface MonthOption {
label: string; label: string;
} }
const monthOp: MonthOption[] = []; const monthOp: MonthOption[] = [];
//-----------------(3.1)-----------// //-----------------(3.1)-----------//
const activityCount = ref<number>(2); const activityCount = ref<number>(2);
const activityDataArray = ref<any[]>([]); const activityDataArray = ref<any[]>([]);
@ -1811,12 +1812,12 @@ const putData = (id: string) => {
const assign_director = [ const assign_director = [
{ {
personal_id: caretakerFoot.value.personal_id, personal_id: caretaker1.value.personal_id,
role: "mentor", role: "mentor",
dated: date2.value instanceof Date ? dateToISO(date2.value) : null, dated: date2.value instanceof Date ? dateToISO(date2.value) : null,
}, },
{ {
personal_id: caretakerFoot2.value.personal_id, personal_id: caretaker2.value.personal_id,
role: "mentor", role: "mentor",
dated: date3.value instanceof Date ? dateToISO(date3.value) : null, dated: date3.value instanceof Date ? dateToISO(date3.value) : null,
}, },
@ -1862,8 +1863,7 @@ const putData = (id: string) => {
checked: item.checked, checked: item.checked,
})), })),
}; };
console.log("test", data); return data
}; };
const saveData = (id: string) => { const saveData = (id: string) => {
@ -1882,7 +1882,7 @@ const saveData = (id: string) => {
http http
.post(config.API.saveFinish(id), data) .post(config.API.saveFinish(id), data)
.then((res) => { .then((res) => {
console.log("🚀 ~ file: FormAssign.vue:1887 ~ .then ~ res:", res); router.push(`/probation/detail/${id}`);
}) })
.catch((e) => {}) .catch((e) => {})
.finally(() => { .finally(() => {

View file

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