ต่อ Api prefix /educationLevel
This commit is contained in:
parent
579f56dbcd
commit
c289ed17ad
4 changed files with 134 additions and 14 deletions
|
|
@ -48,11 +48,11 @@
|
|||
:outlined="edit"
|
||||
dense
|
||||
lazy-rules
|
||||
v-model="familyData.prefixIdC"
|
||||
v-model="prefixRelation"
|
||||
emit-value
|
||||
map-options
|
||||
option-label="name"
|
||||
:options="prefixOptions"
|
||||
:options="prefixRelationOptions"
|
||||
option-value="id"
|
||||
:label="`${'คำนำหน้า'}`"
|
||||
/>
|
||||
|
|
@ -126,11 +126,11 @@
|
|||
:outlined="edit"
|
||||
dense
|
||||
lazy-rules
|
||||
v-model="familyData.prefixIdM"
|
||||
v-model="prefixDad"
|
||||
emit-value
|
||||
map-options
|
||||
option-label="name"
|
||||
:options="prefixOptions"
|
||||
:options="prefixDadOptions"
|
||||
option-value="id"
|
||||
:label="`${'คำนำหน้า'}`"
|
||||
/>
|
||||
|
|
@ -204,11 +204,11 @@
|
|||
:outlined="edit"
|
||||
dense
|
||||
lazy-rules
|
||||
v-model="familyData.prefixIdF"
|
||||
v-model="prefixMom"
|
||||
emit-value
|
||||
map-options
|
||||
option-label="name"
|
||||
:options="prefixOptions"
|
||||
:options="prefixMomOptions"
|
||||
option-value="id"
|
||||
:label="`${'คำนำหน้า'}`"
|
||||
/>
|
||||
|
|
@ -280,10 +280,17 @@ import { useCounterMixin } from '@/stores/mixin'
|
|||
import type { Family, DataOption } from '@/modules/01_exam/interface/index/Main'
|
||||
import { defaultFamily } from '@/modules/01_exam/interface/index/Main'
|
||||
import HeaderTop from '@/components/top.vue'
|
||||
import http from '@/plugins/http'
|
||||
import config from '@/app.config'
|
||||
|
||||
const mixin = useCounterMixin()
|
||||
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 myform = ref<any>()
|
||||
const familyData = ref<Family>(defaultFamily)
|
||||
|
|
@ -316,7 +323,71 @@ const props = defineProps({
|
|||
|
||||
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 () => {
|
||||
await myform.value.validate().then(async (success: boolean) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue