ผังบัญชีเงินเดือน => validate

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-03-01 13:12:21 +07:00
parent d7c164ac9b
commit e4835425c0

View file

@ -8,7 +8,7 @@ import config from "@/app.config";
import type {
DataOption,
ObjectSalaryRef,
FormData
FormData,
} from "@/modules/13_salary/interface/index/Main";
import type {
SalaryPosType,
@ -63,9 +63,9 @@ const formData = reactive<FormData>({
const salaryTypeRef = ref<Object | null>(null);
const posTypeRef = ref<Object | null>(null);
const posLevelRef = ref<Object | null>(null);
const dateRef = ref<Object | null>(null);
const startDateRef = ref<Object | null>(null);
const endDateRef = ref<Object | null>(null);
const dateRef = ref<any>(null);
const startDateRef = ref<any>();
const endDateRef = ref<any>();
const ObjectRef: ObjectSalaryRef = {
salaryType: salaryTypeRef,
@ -169,11 +169,11 @@ watch(
if (salaryPosTypeOption.value.length === 0) {
await fetchPosType();
}
if (props.typeAction === "add") {
formData.date = new Date()
formData.startDate = new Date()
formData.endDate = new Date()
}
// if (props.typeAction === "add") {
// formData.date = new Date();
// formData.startDate = new Date();
// formData.endDate = new Date();
// }
if (props.typeAction === "edit") {
await showLoader();
if (props.data) {
@ -251,6 +251,33 @@ function checkEndDate() {
}
}
watch(
() => formData.date,
() => {
if (formData.date) {
dateRef.value.resetValidation();
}
}
);
watch(
() => formData.startDate,
() => {
if (formData.startDate) {
startDateRef.value.resetValidation();
}
}
);
watch(
() => formData.endDate,
() => {
if (formData.endDate) {
endDateRef.value.resetValidation();
}
}
);
/**
* function เรยกไฟล PDF
* @param url link PDF