แก้ไข กรณี แก้ไข + ยกเลิก
This commit is contained in:
parent
016f256d38
commit
4959e0847e
6 changed files with 54 additions and 27 deletions
|
|
@ -6,7 +6,7 @@ import { useCounterMixin } from "@/stores/mixin";
|
|||
import CurrencyInput from "@/components/CurruncyInput.vue";
|
||||
import type { ResponseTitle } from "@/modules/05_placement/interface/response/Receive";
|
||||
import type { appointmentData,ResponseData } from "@/modules/05_placement/interface/response/AppointMent";
|
||||
|
||||
import type { QForm } from "quasar";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
|
|
@ -21,7 +21,7 @@ prefixId:"",
|
|||
firstname:"",
|
||||
lastname:""
|
||||
});
|
||||
const myform = ref<any>();
|
||||
const myForm = ref<QForm | null>(null);
|
||||
const edit = ref<boolean>(false);
|
||||
const profileId = ref<string>("");
|
||||
const organizationPositionOld = ref<string>("");
|
||||
|
|
@ -87,12 +87,18 @@ const fecthappointmentByid = async () => {
|
|||
|
||||
//ยืนยันการเเก้ไข
|
||||
const clickSave = async () => {
|
||||
await myform.value.validate().then(async (success: boolean) => {
|
||||
if (success) {
|
||||
dialogConfirm($q, () => putAppointment());
|
||||
} else {
|
||||
}
|
||||
});
|
||||
if (myForm.value !== null) {
|
||||
myForm.value.validate().then((success: any) => {
|
||||
if (success) {
|
||||
dialogConfirm(
|
||||
$q,
|
||||
async () => await putAppointment(),
|
||||
"ต้องการแก้ไขข้อมูลหรือไม่?",
|
||||
"แก้ไขข้อมูลเพื่อลงบัญชีแนบท้าย"
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
// เเก้ไขข้อมูล
|
||||
const putAppointment = async () => {
|
||||
|
|
@ -127,7 +133,7 @@ const putAppointment = async () => {
|
|||
const cancel = () => {
|
||||
edit.value = false
|
||||
fecthappointmentByid()
|
||||
|
||||
myForm.value?.resetValidation()
|
||||
}
|
||||
const getClass = (val: boolean) => {
|
||||
return {
|
||||
|
|
@ -210,7 +216,7 @@ onMounted(async () => {
|
|||
</div>
|
||||
</div>
|
||||
<div class="col-12"><q-separator /></div>
|
||||
<q-form ref="myform">
|
||||
<q-form ref="myForm">
|
||||
<div class="row col-12 q-pa-md">
|
||||
<div class="col-12">
|
||||
<div class="text-weight-bold text-grey">วุฒิการศึกษา</div>
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ const responseData = ref<ResponseDataDetail>({
|
|||
const edit = ref<boolean>(false);
|
||||
const organizationPositionOld = ref<string>("");
|
||||
const positionTypeOld = ref<string>("");
|
||||
const myform = ref<any>();
|
||||
const myForm = ref<QForm | null>(null);
|
||||
const positionLevelOld = ref<string>("");
|
||||
const posNo = ref<string>("");
|
||||
const salary = ref<number>(0);
|
||||
|
|
@ -111,13 +111,20 @@ const fecthOther = async () => {
|
|||
|
||||
//-----(edit)-----//
|
||||
const clickEdit = async () => {
|
||||
await myform.value.validate().then(async (success: boolean) => {
|
||||
if (success) {
|
||||
dialogConfirm($q, () => saveOther());
|
||||
} else {
|
||||
}
|
||||
});
|
||||
if (myForm.value !== null) {
|
||||
myForm.value.validate().then((success: any) => {
|
||||
if (success) {
|
||||
dialogConfirm(
|
||||
$q,
|
||||
async () => await saveOther(),
|
||||
"ต้องการแก้ไขข้อมูลหรือไม่?",
|
||||
"แก้ไขข้อมูลเพื่อลงบัญชีแนบท้าย"
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
//-----(update)-----//
|
||||
const saveOther = async () => {
|
||||
let data = {
|
||||
|
|
@ -145,6 +152,11 @@ const saveOther = async () => {
|
|||
await fecthOther();
|
||||
});
|
||||
};
|
||||
const cancel = () => {
|
||||
edit.value = false;
|
||||
fecthOther();
|
||||
myForm.value?.resetValidation()
|
||||
};
|
||||
const getClass = (val: boolean) => {
|
||||
return {
|
||||
"full-width inputgreen cursor-pointer": val,
|
||||
|
|
@ -227,12 +239,12 @@ onMounted(async () => {
|
|||
<q-btn outline color="public" dense class="q-px-sm" label="บันทึก"
|
||||
style="width: 80px" @click="clickEdit" />
|
||||
<q-btn outline color="red" dense class="q-px-sm" label="ยกเลิก"
|
||||
style="width: 80px" @click="(edit = !edit), fecthOther()" />
|
||||
style="width: 80px" @click="cancel()" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12"><q-separator /></div>
|
||||
<q-form ref="myform">
|
||||
<q-form ref="myForm">
|
||||
<div class="row col-12 q-pa-md">
|
||||
<div class="col-12 row bg-white q-col-gutter-md">
|
||||
<div class="col-xs-12 row items-center">
|
||||
|
|
|
|||
|
|
@ -272,7 +272,7 @@ const cancel = async () => {
|
|||
edit.value = !edit.value;
|
||||
if (myForm.value !== null) {
|
||||
await getData();
|
||||
myForm.value.reset();
|
||||
myForm.value?.resetValidation()
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -108,6 +108,7 @@ const conditionSave = async () => {
|
|||
const cancelBtn = () => {
|
||||
edit.value = !edit;
|
||||
getData();
|
||||
myForm.value?.resetValidation()
|
||||
};
|
||||
const saveData = async () => {
|
||||
const body = {
|
||||
|
|
|
|||
|
|
@ -277,6 +277,7 @@ const saveData = async () => {
|
|||
const cancel = () => {
|
||||
edit.value = false
|
||||
getData()
|
||||
myForm.value?.resetValidation()
|
||||
}
|
||||
const getClass = (val: boolean) => {
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -89,17 +89,24 @@ const getClass = (val: boolean) => {
|
|||
};
|
||||
//
|
||||
const conditionSave = async () => {
|
||||
dialogConfirm(
|
||||
$q,
|
||||
async () => await saveData(),
|
||||
"ต้องการแก้ไขข้อมูลหรือไม่?",
|
||||
"แก้ไขข้อมูลเพื่อลงบัญชีแนบท้าย"
|
||||
);
|
||||
if (myForm.value !== null) {
|
||||
myForm.value.validate().then((success: any) => {
|
||||
if (success) {
|
||||
dialogConfirm(
|
||||
$q,
|
||||
async () => await saveData(),
|
||||
"ต้องการแก้ไขข้อมูลหรือไม่?",
|
||||
"แก้ไขข้อมูลเพื่อลงบัญชีแนบท้าย"
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const cancelBtn = () => {
|
||||
edit.value = !edit;
|
||||
getData();
|
||||
myForm.value?.resetValidation()
|
||||
};
|
||||
const saveData = async () => {
|
||||
const body = {
|
||||
|
|
@ -201,7 +208,7 @@ onMounted(async () => {
|
|||
</div>
|
||||
</div>
|
||||
<div class="col-12"><q-separator /></div>
|
||||
<q-form ref="myForm " class="window-width">
|
||||
<q-form ref="myForm" class="window-width">
|
||||
<div class="row col-12 q-pa-md">
|
||||
<div class="col-12 row bg-white q-col-gutter-md">
|
||||
<div class="col-xs-12 row items-center">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue