ต่อ Api prefix /educationLevel

This commit is contained in:
AnandaTon 2023-03-21 17:24:01 +07:00
parent 579f56dbcd
commit c289ed17ad
4 changed files with 134 additions and 14 deletions

View file

@ -67,14 +67,14 @@
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="qualificationId"
v-model="educationLevel"
:rules="[(val) => !!val || `${'กรุณาเลือกวุฒิที่ได้รับ'}`]"
:label="`${'วุฒิที่ได้รับ'}`"
@update:modelValue="clickEditRow"
emit-value
map-options
option-label="name"
:options="qualificationOptions"
:options="educationLevelOptions"
option-value="id"
/>
</div>
@ -220,9 +220,10 @@ const store = useExamDataStore()
const { examData, changeExamColumns } = store
const loader = ref<boolean>(false)
const id = ref<string>()
const educationLevel = ref<string>()
const qualification = ref<string>()
const qualificationId = ref<string>()
const qualificationOptions = ref<DataOption[]>([])
const educationLevelOptions = ref<DataOption[]>([])
const major = ref<string>()
const scores = ref<number | null>()
const name = ref<string>()
@ -333,8 +334,27 @@ watch(edit, (count: boolean, prevCount: boolean) => {
onMounted(async () => {
// await fetchData()
// await fetchQualification()
fetcheducationLevel()
})
const fetcheducationLevel = async () => {
// loader.value = true;
await http
.get(config.API.educationLevel)
.then((res) => {
const data = res.data.result
let option: DataOption[] = []
data.map((r: DataOption) => {
option.push({ id: r.id.toString(), name: r.name.toString() })
})
educationLevelOptions.value = option
})
.catch((e) => {})
.finally(() => {
// loader.value = false;
})
}
const fetchQualification = async () => {
// loader.value = true;
// await http