consend form

This commit is contained in:
Kittapath 2023-03-22 00:25:55 +07:00
parent 6fe6aed921
commit 380eb0d10b
17 changed files with 482 additions and 346 deletions

View file

@ -177,10 +177,14 @@
</q-form>
</q-card>
</q-dialog>
<q-dialog :model-value="modalConsend" persistent>
<q-card style="min-width: 800px">
<Conference :ok="consendOk" :close="consenClose" />
</q-card>
</q-dialog>
</template>
<script setup lang="ts">
import { onMounted, ref, watch } from 'vue'
import { useExamDataStore } from '@/modules/01_exam/store'
import Table from '@/components/Table.vue'
import DialogHeader from '@/components/DialogHeader.vue'
import DialogFooter from '@/components/DialogFooter.vue'
@ -194,6 +198,8 @@ import type {
import type { ResponseObject } from '@/modules/01_exam/interface/response/Career'
import http from '@/plugins/http'
import config from '@/app.config'
import Conference from '@/modules/01_exam/components/Conference.vue'
import { useExamDataStore } from '@/modules/01_exam/store'
const props = defineProps({
loader: {
@ -213,7 +219,7 @@ const props = defineProps({
const $q = useQuasar()
const mixin = useCounterMixin() //
const { dateThaiRange, notifyDelete, notifyConfirm } = mixin
const { dateThaiRange, modalDelete, modalConfirm } = mixin
const store = useExamDataStore()
const { examData, changeExamColumns } = store
const loader = ref<boolean>(false)
@ -234,6 +240,7 @@ const next = ref<boolean>() //แสดงปุ่มดูข้อมูล
const editRow = ref<boolean>(false) //
const statusCode = ref<number>()
const checkValidate = ref<boolean>(false) //validate data
const modalConsend = ref<boolean>(false)
const emit = defineEmits(['update:loader', 'update:statusEdit'])
@ -397,7 +404,7 @@ const clickAdd = () => {
const checkDelete = (row: RequestItemsObject) => {
rawItem.value = row
notifyDelete($q, 'ยืนยันการลบข้อมูล', 'หากต้องการลบกดให้กดตกลง', clickDeleteRow)
modalDelete($q, 'ยืนยันการลบข้อมูล', 'หากต้องการลบกดให้กดตกลง', clickDeleteRow)
}
/**
@ -414,10 +421,14 @@ function clickDeleteRow() {
const clickSave = async () => {
myForm.value.validate().then(async (result: boolean) => {
if (result) {
if (modalEdit.value) {
await editData()
if (store.consend == true) {
if (modalEdit.value) {
await editData()
} else {
await saveData()
}
} else {
await saveData()
modalConsend.value = true
}
}
})
@ -427,8 +438,8 @@ const clickSave = async () => {
* นทกเพมขอม
*/
const saveData = async () => {
edit.value = false
modal.value = false
// loader.value = true;
// await http
// .post(config.API.xxxxxxxxxxxxxxx, {
@ -453,9 +464,8 @@ const saveData = async () => {
* นทกแกไขขอม
*/
const editData = async () => {
// edit.value = false
editRow.value = false
edit.value = false
modal.value = false
// loader.value = true;
// await http
// .post(config.API.xxxxxxxxxxxxxxx(id.value), {
@ -478,7 +488,7 @@ const editData = async () => {
const checkClose = async () => {
if (editRow.value == true) {
notifyConfirm($q, 'ข้อมูลมีการแก้ไข', 'ยืนยันการดำเนินต่อใช่หรือไม่', clickClose)
modalConfirm($q, 'ข้อมูลมีการแก้ไข', 'ยืนยันการดำเนินต่อใช่หรือไม่', clickClose)
} else {
await clickClose()
}
@ -532,6 +542,16 @@ const addRow = () => {
reason.value = ''
}
const consenClose = () => {
modalConsend.value = false
}
const consendOk = () => {
modalConsend.value = false
store.consend = true
clickSave()
}
/**
* งกนปมยกเลกการแกไขขอม
*/

View file

@ -1,66 +1,78 @@
<!-- card ปโหลดเอกสาร -->
<template>
<q-card flat bordered class="col-12 q-px-lg q-py-md">
<HeaderTop
v-model:edit="edit"
header="อัปโหลดเอกสาร(เช่น สำเนาบัตรประชาชน ทะเบียนบ้าน วุฒิการศึกษา)"
icon="mdi-file-document"
:addData="true"
:editOnly="true"
:cancel="cancelData"
:editData="step == 2"
/>
<div class="row col-12 q-gutter-sm q-pt-sm">
<div v-if="edit" class="col-12 q-ma-none">
<q-input
class="q-my-sm"
hide-bottom-space
:outlined="edit"
dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="name"
:rules="[(val) => !!val || `${'กรุณากรอกชื่อเอกสาร'}`]"
:label="`${'ชื่อเอกสาร'}`"
/>
<q-uploader
color="blue"
type="file"
flat
auto-upload
:factory="fileUpload"
class="full-width"
accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
bordered
label="[ไฟล์ jpg,png,pdf,csv,doc]"
/>
</div>
<div class="col-12">
<HeaderTop
v-model:edit="edit"
header="อัปโหลดเอกสาร(เช่น สำเนาบัตรประชาชน ทะเบียนบ้าน วุฒิการศึกษา)"
icon="mdi-file-document"
:addData="true"
:editOnly="true"
:cancel="cancelData"
:editData="step == 2"
/>
</div>
<q-separator class="q-mt-sm" />
<q-card bordered flat class="full-width">
<q-list separator>
<q-item v-for="file in files" :key="file.key" class="q-my-xs">
<q-item-section>
<q-item-label class="full-width ellipsis">
{{ file.name }}
</q-item-label>
<div class="col-12">
<div v-if="edit" class="row justify-center q-pa-md">
<div class="col-4">
<q-input
class="q-my-sm"
hide-bottom-space
:outlined="edit"
dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="name"
:rules="[(val) => !!val || `${'กรุณากรอกชื่อเอกสาร'}`]"
:label="`${'ชื่อเอกสาร'}`"
/>
<q-uploader
color="blue"
type="file"
flat
auto-upload
:factory="fileUpload"
class="full-width"
accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
bordered
label="[ไฟล์ jpg,png,pdf,csv,doc]"
/>
</div>
</div>
<q-separator class="q-mt-sm" />
<q-card bordered flat class="full-width">
<q-list separator>
<q-item v-for="file in files" :key="file.key" class="q-my-xs">
<q-item-section>
<q-item-label class="full-width ellipsis">
{{ file.name }}
</q-item-label>
<q-item-label caption> สถานะ: {{ file.status }} / {{ file.sizeLabel }} </q-item-label>
</q-item-section>
<q-item-section top side>
<div class="q-gutter-sm">
<q-btn size="12px" flat dense round color="blue" icon="mdi-download-outline">
<q-tooltip>ดาวนโหลด</q-tooltip>
</q-btn>
<q-btn size="12px" flat dense round color="red" icon="mdi-delete-outline" v-if="edit">
<q-tooltip>ลบไฟล</q-tooltip>
</q-btn>
</div>
</q-item-section>
</q-item>
</q-list>
</q-card>
<q-item-label caption> สถานะ: {{ file.status }} / {{ file.sizeLabel }} </q-item-label>
</q-item-section>
<q-item-section top side>
<div class="q-gutter-sm">
<q-btn size="12px" flat dense round color="blue" icon="mdi-download-outline">
<q-tooltip>ดาวนโหลด</q-tooltip>
</q-btn>
<q-btn
size="12px"
flat
dense
round
color="red"
icon="mdi-delete-outline"
v-if="edit"
>
<q-tooltip>ลบไฟล</q-tooltip>
</q-btn>
</div>
</q-item-section>
</q-item>
</q-list>
</q-card>
</div>
</q-card>
</template>
<script setup lang="ts">

View file

@ -178,10 +178,14 @@
</q-form>
</q-card>
</q-dialog>
<q-dialog :model-value="modalConsend" persistent>
<q-card style="min-width: 800px">
<Conference :ok="consendOk" :close="consenClose" />
</q-card>
</q-dialog>
</template>
<script setup lang="ts">
import { onMounted, ref, watch } from 'vue'
import { useExamDataStore } from '@/modules/01_exam/store'
import Table from '@/components/Table.vue'
import DialogHeader from '@/components/DialogHeader.vue'
import DialogFooter from '@/components/DialogFooter.vue'
@ -196,6 +200,8 @@ import type { ResponseObject } from '@/modules/01_exam/interface/response/Educat
import type { DataOption } from '@/modules/01_exam/interface/index/Main'
import http from '@/plugins/http'
import config from '@/app.config'
import Conference from '@/modules/01_exam/components/Conference.vue'
import { useExamDataStore } from '@/modules/01_exam/store'
const props = defineProps({
loader: {
@ -215,7 +221,7 @@ const props = defineProps({
const $q = useQuasar()
const mixin = useCounterMixin() //
const { dateThaiRange, notifyDelete, notifyConfirm } = mixin
const { dateThaiRange, modalDelete, modalConfirm } = mixin
const store = useExamDataStore()
const { examData, changeExamColumns } = store
const loader = ref<boolean>(false)
@ -238,6 +244,7 @@ const next = ref<boolean>() //แสดงปุ่มดูข้อมูล
const editRow = ref<boolean>(false) //
const statusCode = ref<number>()
const checkValidate = ref<boolean>(false) //validate data
const modalConsend = ref<boolean>(false)
const emit = defineEmits(['update:loader', 'update:statusEdit'])
@ -424,7 +431,7 @@ const clickAdd = () => {
const checkDelete = (row: RequestItemsObject) => {
rawItem.value = row
notifyDelete($q, 'ยืนยันการลบข้อมูล', 'หากต้องการลบกดให้กดตกลง', clickDeleteRow)
modalDelete($q, 'ยืนยันการลบข้อมูล', 'หากต้องการลบกดให้กดตกลง', clickDeleteRow)
}
/**
@ -441,10 +448,14 @@ function clickDeleteRow() {
const clickSave = async () => {
myForm.value.validate().then(async (result: boolean) => {
if (result) {
if (modalEdit.value) {
await editData()
if (store.consend == true) {
if (modalEdit.value) {
await editData()
} else {
await saveData()
}
} else {
await saveData()
modalConsend.value = true
}
}
})
@ -454,8 +465,8 @@ const clickSave = async () => {
* นทกเพมขอม
*/
const saveData = async () => {
edit.value = false
modal.value = false
// loader.value = true;
// await http
// .post(config.API.xxxxxxxxxxxxxxx, {
@ -480,9 +491,8 @@ const saveData = async () => {
* นทกแกไขขอม
*/
const editData = async () => {
// edit.value = false
editRow.value = false
edit.value = false
modal.value = false
// loader.value = true;
// await http
// .post(config.API.xxxxxxxxxxxxxxx(id.value), {
@ -505,7 +515,7 @@ const editData = async () => {
const checkClose = async () => {
if (editRow.value == true) {
notifyConfirm($q, 'ข้อมูลมีการแก้ไข', 'ยืนยันการดำเนินต่อใช่หรือไม่', clickClose)
modalConfirm($q, 'ข้อมูลมีการแก้ไข', 'ยืนยันการดำเนินต่อใช่หรือไม่', clickClose)
} else {
await clickClose()
}
@ -561,6 +571,16 @@ const addRow = () => {
duration.value = [new Date(), new Date()]
}
const consenClose = () => {
modalConsend.value = false
}
const consendOk = () => {
modalConsend.value = false
store.consend = true
clickSave()
}
/**
* งกนปมยกเลกการแกไขขอม
*/

View file

@ -19,12 +19,6 @@
:step="step"
/>
<Occupation v-model:statusEdit="statusEdit" :notiNoEdit="notiNoEdit" :step="step" />
<NotifyError
:modal="modalNoEdit"
:tittle="modalNoEditTittle"
:detail="modalNoEditDetail"
:close="closeModalError"
/>
</template>
<script setup lang="ts">
import { ref, onMounted, watch } from 'vue'
@ -33,7 +27,6 @@ import Information from '@/modules/01_exam/components/Form/Profile/Information.v
import Address from '@/modules/01_exam/components/Form/Profile/Address.vue'
import Family from '@/modules/01_exam/components/Form/Profile/Family.vue'
import Occupation from '@/modules/01_exam/components/Form/Profile/Occupation.vue'
import NotifyError from '@/components/NotifyError.vue'
import http from '@/plugins/http'
import config from '@/app.config'
import { useQuasar } from 'quasar'
@ -55,18 +48,11 @@ const props = defineProps({
}
})
const $q = useQuasar()
const mixin = useCounterMixin() //
const { notifyConfirm } = mixin
const { modalError } = mixin
const loader = ref<boolean>(true)
const statusEdit = ref<boolean>(false)
const modalNoEdit = ref<boolean>(false)
// const modalNoEditTittle = ref<string>('?')
// const modalNoEditDetail = ref<string>(
// ' '
// )
const modalNoEditTittle = ref<string>('ไม่สามารถไม่สามารถแก้ไขข้อมูลได้?')
const modalNoEditDetail = ref<string>('มีข้อมูลที่ยังไม่ถูกบันทึกข้อมูล')
const prefixOptions = ref<DataOption[]>([])
const bloodOptions = ref<DataOption[]>([])
const genderOptions = ref<DataOption[]>([])
@ -80,11 +66,7 @@ watch(statusEdit, (count: boolean, prevCount: boolean) => {
emit('update:statusEdit', count)
})
const closeModalError = () => {
modalNoEdit.value = false
}
const notiNoEdit = () => {
modalNoEdit.value = true
modalError($q, 'ไม่สามารถไม่สามารถแก้ไขข้อมูลได้', 'มีข้อมูลที่ยังไม่ถูกบันทึกข้อมูล')
}
</script>

View file

@ -220,6 +220,11 @@
</div>
</q-form>
</q-card>
<q-dialog :model-value="modalConsend" persistent>
<q-card style="min-width: 800px">
<Conference :ok="consendOk" :close="consenClose" />
</q-card>
</q-dialog>
</template>
<script setup lang="ts">
import { ref, onMounted, watch } from 'vue'
@ -230,8 +235,11 @@ import config from '@/app.config'
import type { Address, DataOption, zipCodeOption } from '@/modules/01_exam/interface/index/Main'
import { defaultAddress } from '@/modules/01_exam/interface/index/Main'
import HeaderTop from '@/components/top.vue'
import Conference from '@/modules/01_exam/components/Conference.vue'
import { useExamDataStore } from '@/modules/01_exam/store'
const mixin = useCounterMixin()
const store = useExamDataStore()
const { date2Thai, calAge } = mixin
const edit = ref<boolean>(false)
@ -239,6 +247,7 @@ const addressData = ref<Address>(defaultAddress)
const myform = ref<any>()
const codep = ref<string>('')
const codec = ref<string>('')
const modalConsend = ref<boolean>(false)
const provinceOptions = ref<DataOption[]>([])
const districtOptions = ref<DataOption[]>([])
@ -270,11 +279,17 @@ onMounted(() => {
})
const saveData = async () => {
await myform.value.validate().then(async (success: boolean) => {
if (success) {
} else {
}
})
if (store.consend == true) {
edit.value = false
emit('update:statusEdit', false)
await myform.value.validate().then(async (success: boolean) => {
if (success) {
} else {
}
})
} else {
modalConsend.value = true
}
}
const changeBtn = async () => {
@ -402,6 +417,16 @@ const fetchSubDistrict = async (id: string, position: string) => {
// })
}
const consenClose = () => {
modalConsend.value = false
}
const consendOk = () => {
modalConsend.value = false
store.consend = true
saveData()
}
const cancelData = () => {}
const getClass = (val: boolean) => {

View file

@ -272,6 +272,11 @@
</div>
</q-form>
</q-card>
<q-dialog :model-value="modalConsend" persistent>
<q-card style="min-width: 800px">
<Conference :ok="consendOk" :close="consenClose" />
</q-card>
</q-dialog>
</template>
<script setup lang="ts">
import { onMounted, ref, watch } from 'vue'
@ -280,14 +285,18 @@ 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 Conference from '@/modules/01_exam/components/Conference.vue'
import { useExamDataStore } from '@/modules/01_exam/store'
const mixin = useCounterMixin()
const store = useExamDataStore()
const { date2Thai, calAge } = mixin
const edit = ref<boolean>(false)
const myform = ref<any>()
const familyData = ref<Family>(defaultFamily)
const statusOptions = ref<DataOption[]>([])
const modalConsend = ref<boolean>(false)
// const prefixOptions = ref<any>([
// { id: "1", name: "" },
@ -319,11 +328,17 @@ const emit = defineEmits(['update:statusEdit'])
onMounted(() => {})
const saveData = async () => {
await myform.value.validate().then(async (success: boolean) => {
if (success) {
} else {
}
})
if (store.consend == true) {
edit.value = false
emit('update:statusEdit', false)
await myform.value.validate().then(async (success: boolean) => {
if (success) {
} else {
}
})
} else {
modalConsend.value = true
}
}
const changeBtn = async () => {
@ -348,6 +363,16 @@ const selectRadio = (e: boolean, i: any) => {
}
}
const consenClose = () => {
modalConsend.value = false
}
const consendOk = () => {
modalConsend.value = false
store.consend = true
saveData()
}
const cancelData = () => {}
const getClass = (val: boolean) => {

View file

@ -84,6 +84,7 @@
:enableTimePicker="false"
week-start="0"
:max-date="new Date()"
:disabled="!edit"
>
<template #year="{ year }">
{{ year + 543 }}
@ -218,6 +219,7 @@
:enableTimePicker="false"
week-start="0"
:max-date="new Date()"
:disabled="!edit"
>
<template #year="{ year }">
{{ year + 543 }}
@ -325,6 +327,11 @@
</div>
</q-form>
</q-card>
<q-dialog :model-value="modalConsend" persistent>
<q-card style="min-width: 800px">
<Conference :ok="consendOk" :close="consenClose" />
</q-card>
</q-dialog>
</template>
<script setup lang="ts">
import { ref, onMounted, watch } from 'vue'
@ -336,8 +343,11 @@ import HeaderTop from '@/components/top.vue'
import http from '@/plugins/http'
import config from '@/app.config'
import type { file } from '@babel/types'
import Conference from '@/modules/01_exam/components/Conference.vue'
import { useExamDataStore } from '@/modules/01_exam/store'
const mixin = useCounterMixin()
const store = useExamDataStore()
const { date2Thai, calAge } = mixin
const edit = ref<boolean>(false)
@ -346,6 +356,7 @@ const provinceOptions = ref<DataOption[]>([])
const myform = ref<any>()
const imageUrl = ref<string | null>(null)
const disabledPic = ref<boolean>(false)
const modalConsend = ref<boolean>(false)
const fileData = ref<File | null>()
const props = defineProps({
prefixOptions: {
@ -393,11 +404,17 @@ onMounted(() => {
})
const saveData = async () => {
await myform.value.validate().then(async (success: boolean) => {
if (success) {
} else {
}
})
if (store.consend == true) {
edit.value = false
emit('update:statusEdit', false)
await myform.value.validate().then(async (success: boolean) => {
if (success) {
} else {
}
})
} else {
modalConsend.value = true
}
}
const changeBtn = async () => {
@ -442,6 +459,16 @@ const pickFile = () => {
disabledPic.value = true
}
const consenClose = () => {
modalConsend.value = false
}
const consendOk = () => {
modalConsend.value = false
store.consend = true
saveData()
}
const cancelData = () => {
fileData.value = null
disabledPic.value = false

View file

@ -230,6 +230,11 @@
</div>
</q-form>
</q-card>
<q-dialog :model-value="modalConsend" persistent>
<q-card style="min-width: 800px">
<Conference :ok="consendOk" :close="consenClose" />
</q-card>
</q-dialog>
</template>
<script setup lang="ts">
import { ref, onMounted, watch } from 'vue'
@ -239,10 +244,15 @@ import config from '@/app.config'
import type { Occupation } from '@/modules/01_exam/interface/index/Main'
import { defaultOccupation } from '@/modules/01_exam/interface/index/Main'
import HeaderTop from '@/components/top.vue'
import Conference from '@/modules/01_exam/components/Conference.vue'
import { useExamDataStore } from '@/modules/01_exam/store'
const store = useExamDataStore()
const edit = ref<boolean>(false)
const occupationData = ref<Occupation>(defaultOccupation)
const myform = ref<any>()
const modalConsend = ref<boolean>(false)
const props = defineProps({
statusEdit: {
@ -264,11 +274,17 @@ const emit = defineEmits(['update:statusEdit'])
onMounted(() => {})
const saveData = async () => {
await myform.value.validate().then(async (success: boolean) => {
if (success) {
} else {
}
})
if (store.consend == true) {
edit.value = false
emit('update:statusEdit', false)
await myform.value.validate().then(async (success: boolean) => {
if (success) {
} else {
}
})
} else {
modalConsend.value = true
}
}
const changeBtn = async () => {
@ -284,6 +300,16 @@ const changeBtn = async () => {
}
}
const consenClose = () => {
modalConsend.value = false
}
const consendOk = () => {
modalConsend.value = false
store.consend = true
saveData()
}
const cancelData = () => {}
const getClass = (val: boolean) => {