diff --git a/src/components/FormTime.vue b/src/components/FormTime.vue index 030dbc5..51a19b7 100644 --- a/src/components/FormTime.vue +++ b/src/components/FormTime.vue @@ -28,11 +28,14 @@ const props = defineProps({ fetchData: { type: Function, require: true, + default: () => { + console.log('fetchData func') + }, }, }) const dataByIdVal = ref([]) -const date = ref(null) +const date = ref(null) const checkboxIn = ref(false) const checkboxOut = ref(false) const reason = ref('') @@ -78,7 +81,7 @@ function onCkickSave() { ) ) { dialogConfirm($q, async () => { - const data: FormTimeStemp = { + const data: FormTimeStemp = await { checkDate: date.value, checkInEdit: checkboxIn.value, checkOutEdit: checkboxOut.value, @@ -86,8 +89,6 @@ function onCkickSave() { } createListTime(data) }) - } else { - console.log('ไม่ผ่าน ') } } @@ -106,7 +107,7 @@ async function createListTime(data: FormTimeStemp) { }) .finally(() => { props.closePopup?.() - props.fetchData?.() + props.fetchData() }) } @@ -118,7 +119,9 @@ onMounted(() => { if (dataByIdVal.value == null) { statusAction.value = true } else { - date.value = new Date(dataByIdVal.value.checkInDateTime) + date.value = moment(new Date(dataByIdVal.value.checkInDateTime)).format( + 'YYYY-MM-DD' + ) } }) @@ -153,14 +156,15 @@ watch( - +