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

View file

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

View file

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

View file

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

View file

@ -109,6 +109,7 @@ onMounted(() => {
<div class="col-12 q-pa-md text-grey-9"> <div class="col-12 q-pa-md text-grey-9">
<ToolBar :fetchData="fetchlistHistory" @update:year="updateYear" /> <ToolBar :fetchData="fetchlistHistory" @update:year="updateYear" />
<Table <Table
:fetchData="fetchlistHistory"
:page-size="pageSize" :page-size="pageSize"
:total="total" :total="total"
:page="page" :page="page"