ปรับหน้ารายละเอียดของผู้สอบผ่าน ให้เป็นข้อมูลหลักจากระบบใหม่

This commit is contained in:
STW_TTTY\stwtt 2024-05-20 10:49:45 +07:00
parent 30befa38c2
commit 7afafb68e5
7 changed files with 204 additions and 173 deletions

View file

@ -23,7 +23,6 @@ import Document from "@/modules/05_placement/components/PersonalDetail/Informati
import { import {
AddressDataDefualt, AddressDataDefualt,
FamilyDataDefualt, FamilyDataDefualt,
} from "@/modules/05_placement/interface/index/Main"; } from "@/modules/05_placement/interface/index/Main";
import type { import type {
@ -34,7 +33,7 @@ import type {
Address, Address,
Certificate, Certificate,
optionData, optionData,
InformationOps InformationOps,
} from "@/modules/05_placement/interface/index/Main"; } from "@/modules/05_placement/interface/index/Main";
import type { Information } from "@/modules/05_placement/components/PersonalDetail/profileType"; import type { Information } from "@/modules/05_placement/components/PersonalDetail/profileType";
@ -102,8 +101,6 @@ const FamilyData = ref<Family>(FamilyDataDefualt);
const AddressData = ref<Address>(AddressDataDefualt); const AddressData = ref<Address>(AddressDataDefualt);
const CertificateData = ref<Certificate[]>([]); const CertificateData = ref<Certificate[]>([]);
const guidCheck = (id: string) => { const guidCheck = (id: string) => {
if (id == "00000000-0000-0000-0000-000000000000") { if (id == "00000000-0000-0000-0000-000000000000") {
return null; return null;
@ -265,8 +262,7 @@ const fetchData = async () => {
.catch((e: any) => { .catch((e: any) => {
messageError($q, e); messageError($q, e);
}) })
.finally(() => { .finally(() => {});
});
}; };
const fetchDataByType = async (type: string) => { const fetchDataByType = async (type: string) => {
@ -349,48 +345,48 @@ const fetchDataByType = async (type: string) => {
ExamData.value.examNumber = data.examNumber; ExamData.value.examNumber = data.examNumber;
ExamData.value.examRound = data.examRound; ExamData.value.examRound = data.examRound;
ExamData.value.pass = data.pass; ExamData.value.pass = data.pass;
} else if (type == "Certificate") {
let listCert: Certificate[] = [];
data.certificates.map((row: any) => {
listCert.push({
id: guidCheck(row.id) ?? "",
certificateNo: guidCheck(row.certificateNo) ?? "",
issuer: row.issuer ?? "",
issueDate: new Date(row.issueDate) ?? new Date(),
expireDate: new Date(row.expireDate) ?? new Date(),
certificateType: row.certificateType ?? "",
});
});
CertificateData.value = listCert;
} else if (type == "Education") {
let listRow: Education[] = [];
data.education.map((row: any) => {
listRow.push({
id: guidCheck(row.id) ?? "",
educationLevel: row.educationLevel ?? "",
educationLevelId: guidCheck(row.educationLevelId) ?? "",
institute: row.institute ?? "",
degree: row.degree ?? "",
field: row.field ?? "",
gpa: row.gpa ?? "",
country: row.country ?? "",
duration: row.duration ?? "",
other: row.other ?? "",
fundName: row.fundName ?? "",
durationYear: row.durationYear ?? 0,
finishDate: row.finishDate ?? new Date(),
isDate: row.isDate ? "true" : "false",
startDate: row.startDate ? new Date(row.startDate) : new Date(),
endDate: row.endDate ? new Date(row.endDate) : new Date(),
positionPath: row.positionPath ?? "",
isEducation: row.isEducation ? true : false,
});
});
EducationData.value = listRow;
} else if (type == "Qualification") {
QualificationData.value = data.isProperty;
} }
QualificationData.value = data.isProperty;
let listRow: Education[] = [];
data.education.map((row: any) => {
listRow.push({
id: guidCheck(row.id) ?? "",
educationLevel: row.educationLevel ?? "",
educationLevelId: guidCheck(row.educationLevelId) ?? "",
institute: row.institute ?? "",
degree: row.degree ?? "",
field: row.field ?? "",
gpa: row.gpa ?? "",
country: row.country ?? "",
duration: row.duration ?? "",
other: row.other ?? "",
fundName: row.fundName ?? "",
durationYear: row.durationYear ?? 0,
finishDate: row.finishDate ?? new Date(),
isDate: row.isDate ? "true" : "false",
startDate: row.startDate ? new Date(row.startDate) : new Date(),
endDate: row.endDate ? new Date(row.endDate) : new Date(),
positionPath: row.positionPath ?? "",
isEducation: row.isEducation ? true : false,
});
});
EducationData.value = listRow;
let listCert: Certificate[] = [];
data.certificates.map((row: any) => {
listCert.push({
id: guidCheck(row.id) ?? "",
certificateNo: guidCheck(row.certificateNo) ?? "",
issuer: row.issuer ?? "",
issueDate: new Date(row.issueDate) ?? new Date(),
expireDate: new Date(row.expireDate) ?? new Date(),
certificateType: row.certificateType ?? "",
});
});
CertificateData.value = listCert;
}) })
.catch((e: any) => { .catch((e: any) => {
messageError($q, e); messageError($q, e);
@ -403,7 +399,7 @@ const fetchDataByType = async (type: string) => {
/** /**
* get รายการ อมลเกยวกบบคคล * get รายการ อมลเกยวกบบคคล
*/ */
const fetchPerson = async () => { const fetchPerson = async () => {
await http await http
.get(config.API.profileNewMetaMain) .get(config.API.profileNewMetaMain)
.then((res) => { .then((res) => {
@ -465,8 +461,7 @@ const fetchDataByType = async (type: string) => {
OpsFilter.value.religionOps = optionreligions; OpsFilter.value.religionOps = optionreligions;
}) })
.catch((e: any) => {}) .catch((e: any) => {})
.finally(() => { .finally(() => {});
});
}; };
onMounted(async () => { onMounted(async () => {
@ -474,9 +469,8 @@ onMounted(async () => {
await fetchData(); await fetchData();
await changeTab("information"); await changeTab("information");
await fetchPerson() await fetchPerson();
}); });
</script> </script>
<template> <template>
<div class="col-xs-12 col-sm-12 col-md-8 col-lg-8 row q-pb-sm"> <div class="col-xs-12 col-sm-12 col-md-8 col-lg-8 row q-pb-sm">
@ -529,7 +523,7 @@ onMounted(async () => {
v-model:statusEdit="statusEdit" v-model:statusEdit="statusEdit"
:profileType="profileType" :profileType="profileType"
v-model:data="CertificateData" v-model:data="CertificateData"
:fetch="fetchData" :fetch="fetchDataByType"
/> />
</div> </div>
@ -538,7 +532,7 @@ onMounted(async () => {
<EducationVue <EducationVue
v-model:statusEdit="statusEdit" v-model:statusEdit="statusEdit"
v-model:data="EducationData" v-model:data="EducationData"
:fetch="fetchData" :fetch="fetchDataByType"
/> />
</div> </div>
@ -552,7 +546,7 @@ onMounted(async () => {
<Qualification <Qualification
v-model:statusEdit="statusEdit" v-model:statusEdit="statusEdit"
v-model:data="QualificationData" v-model:data="QualificationData"
:fetch="fetchData" :fetch="fetchDataByType"
/> />
</div> </div>

View file

@ -494,7 +494,7 @@ const saveData = async () => {
messageError($q, e); messageError($q, e);
}) })
.finally(async () => { .finally(async () => {
await props.fetch(); await props.fetch('Education');
rows.value = props.data; rows.value = props.data;
}); });
}; };
@ -544,7 +544,7 @@ const editData = async () => {
messageError($q, e); messageError($q, e);
}) })
.finally(async () => { .finally(async () => {
await props.fetch(); await props.fetch('Education');
rows.value = props.data; rows.value = props.data;
}); });
}; };
@ -559,16 +559,17 @@ const deletePlacementEducation = async () => {
showLoader(); showLoader();
await http await http
.delete(config.API.placementEducationId(id.value)) .delete(config.API.placementEducationId(id.value))
.then((res) => { .then(async(res) => {
success($q, "ลบข้อมูลสำเร็จ"); success($q, "ลบข้อมูลสำเร็จ");
modal.value = false; modal.value = false;
await props.fetch('Education');
rows.value = props.data;
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
}) })
.finally(async () => { .finally(async () => {
await props.fetch();
rows.value = props.data;
}); });
}; };
@ -577,17 +578,16 @@ const deletePlacementEducation = async () => {
*/ */
const clickClose = async () => { const clickClose = async () => {
if (editRow.value == true) { if (editRow.value == true) {
$q.dialog({ dialogConfirm(
title: `ข้อมูลมีการแก้ไข`, $q,
message: `ยืนยันที่จะปิดโดยไม่บันทึกใช่หรือไม่?`, () => {
cancel: "ยกเลิก", modal.value = false;
ok: "ยืนยัน", next.value = false;
persistent: true, previous.value = false;
}).onOk(async () => { },
modal.value = false; "ข้อมูลมีการแก้ไข",
next.value = false; "ยืนยันที่จะปิดโดยไม่บันทึกใช่หรือไม่"
previous.value = false; );
});
} else { } else {
modal.value = false; modal.value = false;
next.value = false; next.value = false;
@ -658,7 +658,7 @@ const addData = () => {
* งกนปมยกเลกการแกไขขอม * งกนปมยกเลกการแกไขขอม
*/ */
const clickCancel = async () => { const clickCancel = async () => {
myForm.value.resetValidation() myForm.value.resetValidation();
if (editRow.value == true) { if (editRow.value == true) {
dialogConfirm( dialogConfirm(
$q, $q,
@ -774,16 +774,19 @@ const getClass = (val: boolean) => {
</ProfileTable> </ProfileTable>
</q-form> </q-form>
</q-card> </q-card>
<q-dialog v-model="modal" persistent> <q-dialog v-model="modal" persistent>
<q-card style="width: 600px"> <q-card style="width: 600px">
<q-form ref="myForm" greedy @submit.prevent @validation-success="clickSave"> <q-form
ref="myForm"
greedy
@submit.prevent
@validation-success="clickSave"
>
<DialogHeader tittle="ประวัติการศึกษา" :close="clickClose" /> <DialogHeader tittle="ประวัติการศึกษา" :close="clickClose" />
<q-separator /> <q-separator />
<q-card-section class="q-p-sm"> <q-card-section class="q-p-sm">
<div <div class="row col-12 items-top q-col-gutter-x-xs q-col-gutter-y-xs">
class="row col-12 items-top q-col-gutter-x-xs q-col-gutter-y-xs"
>
<div class="col-xs-6 col-sm-6 col-md-6"> <div class="col-xs-6 col-sm-6 col-md-6">
<selector <selector
:class="getClass(edit)" :class="getClass(edit)"

View file

@ -140,6 +140,7 @@ const refreshData = async () => {
async () => { async () => {
emit("update:statusEdit", false); emit("update:statusEdit", false);
await props.fetch("Address"); await props.fetch("Address");
fetchProvince()
edit.value = false; edit.value = false;
onEdit.value = false; onEdit.value = false;
}, },
@ -210,6 +211,7 @@ const editData = async () => {
// //
const selectProvince = async (e: string | null, name: string) => { const selectProvince = async (e: string | null, name: string) => {
onEdit.value = true;
if (e != null) { if (e != null) {
if (name == "1") { if (name == "1") {
registAddress.subDistrictId = ""; registAddress.subDistrictId = "";
@ -227,6 +229,7 @@ const selectProvince = async (e: string | null, name: string) => {
// //
const selectDistrict = async (e: string | null, name: string) => { const selectDistrict = async (e: string | null, name: string) => {
onEdit.value = true;
if (e != null) { if (e != null) {
if (name == "1") { if (name == "1") {
registAddress.subDistrictId = ""; registAddress.subDistrictId = "";
@ -242,6 +245,7 @@ const selectDistrict = async (e: string | null, name: string) => {
// //
const selectSubDistrict = (e: string | null, name: string) => { const selectSubDistrict = (e: string | null, name: string) => {
onEdit.value = true;
if (e != null) { if (e != null) {
if (name == "1") { if (name == "1") {
const findcode = Ops.value.subdistrictOps.filter((r) => r.id == e); const findcode = Ops.value.subdistrictOps.filter((r) => r.id == e);
@ -329,14 +333,12 @@ const fetchProvince = async () => {
messageError($q, e); messageError($q, e);
}) })
.finally(() => { .finally(() => {
hideLoader();
}); });
}; };
// //
const fetchDistrict = async (id: string | null, position: string) => { const fetchDistrict = async (id: string | null, position: string) => {
if (id != null && id != "") { if (id != null && id != "") {
showLoader();
await http await http
.get(config.API.orgProvince + `/${id}`) .get(config.API.orgProvince + `/${id}`)
.then(async (res) => { .then(async (res) => {
@ -374,7 +376,6 @@ const fetchDistrict = async (id: string | null, position: string) => {
messageError($q, e); messageError($q, e);
}) })
.finally(() => { .finally(() => {
hideLoader();
}); });
} }
}; };
@ -382,7 +383,6 @@ const fetchDistrict = async (id: string | null, position: string) => {
// //
const fetchSubDistrict = async (id: string | null, position: string) => { const fetchSubDistrict = async (id: string | null, position: string) => {
if (id != null && id != "") { if (id != null && id != "") {
showLoader();
await http await http
.get(config.API.orgDistrict + `/${id}`) .get(config.API.orgDistrict + `/${id}`)
.then(async (res) => { .then(async (res) => {
@ -447,6 +447,10 @@ const getClass = (val: boolean) => {
"full-width cursor-pointer": !val, "full-width cursor-pointer": !val,
}; };
}; };
function checkEdit() {
onEdit.value = true;
}
</script> </script>
<template> <template>
@ -477,6 +481,7 @@ const getClass = (val: boolean) => {
v-model="addressData.registAddress" v-model="addressData.registAddress"
:rules="[(val: string) => !!val || `${'กรุณากรอก ที่อยู่ตามทะเบียนบ้าน'}`]" :rules="[(val: string) => !!val || `${'กรุณากรอก ที่อยู่ตามทะเบียนบ้าน'}`]"
:label="`${'ที่อยู่ตามทะเบียนบ้าน'}`" :label="`${'ที่อยู่ตามทะเบียนบ้าน'}`"
@update:modelValue="checkEdit"
/> />
</div> </div>
<div class="col-xs-6 col-sm-3 col-md-3"> <div class="col-xs-6 col-sm-3 col-md-3">
@ -583,6 +588,7 @@ const getClass = (val: boolean) => {
label="ใช่" label="ใช่"
dense dense
:disable="!edit" :disable="!edit"
@update:modelValue="checkEdit"
/> />
<q-radio <q-radio
v-model="addressData.registSame" v-model="addressData.registSame"
@ -591,6 +597,7 @@ const getClass = (val: boolean) => {
val="0" val="0"
label="ไม่" label="ไม่"
dense dense
@update:modelValue="checkEdit"
:disable="!edit" :disable="!edit"
/> />
</div> </div>
@ -603,6 +610,7 @@ const getClass = (val: boolean) => {
dense dense
lazy-rules lazy-rules
type="textarea" type="textarea"
@update:modelValue="checkEdit"
autogrow autogrow
:readonly="!edit" :readonly="!edit"
:borderless="!edit" :borderless="!edit"

View file

@ -349,7 +349,7 @@ const saveData = async () => {
messageError($q, e); messageError($q, e);
}) })
.finally(async () => { .finally(async () => {
await props.fetch(); await props.fetch("Certificate");
rows.value = props.data; rows.value = props.data;
}); });
}; };
@ -376,7 +376,7 @@ const editData = async () => {
messageError($q, e); messageError($q, e);
}) })
.finally(async () => { .finally(async () => {
await props.fetch(); await props.fetch("Certificate");
rows.value = props.data; rows.value = props.data;
}); });
}; };
@ -385,38 +385,27 @@ const editData = async () => {
* ลบลบขอม * ลบลบขอม
*/ */
const clickDelete = async () => { const clickDelete = async () => {
$q.dialog({ dialogConfirm($q, async () => {
title: `ลบข้อมูล`, showLoader();
message: `ต้องการทำการลบข้อมูลนี้ใช่หรือไม่?`, await http
cancel: "ยกเลิก", .delete(
ok: "ยืนยัน", config.API.placementCertDetailId(
persistent: true, route.params.personalId.toString(),
}) id.value
.onOk(async () => {
showLoader();
await http
.delete(
config.API.placementCertDetailId(
route.params.personalId.toString(),
id.value
)
) )
.then((res) => { )
success($q, "ลบข้อมูลสำเร็จ"); .then((res) => {
modal.value = false; success($q, "ลบข้อมูลสำเร็จ");
}) modal.value = false;
.catch((e) => { })
messageError($q, e); .catch((e) => {
}) messageError($q, e);
.finally(async () => { })
await props.fetch(); .finally(async () => {
rows.value = props.data; await props.fetch("Certificate");
}); rows.value = props.data;
}) });
.onCancel(async () => { });
await props.fetch();
rows.value = props.data;
});
}; };
/** /**
@ -424,17 +413,16 @@ const clickDelete = async () => {
*/ */
const clickClose = async () => { const clickClose = async () => {
if (editRow.value == true) { if (editRow.value == true) {
$q.dialog({ dialogConfirm(
title: `ข้อมูลมีการแก้ไข`, $q,
message: `ยืนยันที่จะปิดโดยไม่บันทึกใช่หรือไม่?`, () => {
cancel: "ยกเลิก", modal.value = false;
ok: "ยืนยัน", next.value = false;
persistent: true, previous.value = false;
}).onOk(async () => { },
modal.value = false; "ข้อมูลมีการแก้ไข",
next.value = false; "ยืนยันที่จะปิดโดยไม่บันทึกใช่หรือไม่"
previous.value = false; );
});
} else { } else {
modal.value = false; modal.value = false;
next.value = false; next.value = false;
@ -479,19 +467,18 @@ const addData = () => {
* งกนปมยกเลกการแกไขขอม * งกนปมยกเลกการแกไขขอม
*/ */
const clickCancel = async () => { const clickCancel = async () => {
myForm.value.resetValidation() myForm.value.resetValidation();
if (editRow.value == true) { if (editRow.value == true) {
$q.dialog({ dialogConfirm(
title: `ข้อมูลมีการแก้ไข`, $q,
message: `ยืนยันยกเลิกการแก้ไขใช่หรือไม่?`, async () => {
cancel: "ยกเลิก", edit.value = false;
ok: "ยืนยัน", await checkRowPage();
persistent: true, await getData();
}).onOk(async () => { },
edit.value = false; "ข้อมูลมีการแก้ไข",
await checkRowPage(); "ยืนยันยกเลิกการแก้ไขใช่หรือไม่"
await getData(); );
});
} else { } else {
edit.value = false; edit.value = false;
await checkRowPage(); await checkRowPage();
@ -638,9 +625,7 @@ const getClass = (val: boolean) => {
/> />
<q-separator /> <q-separator />
<q-card-section class="q-p-sm"> <q-card-section class="q-p-sm">
<div <div class="row col-12 items-top q-col-gutter-x-xs q-col-gutter-y-xs">
class="row col-12 items-top q-col-gutter-x-xs q-col-gutter-y-xs"
>
<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)"

View file

@ -56,11 +56,13 @@ const onEdit = ref<boolean>(false);
const myform = ref<QForm | null>(null); const myform = ref<QForm | null>(null);
const familyData = ref<Family>(props.data); const familyData = ref<Family>(props.data);
onMounted(async () => {
emit("update:statusEdit", false);
});
const filterSelector = (val: any, update: Function, refData: string) => {
function checkEdit() {
onEdit.value = true;
}
function filterSelector(val: any, update: Function, refData: string){
update(() => { update(() => {
props.Ops[`${refData}`] = props.OpsFilter[`${refData}`].filter( props.Ops[`${refData}`] = props.OpsFilter[`${refData}`].filter(
(v: DataOption) => v.name.indexOf(val) > -1 (v: DataOption) => v.name.indexOf(val) > -1
@ -68,7 +70,7 @@ const filterSelector = (val: any, update: Function, refData: string) => {
}); });
}; };
const refreshData = async () => { async function refreshData(){
if (myform.value != null) { if (myform.value != null) {
myform.value.reset(); myform.value.reset();
} }
@ -89,7 +91,7 @@ const refreshData = async () => {
} }
}; };
const editData = async () => { async function editData(){
dialogConfirm($q, async () => { dialogConfirm($q, async () => {
showLoader(); showLoader();
// const body: ResponseObject = { // const body: ResponseObject = {
@ -148,7 +150,7 @@ const editData = async () => {
}); });
}; };
const saveData = async () => { async function saveData(){
await myform.value?.validate().then(async (success: boolean) => { await myform.value?.validate().then(async (success: boolean) => {
if (success) { if (success) {
await editData(); await editData();
@ -157,7 +159,8 @@ const saveData = async () => {
}); });
}; };
const selectRadio = (e: boolean, i: any) => { function selectRadio(e: boolean, i: any){
onEdit.value = true;
if (e) { if (e) {
familyData.value.marryPrefixId = ""; familyData.value.marryPrefixId = "";
familyData.value.marryFirstName = ""; familyData.value.marryFirstName = "";
@ -167,10 +170,9 @@ const selectRadio = (e: boolean, i: any) => {
} }
}; };
const changeBtn = async () => { async function changeBtn(){
if (edit.value == true) { if (edit.value == true) {
if (props.statusEdit === true) { if (props.statusEdit === true) {
edit.value = false;
props.notiNoEdit(); props.notiNoEdit();
} else { } else {
emit("update:statusEdit", true); emit("update:statusEdit", true);
@ -180,12 +182,16 @@ const changeBtn = async () => {
} }
}; };
const getClass = (val: boolean) => { function getClass(val: boolean){
return { return {
"full-width inputgreen cursor-pointer": val, "full-width inputgreen cursor-pointer": val,
"full-width cursor-pointer": !val, "full-width cursor-pointer": !val,
}; };
}; };
onMounted(async () => {
emit("update:statusEdit", false);
});
</script> </script>
<template> <template>
@ -206,6 +212,7 @@ const getClass = (val: boolean) => {
<div class="col-xs-12 col-sm-3 col-md-3"> <div class="col-xs-12 col-sm-3 col-md-3">
<selector <selector
:hide-dropdown-icon="!edit" :hide-dropdown-icon="!edit"
@update:modelValue="checkEdit"
hide-bottom-space hide-bottom-space
:class="getClass(edit)" :class="getClass(edit)"
:readonly="!edit" :readonly="!edit"
@ -241,6 +248,7 @@ const getClass = (val: boolean) => {
v-model="familyData.fatherFirstName" v-model="familyData.fatherFirstName"
:rules="[(val:string) => !!val || `${'กรุณากรอก ชื่อ'}`]" :rules="[(val:string) => !!val || `${'กรุณากรอก ชื่อ'}`]"
:label="`${'ชื่อ'}`" :label="`${'ชื่อ'}`"
@update:modelValue="checkEdit"
/> />
</div> </div>
<div class="col-xs-6 col-sm-3 col-md-3"> <div class="col-xs-6 col-sm-3 col-md-3">
@ -255,6 +263,7 @@ const getClass = (val: boolean) => {
v-model="familyData.fatherLastName" v-model="familyData.fatherLastName"
:rules="[(val:string) => !!val || `${'กรุณากรอก นามสกุล'}`]" :rules="[(val:string) => !!val || `${'กรุณากรอก นามสกุล'}`]"
:label="`${'นามสกุล'}`" :label="`${'นามสกุล'}`"
@update:modelValue="checkEdit"
/> />
</div> </div>
<div class="col-xs-12 col-sm-3 col-md-3"> <div class="col-xs-12 col-sm-3 col-md-3">
@ -268,6 +277,7 @@ const getClass = (val: boolean) => {
:borderless="!edit" :borderless="!edit"
v-model="familyData.fatherOccupation" v-model="familyData.fatherOccupation"
:label="`${'อาชีพ'}`" :label="`${'อาชีพ'}`"
@update:modelValue="checkEdit"
/> />
</div> </div>
@ -292,6 +302,7 @@ const getClass = (val: boolean) => {
option-value="id" option-value="id"
:label="`${'คำนำหน้า'}`" :label="`${'คำนำหน้า'}`"
use-input use-input
@update:modelValue="checkEdit"
input-debounce="0" input-debounce="0"
@filter="(inputValue:any, @filter="(inputValue:any,
doneFn:Function) => filterSelector(inputValue, doneFn,'prefixOps' doneFn:Function) => filterSelector(inputValue, doneFn,'prefixOps'
@ -311,6 +322,7 @@ const getClass = (val: boolean) => {
v-model="familyData.motherFirstName" v-model="familyData.motherFirstName"
:rules="[(val:string) => !!val || `${'กรุณากรอก ชื่อ'}`]" :rules="[(val:string) => !!val || `${'กรุณากรอก ชื่อ'}`]"
:label="`${'ชื่อ'}`" :label="`${'ชื่อ'}`"
@update:modelValue="checkEdit"
/> />
</div> </div>
<div class="col-xs-6 col-sm-3 col-md-3"> <div class="col-xs-6 col-sm-3 col-md-3">
@ -325,6 +337,7 @@ const getClass = (val: boolean) => {
v-model="familyData.motherLastName" v-model="familyData.motherLastName"
:rules="[(val:string) => !!val || `${'กรุณากรอก นามสกุล'}`]" :rules="[(val:string) => !!val || `${'กรุณากรอก นามสกุล'}`]"
:label="`${'นามสกุล'}`" :label="`${'นามสกุล'}`"
@update:modelValue="checkEdit"
/> />
</div> </div>
<div class="col-xs-12 col-sm-3 col-md-3"> <div class="col-xs-12 col-sm-3 col-md-3">
@ -338,6 +351,7 @@ const getClass = (val: boolean) => {
:borderless="!edit" :borderless="!edit"
v-model="familyData.motherOccupation" v-model="familyData.motherOccupation"
:label="`${'อาชีพ'}`" :label="`${'อาชีพ'}`"
@update:modelValue="checkEdit"
/> />
</div> </div>
<div class="col-12 q-pt-md q-pb-sm"><q-separator /></div> <div class="col-12 q-pt-md q-pb-sm"><q-separator /></div>
@ -387,6 +401,7 @@ const getClass = (val: boolean) => {
option-value="id" option-value="id"
:label="`${'คำนำหน้า'}`" :label="`${'คำนำหน้า'}`"
use-input use-input
@update:modelValue="checkEdit"
input-debounce="0" input-debounce="0"
@filter="(inputValue:any, @filter="(inputValue:any,
doneFn:Function) => filterSelector(inputValue, doneFn,'prefixOps' doneFn:Function) => filterSelector(inputValue, doneFn,'prefixOps'
@ -406,6 +421,7 @@ const getClass = (val: boolean) => {
v-model="familyData.marryFirstName" v-model="familyData.marryFirstName"
:rules="[(val:string) => !!val || `${'กรุณากรอก ชื่อ'}`]" :rules="[(val:string) => !!val || `${'กรุณากรอก ชื่อ'}`]"
:label="`${'ชื่อ'}`" :label="`${'ชื่อ'}`"
@update:modelValue="checkEdit"
/> />
</div> </div>
<div class="col-xs-6 col-sm-2 col-md-2" v-if="familyData.couple == '1'"> <div class="col-xs-6 col-sm-2 col-md-2" v-if="familyData.couple == '1'">
@ -420,6 +436,7 @@ const getClass = (val: boolean) => {
v-model="familyData.marryLastName" v-model="familyData.marryLastName"
:rules="[(val:string) => !!val || `${'กรุณากรอก นามสกุล'}`]" :rules="[(val:string) => !!val || `${'กรุณากรอก นามสกุล'}`]"
:label="`${'นามสกุล'}`" :label="`${'นามสกุล'}`"
@update:modelValue="checkEdit"
/> />
</div> </div>
<!-- <div class="col-xs-6 col-sm-2 col-md-2" v-if="familyData.couple == '1'"> <!-- <div class="col-xs-6 col-sm-2 col-md-2" v-if="familyData.couple == '1'">
@ -450,6 +467,7 @@ const getClass = (val: boolean) => {
:borderless="!edit" :borderless="!edit"
v-model="familyData.marryOccupation" v-model="familyData.marryOccupation"
:label="`${'อาชีพ'}`" :label="`${'อาชีพ'}`"
@update:modelValue="checkEdit"
/> />
</div> </div>
</div> </div>

View file

@ -19,6 +19,7 @@ import { useProfileDataStore } from "@/modules/05_placement/store";
import type { QForm } from "quasar"; import type { QForm } from "quasar";
import type { PropType } from "vue"; import type { PropType } from "vue";
const onEdit = ref<boolean>(false);
const props = defineProps({ const props = defineProps({
statusEdit: { statusEdit: {
type: Boolean, type: Boolean,
@ -251,7 +252,7 @@ const getClass = (val: boolean) => {
}; };
}; };
const onEdit = ref<boolean>(false);
function checkEdit() { function checkEdit() {
onEdit.value = true; onEdit.value = true;
} }

View file

@ -15,7 +15,7 @@ import type { Property } from "@/modules/05_placement/interface/index/Main";
const $q = useQuasar(); const $q = useQuasar();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const route = useRoute(); const route = useRoute();
const { showLoader, hideLoader, messageError, success } = mixin; const { showLoader, hideLoader, messageError, success, dialogConfirm } = mixin;
const props = defineProps({ const props = defineProps({
statusEdit: { statusEdit: {
@ -34,36 +34,39 @@ const props = defineProps({
const emit = defineEmits(["update:statusEdit", "update:data"]); const emit = defineEmits(["update:statusEdit", "update:data"]);
const edit = ref<boolean>(false); const edit = ref<boolean>(false);
const onEdit = ref<boolean>(false);
onMounted(() => { onMounted(() => {
emit("update:statusEdit", false); emit("update:statusEdit", false);
}); });
const saveData = async () => { const saveData = async () => {
showLoader(); dialogConfirm($q, async () => {
await http showLoader();
.put( await http
config.API.placementPropertyId(route.params.personalId.toString()), .put(
props.data config.API.placementPropertyId(route.params.personalId.toString()),
) props.data
.then((res: any) => { )
success($q, "แก้ไขข้อมูลสำเร็จ"); .then((res: any) => {
}) success($q, "แก้ไขข้อมูลสำเร็จ");
.catch((e: any) => { onEdit.value = false;
messageError($q, e); })
}) .catch((e: any) => {
.finally(async () => { messageError($q, e);
await props.fetch(); })
edit.value = false; .finally(async () => {
hideLoader(); await props.fetch("Qualification");
changeBtn(); edit.value = false;
}); hideLoader();
changeBtn();
});
});
}; };
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;
} else { } else {
emit("update:statusEdit", true); emit("update:statusEdit", true);
} }
@ -73,8 +76,26 @@ const changeBtn = async () => {
}; };
const onCancel = async () => { const onCancel = async () => {
await props.fetch(); if (onEdit.value) {
dialogConfirm(
$q,
async () => {
emit("update:statusEdit", false);
await props.fetch("Qualification");
edit.value = false;
onEdit.value = false;
},
`ข้อมูลมีการแก้ไข`,
`ยืนยันยกเลิกการแก้ไขใช่หรือไม่?`
);
} else {
edit.value = false;
}
}; };
function checkEdit() {
onEdit.value = true;
}
</script> </script>
<template> <template>
<q-form ref="myform" greedy @submit.prevent @validation-success="saveData"> <q-form ref="myform" greedy @submit.prevent @validation-success="saveData">
@ -96,6 +117,7 @@ const onCancel = async () => {
v-model="item.value" v-model="item.value"
:label="item.name" :label="item.name"
keep-color keep-color
@update:modelValue="checkEdit"
color="gray-5" color="gray-5"
:disable="!statusEdit" :disable="!statusEdit"
/> />