hide bottom space rule

This commit is contained in:
Kittapath 2023-03-28 13:22:07 +07:00
parent 3c12d849f6
commit a95c2fcbb4
10 changed files with 469 additions and 494 deletions

View file

@ -8,7 +8,7 @@
</div> </div>
<div v-if="editData == true"> <div v-if="editData == true">
<div class="q-gutter-sm q-mx-sm" v-if="addData == true"> <div class="q-gutter-sm q-mx-sm" v-if="addData == true">
<q-btn <!-- <q-btn
size="12px" size="12px"
v-if="!edit" v-if="!edit"
flat flat
@ -19,7 +19,7 @@
icon="mdi-pencil-outline" icon="mdi-pencil-outline"
> >
<q-tooltip>แกไขขอม</q-tooltip> <q-tooltip>แกไขขอม</q-tooltip>
</q-btn> </q-btn> -->
<q-btn <q-btn
size="12px" size="12px"
flat flat
@ -31,7 +31,7 @@
> >
<q-tooltip>นทกขอม</q-tooltip> <q-tooltip>นทกขอม</q-tooltip>
</q-btn> </q-btn>
<q-btn <!-- <q-btn
size="12px" size="12px"
flat flat
round round
@ -41,10 +41,10 @@
icon="mdi-undo" icon="mdi-undo"
> >
<q-tooltip>ยกเล</q-tooltip> <q-tooltip>ยกเล</q-tooltip>
</q-btn> </q-btn> -->
</div> </div>
<div class="q-pl-sm" v-else> <div class="q-pl-sm" v-else>
<q-btn <!-- <q-btn
size="12px" size="12px"
v-if="!edit" v-if="!edit"
flat flat
@ -55,7 +55,7 @@
icon="mdi-pencil-outline" icon="mdi-pencil-outline"
> >
<q-tooltip>แกไขขอม</q-tooltip> <q-tooltip>แกไขขอม</q-tooltip>
</q-btn> </q-btn> -->
<q-btn <q-btn
size="12px" size="12px"
flat flat
@ -67,7 +67,7 @@
> >
<q-tooltip>เพมขอม</q-tooltip> <q-tooltip>เพมขอม</q-tooltip>
</q-btn> </q-btn>
<q-btn <!-- <q-btn
size="12px" size="12px"
flat flat
round round
@ -77,7 +77,7 @@
icon="mdi-undo" icon="mdi-undo"
> >
<q-tooltip>ยกเล</q-tooltip> <q-tooltip>ยกเล</q-tooltip>
</q-btn> </q-btn> -->
</div> </div>
</div> </div>
<q-space /> <q-space />

View file

