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

View file

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