ต่อ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-briefcase"
>
@ -168,7 +168,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"
@ -185,21 +185,21 @@
</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/Career'
import type { ResponseObject } from '@/modules/01_exam/interface/response/Career'
import http from '@/plugins/http'
import config from '@/app.config'
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: {
@ -207,8 +207,8 @@ const props = defineProps({
type: Boolean,
required: true
},
step: {
type: Number,
status: {
type: String,
required: true
},
statusEdit: {
@ -242,13 +242,11 @@ const statusCode = ref<number>()
const checkValidate = ref<boolean>(false) //validate data
const modalConsend = ref<boolean>(false)
const candidateId = ref<string>('2223ba53-2fb2-470b-8dc1-27e5471b0331')
const rows = ref<RequestItemsObject[]>([])
const filter = ref<string>('') //search data table
const emit = defineEmits(['update:loader', 'update:statusEdit'])
const rows = ref<RequestItemsObject[]>([])
const filter = ref<string>('') //search data table
const visibleColumns = ref<String[]>([])
examData.career.columns.length == 0
@ -326,7 +324,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,
location: r.name,
@ -334,7 +332,7 @@ const fetchData = async () => {
})
})
})
.catch((e: any) => {})
.catch(() => {})
.finally(() => {
loader.value = false
})
@ -344,7 +342,6 @@ const fetchData = async () => {
* กดดอมลกอนหน
*/
const clickPrevious = () => {
// edit.value = false
rowIndex.value -= 1
const row = rows.value[rowIndex.value]
location.value = row.location
@ -360,7 +357,6 @@ const clickPrevious = () => {
* กดดอมลตอไป
*/
const clickNext = () => {
// edit.value = false
rowIndex.value += 1
const row = rows.value[rowIndex.value]
location.value = row.location
@ -419,13 +415,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
})
@ -458,8 +455,6 @@ const clickSave = async () => {
* นทกเพมขอม
*/
const saveData = async () => {
edit.value = false
modal.value = false
loader.value = true
await http
.post(config.API.candidateCareer(candidateId.value), {
@ -470,16 +465,18 @@ const saveData = async () => {
durationEnd: dateToISO(new Date(duration.value[1])),
reason: reason.value
})
.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()
})
@ -489,8 +486,6 @@ const saveData = async () => {
* นทกแกไขขอม
*/
const editData = async () => {
edit.value = false
modal.value = false
loader.value = true
await http
.put(config.API.candidateCareer(id.value), {
@ -501,17 +496,19 @@ const editData = async () => {
durationEnd: dateToISO(new Date(duration.value[1])),
reason: reason.value
})
.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()
})
}
@ -565,7 +562,6 @@ const selectData = (props: DataProps) => {
const addRow = () => {
modalEdit.value = false
modal.value = true
// edit.value = true
location.value = ''
position.value = ''
salary.value = null