@ -64,7 +64,6 @@
<div class="col-xs-6 col-sm-6 col-md-6"> <div class="col-xs-6 col-sm-6 col-md-6">
<q-input <q-input
:class="getClass(edit)" :class="getClass(edit)"
hide-bottom-space
:outlined="edit" :outlined="edit"
dense dense
lazy-rules lazy-rules
@ -79,7 +78,6 @@
<div class="col-xs-6 col-sm-6 col-md-6"> <div class="col-xs-6 col-sm-6 col-md-6">
<q-input <q-input
:class="getClass(edit)" :class="getClass(edit)"
hide-bottom-space
:outlined="edit" :outlined="edit"
dense dense
lazy-rules lazy-rules
@ -94,7 +92,6 @@
<div class="col-xs-6 col-sm-6 col-md-6"> <div class="col-xs-6 col-sm-6 col-md-6">
<q-input <q-input
:class="getClass(edit)" :class="getClass(edit)"
hide-bottom-space
:outlined="edit" :outlined="edit"
dense dense
lazy-rules lazy-rules
@ -127,7 +124,6 @@
<q-input <q-input
:class="getClass(edit)" :class="getClass(edit)"
class="datepicker" class="datepicker"
hide-bottom-space
:outlined="edit" :outlined="edit"
dense dense
lazy-rules lazy-rules
@ -145,7 +141,6 @@
<div class="col-xs-12 col-sm-12 col-md-12"> <div class="col-xs-12 col-sm-12 col-md-12">
<q-input <q-input
:class="getClass(edit)" :class="getClass(edit)"
hide-bottom-space
:outlined="edit" :outlined="edit"
dense dense
lazy-rules lazy-rules
@ -177,11 +172,11 @@
</q-form> </q-form>
</q-card> </q-card>
</q-dialog> </q-dialog>
<q-dialog :model-value="modalConsend" persistent> <!-- <q-dialog :model-value="modalConsend" persistent>
<q-card style="min-width: 800px"> <q-card style="min-width: 800px">
<Conference :ok="consendOk" :close="consenClose" /> <Conference :ok="consendOk" :close="consenClose" />
</q-card> </q-card>
</q-dialog> </q-dialog> -->
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref, watch } from 'vue' import { onMounted, ref, watch } from 'vue'
@ -230,7 +225,7 @@ const salary = ref<number | null>()
const duration = ref<[Date, Date]>([new Date(), new Date()]) const duration = ref<[Date, Date]>([new Date(), new Date()])
const reason = ref<string>() const reason = ref<string>()
const myForm = ref<any>() //form data input const myForm = ref<any>() //form data input
const edit = ref<boolean>(false) // dialog const edit = ref<boolean>(true) // dialog
const modal = ref<boolean>(false) //modal add detail const modal = ref<boolean>(false) //modal add detail
const modalEdit = ref<boolean>(false) //modal const modalEdit = ref<boolean>(false) //modal
const rawItem = ref<RequestItemsObject>() // row const rawItem = ref<RequestItemsObject>() // row
@ -240,7 +235,7 @@ const next = ref<boolean>() //แสดงปุ่มดูข้อมูล
const editRow = ref<boolean>(false) // const editRow = ref<boolean>(false) //
const statusCode = ref<number>() const statusCode = ref<number>()
const checkValidate = ref<boolean>(false) //validate data const checkValidate = ref<boolean>(false) //validate data
const modalConsend = ref<boolean>(false) // const modalConsend = ref<boolean>(false)
const candidateId = ref<string>('2223ba53-2fb2-470b-8dc1-27e5471b0331') const candidateId = ref<string>('2223ba53-2fb2-470b-8dc1-27e5471b0331')
const rows = ref<RequestItemsObject[]>([]) const rows = ref<RequestItemsObject[]>([])
const filter = ref<string>('') //search data table const filter = ref<string>('') //search data table
@ -387,7 +382,7 @@ const checkRowPage = () => {
* กดปมแกไขใน dialog * กดปมแกไขใน dialog
*/ */
const clickEdit = () => { const clickEdit = () => {
edit.value = true // edit.value = true
next.value = false next.value = false
previous.value = false previous.value = false
} }
@ -424,11 +419,11 @@ const clickDeleteRow = async () => {
.finally(async () => { .finally(async () => {
loader.value = false loader.value = false
await fetchData() await fetchData()
edit.value = false // edit.value = false
}) })
} else { } else {
await fetchData() await fetchData()
edit.value = false // edit.value = false
} }
} }
@ -438,15 +433,15 @@ const clickDeleteRow = async () => {
const clickSave = async () => { const clickSave = async () => {
myForm.value.validate().then(async (result: boolean) => { myForm.value.validate().then(async (result: boolean) => {
if (result) { if (result) {
if (store.consend == true) { // if (store.consend == true) {
if (modalEdit.value) { if (modalEdit.value) {
await editData() await editData()
} else {
await saveData()
}
} else { } else {
modalConsend.value = true await saveData()
} }
// } else {
// modalConsend.value = true
// }
} }
}) })
} }
@ -476,7 +471,7 @@ const saveData = async () => {
}) })
.finally(async () => { .finally(async () => {
loader.value = false loader.value = false
edit.value = false // edit.value = false
modal.value = false modal.value = false
await fetchData() await fetchData()
}) })
@ -507,7 +502,7 @@ const editData = async () => {
}) })
.finally(async () => { .finally(async () => {
loader.value = false loader.value = false
edit.value = false // edit.value = false
modal.value = false modal.value = false
await fetchData() await fetchData()
}) })
@ -548,12 +543,12 @@ const selectData = (props: DataProps) => {
duration.value = props.row.duration duration.value = props.row.duration
reason.value = props.row.reason reason.value = props.row.reason
id.value = props.row.id id.value = props.row.id
if (edit.value == true) { // if (edit.value == true) {
next.value = false next.value = false
previous.value = false previous.value = false
} else { // } else {
checkRowPage() // checkRowPage()
} // }
} }
/** /**
@ -569,21 +564,21 @@ const addRow = () => {
reason.value = '' reason.value = ''
} }
const consenClose = () => { // const consenClose = () => {
modalConsend.value = false // modalConsend.value = false
} // }
const consendOk = () => { // const consendOk = () => {
modalConsend.value = false // modalConsend.value = false
store.consend = true // store.consend = true
clickSave() // clickSave()
} // }
/** /**
* งกนปมยกเลกการแกไขขอม * งกนปมยกเลกการแกไขขอม
*/ */
const clickCancel = async () => { const clickCancel = async () => {
edit.value = false // edit.value = false
} }
/** /**

View file

@ -17,7 +17,6 @@
<div class="col-4"> <div class="col-4">
<q-input <q-input
class="q-my-sm" class="q-my-sm"
hide-bottom-space
:outlined="edit" :outlined="edit"
dense dense
lazy-rules lazy-rules
@ -100,7 +99,7 @@ const props = defineProps({
} }
}) })
const edit = ref<boolean>(false) const edit = ref<boolean>(true)
const name = ref<string>('') const name = ref<string>('')
const files = ref<any>([ const files = ref<any>([
{ {

View file

@ -61,7 +61,6 @@
<div class="col-xs-6 col-sm-6 col-md-6"> <div class="col-xs-6 col-sm-6 col-md-6">
<q-select <q-select
:class="getClass(edit)" :class="getClass(edit)"
hide-bottom-space
:outlined="edit" :outlined="edit"
dense dense
lazy-rules lazy-rules
@ -81,7 +80,6 @@
<div class="col-xs-6 col-sm-6 col-md-6"> <div class="col-xs-6 col-sm-6 col-md-6">
<q-input <q-input
:class="getClass(edit)" :class="getClass(edit)"
hide-bottom-space
:outlined="edit" :outlined="edit"
dense dense
lazy-rules lazy-rules
@ -97,7 +95,6 @@
<q-input <q-input
type="number" type="number"
:class="getClass(edit)" :class="getClass(edit)"
hide-bottom-space
:outlined="edit" :outlined="edit"
dense dense
lazy-rules lazy-rules
@ -112,7 +109,6 @@
<div class="col-xs-6 col-sm-6 col-md-6"> <div class="col-xs-6 col-sm-6 col-md-6">
<q-input <q-input
:class="getClass(edit)" :class="getClass(edit)"
hide-bottom-space
:outlined="edit" :outlined="edit"
dense dense
lazy-rules lazy-rules
@ -144,7 +140,6 @@
<q-input <q-input
:class="getClass(edit)" :class="getClass(edit)"
class="datepicker" class="datepicker"
hide-bottom-space
:outlined="edit" :outlined="edit"
dense dense
lazy-rules lazy-rules
@ -178,11 +173,11 @@
</q-form> </q-form>
</q-card> </q-card>
</q-dialog> </q-dialog>
<q-dialog :model-value="modalConsend" persistent> <!-- <q-dialog :model-value="modalConsend" persistent>
<q-card style="min-width: 800px"> <q-card style="min-width: 800px">
<Conference :ok="consendOk" :close="consenClose" /> <Conference :ok="consendOk" :close="consenClose" />
</q-card> </q-card>
</q-dialog> </q-dialog> -->
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref, watch } from 'vue' import { onMounted, ref, watch } from 'vue'
@ -234,7 +229,7 @@ const scores = ref<number | null>()
const name = ref<string>() const name = ref<string>()
const duration = ref<[Date, Date]>([new Date(), new Date()]) const duration = ref<[Date, Date]>([new Date(), new Date()])
const myForm = ref<any>() //form data input const myForm = ref<any>() //form data input
const edit = ref<boolean>(false) // dialog const edit = ref<boolean>(true) // dialog
const modal = ref<boolean>(false) //modal add detail const modal = ref<boolean>(false) //modal add detail
const modalEdit = ref<boolean>(false) //modal const modalEdit = ref<boolean>(false) //modal
const rawItem = ref<RequestItemsObject>() // row const rawItem = ref<RequestItemsObject>() // row
@ -244,7 +239,7 @@ const next = ref<boolean>() //แสดงปุ่มดูข้อมูล
const editRow = ref<boolean>(false) // const editRow = ref<boolean>(false) //
const statusCode = ref<number>() const statusCode = ref<number>()
const checkValidate = ref<boolean>(false) //validate data const checkValidate = ref<boolean>(false) //validate data
const modalConsend = ref<boolean>(false) // const modalConsend = ref<boolean>(false)
const rows = ref<RequestItemsObject[]>([]) const rows = ref<RequestItemsObject[]>([])
const candidateId = ref<string>('2223ba53-2fb2-470b-8dc1-27e5471b0331') const candidateId = ref<string>('2223ba53-2fb2-470b-8dc1-27e5471b0331')
const filter = ref<string>('') //search data table const filter = ref<string>('') //search data table
@ -413,7 +408,7 @@ const checkRowPage = () => {
* กดปมแกไขใน dialog * กดปมแกไขใน dialog
*/ */
const clickEdit = () => { const clickEdit = () => {
edit.value = true // edit.value = true
next.value = false next.value = false
previous.value = false previous.value = false
} }
@ -450,11 +445,11 @@ const clickDeleteRow = async () => {
.finally(async () => { .finally(async () => {
loader.value = false loader.value = false
await fetchData() await fetchData()
edit.value = false // edit.value = false
}) })
} else { } else {
await fetchData() await fetchData()
edit.value = false // edit.value = false
} }
} }
@ -464,15 +459,15 @@ const clickDeleteRow = async () => {
const clickSave = async () => { const clickSave = async () => {
myForm.value.validate().then(async (result: boolean) => { myForm.value.validate().then(async (result: boolean) => {
if (result) { if (result) {
if (store.consend == true) { // if (store.consend == true) {
if (modalEdit.value) { if (modalEdit.value) {
await editData() await editData()
} else {
await saveData()
}
} else { } else {
modalConsend.value = true await saveData()
} }
// } else {
// modalConsend.value = true
// }
} }
}) })
} }
@ -502,7 +497,7 @@ const saveData = async () => {
}) })
.finally(async () => { .finally(async () => {
loader.value = false loader.value = false
edit.value = false // edit.value = false
modal.value = false modal.value = false
await fetchData() await fetchData()
}) })
@ -533,7 +528,7 @@ const editData = async () => {
}) })
.finally(async () => { .finally(async () => {
loader.value = false loader.value = false
edit.value = false // edit.value = false
modal.value = false modal.value = false
await fetchData() await fetchData()
}) })
@ -575,12 +570,12 @@ const selectData = (props: DataProps) => {
name.value = props.row.name name.value = props.row.name
duration.value = props.row.duration duration.value = props.row.duration
id.value = props.row.id id.value = props.row.id
if (edit.value == true) { // if (edit.value == true) {
next.value = false next.value = false
previous.value = false previous.value = false
} else { // } else {
checkRowPage() // checkRowPage()
} // }
} }
/** /**
@ -597,21 +592,21 @@ const addRow = () => {
duration.value = [new Date(), new Date()] duration.value = [new Date(), new Date()]
} }
const consenClose = () => { // const consenClose = () => {
modalConsend.value = false // modalConsend.value = false
} // }
const consendOk = () => { // const consendOk = () => {
modalConsend.value = false // modalConsend.value = false
store.consend = true // store.consend = true
clickSave() // clickSave()
} // }
/** /**
* งกนปมยกเลกการแกไขขอม * งกนปมยกเลกการแกไขขอม
*/ */
const clickCancel = async () => { const clickCancel = async () => {
edit.value = false // edit.value = false
} }
/** /**

View file

@ -9,16 +9,15 @@
:addData="true" :addData="true"
:editOnly="false" :editOnly="false"
:cancel="cancelData" :cancel="cancelData"
:changeBtn="changeBtn"
:editData="status == 'register' || status == 'rejectRegister'" :editData="status == 'register' || status == 'rejectRegister'"
:disable="statusEdit" :disable="statusEdit"
/> />
<!-- :changeBtn="changeBtn" -->
<q-form ref="myform"> <q-form ref="myform">
<div class="row col-12 items-center q-col-gutter-x-xs q-col-gutter-y-xs"> <div class="row col-12 items-center q-col-gutter-x-xs q-col-gutter-y-xs">
<div class="col-xs-12"> <div class="col-xs-12">
<q-input <q-input
:class="getClass(edit)" :class="getClass(edit)"
hide-bottom-space
:outlined="edit" :outlined="edit"
dense dense
lazy-rules lazy-rules
@ -34,7 +33,6 @@
</div> </div>
<div class="col-xs-6 col-sm-3 col-md-3"> <div class="col-xs-6 col-sm-3 col-md-3">
<q-select <q-select
hide-bottom-space
:class="getClass(edit)" :class="getClass(edit)"
:readonly="!edit" :readonly="!edit"
:borderless="!edit" :borderless="!edit"
@ -54,7 +52,6 @@
</div> </div>
<div class="col-xs-6 col-sm-3 col-md-3"> <div class="col-xs-6 col-sm-3 col-md-3">
<q-select <q-select
hide-bottom-space
:class="getClass(edit)" :class="getClass(edit)"
:readonly="!edit" :readonly="!edit"
:borderless="!edit" :borderless="!edit"
@ -74,7 +71,6 @@
</div> </div>
<div class="col-xs-6 col-sm-3 col-md-3"> <div class="col-xs-6 col-sm-3 col-md-3">
<q-select <q-select
hide-bottom-space
:class="getClass(edit)" :class="getClass(edit)"
:readonly="!edit" :readonly="!edit"
:borderless="!edit" :borderless="!edit"
@ -95,7 +91,6 @@
<div class="col-xs-6 col-sm-3 col-md-3"> <div class="col-xs-6 col-sm-3 col-md-3">
<q-input <q-input
:class="getClass(edit)" :class="getClass(edit)"
hide-bottom-space
dense dense
lazy-rules lazy-rules
readonly readonly
@ -105,7 +100,7 @@
:label="`${'รหัสไปรษณีย์'}`" :label="`${'รหัสไปรษณีย์'}`"
/> />
</div> </div>
<div class="col-12 q-pt-lg"><q-separator /></div> <div class="col-12"><q-separator /></div>
<div class="col-xs-12 q-gutter-sm items-center flex q-my-sm"> <div class="col-xs-12 q-gutter-sm items-center flex q-my-sm">
<label class="text-bold">อยจจนตรงกบทอยตามทะเบยนบาน</label> <label class="text-bold">อยจจนตรงกบทอยตามทะเบยนบาน</label>
<q-radio <q-radio
@ -131,7 +126,6 @@
<div class="col-xs-12" v-if="addressData.same == '0'"> <div class="col-xs-12" v-if="addressData.same == '0'">
<q-input <q-input
:class="getClass(edit)" :class="getClass(edit)"
hide-bottom-space
:outlined="edit" :outlined="edit"
dense dense
lazy-rules lazy-rules
@ -146,7 +140,6 @@
</div> </div>
<div class="col-xs-6 col-sm-3 col-md-3" v-if="addressData.same == '0'"> <div class="col-xs-6 col-sm-3 col-md-3" v-if="addressData.same == '0'">
<q-select <q-select
hide-bottom-space
:class="getClass(edit)" :class="getClass(edit)"
:readonly="!edit" :readonly="!edit"
:borderless="!edit" :borderless="!edit"
@ -166,7 +159,6 @@
</div> </div>
<div class="col-xs-6 col-sm-3 col-md-3" v-if="addressData.same == '0'"> <div class="col-xs-6 col-sm-3 col-md-3" v-if="addressData.same == '0'">
<q-select <q-select
hide-bottom-space
:class="getClass(edit)" :class="getClass(edit)"
:readonly="!edit" :readonly="!edit"
:borderless="!edit" :borderless="!edit"
@ -186,7 +178,6 @@
</div> </div>
<div class="col-xs-6 col-sm-3 col-md-3" v-if="addressData.same == '0'"> <div class="col-xs-6 col-sm-3 col-md-3" v-if="addressData.same == '0'">
<q-select <q-select
hide-bottom-space
:class="getClass(edit)" :class="getClass(edit)"
:readonly="!edit" :readonly="!edit"
:borderless="!edit" :borderless="!edit"
@ -207,7 +198,6 @@
<div class="col-xs-6 col-sm-3 col-md-3" v-if="addressData.same == '0'"> <div class="col-xs-6 col-sm-3 col-md-3" v-if="addressData.same == '0'">
<q-input <q-input
:class="getClass(edit)" :class="getClass(edit)"
hide-bottom-space
dense dense
lazy-rules lazy-rules
readonly readonly
@ -220,11 +210,11 @@
</div> </div>
</q-form> </q-form>
</q-card> </q-card>
<q-dialog :model-value="modalConsend" persistent> <!-- <q-dialog :model-value="modalConsend" persistent>
<q-card style="min-width: 800px"> <q-card style="min-width: 800px">
<Conference :ok="consendOk" :close="consenClose" /> <Conference :ok="consendOk" :close="consenClose" />
</q-card> </q-card>
</q-dialog> </q-dialog> -->
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted } from 'vue' import { ref, onMounted } from 'vue'
@ -237,7 +227,7 @@ import { useExamDataStore } from '@/modules/01_exam/store'
import type { Address, DataOption } from '@/modules/01_exam/interface/index/Main' import type { Address, DataOption } from '@/modules/01_exam/interface/index/Main'
import { defaultAddress } from '@/modules/01_exam/interface/index/Main' import { defaultAddress } from '@/modules/01_exam/interface/index/Main'
import HeaderTop from '@/components/top.vue' import HeaderTop from '@/components/top.vue'
import Conference from '@/modules/01_exam/components/Conference.vue' // import Conference from '@/modules/01_exam/components/Conference.vue'
const props = defineProps({ const props = defineProps({
provinceOptions: { provinceOptions: {
@ -263,10 +253,10 @@ const mixin = useCounterMixin()
const store = useExamDataStore() const store = useExamDataStore()
const { success } = mixin const { success } = mixin
const candidateId = ref<string>('2223ba53-2fb2-470b-8dc1-27e5471b0331') const candidateId = ref<string>('2223ba53-2fb2-470b-8dc1-27e5471b0331')
const edit = ref<boolean>(false) const edit = ref<boolean>(true)
const addressData = ref<Address>(defaultAddress) const addressData = ref<Address>(defaultAddress)
const myform = ref<any>() const myform = ref<any>()
const modalConsend = ref<boolean>(false) // const modalConsend = ref<boolean>(false)
const loader = ref<boolean>(false) const loader = ref<boolean>(false)
const districtOptions = ref<DataOption[]>([]) const districtOptions = ref<DataOption[]>([])
const districtCOptions = ref<DataOption[]>([]) const districtCOptions = ref<DataOption[]>([])
@ -277,10 +267,12 @@ const emit = defineEmits(['update:statusEdit'])
onMounted(async () => { onMounted(async () => {
await fetchData() await fetchData()
await fetchDistrict(addressData.value.provinceId, '1') if (addressData.value.provinceId != null) await fetchDistrict(addressData.value.provinceId, '1')
await fetchDistrict(addressData.value.provinceIdC, '2') if (addressData.value.provinceIdC != null) await fetchDistrict(addressData.value.provinceIdC, '2')
await fetchSubDistrict(addressData.value.districtId, '1') if (addressData.value.districtId != null)
await fetchSubDistrict(addressData.value.districtIdC, '2') await fetchSubDistrict(addressData.value.districtId, '1')
if (addressData.value.districtIdC != null)
await fetchSubDistrict(addressData.value.districtIdC, '2')
}) })
const fetchData = async () => { const fetchData = async () => {
@ -298,7 +290,7 @@ const fetchData = async () => {
addressData.value.subdistrictIdC = data.currentSubDistrictId addressData.value.subdistrictIdC = data.currentSubDistrictId
addressData.value.code = data.registZipCode addressData.value.code = data.registZipCode
addressData.value.codeC = data.currentZipCode addressData.value.codeC = data.currentZipCode
addressData.value.same = data.registSame == true ? '1' : '0' addressData.value.same = data.registSame == true ? '1' : data.registSame == false ? '0' : null
}) })
.catch(() => {}) .catch(() => {})
.finally(() => { .finally(() => {
@ -309,57 +301,57 @@ const fetchData = async () => {
const saveData = async () => { const saveData = async () => {
await myform.value.validate().then(async (suc: boolean) => { await myform.value.validate().then(async (suc: boolean) => {
if (suc) { if (suc) {
if (store.consend == true) { // if (store.consend == true) {
loader.value = true loader.value = true
await http await http
.post(config.API.candidateAddress(candidateId.value), { .post(config.API.candidateAddress(candidateId.value), {
registAddress: addressData.value.address, registAddress: addressData.value.address,
currentAddress: addressData.value.addressC, currentAddress: addressData.value.addressC,
registProvinceId: addressData.value.provinceId, registProvinceId: addressData.value.provinceId,
currentProvinceId: addressData.value.provinceIdC, currentProvinceId: addressData.value.provinceIdC,
registDistrictId: addressData.value.districtId, registDistrictId: addressData.value.districtId,
currentDistrictId: addressData.value.districtIdC, currentDistrictId: addressData.value.districtIdC,
registSubDistrictId: addressData.value.subdistrictId, registSubDistrictId: addressData.value.subdistrictId,
currentSubDistrictId: addressData.value.subdistrictIdC, currentSubDistrictId: addressData.value.subdistrictIdC,
registZipCode: addressData.value.code, registZipCode: addressData.value.code,
currentZipCode: addressData.value.codeC, currentZipCode: addressData.value.codeC,
registSame: registSame:
addressData.value.same == '1' ? true : addressData.value.same == '0' ? false : null addressData.value.same == '1' ? true : addressData.value.same == '0' ? false : null
}) })
.then(() => { .then(() => {
success($q, 'บันทึกข้อมูลที่อยู่สำเร็จ') success($q, 'บันทึกข้อมูลที่อยู่สำเร็จ')
edit.value = false // edit.value = false
emit('update:statusEdit', false) emit('update:statusEdit', false)
}) })
.catch(() => { .catch(() => {
// modalError.value = true // modalError.value = true
// modalErrorTittle.value = '' // modalErrorTittle.value = ''
// modalErrorDetail.value = e.response.data.message // modalErrorDetail.value = e.response.data.message
// statusCode.value = e.response.data.status // statusCode.value = e.response.data.status
}) })
.finally(async () => { .finally(async () => {
loader.value = false loader.value = false
await fetchData() await fetchData()
}) })
} else { // } else {
modalConsend.value = true // modalConsend.value = true
} // }
} }
}) })
} }
const changeBtn = async () => { // const changeBtn = async () => {
if (edit.value == true) { // if (edit.value == true) {
if (props.statusEdit === true) { // if (props.statusEdit === true) {
edit.value = false // edit.value = false
props.notiNoEdit() // props.notiNoEdit()
} else { // } else {
emit('update:statusEdit', true) // emit('update:statusEdit', true)
} // }
} else { // } else {
emit('update:statusEdit', false) // emit('update:statusEdit', false)
} // }
} // }
const selectProvince = (e: string, name: string) => { const selectProvince = (e: string, name: string) => {
if (name == '1') { if (name == '1') {
@ -388,7 +380,6 @@ const selectDistrict = (e: string, name: string) => {
} }
const selectSubDistrict = (e: string, name: string) => { const selectSubDistrict = (e: string, name: string) => {
console.log('zxc')
if (name == '1') { if (name == '1') {
const findcode = subdistrictOptions.value.filter((r) => r.id == e) const findcode = subdistrictOptions.value.filter((r) => r.id == e)
const namecode = findcode.length > 0 ? findcode[0].zipCode : null const namecode = findcode.length > 0 ? findcode[0].zipCode : null
@ -448,15 +439,15 @@ const fetchSubDistrict = async (id: string, position: string) => {
}) })
} }
const consenClose = () => { // const consenClose = () => {
modalConsend.value = false // modalConsend.value = false
} // }
const consendOk = () => { // const consendOk = () => {
modalConsend.value = false // modalConsend.value = false
store.consend = true // store.consend = true
saveData() // saveData()
} // }
const cancelData = () => {} const cancelData = () => {}

View file

@ -9,10 +9,10 @@
:addData="true" :addData="true"
:editOnly="false" :editOnly="false"
:cancel="cancelData" :cancel="cancelData"
:changeBtn="changeBtn"
:editData="status == 'register' || status == 'rejectRegister'" :editData="status == 'register' || status == 'rejectRegister'"
:disable="statusEdit" :disable="statusEdit"
/> />
<!-- :changeBtn="changeBtn" -->
<q-form ref="myform" class="col-12"> <q-form ref="myform" class="col-12">
<div class="row col-12 items-center q-col-gutter-x-xs q-col-gutter-y-xs"> <div class="row col-12 items-center q-col-gutter-x-xs q-col-gutter-y-xs">
<div class="col-xs-12 q-gutter-sm items-center flex q-my-sm"> <div class="col-xs-12 q-gutter-sm items-center flex q-my-sm">
@ -40,7 +40,6 @@
</div> </div>
<div class="col-xs-12 col-sm-2 col-md-2" v-if="familyData.same == '1'"> <div class="col-xs-12 col-sm-2 col-md-2" v-if="familyData.same == '1'">
<q-select <q-select
hide-bottom-space
:class="getClass(edit)" :class="getClass(edit)"
:readonly="!edit" :readonly="!edit"
:borderless="!edit" :borderless="!edit"
@ -61,7 +60,6 @@
<div class="col-xs-6 col-sm-3 col-md-3" v-if="familyData.same == '1'"> <div class="col-xs-6 col-sm-3 col-md-3" v-if="familyData.same == '1'">
<q-input <q-input
:class="getClass(edit)" :class="getClass(edit)"
hide-bottom-space
:outlined="edit" :outlined="edit"
dense dense
lazy-rules lazy-rules
@ -75,7 +73,6 @@
<div class="col-xs-6 col-sm-3 col-md-3" v-if="familyData.same == '1'"> <div class="col-xs-6 col-sm-3 col-md-3" v-if="familyData.same == '1'">
<q-input <q-input
:class="getClass(edit)" :class="getClass(edit)"
hide-bottom-space
:outlined="edit" :outlined="edit"
dense dense
lazy-rules lazy-rules
@ -89,7 +86,6 @@
<div class="col-xs-12 col-sm-2 col-md-2" v-if="familyData.same == '1'"> <div class="col-xs-12 col-sm-2 col-md-2" v-if="familyData.same == '1'">
<q-input <q-input
:class="getClass(edit)" :class="getClass(edit)"
hide-bottom-space
:outlined="edit" :outlined="edit"
dense dense
lazy-rules lazy-rules
@ -103,7 +99,6 @@
<div class="col-xs-12 col-sm-2 col-md-2" v-if="familyData.same == '1'"> <div class="col-xs-12 col-sm-2 col-md-2" v-if="familyData.same == '1'">
<q-input <q-input
:class="getClass(edit)" :class="getClass(edit)"
hide-bottom-space
:outlined="edit" :outlined="edit"
dense dense
lazy-rules lazy-rules
@ -118,7 +113,6 @@
<div class="col-xs-12 text-weight-bold"> ดา</div> <div class="col-xs-12 text-weight-bold"> ดา</div>
<div class="col-xs-12 col-sm-2 col-md-2"> <div class="col-xs-12 col-sm-2 col-md-2">
<q-select <q-select
hide-bottom-space
:class="getClass(edit)" :class="getClass(edit)"
:readonly="!edit" :readonly="!edit"
:borderless="!edit" :borderless="!edit"
@ -139,7 +133,6 @@
<div class="col-xs-6 col-sm-3 col-md-3"> <div class="col-xs-6 col-sm-3 col-md-3">
<q-input <q-input
:class="getClass(edit)" :class="getClass(edit)"
hide-bottom-space
:outlined="edit" :outlined="edit"
dense dense
lazy-rules lazy-rules
@ -153,7 +146,6 @@
<div class="col-xs-6 col-sm-3 col-md-3"> <div class="col-xs-6 col-sm-3 col-md-3">
<q-input <q-input
:class="getClass(edit)" :class="getClass(edit)"
hide-bottom-space
:outlined="edit" :outlined="edit"
dense dense
lazy-rules lazy-rules
@ -167,7 +159,6 @@
<div class="col-xs-12 col-sm-2 col-md-2"> <div class="col-xs-12 col-sm-2 col-md-2">
<q-input <q-input
:class="getClass(edit)" :class="getClass(edit)"
hide-bottom-space
:outlined="edit" :outlined="edit"
dense dense
lazy-rules lazy-rules
@ -181,7 +172,6 @@
<div class="col-xs-12 col-sm-2 col-md-2"> <div class="col-xs-12 col-sm-2 col-md-2">
<q-input <q-input
:class="getClass(edit)" :class="getClass(edit)"
hide-bottom-space
:outlined="edit" :outlined="edit"
dense dense
lazy-rules lazy-rules
@ -196,7 +186,6 @@
<div class="col-xs-12 text-weight-bold"> มารดา</div> <div class="col-xs-12 text-weight-bold"> มารดา</div>
<div class="col-xs-12 col-sm-2 col-md-2"> <div class="col-xs-12 col-sm-2 col-md-2">
<q-select <q-select
hide-bottom-space
:class="getClass(edit)" :class="getClass(edit)"
:readonly="!edit" :readonly="!edit"
:borderless="!edit" :borderless="!edit"
@ -216,7 +205,6 @@
<div class="col-xs-6 col-sm-3 col-md-3"> <div class="col-xs-6 col-sm-3 col-md-3">
<q-input <q-input
:class="getClass(edit)" :class="getClass(edit)"
hide-bottom-space
:outlined="edit" :outlined="edit"
dense dense
lazy-rules lazy-rules
@ -230,7 +218,6 @@
<div class="col-xs-6 col-sm-3 col-md-3"> <div class="col-xs-6 col-sm-3 col-md-3">
<q-input <q-input
:class="getClass(edit)" :class="getClass(edit)"
hide-bottom-space
:outlined="edit" :outlined="edit"
dense dense
lazy-rules lazy-rules
@ -244,7 +231,6 @@
<div class="col-xs-12 col-sm-2 col-md-2"> <div class="col-xs-12 col-sm-2 col-md-2">
<q-input <q-input
:class="getClass(edit)" :class="getClass(edit)"
hide-bottom-space
:outlined="edit" :outlined="edit"
dense dense
lazy-rules lazy-rules
@ -258,7 +244,6 @@
<div class="col-xs-12 col-sm-2 col-md-2"> <div class="col-xs-12 col-sm-2 col-md-2">
<q-input <q-input
:class="getClass(edit)" :class="getClass(edit)"
hide-bottom-space
:outlined="edit" :outlined="edit"
dense dense
lazy-rules lazy-rules
@ -272,11 +257,11 @@
</div> </div>
</q-form> </q-form>
</q-card> </q-card>
<q-dialog :model-value="modalConsend" persistent> <!-- <q-dialog :model-value="modalConsend" persistent>
<q-card style="min-width: 800px"> <q-card style="min-width: 800px">
<Conference :ok="consendOk" :close="consenClose" /> <Conference :ok="consendOk" :close="consenClose" />
</q-card> </q-card>
</q-dialog> </q-dialog> -->
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref, watch } from 'vue' import { onMounted, ref, watch } from 'vue'
@ -314,10 +299,10 @@ const $q = useQuasar()
const mixin = useCounterMixin() const mixin = useCounterMixin()
const store = useExamDataStore() const store = useExamDataStore()
const { success } = mixin const { success } = mixin
const edit = ref<boolean>(false) const edit = ref<boolean>(true)
const myform = ref<any>() const myform = ref<any>()
const familyData = ref<Family>(defaultFamily) const familyData = ref<Family>(defaultFamily)
const modalConsend = ref<boolean>(false) // const modalConsend = ref<boolean>(false)
const candidateId = ref<string>('2223ba53-2fb2-470b-8dc1-27e5471b0331') const candidateId = ref<string>('2223ba53-2fb2-470b-8dc1-27e5471b0331')
const loader = ref<boolean>(false) const loader = ref<boolean>(false)
@ -359,61 +344,61 @@ const fetchData = async () => {
const saveData = async () => { const saveData = async () => {
await myform.value.validate().then(async (suc: boolean) => { await myform.value.validate().then(async (suc: boolean) => {
if (suc) { if (suc) {
if (store.consend == true) { // if (store.consend == true) {
loader.value = true loader.value = true
await http await http
.post(config.API.candidateFamily(candidateId.value), { .post(config.API.candidateFamily(candidateId.value), {
marryPrefixId: familyData.value.prefixIdC, marryPrefixId: familyData.value.prefixIdC,
marryFirstName: familyData.value.firstnameC, marryFirstName: familyData.value.firstnameC,
marryLastName: familyData.value.lastnameC, marryLastName: familyData.value.lastnameC,
marryOccupation: familyData.value.occupationC, marryOccupation: familyData.value.occupationC,
marryNationality: familyData.value.nationalityC, marryNationality: familyData.value.nationalityC,
fatherPrefixId: familyData.value.prefixIdM, fatherPrefixId: familyData.value.prefixIdM,
fatherFirstName: familyData.value.firstnameM, fatherFirstName: familyData.value.firstnameM,
fatherLastName: familyData.value.lastnameM, fatherLastName: familyData.value.lastnameM,
fatherOccupation: familyData.value.occupationM, fatherOccupation: familyData.value.occupationM,
fatherNationality: familyData.value.nationalityM, fatherNationality: familyData.value.nationalityM,
motherPrefixId: familyData.value.prefixIdF, motherPrefixId: familyData.value.prefixIdF,
motherFirstName: familyData.value.firstnameF, motherFirstName: familyData.value.firstnameF,
motherLastName: familyData.value.lastnameF, motherLastName: familyData.value.lastnameF,
motherOccupation: familyData.value.occupationF, motherOccupation: familyData.value.occupationF,
motherNationality: familyData.value.nationalityF, motherNationality: familyData.value.nationalityF,
marry: familyData.value.same == '1' ? true : familyData.value.same == '0' ? false : null marry: familyData.value.same == '1' ? true : familyData.value.same == '0' ? false : null
}) })
.then(() => { .then(() => {
success($q, 'บันทึกข้อมูลครอบครัวสำเร็จ') success($q, 'บันทึกข้อมูลครอบครัวสำเร็จ')
edit.value = false // edit.value = false
emit('update:statusEdit', false) emit('update:statusEdit', false)
}) })
.catch(() => { .catch(() => {
// modalError.value = true // modalError.value = true
// modalErrorTittle.value = '' // modalErrorTittle.value = ''
// modalErrorDetail.value = e.response.data.message // modalErrorDetail.value = e.response.data.message
// statusCode.value = e.response.data.status // statusCode.value = e.response.data.status
}) })
.finally(async () => { .finally(async () => {
loader.value = false loader.value = false
await fetchData() await fetchData()
}) })
} else { // } else {
modalConsend.value = true // modalConsend.value = true
} // }
} }
}) })
} }
const changeBtn = async () => { // const changeBtn = async () => {
if (edit.value == true) { // if (edit.value == true) {
if (props.statusEdit === true) { // if (props.statusEdit === true) {
edit.value = false // edit.value = false
props.notiNoEdit() // props.notiNoEdit()
} else { // } else {
emit('update:statusEdit', true) // emit('update:statusEdit', true)
} // }
} else { // } else {
emit('update:statusEdit', false) // emit('update:statusEdit', false)
} // }
} // }
const selectRadio = (e: boolean) => { const selectRadio = (e: boolean) => {
if (!e) { if (!e) {
@ -424,15 +409,15 @@ const selectRadio = (e: boolean) => {
} }
} }
const consenClose = () => { // const consenClose = () => {
modalConsend.value = false // modalConsend.value = false
} // }
const consendOk = async () => { // const consendOk = async () => {
modalConsend.value = false // modalConsend.value = false
store.consend = true // store.consend = true
saveData() // saveData()
} // }
const cancelData = () => {} const cancelData = () => {}

View file

@ -9,15 +9,14 @@
:addData="true" :addData="true"
:editOnly="false" :editOnly="false"
:cancel="cancelData" :cancel="cancelData"
:changeBtn="changeBtn"
:editData="status == 'register' || status == 'rejectRegister'" :editData="status == 'register' || status == 'rejectRegister'"
:disable="statusEdit" :disable="statusEdit"
/> />
<!-- :changeBtn="changeBtn" -->
<q-form ref="myform" class="col-12 row"> <q-form ref="myform" class="col-12 row">
<div class="row col-10 items-center q-col-gutter-x-sm q-col-gutter-y-sm"> <div class="row col-10 items-center q-col-gutter-x-sm q-col-gutter-y-sm">
<div class="col-xs-6 col-sm-3 col-md-3"> <div class="col-xs-6 col-sm-3 col-md-3">
<q-select <q-select
hide-bottom-space
:class="getClass(edit)" :class="getClass(edit)"
:readonly="!edit" :readonly="!edit"
:borderless="!edit" :borderless="!edit"
@ -37,7 +36,6 @@
<div class="col-xs-6 col-sm-3 col-md-3"> <div class="col-xs-6 col-sm-3 col-md-3">
<q-input <q-input
:class="getClass(edit)" :class="getClass(edit)"
hide-bottom-space
:outlined="edit" :outlined="edit"
dense dense
lazy-rules lazy-rules
@ -51,7 +49,6 @@
<div class="col-xs-6 col-sm-3 col-md-3"> <div class="col-xs-6 col-sm-3 col-md-3">
<q-input <q-input
:class="getClass(edit)" :class="getClass(edit)"
hide-bottom-space
:outlined="edit" :outlined="edit"
dense dense
lazy-rules lazy-rules
@ -65,7 +62,6 @@
<div class="col-xs-6 col-sm-3 col-md-3"> <div class="col-xs-6 col-sm-3 col-md-3">
<q-input <q-input
:class="getClass(edit)" :class="getClass(edit)"
hide-bottom-space
:outlined="edit" :outlined="edit"
dense dense
lazy-rules lazy-rules
@ -95,13 +91,14 @@
<template #trigger> <template #trigger>
<q-input <q-input
:class="getClass(edit)" :class="getClass(edit)"
hide-bottom-space
:outlined="edit" :outlined="edit"
dense dense
lazy-rules lazy-rules
:readonly="!edit" :readonly="!edit"
:borderless="!edit" :borderless="!edit"
:model-value="date2Thai(informaData.birthDate)" :model-value="
informaData.birthDate == null ? null : date2Thai(informaData.birthDate)
"
:rules="[(val) => !!val || `${'กรุณาเลือก วัน/เดือน/ปี เกิด'}`]" :rules="[(val) => !!val || `${'กรุณาเลือก วัน/เดือน/ปี เกิด'}`]"
:label="`${'วัน/เดือน/ปี เกิด'}`" :label="`${'วัน/เดือน/ปี เกิด'}`"
> >
@ -120,19 +117,17 @@
<div class="col-xs-6 col-sm-3 col-md-3"> <div class="col-xs-6 col-sm-3 col-md-3">
<q-input <q-input
:class="getClass(edit)" :class="getClass(edit)"
hide-bottom-space
dense dense
lazy-rules lazy-rules
readonly readonly
borderless borderless
:style="!edit ? '' : 'padding:0 12px;'" :style="!edit ? '' : 'padding:0 12px;'"
:model-value="calAge(informaData.birthDate)" :model-value="informaData.birthDate == null ? null : calAge(informaData.birthDate)"
:label="`${'อายุ'}`" :label="`${'อายุ'}`"
/> />
</div> </div>
<div class="col-xs-6 col-sm-3 col-md-3"> <div class="col-xs-6 col-sm-3 col-md-3">
<q-select <q-select
hide-bottom-space
:class="getClass(edit)" :class="getClass(edit)"
:readonly="!edit" :readonly="!edit"
:borderless="!edit" :borderless="!edit"
@ -152,7 +147,6 @@
<div class="col-xs-6 col-sm-3 col-md-3"> <div class="col-xs-6 col-sm-3 col-md-3">
<q-input <q-input
:class="getClass(edit)" :class="getClass(edit)"
hide-bottom-space
:outlined="edit" :outlined="edit"
dense dense
lazy-rules lazy-rules
@ -166,9 +160,9 @@
<div class="col-xs-6 col-sm-3 col-md-3"> <div class="col-xs-6 col-sm-3 col-md-3">
<q-input <q-input
:class="getClass(edit)" :class="getClass(edit)"
hide-bottom-space
:outlined="edit" :outlined="edit"
dense dense
counter
lazy-rules lazy-rules
:readonly="!edit" :readonly="!edit"
:borderless="!edit" :borderless="!edit"
@ -183,7 +177,6 @@
</div> </div>
<div class="col-xs-6 col-sm-3 col-md-3"> <div class="col-xs-6 col-sm-3 col-md-3">
<q-select <q-select
hide-bottom-space
:class="getClass(edit)" :class="getClass(edit)"
:readonly="!edit" :readonly="!edit"
:borderless="!edit" :borderless="!edit"
@ -204,7 +197,7 @@
<div class="col-xs-6 col-sm-3 col-md-3"> <div class="col-xs-6 col-sm-3 col-md-3">
<!-- <q-input <!-- <q-input
:class="getClass(edit)" :class="getClass(edit)"
hide-bottom-space
:outlined="edit" :outlined="edit"
dense dense
lazy-rules lazy-rules
@ -215,7 +208,6 @@
label="ออกให้ ณ อำเภอ" label="ออกให้ ณ อำเภอ"
/> --> /> -->
<q-select <q-select
hide-bottom-space
:class="getClass(edit)" :class="getClass(edit)"
:readonly="!edit" :readonly="!edit"
:borderless="!edit" :borderless="!edit"
@ -252,13 +244,14 @@
<template #trigger> <template #trigger>
<q-input <q-input
:class="getClass(edit)" :class="getClass(edit)"
hide-bottom-space
:outlined="edit" :outlined="edit"
dense dense
lazy-rules lazy-rules
:readonly="!edit" :readonly="!edit"
:borderless="!edit" :borderless="!edit"
:model-value="date2Thai(informaData.cardIdDate)" :model-value="
informaData.cardIdDate == null ? null : date2Thai(informaData.cardIdDate)
"
:rules="[(val) => !!val || `${'กรุณาเลือก วัน/เดือน/ปี'}`]" :rules="[(val) => !!val || `${'กรุณาเลือก วัน/เดือน/ปี'}`]"
:label="`${'วัน/เดือน/ปี'}`" :label="`${'วัน/เดือน/ปี'}`"
> >
@ -276,13 +269,12 @@
</div> </div>
<div class="col-xs-6 col-sm-3 col-md-3"> <div class="col-xs-6 col-sm-3 col-md-3">
<q-input <q-input
hide-bottom-space
:outlined="edit" :outlined="edit"
dense dense
counter counter
lazy-rules lazy-rules
type="tel" type="tel"
maxlength="12" maxlength="10"
:class="getClass(edit)" :class="getClass(edit)"
:readonly="!edit" :readonly="!edit"
:borderless="!edit" :borderless="!edit"
@ -296,13 +288,12 @@
</div> </div>
<div class="col-xs-6 col-sm-3 col-md-3"> <div class="col-xs-6 col-sm-3 col-md-3">
<q-input <q-input
hide-bottom-space
:outlined="edit" :outlined="edit"
dense dense
counter counter
lazy-rules lazy-rules
type="tel" type="tel"
maxlength="12" maxlength="10"
:class="getClass(edit)" :class="getClass(edit)"
:readonly="!edit" :readonly="!edit"
:borderless="!edit" :borderless="!edit"
@ -317,7 +308,6 @@
<div class="col-xs-12 col-sm-12 col-md-12"> <div class="col-xs-12 col-sm-12 col-md-12">
<q-input <q-input
:class="getClass(edit)" :class="getClass(edit)"
hide-bottom-space
:outlined="edit" :outlined="edit"
dense dense
lazy-rules lazy-rules
@ -355,11 +345,11 @@
</div> </div>
</q-form> </q-form>
</q-card> </q-card>
<q-dialog :model-value="modalConsend" persistent> <!-- <q-dialog :model-value="modalConsend" persistent>
<q-card style="min-width: 800px"> <q-card style="min-width: 800px">
<Conference :ok="consendOk" :close="consenClose" /> <Conference :ok="consendOk" :close="consenClose" />
</q-card> </q-card>
</q-dialog> </q-dialog> -->
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted } from 'vue' import { ref, onMounted } from 'vue'
@ -407,12 +397,12 @@ const store = useExamDataStore()
const { date2Thai, calAge, success, dateToISO } = mixin const { date2Thai, calAge, success, dateToISO } = mixin
const districtOptions = ref<DataOption[]>([]) const districtOptions = ref<DataOption[]>([])
const candidateId = ref<string>('2223ba53-2fb2-470b-8dc1-27e5471b0331') const candidateId = ref<string>('2223ba53-2fb2-470b-8dc1-27e5471b0331')
const edit = ref<boolean>(false) const edit = ref<boolean>(true)
const informaData = ref<Information>(defaultInformation) const informaData = ref<Information>(defaultInformation)
const myform = ref<any>() const myform = ref<any>()
const imageUrl = ref<string | null>(null) const imageUrl = ref<string | null>(null)
const disabledPic = ref<boolean>(false) const disabledPic = ref<boolean>(false)
const modalConsend = ref<boolean>(false) // const modalConsend = ref<boolean>(false)
const fileData = ref<File | null>() const fileData = ref<File | null>()
const loader = ref<boolean>(false) const loader = ref<boolean>(false)
@ -420,7 +410,7 @@ const emit = defineEmits(['update:statusEdit'])
onMounted(async () => { onMounted(async () => {
await fetchData() await fetchData()
await fetchDistrict(informaData.value.provinceId) if (informaData.value.provinceId != null) await fetchDistrict(informaData.value.provinceId)
}) })
const fetchData = async () => { const fetchData = async () => {
@ -433,8 +423,8 @@ const fetchData = async () => {
informaData.value.lastname = data.lastName informaData.value.lastname = data.lastName
informaData.value.provinceId = data.citizenProvinceId informaData.value.provinceId = data.citizenProvinceId
informaData.value.districtId = data.citizenDistrictId informaData.value.districtId = data.citizenDistrictId
informaData.value.birthDate = new Date(data.dateOfBirth) informaData.value.birthDate = data.dateOfBirth == null ? null : new Date(data.dateOfBirth)
informaData.value.cardIdDate = new Date(data.citizenDate) informaData.value.cardIdDate = data.citizenDate == null ? null : new Date(data.citizenDate)
informaData.value.cardid = data.citizenId informaData.value.cardid = data.citizenId
informaData.value.firstname = data.firstName informaData.value.firstname = data.firstName
informaData.value.relationship = data.relationshipId informaData.value.relationship = data.relationshipId
@ -459,59 +449,61 @@ const selectProvince = (val: string) => {
const saveData = async () => { const saveData = async () => {
await myform.value.validate().then(async (suc: boolean) => { await myform.value.validate().then(async (suc: boolean) => {
if (suc) { if (suc) {
if (store.consend == true) { // if (store.consend == true) {
loader.value = true loader.value = true
await http await http
.post(config.API.candidateInformation(candidateId.value), { .post(config.API.candidateInformation(candidateId.value), {
prefixId: informaData.value.prefixId, prefixId: informaData.value.prefixId,
lastName: informaData.value.lastname, lastName: informaData.value.lastname,
citizenProvinceId: informaData.value.provinceId, citizenProvinceId: informaData.value.provinceId,
citizenDistrictId: informaData.value.districtId, citizenDistrictId: informaData.value.districtId,
dateOfBirth: dateToISO(informaData.value.birthDate), dateOfBirth:
citizenDate: dateToISO(informaData.value.cardIdDate), informaData.value.birthDate == null ? null : dateToISO(informaData.value.birthDate),
citizenId: informaData.value.cardid, citizenDate:
firstName: informaData.value.firstname, informaData.value.cardIdDate == null ? null : dateToISO(informaData.value.cardIdDate),
relationshipId: informaData.value.relationship, citizenId: informaData.value.cardid,
nationality: informaData.value.nationality, firstName: informaData.value.firstname,
email: informaData.value.email, relationshipId: informaData.value.relationship,
mobilePhone: informaData.value.phone, nationality: informaData.value.nationality,
telephone: informaData.value.tel, email: informaData.value.email,
knowledge: informaData.value.knowledge mobilePhone: informaData.value.phone,
}) telephone: informaData.value.tel,
.then(() => { knowledge: informaData.value.knowledge
success($q, 'บันทึกข้อมูลส่วนตัวสำเร็จ') })
edit.value = false .then(() => {
emit('update:statusEdit', false) success($q, 'บันทึกข้อมูลส่วนตัวสำเร็จ')
}) // edit.value = false
.catch(() => { emit('update:statusEdit', false)
// modalError.value = true })
// modalErrorTittle.value = '' .catch(() => {
// modalErrorDetail.value = e.response.data.message // modalError.value = true
// statusCode.value = e.response.data.status // modalErrorTittle.value = ''
}) // modalErrorDetail.value = e.response.data.message
.finally(async () => { // statusCode.value = e.response.data.status
loader.value = false })
await fetchData() .finally(async () => {
}) loader.value = false
} else { await fetchData()
modalConsend.value = true })
} // } else {
// modalConsend.value = true
// }
} }
}) })
} }
const changeBtn = async () => { // const changeBtn = async () => {
if (edit.value == true) { // if (edit.value == true) {
if (props.statusEdit === true) { // if (props.statusEdit === true) {
edit.value = false // edit.value = false
props.notiNoEdit() // props.notiNoEdit()
} else { // } else {
emit('update:statusEdit', true) // emit('update:statusEdit', true)
} // }
} else { // } else {
emit('update:statusEdit', false) // emit('update:statusEdit', false)
} // }
} // }
const fetchDistrict = async (id: string) => { const fetchDistrict = async (id: string) => {
loader.value = true loader.value = true
@ -541,15 +533,15 @@ const pickFile = () => {
disabledPic.value = true disabledPic.value = true
} }
const consenClose = () => { // const consenClose = () => {
modalConsend.value = false // modalConsend.value = false
} // }
const consendOk = () => { // const consendOk = () => {
modalConsend.value = false // modalConsend.value = false
store.consend = true // store.consend = true
saveData() // saveData()
} // }
const cancelData = () => { const cancelData = () => {
fileData.value = null fileData.value = null

View file

@ -9,10 +9,10 @@
:addData="true" :addData="true"
:editOnly="false" :editOnly="false"
:cancel="cancelData" :cancel="cancelData"
:changeBtn="changeBtn"
:editData="status == 'register' || status == 'rejectRegister'" :editData="status == 'register' || status == 'rejectRegister'"
:disable="statusEdit" :disable="statusEdit"
/> />
<!-- :changeBtn="changeBtn" -->
<q-form ref="myform"> <q-form ref="myform">
<div class="row col-12 items-center q-col-gutter-x-xs q-col-gutter-y-xs"> <div class="row col-12 items-center q-col-gutter-x-xs q-col-gutter-y-xs">
<div class="col-12 row"> <div class="col-12 row">
@ -230,11 +230,11 @@
</div> </div>
</q-form> </q-form>
</q-card> </q-card>
<q-dialog :model-value="modalConsend" persistent> <!-- <q-dialog :model-value="modalConsend" persistent>
<q-card style="min-width: 800px"> <q-card style="min-width: 800px">
<Conference :ok="consendOk" :close="consenClose" /> <Conference :ok="consendOk" :close="consenClose" />
</q-card> </q-card>
</q-dialog> </q-dialog> -->
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted } from 'vue' import { ref, onMounted } from 'vue'
@ -267,10 +267,10 @@ const $q = useQuasar()
const mixin = useCounterMixin() const mixin = useCounterMixin()
const store = useExamDataStore() const store = useExamDataStore()
const { success } = mixin const { success } = mixin
const edit = ref<boolean>(false) const edit = ref<boolean>(true)
const occupationData = ref<Occupation>(defaultOccupation) const occupationData = ref<Occupation>(defaultOccupation)
const myform = ref<any>() const myform = ref<any>()
const modalConsend = ref<boolean>(false) // const modalConsend = ref<boolean>(false)
const loader = ref<boolean>(false) const loader = ref<boolean>(false)
const candidateId = ref<string>('2223ba53-2fb2-470b-8dc1-27e5471b0331') const candidateId = ref<string>('2223ba53-2fb2-470b-8dc1-27e5471b0331')
@ -310,68 +310,68 @@ const fetchData = async () => {
const saveData = async () => { const saveData = async () => {
await myform.value.validate().then(async (suc: boolean) => { await myform.value.validate().then(async (suc: boolean) => {
if (suc) { if (suc) {
if (store.consend == true) { // if (store.consend == true) {
const type = ref<string | null>('') const type = ref<string | null>('')
if (occupationData.value.status == 'official') type.value = occupationData.value.official if (occupationData.value.status == 'official') type.value = occupationData.value.official
if (occupationData.value.status == 'personnel') type.value = occupationData.value.personnel if (occupationData.value.status == 'personnel') type.value = occupationData.value.personnel
if (occupationData.value.status == 'officialsOther') if (occupationData.value.status == 'officialsOther')
type.value = occupationData.value.officialsOther type.value = occupationData.value.officialsOther
if (occupationData.value.status == 'employee') type.value = occupationData.value.employee if (occupationData.value.status == 'employee') type.value = occupationData.value.employee
if (occupationData.value.status == 'other') type.value = occupationData.value.other if (occupationData.value.status == 'other') type.value = occupationData.value.other
loader.value = true loader.value = true
await http await http
.post(config.API.candidateOccupation(candidateId.value), { .post(config.API.candidateOccupation(candidateId.value), {
occupationType: occupationData.value.status, occupationType: occupationData.value.status,
occupationCompany: occupationData.value.company, occupationCompany: occupationData.value.company,
occupationDepartment: occupationData.value.department, occupationDepartment: occupationData.value.department,
occupationEmail: occupationData.value.email, occupationEmail: occupationData.value.email,
occupationTelephone: occupationData.value.tel, occupationTelephone: occupationData.value.tel,
occupationPosition: type.value occupationPosition: type.value
}) })
.then(() => { .then(() => {
success($q, 'บันทึกข้อมูลอาชีพสำเร็จ') success($q, 'บันทึกข้อมูลอาชีพสำเร็จ')
edit.value = false // edit.value = false
emit('update:statusEdit', false) emit('update:statusEdit', false)
}) })
.catch(() => { .catch(() => {
// modalError.value = true // modalError.value = true
// modalErrorTittle.value = '' // modalErrorTittle.value = ''
// modalErrorDetail.value = e.response.data.message // modalErrorDetail.value = e.response.data.message
// statusCode.value = e.response.data.status // statusCode.value = e.response.data.status
}) })
.finally(async () => { .finally(async () => {
loader.value = false loader.value = false
await fetchData() await fetchData()
}) })
} else { // } else {
modalConsend.value = true // modalConsend.value = true
} // }
} }
}) })
} }
const changeBtn = async () => { // const changeBtn = async () => {
if (edit.value == true) { // if (edit.value == true) {
if (props.statusEdit === true) { // if (props.statusEdit === true) {
edit.value = false // edit.value = false
props.notiNoEdit() // props.notiNoEdit()
} else { // } else {
emit('update:statusEdit', true) // emit('update:statusEdit', true)
} // }
} else { // } else {
emit('update:statusEdit', false) // emit('update:statusEdit', false)
} // }
} // }
const consenClose = () => { // const consenClose = () => {
modalConsend.value = false // modalConsend.value = false
} // }
const consendOk = () => { // const consendOk = () => {
modalConsend.value = false // modalConsend.value = false
store.consend = true // store.consend = true
saveData() // saveData()
} // }
const cancelData = () => {} const cancelData = () => {}

View file

@ -14,57 +14,57 @@ interface ChangeActive {
//ข้อมูลส่วนตัว //ข้อมูลส่วนตัว
interface Information { interface Information {
cardid: string cardid: string | null
prefix: string prefix: string | null
prefixId: string prefixId: string | null
firstname: string firstname: string | null
lastname: string lastname: string | null
birthDate: Date birthDate: Date | null
genderId: string genderId: string | null
bloodId: string bloodId: string | null
nationality: string nationality: string | null
ethnicity: string ethnicity: string | null
religionId: string religionId: string | null
tel: string tel: string | null
phone: string phone: string | null
email: string email: string | null
province: string province: string | null
provinceId: string provinceId: string | null
districtId: string districtId: string | null
cardIdDate: Date cardIdDate: Date | null
relationship: string relationship: string | null
statusId: string statusId: string | null
knowledge: string knowledge: string | null
} }
interface Family { interface Family {
prefixC: string // couple prefixC: string | null // couple
prefixIdC: string prefixIdC: string | null
firstnameC: string firstnameC: string | null
lastnameC: string lastnameC: string | null
occupationC: string occupationC: string | null
nationalityC: string nationalityC: string | null
prefixM: string // male prefixM: string | null // male
prefixIdM: string prefixIdM: string | null
firstnameM: string firstnameM: string | null
lastnameM: string lastnameM: string | null
occupationM: string occupationM: string | null
nationalityM: string nationalityM: string | null
prefixF: string // female prefixF: string | null // female
prefixIdF: string prefixIdF: string | null
firstnameF: string firstnameF: string | null
lastnameF: string lastnameF: string | null
occupationF: string occupationF: string | null
nationalityF: string nationalityF: string | null
same: string | null same: string | null
} }
interface Occupation { interface Occupation {
status: string status: string | null
company: string company: string | null
department: string department: string | null
email: string email: string | null
tel: string tel: string | null
official: string | null official: string | null
personnel: string | null personnel: string | null
officialsOther: string | null officialsOther: string | null
@ -73,17 +73,17 @@ interface Occupation {
} }
interface Address { interface Address {
address: string address: string | null
provinceId: string provinceId: string | null
districtId: string districtId: string | null
subdistrictId: string subdistrictId: string | null
code?: number | null code?: number | null
addressC: string addressC: string | null
provinceIdC: string provinceIdC: string | null
districtIdC: string districtIdC: string | null
subdistrictIdC: string subdistrictIdC: string | null
codeC?: number | null codeC?: number | null
same: string same: string | null
} }
interface DataOption { interface DataOption {
@ -202,72 +202,72 @@ const defaultCard: ExamCard[] = [
] ]
const defaultAddress: Address = { const defaultAddress: Address = {
address: 'บ้านเลขที่ 1/2 ซอย 56 ถนนตัดใหม่', address: null,
provinceId: 'กรุงเทพ', provinceId: null,
districtId: 'หนองแขม', districtId: null,
subdistrictId: 'หนองค้างพลู', subdistrictId: null,
code: 10160, // code: ,
addressC: 'บ้านเลขที่ 1/2 ซอย 56 ถนนตัดใหม่', addressC: null,
provinceIdC: 'กรุงเทพ', provinceIdC: null,
districtIdC: 'หนองแขม', districtIdC: null,
subdistrictIdC: 'หนองค้างพลู', subdistrictIdC: null,
codeC: 10160, // codeC: ,
same: '0' same: null
} }
const defaultInformation: Information = { const defaultInformation: Information = {
cardid: '', cardid: null,
prefix: '', prefix: null,
prefixId: '', prefixId: null,
firstname: '', firstname: null,
lastname: '', lastname: null,
birthDate: new Date(), birthDate: new Date(),
genderId: '', genderId: null,
bloodId: '', bloodId: null,
nationality: '', nationality: null,
ethnicity: '', ethnicity: null,
religionId: '', religionId: null,
tel: '', tel: null,
phone: '', phone: null,
email: '', email: null,
province: '', province: null,
cardIdDate: new Date(), cardIdDate: new Date(),
relationship: '', relationship: null,
knowledge: '', knowledge: null,
districtId: '', districtId: null,
provinceId: '', provinceId: null,
statusId: '' statusId: null
} }
const defaultFamily: Family = { const defaultFamily: Family = {
prefixC: 'นาย', prefixC: null,
prefixIdC: 'นาย', prefixIdC: null,
firstnameC: 'ธนาคาร', firstnameC: null,
lastnameC: 'กสิกร', lastnameC: null,
occupationC: 'ว่าง', occupationC: null,
nationalityC: 'ไทย', nationalityC: null,
prefixM: 'นาย', prefixM: null,
prefixIdM: 'นาย', prefixIdM: null,
firstnameM: 'ธนายุทธ', firstnameM: null,
lastnameM: 'ชมสิน', lastnameM: null,
occupationM: 'ว่าง', occupationM: null,
nationalityM: 'ไทย', nationalityM: null,
prefixF: 'นางสาว', prefixF: null,
prefixIdF: 'นางสาว', prefixIdF: null,
firstnameF: 'ณัฐกาล', firstnameF: null,
lastnameF: 'ชมสิน', lastnameF: null,
occupationF: 'ว่าง', occupationF: null,
nationalityF: 'ไทย', nationalityF: null,
same: '1' same: null
} }
const defaultOccupation: Occupation = { const defaultOccupation: Occupation = {
status: 'official', status: null,
company: 'บริษัท ทรู คอร์ปอเรชั่น จำกัด (มหาชน)', company: null,
department: '-', department: null,
email: 'kittapath@frappet.com', email: null,
tel: '0846464646', tel: null,
official: 'Direct Sales Staff', official: null,
personnel: null, personnel: null,
officialsOther: null, officialsOther: null,
employee: null, employee: null,

View file

@ -63,6 +63,11 @@
</q-stepper> </q-stepper>
</div> </div>
</q-card> </q-card>
<q-dialog :model-value="modalConsend" persistent>
<q-card style="min-width: 800px">
<Conference :ok="consendOk" :close="consenClose" />
</q-card>
</q-dialog>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -75,6 +80,7 @@ import config from '@/app.config'
import ExamForm from '@/modules/01_exam/components/ExamForm.vue' import ExamForm from '@/modules/01_exam/components/ExamForm.vue'
import ExamPayment from '@/modules/01_exam/components/ExamPayment.vue' import ExamPayment from '@/modules/01_exam/components/ExamPayment.vue'
import ExamFinished from '@/modules/01_exam/components/ExamFinished.vue' import ExamFinished from '@/modules/01_exam/components/ExamFinished.vue'
import Conference from '@/modules/01_exam/components/Conference.vue'
const $q = useQuasar() const $q = useQuasar()
const store = useExamDataStore() const store = useExamDataStore()
@ -84,6 +90,7 @@ const tittle = ref<string>('การสอบภาค ข. พิเศษ ส
const candidateId = ref<string>('2223ba53-2fb2-470b-8dc1-27e5471b0331') const candidateId = ref<string>('2223ba53-2fb2-470b-8dc1-27e5471b0331')
const loader = ref<boolean>(false) const loader = ref<boolean>(false)
const status = ref<string>('register') const status = ref<string>('register')
const modalConsend = ref<boolean>(false)
onMounted(async () => { onMounted(async () => {
await candidateCheck() await candidateCheck()
@ -99,6 +106,7 @@ const candidateCheck = async () => {
if (store.consend == true) { if (store.consend == true) {
await fetchStep() await fetchStep()
} else { } else {
modalConsend.value = true
stepRaw.value = 2 stepRaw.value = 2
step.value = 2 step.value = 2
} }
@ -148,6 +156,16 @@ const fetchStep = async () => {
}) })
} }
const consenClose = () => {
modalConsend.value = false
}
const consendOk = () => {
modalConsend.value = false
// store.consend = true
// saveData()
}
/** /**
* logout keycloak * logout keycloak
* confirm อนออกจากระบบ * confirm อนออกจากระบบ