ต่อapiคนสมัครกรอกข้อมูลสมัครสอบ

This commit is contained in:
Kittapath 2023-03-25 01:07:18 +07:00
parent f74972e5ec
commit b7a91fa326
16 changed files with 567 additions and 522 deletions

View file

@ -14,7 +14,7 @@
:edit="clickEdit"
:cancel="clickCancel"
:addData="false"
:editData="step == 2"
:editData="status == 'register' || status == 'rejectRegister'"
name="ประวัติการศีกษา"
icon="mdi-school"
>
@ -169,7 +169,7 @@
:validate="validateData"
:clickNext="clickNext"
:clickPrevious="clickPrevious"
:editData="step == 2"
:editData="status == 'register' || status == 'rejectRegister'"
v-model:editvisible="edit"
v-model:next="next"
v-model:previous="previous"
@ -186,22 +186,22 @@
</template>
<script setup lang="ts">
import { onMounted, ref, watch } from 'vue'
import Table from '@/components/Table.vue'
import DialogHeader from '@/components/DialogHeader.vue'
import DialogFooter from '@/components/DialogFooter.vue'
import { useQuasar } from 'quasar'
import { useCounterMixin } from '@/stores/mixin'
import http from '@/plugins/http'
import config from '@/app.config'
import { useExamDataStore } from '@/modules/01_exam/store'
import type {
RequestItemsObject,
Columns,
DataProps
} from '@/modules/01_exam/interface/request/Education'
import type { ResponseObject } from '@/modules/01_exam/interface/response/Education'
import type { DataOption } from '@/modules/01_exam/interface/index/Main'
import http from '@/plugins/http'
import config from '@/app.config'
import type { ResponseObject } from '@/modules/01_exam/interface/response/Education'
import Table from '@/components/Table.vue'
import DialogHeader from '@/components/DialogHeader.vue'
import DialogFooter from '@/components/DialogFooter.vue'
import Conference from '@/modules/01_exam/components/Conference.vue'
import { useExamDataStore } from '@/modules/01_exam/store'
const props = defineProps({
loader: {
@ -209,8 +209,8 @@ const props = defineProps({
type: Boolean,
required: true
},
step: {
type: Number,
status: {
type: String,
required: true
},
statusEdit: {
@ -247,11 +247,10 @@ const checkValidate = ref<boolean>(false) //validate data ผ่านหรื
const modalConsend = ref<boolean>(false)
const rows = ref<RequestItemsObject[]>([])
const candidateId = ref<string>('2223ba53-2fb2-470b-8dc1-27e5471b0331')
const filter = ref<string>('') //search data table
const emit = defineEmits(['update:loader', 'update:statusEdit'])
const filter = ref<string>('') //search data table
const visibleColumns = ref<String[]>([])
examData.education.columns.length == 0
@ -322,6 +321,7 @@ onMounted(async () => {
await fetchData()
await fetcheducationLevel()
})
const fetchData = async () => {
loader.value = true
await http
@ -329,7 +329,7 @@ const fetchData = async () => {
.then((res) => {
const data = res.data.result
rows.value = []
data.map((r: any) => {
data.map((r: ResponseObject) => {
rows.value.push({
...r,
educationLevelId: r.educationLevel.id,
@ -338,14 +338,14 @@ const fetchData = async () => {
})
})
})
.catch((e: any) => {})
.catch(() => {})
.finally(() => {
loader.value = false
})
}
const fetcheducationLevel = async () => {
// loader.value = true;
loader.value = true
await http
.get(config.API.educationLevel)
.then((res) => {
@ -356,9 +356,9 @@ const fetcheducationLevel = async () => {
})
educationLevelOptions.value = option
})
.catch((e) => {})
.catch(() => {})
.finally(() => {
// loader.value = false;
loader.value = false
})
}
@ -366,7 +366,6 @@ const fetcheducationLevel = async () => {
* กดดอมลกอนหน
*/
const clickPrevious = () => {
// edit.value = false
rowIndex.value -= 1
const row = rows.value[rowIndex.value]
educationLevel.value = row.educationLevel
@ -383,7 +382,6 @@ const clickPrevious = () => {
* กดดอมลตอไป
*/
const clickNext = () => {
// edit.value = false
rowIndex.value += 1
const row = rows.value[rowIndex.value]
educationLevel.value = row.educationLevel
@ -443,13 +441,14 @@ const clickDeleteRow = async () => {
.then(() => {
success($q, 'ลบข้อมูลสำเร็จ')
})
.catch((e) => {
.catch(() => {
// modalError.value = true
// modalErrorTittle.value = ''
// modalErrorDetail.value = e.response.data.message
statusCode.value = e.response.data.status
// statusCode.value = e.response.data.status
})
.finally(async () => {
loader.value = false
await fetchData()
edit.value = false
})
@ -492,16 +491,18 @@ const saveData = async () => {
durationStart: dateToISO(new Date(duration.value[0])),
durationEnd: dateToISO(new Date(duration.value[1]))
})
.then((res) => {
.then(() => {
success($q, 'บันทึกข้อมูลร่างสำเร็จ')
})
.catch((e) => {
.catch(() => {
// modalError.value = true
// modalErrorTittle.value = ''
// modalErrorDetail.value = e.response.data.message
statusCode.value = e.response.data.status
// statusCode.value = e.response.data.status
})
.finally(async () => {
loader.value = false
edit.value = false
modal.value = false
await fetchData()
})
@ -521,17 +522,17 @@ const editData = async () => {
durationStart: dateToISO(new Date(duration.value[0])),
durationEnd: dateToISO(new Date(duration.value[1]))
})
.then((res) => {
.then(() => {
success($q, 'บันทึกข้อมูลร่างสำเร็จ')
})
.catch((e) => {
.catch(() => {
// modalError.value = true
// modalErrorTittle.value = ''
// modalErrorDetail.value = e.response.data.message
statusCode.value = e.response.data.status
// statusCode.value = e.response.data.status
})
.finally(async () => {
edit.value = false
loader.value = false
edit.value = false
modal.value = false
await fetchData()
@ -588,7 +589,6 @@ const selectData = (props: DataProps) => {
const addRow = () => {
modalEdit.value = false
modal.value = true
// edit.value = true
educationLevel.value = ''
educationLevelId.value = ''
major.value = ''