ต่อ 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

@ -1,7 +1,15 @@
import env from '../index' import env from '../index'
const dashbord = `${env.API_URI}/dashbord/` const dashbord = `${env.API_URI}/dashbord/`
const prefix = `${env.API_URI}/prefix/`
const religion = `${env.API_URI}/religion/`
const relationship = `${env.API_URI}/relationship/`
const educationLevel = `${env.API_URI}/education-level/`
export default { export default {
countDashbordSubHistory: (type: number) => `${dashbord}${type}`, countDashbordSubHistory: (type: number) => `${dashbord}${type}`,
countDashbordHistory: `${dashbord}` countDashbordHistory: `${dashbord}`,
prefix,
religion,
relationship,
educationLevel
} }

View file

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

View file

@ -48,11 +48,11 @@
:outlined="edit" :outlined="edit"
dense dense
lazy-rules lazy-rules
v-model="familyData.prefixIdC" v-model="prefixRelation"
emit-value emit-value
map-options map-options
option-label="name" option-label="name"
:options="prefixOptions" :options="prefixRelationOptions"
option-value="id" option-value="id"
:label="`${'คำนำหน้า'}`" :label="`${'คำนำหน้า'}`"
/> />
@ -126,11 +126,11 @@
:outlined="edit" :outlined="edit"
dense dense
lazy-rules lazy-rules
v-model="familyData.prefixIdM" v-model="prefixDad"
emit-value emit-value
map-options map-options
option-label="name" option-label="name"
:options="prefixOptions" :options="prefixDadOptions"
option-value="id" option-value="id"
:label="`${'คำนำหน้า'}`" :label="`${'คำนำหน้า'}`"
/> />
@ -204,11 +204,11 @@
:outlined="edit" :outlined="edit"
dense dense
lazy-rules lazy-rules
v-model="familyData.prefixIdF" v-model="prefixMom"
emit-value emit-value
map-options map-options
option-label="name" option-label="name"
:options="prefixOptions" :options="prefixMomOptions"
option-value="id" option-value="id"
:label="`${'คำนำหน้า'}`" :label="`${'คำนำหน้า'}`"
/> />
@ -280,10 +280,17 @@ import { useCounterMixin } from '@/stores/mixin'
import type { Family, DataOption } from '@/modules/01_exam/interface/index/Main' import type { Family, DataOption } from '@/modules/01_exam/interface/index/Main'
import { defaultFamily } from '@/modules/01_exam/interface/index/Main' import { defaultFamily } from '@/modules/01_exam/interface/index/Main'
import HeaderTop from '@/components/top.vue' import HeaderTop from '@/components/top.vue'
import http from '@/plugins/http'
import config from '@/app.config'
const mixin = useCounterMixin() const mixin = useCounterMixin()
const { date2Thai, calAge } = mixin const { date2Thai, calAge } = mixin
const prefixRelation = ref<string>()
const prefixMom = ref<string>()
const prefixDad = ref<string>()
const prefixDadOptions = ref<DataOption[]>([])
const prefixMomOptions = ref<DataOption[]>([])
const prefixRelationOptions = ref<DataOption[]>([])
const edit = ref<boolean>(false) const edit = ref<boolean>(false)
const myform = ref<any>() const myform = ref<any>()
const familyData = ref<Family>(defaultFamily) const familyData = ref<Family>(defaultFamily)
@ -316,7 +323,71 @@ const props = defineProps({
const emit = defineEmits(['update:statusEdit']) const emit = defineEmits(['update:statusEdit'])
onMounted(() => {}) onMounted(() => {
fetchData()
fetchprefixMom()
fetchprefixDad()
fetchprefixRelation()
})
const fetchData = () => {
prefixRelation.value = 'e4e6a4f8-39c6-467f-bd84-7650d105fc4c'
prefixDad.value = '02fbc0e3-1da0-45b5-90da-783d344b5896'
prefixMom.value = '362405f7-9ca2-4f3a-b5ac-08b56c24555d'
}
const fetchprefixMom = async () => {
// loader.value = true;
await http
.get(config.API.prefix)
.then((res) => {
const data = res.data.result
let option: DataOption[] = []
data.map((r: DataOption) => {
option.push({ id: r.id.toString(), name: r.name.toString() })
})
prefixMomOptions.value = option
})
.catch((e) => {})
.finally(() => {
// loader.value = false;
})
}
const fetchprefixDad = async () => {
// loader.value = true;
await http
.get(config.API.prefix)
.then((res) => {
const data = res.data.result
let option: DataOption[] = []
data.map((r: DataOption) => {
option.push({ id: r.id.toString(), name: r.name.toString() })
})
prefixDadOptions.value = option
})
.catch((e) => {})
.finally(() => {
// loader.value = false;
})
}
const fetchprefixRelation = async () => {
// loader.value = true;
await http
.get(config.API.prefix)
.then((res) => {
const data = res.data.result
let option: DataOption[] = []
data.map((r: DataOption) => {
option.push({ id: r.id.toString(), name: r.name.toString() })
})
prefixRelationOptions.value = option
})
.catch((e) => {})
.finally(() => {
// loader.value = false;
})
}
const saveData = async () => { const saveData = async () => {
await myform.value.validate().then(async (success: boolean) => { await myform.value.validate().then(async (success: boolean) => {

View file

@ -135,11 +135,11 @@
:outlined="edit" :outlined="edit"
dense dense
lazy-rules lazy-rules
v-model="informaData.statusId" v-model="relationship"
emit-value emit-value
map-options map-options
option-label="name" option-label="name"
:options="statusOptions" :options="relationshipOptions"
option-value="id" option-value="id"
:label="`${'สถานภาพ'}`" :label="`${'สถานภาพ'}`"
/> />
@ -340,8 +340,10 @@ import type { file } from '@babel/types'
const mixin = useCounterMixin() const mixin = useCounterMixin()
const { date2Thai, calAge } = mixin const { date2Thai, calAge } = mixin
const prefix = ref<string>() const prefix = ref<string>()
const relationship = ref<string>()
const prefixOptions = ref<DataOption[]>([]) const prefixOptions = ref<DataOption[]>([])
const relationshipOptions = ref<DataOption[]>([])
const edit = ref<boolean>(false) const edit = ref<boolean>(false)
const informaData = ref<Information>(defaultInformation) const informaData = ref<Information>(defaultInformation)
@ -394,6 +396,7 @@ const emit = defineEmits(['update:statusEdit'])
onMounted(() => { onMounted(() => {
// fetchProvince() // fetchProvince()
fetchprefix() fetchprefix()
fetchrelationship()
}) })
const saveData = async () => { const saveData = async () => {
@ -452,6 +455,24 @@ const fetchprefix = async () => {
// loader.value = false; // loader.value = false;
}) })
} }
const fetchrelationship = async () => {
// loader.value = true;
await http
.get(config.API.relationship)
.then((res) => {
const data = res.data.result
let option: DataOption[] = []
data.map((r: DataOption) => {
option.push({ id: r.id.toString(), name: r.name.toString() })
})
relationshipOptions.value = option
})
.catch((e) => {})
.finally(() => {
// loader.value = false;
})
}
const savePic = () => { const savePic = () => {
disabledPic.value = false disabledPic.value = false
} }