fix fetchData ใหม่

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-01-09 09:44:14 +07:00
parent 1c490719b9
commit 424808fab0
2 changed files with 30 additions and 6 deletions

View file

@ -150,9 +150,7 @@
/> />
</div> </div>
<div class="col-xs-4 col-sm-5 q-pr-sm text-grey-7">ความคดเห/อแนะนำ</div> <div class="col-xs-4 col-sm-5 q-pr-sm text-grey-7">ความคดเห/อแนะนำ</div>
<div class="col-xs-8 col-sm-6 q-pr-xs"> <div class="col-xs-8 col-sm-6 q-pr-xs">{{ review }}</div>
{{ review }}
</div>
</div> </div>
</div> </div>
</q-card> </q-card>
@ -161,7 +159,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { useQuasar } from 'quasar' import { useQuasar } from 'quasar'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import { onMounted, ref } from 'vue' import { onMounted, ref, watch } from 'vue'
import http from '@/plugins/http' import http from '@/plugins/http'
import config from '@/app.config' import config from '@/app.config'
@ -200,6 +198,15 @@ const reviewPoint = ref<number>(0)
const review = ref<string>('-') const review = ref<string>('-')
const candidateId = ref<string>('') const candidateId = ref<string>('')
const props = defineProps({
isSubmit: {
type: Boolean,
required: true
}
})
const emit = defineEmits(['updateIsSubmit'])
onMounted(async () => { onMounted(async () => {
await fetchStatus() await fetchStatus()
}) })
@ -243,6 +250,7 @@ const fetchStatus = async () => {
}) })
.finally(() => { .finally(() => {
loaderPage(false) loaderPage(false)
emit('updateIsSubmit') // event 'submit'
}) })
} }
@ -272,6 +280,15 @@ const downloadFilePDF = async (res: string, fileName: string) => {
document.body.appendChild(link) document.body.appendChild(link)
link.click() link.click()
} }
watch(
() => props.isSubmit,
() => {
if (props.isSubmit) {
fetchStatus()
}
}
)
</script> </script>
<style scoped></style> <style scoped></style>

View file

@ -35,7 +35,7 @@
/> />
</div> </div>
</q-card> </q-card>
<ExamCard /> <ExamCard :isSubmit="isSubmit" @updateIsSubmit="updateIsSubmit" />
</div> </div>
</div> </div>
<q-dialog v-model="dialog" persistent> <q-dialog v-model="dialog" persistent>
@ -127,6 +127,7 @@ const avatar = ref<string>('')
const dialog = ref<boolean>(false) const dialog = ref<boolean>(false)
const rating = ref<number>(5) const rating = ref<number>(5)
const text = ref<string>('') const text = ref<string>('')
const isSubmit = ref<boolean>(false)
onMounted(async () => { onMounted(async () => {
await fetchStatus() await fetchStatus()
@ -174,7 +175,9 @@ const sendRating = async () => {
reviewPoint: rating.value, // reviewPoint: rating.value, //
review: text.value // review: text.value //
}) })
.then((res) => {}) .then(async () => {
isSubmit.value = true
})
.catch((e) => { .catch((e) => {
messageError($q, e) messageError($q, e)
}) })
@ -184,6 +187,10 @@ const sendRating = async () => {
}) })
} }
const updateIsSubmit = () => {
isSubmit.value = false
}
const getClass = (val: string) => { const getClass = (val: string) => {
return val == 'done' || val == 'checkPoint' ? 'bg-green-1' : 'bg-yellow-2' return val == 'done' || val == 'checkPoint' ? 'bg-green-1' : 'bg-yellow-2'
} }