consend form
This commit is contained in:
parent
6fe6aed921
commit
380eb0d10b
17 changed files with 482 additions and 346 deletions
|
|
@ -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()
|
||||
}
|
||||
|
||||
/**
|
||||
* ฟังก์ชันปุ่มยกเลิกการแก้ไขข้อมูล
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue