ผังบัญชีเงินเดือน => 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 { import type {
DataOption, DataOption,
ObjectSalaryRef, ObjectSalaryRef,
FormData FormData,
} from "@/modules/13_salary/interface/index/Main"; } from "@/modules/13_salary/interface/index/Main";
import type { import type {
SalaryPosType, SalaryPosType,
@ -63,9 +63,9 @@ const formData = reactive<FormData>({
const salaryTypeRef = ref<Object | null>(null); const salaryTypeRef = ref<Object | null>(null);
const posTypeRef = ref<Object | null>(null); const posTypeRef = ref<Object | null>(null);
const posLevelRef = ref<Object | null>(null); const posLevelRef = ref<Object | null>(null);
const dateRef = ref<Object | null>(null); const dateRef = ref<any>(null);
const startDateRef = ref<Object | null>(null); const startDateRef = ref<any>();
const endDateRef = ref<Object | null>(null); const endDateRef = ref<any>();
const ObjectRef: ObjectSalaryRef = { const ObjectRef: ObjectSalaryRef = {
salaryType: salaryTypeRef, salaryType: salaryTypeRef,
@ -169,11 +169,11 @@ watch(
if (salaryPosTypeOption.value.length === 0) { if (salaryPosTypeOption.value.length === 0) {
await fetchPosType(); await fetchPosType();
} }
if (props.typeAction === "add") { // if (props.typeAction === "add") {
formData.date = new Date() // formData.date = new Date();
formData.startDate = new Date() // formData.startDate = new Date();
formData.endDate = new Date() // formData.endDate = new Date();
} // }
if (props.typeAction === "edit") { if (props.typeAction === "edit") {
await showLoader(); await showLoader();
if (props.data) { 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 * function เรยกไฟล PDF
* @param url link PDF * @param url link PDF