ต่อ api หน้า information

This commit is contained in:
AnandaTon 2023-03-24 13:41:07 +07:00
parent 4c78d4eab4
commit 79182a1e86
3 changed files with 36 additions and 9 deletions

View file

@ -179,7 +179,6 @@
(val) => val.length >= 13 || `${'กรุณากรอกเลขบัตรประจำตัวประชาชนให้ครบ'}`
]"
label="เลขบัตรประจำตัวประชาชน"
mask="#############"
/>
</div>
<div class="col-xs-6 col-sm-3 col-md-3">
@ -198,7 +197,7 @@
option-label="name"
:options="provinceOptions"
option-value="id"
:label="`${'จังหวัด'}`"
:label="`${'ออกให้ ณ จังหวัด'}`"
@update:model-value="(value) => selectProvince(value)"
/>
</div>
@ -364,7 +363,7 @@
import { ref, onMounted, watch } from 'vue'
import { useCounterMixin } from '@/stores/mixin'
import type { PropType } from 'vue'
import type { Information, DataOption } from '@/modules/01_exam/interface/index/Main'
import { Information, DataOption } from '@/modules/01_exam/interface/index/Main'
import { defaultInformation } from '@/modules/01_exam/interface/index/Main'
import HeaderTop from '@/components/top.vue'
import http from '@/plugins/http'
@ -380,6 +379,8 @@ const prefixOptions = ref<DataOption[]>([])
const relationshipOptions = ref<DataOption[]>([])
const districtOptions = ref<DataOption[]>([])
const candidateId = ref<string>('2223ba53-2fb2-470b-8dc1-27e5471b0331')
const edit = ref<boolean>(false)
const informaData = ref<Information>(defaultInformation)
const provinceOptions = ref<DataOption[]>([])
@ -436,11 +437,28 @@ onMounted(async () => {
await fetchProvince()
await fetchDistrict(informaData.value.provinceId)
})
const fetchData = () => {
informaData.value.prefix = 'e4e6a4f8-39c6-467f-bd84-7650d105fc4c'
informaData.value.relationship = '02fbc0e3-1da0-45b5-90da-783d344b5896'
informaData.value.provinceId = '02fbc0e3-1da0-45b5-90da-783d344b5896'
informaData.value.districtId = 'e4e6a4f8-39c6-467f-bd84-7650d105fc4c'
const fetchData = async () => {
await http
.get(config.API.countDashbordSubHistory(candidateId.value))
.then((res) => {
const data = res.data.result
informaData.value.prefix = data.prefixId
informaData.value.lastname = data.lastName
informaData.value.province = data.citizenProvinceId
informaData.value.districtId = data.citizenDistrictId
informaData.value.birthDate = new Date(data.dateOfBirth)
informaData.value.cardIdDate = new Date(data.dateOfBirth)
informaData.value.cardid = data.citizenId
informaData.value.firstname = data.firstName
informaData.value.relationship = data.relationshipId
informaData.value.nationality = data.nationality
informaData.value.email = data.email
// informaData.value = data
})
.catch((e: any) => {})
.finally(() => {
// loader.value = false;
})
}
const selectProvince = (e: string) => {
informaData.value.districtId = ''