diff --git a/src/modules/04_registry/components/Leave.vue b/src/modules/04_registry/components/Leave.vue index 90284075b..dfda325af 100644 --- a/src/modules/04_registry/components/Leave.vue +++ b/src/modules/04_registry/components/Leave.vue @@ -212,7 +212,21 @@ -->
+ + (""); const rowsTotal = ref([]); //select data history const filter = ref(""); //search data table +const inputDateLaeaveYear = ref(""); +/** ตรวจเวลา */ +watch( + () => inputDateLaeaveYear.value, + (value: string) => { + if (value.length === 4) { + formData.leaveYear = parseInt(value) - 543; + } + } +); /**old */ // const visibleColumns = ref([]); // profileData.leave.columns.length == 0 @@ -1051,11 +1078,11 @@ const getData = () => { // coupleDay.value = row.coupleDay; // therapyDay.value = row.therapyDay; formData.id = row.id; - formData.sumSick = row.sumSick =='-' ? '':row.sumSick; - formData.sumRest = row.sumRest =='-' ? '':row.sumRest; - formData.sumLate = row.sumLate =='-' ? '':row.sumLate; - formData.sumAbsent = row.sumAbsent =='-' ? '':row.sumAbsent; - formData.sumEducation = row.sumEducation =='-' ? '':row.sumEducation; + formData.sumSick = row.sumSick == "-" ? "" : row.sumSick; + formData.sumRest = row.sumRest == "-" ? "" : row.sumRest; + formData.sumLate = row.sumLate == "-" ? "" : row.sumLate; + formData.sumAbsent = row.sumAbsent == "-" ? "" : row.sumAbsent; + formData.sumEducation = row.sumEducation == "-" ? "" : row.sumEducation; formData.leaveYear = row.leaveYear == "-" ? 0 : Number(row.leaveYear) - 543; // id.value = row.id; @@ -1101,6 +1128,7 @@ const clickAdd = async () => { const clickAddLeave = async () => { clearForm(); + inputDateLaeaveYear.value = (moment().year() + 543).toString(); editRow.value = false; edit.value = true; modalAdd.value = true; @@ -1158,11 +1186,11 @@ const clickSave = async () => { if (result) { if (modalEdit.value) { // await dialogConfirm($q, () => { - editData(); + editData(); // }); } else { // await dialogConfirm($q, () => { - saveData(); + saveData(); // }); } } @@ -1324,12 +1352,19 @@ const selectData = async (props: DataProps) => { rowIndex.value = props.rowIndex; formData.id = props.row.id; - formData.sumSick = props.row.sumSick == '-' ? '':props.row.sumSick; - formData.sumRest = props.row.sumRest == '-' ? '':props.row.sumRest; - formData.sumLate = props.row.sumLate == '-' ? '':props.row.sumLate; - formData.sumAbsent = props.row.sumAbsent == '-' ? '':props.row.sumAbsent; - formData.sumEducation = props.row.sumEducation == '-' ? '':props.row.sumEducation; - formData.leaveYear = props.row.leaveYear == "-" ? 0 : Number(props.row.leaveYear) - 543; + formData.sumSick = props.row.sumSick == "-" ? "" : props.row.sumSick; + formData.sumRest = props.row.sumRest == "-" ? "" : props.row.sumRest; + formData.sumLate = props.row.sumLate == "-" ? "" : props.row.sumLate; + formData.sumAbsent = props.row.sumAbsent == "-" ? "" : props.row.sumAbsent; + formData.sumEducation = + props.row.sumEducation == "-" ? "" : props.row.sumEducation; + formData.leaveYear = + props.row.leaveYear == "-" ? 0 : Number(props.row.leaveYear) - 543; + console.log("เเก้ไข"); + + inputDateLaeaveYear.value = ((formData.leaveYear as number) + 543).toString(); + + console.log(inputDateLaeaveYear.value); // id.value = props.row.id; // typeLeave.value = props.row.typeLeaveId; @@ -1361,10 +1396,9 @@ const selectData = async (props: DataProps) => { * กดปุ่มเพิ่มบน table */ const addData = async () => { - // modalEdit.value = false; - + //modalEdit.value = false; modal.value = true; - // edit.value = true; + //edit.value = true; await clickTotal(); }; diff --git a/src/modules/04_registry/components/Other.vue b/src/modules/04_registry/components/Other.vue index fe58707e1..ff283eff8 100644 --- a/src/modules/04_registry/components/Other.vue +++ b/src/modules/04_registry/components/Other.vue @@ -57,7 +57,18 @@
+ + (""); const date = ref(new Date()); @@ -218,6 +237,26 @@ const profileId = ref( const rows = ref([]); const filter = ref(""); //search data table const visibleColumns = ref([]); + +const inputDate = ref(""); +const dayChecked = ref(false); +/** ตรวจเวลา */ +watch( + () => inputDate.value, + (value: string) => { + if (value.length === 10) { + const dateVal = convertDate(value); + if (dateVal.isValid) { + dayChecked.value = false; + date.value = new Date(dateVal.value); + } else { + dayChecked.value = true; + inputDate.value = ""; + } + } + } +); + profileData.other.columns.length == 0 ? (visibleColumns.value = ["date", "detail"]) : (visibleColumns.value = profileData.other.columns); @@ -387,6 +426,7 @@ const clickEdit = () => { * กดปุ่มเพิ่มด้านบน table */ const clickAdd = async () => { + inputDate.value = ""; editRow.value = false; await addData(); }; @@ -521,6 +561,8 @@ const selectData = async (props: DataProps) => { date.value = props.row.date; detail.value = props.row.detail; id.value = props.row.id; + + inputDate.value = convertDateDisplay(date.value); await checkRowPage(); }; diff --git a/src/modules/04_registry/components/Record.vue b/src/modules/04_registry/components/Record.vue index 2275ab6cb..46059f05f 100644 --- a/src/modules/04_registry/components/Record.vue +++ b/src/modules/04_registry/components/Record.vue @@ -65,7 +65,18 @@
+ +
+ + (""); const date = ref(new Date()); @@ -325,6 +354,45 @@ const checkValidate = ref(false); //validate data ผ่านหรื const rows = ref([]); const filter = ref(""); //search data table const visibleColumns = ref([]); +const inputDate = ref(""); +const inputDateRefCommandDate = ref( + refCommandDate.value ? convertDateDisplay(refCommandDate.value) : "" +); + +const dayChecked = ref(false); +const dayCheckedRefCommandDate = ref(false); +/** ตรวจเวลา */ +watch( + () => inputDate.value, + (value: string) => { + if (value.length === 10) { + const dateVal = convertDate(value); + if (dateVal.isValid) { + dayChecked.value = false; + date.value = new Date(dateVal.value); + } else { + dayChecked.value = true; + inputDate.value = ""; + } + } + } +); +watch( + () => inputDateRefCommandDate.value, + (value: string) => { + if (value.length === 10) { + const dateVal = convertDate(value); + if (dateVal.isValid) { + dayChecked.value = false; + refCommandDate.value = new Date(dateVal.value); + } else { + dayChecked.value = true; + inputDateRefCommandDate.value = ""; + } + } + } +); + profileData.record.columns.length == 0 ? (visibleColumns.value = [ "date", @@ -725,6 +793,11 @@ const selectData = async (props: DataProps) => { refCommandNo.value = props.row.refCommandNo; refCommandDate.value = props.row.refCommandDate; id.value = props.row.id; + + inputDate.value = convertDateDisplay(date.value); + inputDateRefCommandDate.value = refCommandDate.value + ? convertDateDisplay(refCommandDate.value) + : ""; await checkRowPage(); }; @@ -740,6 +813,8 @@ const addData = () => { reference.value = ""; refCommandNo.value = ""; refCommandDate.value = null; + inputDate.value = convertDateDisplay(date.value); + inputDateRefCommandDate.value = ""; }; /** diff --git a/src/modules/04_registry/components/Work.vue b/src/modules/04_registry/components/Work.vue index 2b7bd07e4..c2f932ae4 100644 --- a/src/modules/04_registry/components/Work.vue +++ b/src/modules/04_registry/components/Work.vue @@ -64,7 +64,20 @@
+ +
+
+ + - -
@@ -311,6 +344,7 @@