แก้ไขการ fetch ข้อมูล

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-11-27 09:23:43 +07:00
parent 4bcc414a4f
commit d3629cff31
5 changed files with 19 additions and 5 deletions

View file

@ -25,7 +25,7 @@ const props = defineProps({
type: Function,
required: true,
},
fetcthDataTable: {
fetchData: {
type: Function,
require: true,
},
@ -59,7 +59,6 @@ const checkstatusBox = ref<boolean>(false)
/** function checkValidate*/
function onCkickSave() {
props.closePopup?.()
const hasError = []
for (const key in objectRef) {
if (Object.prototype.hasOwnProperty.call(objectRef, key)) {
@ -107,6 +106,7 @@ async function createListTime(data: FormTimeStemp) {
})
.finally(() => {
props.closePopup?.()
props.fetchData?.()
})
}

View file

@ -21,6 +21,10 @@ const props = defineProps({
type: Object,
default: null,
},
fetchData: {
type: Function,
default: () => console.log('not function'),
},
})
const data = ref<any>()
@ -39,7 +43,11 @@ watch(
<q-dialog v-model="props.modal">
<q-card class="column" style="width: 300px; min-height: 600px">
<HeaderPopup :title="props.title" :clickClose="clickClosePopup" />
<FormTime :dataById="data" :closePopup="clickClosePopup" />
<FormTime
:dataById="data"
:closePopup="clickClosePopup"
:fetchData="props.fetchData"
/>
</q-card>
</q-dialog>
</template>

View file

@ -431,6 +431,7 @@ const checkRequestEdit = (checkInStatus: string, checkOutStatus: string) => {
</q-table>
<Popup
:fetchData="props.fetchData"
:modal="modalPopup"
:clickClose="closePopup"
:title="titlePopup"

View file

@ -27,7 +27,6 @@ function onClickopen() {
}
function onClickClose() {
modalPopup.value = false
props.fetchData?.()
}
</script>
<template>
@ -80,7 +79,12 @@ function onClickClose() {
</div>
</div>
<Popup :modal="modalPopup" :title="titleName" :clickClose="onClickClose" />
<Popup
:modal="modalPopup"
:title="titleName"
:clickClose="onClickClose"
:fetchData="props.fetchData"
/>
</template>
<style scoped></style>