ปรับเเก้
This commit is contained in:
parent
d395bcbab5
commit
763f73d872
12 changed files with 1464 additions and 368 deletions
|
|
@ -23,6 +23,7 @@ import Document from "@/modules/05_placement/components/PersonalDetail/Informati
|
|||
import {
|
||||
AddressDataDefualt,
|
||||
FamilyDataDefualt,
|
||||
|
||||
} from "@/modules/05_placement/interface/index/Main";
|
||||
|
||||
import type {
|
||||
|
|
@ -32,6 +33,8 @@ import type {
|
|||
Family,
|
||||
Address,
|
||||
Certificate,
|
||||
optionData,
|
||||
InformationOps
|
||||
} from "@/modules/05_placement/interface/index/Main";
|
||||
|
||||
import type { Information } from "@/modules/05_placement/components/PersonalDetail/profileType";
|
||||
|
|
@ -99,11 +102,7 @@ const FamilyData = ref<Family>(FamilyDataDefualt);
|
|||
const AddressData = ref<Address>(AddressDataDefualt);
|
||||
const CertificateData = ref<Certificate[]>([]);
|
||||
|
||||
onMounted(async () => {
|
||||
// await checkProfileData();
|
||||
await fetchData();
|
||||
await changeTab("information");
|
||||
});
|
||||
|
||||
|
||||
const guidCheck = (id: string) => {
|
||||
if (id == "00000000-0000-0000-0000-000000000000") {
|
||||
|
|
@ -112,9 +111,40 @@ const guidCheck = (id: string) => {
|
|||
return id;
|
||||
};
|
||||
|
||||
const Ops = ref<InformationOps>({
|
||||
prefixOps: [],
|
||||
genderOps: [],
|
||||
bloodOps: [],
|
||||
statusOps: [],
|
||||
religionOps: [],
|
||||
employeeClassOps: [
|
||||
{ id: "gov", name: "งบประมาณเงินอุดหนุนรัฐบาล" },
|
||||
{ id: "bkk", name: "งบประมาณกรุงเทพมหานคร" },
|
||||
],
|
||||
employeeTypeOps: [
|
||||
{ id: "gov", name: "งบประมาณเงินอุดหนุนรัฐบาล" },
|
||||
{ id: "bkk", name: "งบประมาณกรุงเทพมหานคร" },
|
||||
],
|
||||
});
|
||||
|
||||
const OpsFilter = ref<InformationOps>({
|
||||
prefixOps: [],
|
||||
genderOps: [],
|
||||
bloodOps: [],
|
||||
statusOps: [],
|
||||
religionOps: [],
|
||||
employeeClassOps: [
|
||||
{ id: "gov", name: "งบประมาณเงินอุดหนุนรัฐบาล" },
|
||||
{ id: "bkk", name: "งบประมาณกรุงเทพมหานคร" },
|
||||
],
|
||||
employeeTypeOps: [
|
||||
{ id: "gov", name: "งบประมาณเงินอุดหนุนรัฐบาล" },
|
||||
{ id: "bkk", name: "งบประมาณกรุงเทพมหานคร" },
|
||||
],
|
||||
});
|
||||
|
||||
const fetchData = async () => {
|
||||
storePersonal.loading = false;
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.placementPersonalId(examId.value))
|
||||
.then((res: any) => {
|
||||
|
|
@ -235,10 +265,218 @@ const fetchData = async () => {
|
|||
.catch((e: any) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
});
|
||||
};
|
||||
|
||||
const fetchDataByType = async (type: string) => {
|
||||
// storePersonal.loading = false;
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.placementPersonalId(examId.value))
|
||||
.then((res: any) => {
|
||||
const data = res.data.result;
|
||||
storePersonal.fecthDataInformation(data);
|
||||
personalData.value.fullName = data.fullName;
|
||||
personalData.value.id = data.personalId;
|
||||
|
||||
if (type == "Information") {
|
||||
InformationData.value.idCard = data.idCard;
|
||||
InformationData.value.fullName = data.fullName;
|
||||
InformationData.value.firstname = data.firstname;
|
||||
InformationData.value.lastname = data.lastname;
|
||||
InformationData.value.nationality = data.nationality;
|
||||
InformationData.value.race = data.race;
|
||||
InformationData.value.genderId = guidCheck(data.gender) ?? "";
|
||||
InformationData.value.prefixId = guidCheck(data.prefix) ?? "";
|
||||
InformationData.value.relationshipId =
|
||||
guidCheck(data.relationship) ?? "";
|
||||
InformationData.value.religionId = guidCheck(data.religion) ?? "";
|
||||
InformationData.value.bloodGroupId = guidCheck(data.bloodGroup) ?? "";
|
||||
InformationData.value.dateOfBirth = new Date(data.dateOfBirth);
|
||||
InformationData.value.age = data.age;
|
||||
InformationData.value.telephone = data.telephone;
|
||||
} else if (type == "Address") {
|
||||
AddressData.value.registAddress = data.registAddress ?? "";
|
||||
AddressData.value.currentAddress = data.currentAddress ?? "";
|
||||
AddressData.value.registSame = data.registSame ? "1" : "0";
|
||||
AddressData.value.registSubDistrict = data.registSubDistrict ?? "";
|
||||
AddressData.value.registSubDistrictId =
|
||||
guidCheck(data.registSubDistrictId) ?? "";
|
||||
AddressData.value.registZipCode = data.registZipCode ?? "";
|
||||
AddressData.value.registDistrict = data.registDistrict ?? "";
|
||||
AddressData.value.registDistrictId =
|
||||
guidCheck(data.registDistrictId) ?? "";
|
||||
AddressData.value.registProvince = data.registProvince ?? "";
|
||||
AddressData.value.registProvinceId =
|
||||
guidCheck(data.registProvinceId) ?? "";
|
||||
AddressData.value.currentSubDistrict = data.currentSubDistrict ?? "";
|
||||
AddressData.value.currentSubDistrictId =
|
||||
guidCheck(data.currentSubDistrictId) ?? "";
|
||||
AddressData.value.currentZipCode = data.currentZipCode ?? "";
|
||||
AddressData.value.currentDistrict = data.currentDistrict ?? "";
|
||||
AddressData.value.currentDistrictId =
|
||||
guidCheck(data.currentDistrictId) ?? "";
|
||||
AddressData.value.currentProvince = data.currentProvince ?? "";
|
||||
AddressData.value.currentProvinceId =
|
||||
guidCheck(data.currentProvinceId) ?? "";
|
||||
} else if (type == "Family") {
|
||||
FamilyData.value.couple = data.couple ? "1" : "0";
|
||||
FamilyData.value.marryPrefix = data.marryPrefix ?? "";
|
||||
FamilyData.value.marryPrefixId = guidCheck(data.marryPrefix) ?? "";
|
||||
FamilyData.value.marryFirstName = data.marryFirstName ?? "";
|
||||
FamilyData.value.marryLastName = data.marryLastName ?? "";
|
||||
FamilyData.value.marryOccupation = data.marryOccupation ?? "";
|
||||
FamilyData.value.fatherPrefix = data.fatherPrefix ?? "";
|
||||
FamilyData.value.fatherPrefixId = guidCheck(data.fatherPrefix) ?? "";
|
||||
FamilyData.value.fatherFirstName = data.fatherFirstName ?? "";
|
||||
FamilyData.value.fatherLastName = data.fatherLastName ?? "";
|
||||
FamilyData.value.fatherOccupation = data.fatherOccupation ?? "";
|
||||
FamilyData.value.motherPrefix = data.motherPrefix ?? "";
|
||||
FamilyData.value.motherPrefixId = guidCheck(data.motherPrefix) ?? "";
|
||||
FamilyData.value.motherFirstName = data.motherFirstName ?? "";
|
||||
FamilyData.value.motherLastName = data.motherLastName ?? "";
|
||||
FamilyData.value.motherOccupation = data.motherOccupation ?? "";
|
||||
} else if (type == "Exam") {
|
||||
ExamData.value.pointA = data.pointA;
|
||||
ExamData.value.pointB = data.pointB;
|
||||
ExamData.value.pointC = data.pointC;
|
||||
ExamData.value.point = data.point;
|
||||
ExamData.value.pointTotalA = data.pointTotalA;
|
||||
ExamData.value.pointTotalB = data.pointTotalB;
|
||||
ExamData.value.pointTotalC = data.pointTotalC;
|
||||
ExamData.value.pointTotal = data.pointTotal;
|
||||
ExamData.value.examNumber = data.examNumber;
|
||||
ExamData.value.examRound = data.examRound;
|
||||
ExamData.value.pass = data.pass;
|
||||
}
|
||||
|
||||
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) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* get รายการ ข้อมูลเกี่ยวกับบุคคล
|
||||
*/
|
||||
const fetchPerson = async () => {
|
||||
await http
|
||||
.get(config.API.profileNewMetaMain)
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
|
||||
//กรุ๊ปเลือด
|
||||
let optionbloodGroups: optionData[] = [];
|
||||
data.bloodGroups.map((r: any) => {
|
||||
optionbloodGroups.push({
|
||||
id: r.name ?? "",
|
||||
name: r.name ?? "",
|
||||
});
|
||||
});
|
||||
Ops.value.bloodOps = optionbloodGroups;
|
||||
OpsFilter.value.bloodOps = optionbloodGroups;
|
||||
|
||||
//เพศ
|
||||
let optiongenders: optionData[] = [];
|
||||
data.genders.map((r: any) => {
|
||||
optiongenders.push({
|
||||
id: r.name ?? "",
|
||||
name: r.name ?? "",
|
||||
});
|
||||
});
|
||||
Ops.value.genderOps = optiongenders;
|
||||
OpsFilter.value.genderOps = optiongenders;
|
||||
|
||||
//คำนำหน้าชื่อ
|
||||
let optionprefixs: optionData[] = [];
|
||||
data.prefixs.map((r: any) => {
|
||||
optionprefixs.push({
|
||||
id: r.name ?? "",
|
||||
name: r.name ?? "",
|
||||
});
|
||||
});
|
||||
Ops.value.prefixOps = optionprefixs;
|
||||
OpsFilter.value.prefixOps = optionprefixs;
|
||||
|
||||
//สถานภาพ
|
||||
let optionrelationships: optionData[] = [];
|
||||
data.relationships.map((r: any) => {
|
||||
optionrelationships.push({
|
||||
id: r.name ?? "",
|
||||
name: r.name ?? "",
|
||||
});
|
||||
});
|
||||
Ops.value.statusOps = optionrelationships;
|
||||
OpsFilter.value.statusOps = optionrelationships;
|
||||
|
||||
//ศาสนา
|
||||
let optionreligions: optionData[] = [];
|
||||
data.religions.map((r: any) => {
|
||||
optionreligions.push({
|
||||
id: r.name ?? "",
|
||||
name: r.name ?? "",
|
||||
});
|
||||
});
|
||||
Ops.value.religionOps = optionreligions;
|
||||
OpsFilter.value.religionOps = optionreligions;
|
||||
})
|
||||
.catch((e: any) => {})
|
||||
.finally(() => {
|
||||
});
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
// await checkProfileData();
|
||||
|
||||
await fetchData();
|
||||
await changeTab("information");
|
||||
await fetchPerson()
|
||||
});
|
||||
|
||||
</script>
|
||||
<template>
|
||||
<div class="col-xs-12 col-sm-12 col-md-8 col-lg-8 row q-pb-sm">
|
||||
|
|
@ -262,13 +500,15 @@ const fetchData = async () => {
|
|||
<Informationvue
|
||||
v-model:statusEdit="statusEdit"
|
||||
v-model:data="InformationData"
|
||||
:fetch="fetchData"
|
||||
:fetch="fetchDataByType"
|
||||
:Ops="Ops"
|
||||
:OpsFilter="OpsFilter"
|
||||
/>
|
||||
<div class="col-12 q-px-md"><q-separator size="4px" /></div>
|
||||
<Addressvue
|
||||
v-model:statusEdit="statusEdit"
|
||||
v-model:data="AddressData"
|
||||
:fetch="fetchData"
|
||||
:fetch="fetchDataByType"
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
|
@ -277,7 +517,9 @@ const fetchData = async () => {
|
|||
<Familyvue
|
||||
v-model:statusEdit="statusEdit"
|
||||
v-model:data="FamilyData"
|
||||
:fetch="fetchData"
|
||||
:fetch="fetchDataByType"
|
||||
:Ops="Ops"
|
||||
:OpsFilter="OpsFilter"
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ const {
|
|||
dialogConfirm,
|
||||
} = mixin;
|
||||
const edit = ref<boolean>(false);
|
||||
const onEdit = ref<boolean>(false);
|
||||
const addressData = ref<AddressType>(props.data);
|
||||
const myform = ref<any>();
|
||||
const Ops = ref<AddressOps>({
|
||||
|
|
@ -133,9 +134,21 @@ const filterSelector = (val: any, update: Function, refData: string) => {
|
|||
|
||||
const refreshData = async () => {
|
||||
myform.value.reset();
|
||||
// await props.fetch();
|
||||
await fetchProvince();
|
||||
await getNewData();
|
||||
if (onEdit.value) {
|
||||
dialogConfirm(
|
||||
$q,
|
||||
async () => {
|
||||
emit("update:statusEdit", false);
|
||||
await props.fetch("Address");
|
||||
edit.value = false;
|
||||
onEdit.value = false;
|
||||
},
|
||||
`ข้อมูลมีการแก้ไข`,
|
||||
`ยืนยันยกเลิกการแก้ไขใช่หรือไม่?`
|
||||
);
|
||||
} else {
|
||||
edit.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const getNewData = async () => {
|
||||
|
|
@ -145,7 +158,7 @@ const getNewData = async () => {
|
|||
|
||||
// บันทึกข้อมูล
|
||||
const editData = async () => {
|
||||
dialogConfirm($q, async() => {
|
||||
dialogConfirm($q, async () => {
|
||||
const body = {
|
||||
registrationSame: addressData.value.registSame == "1",
|
||||
registrationAddress: addressData.value.registAddress,
|
||||
|
|
@ -189,8 +202,7 @@ const editData = async () => {
|
|||
.finally(async () => {
|
||||
edit.value = false;
|
||||
emit("update:statusEdit", false);
|
||||
await getNewData();
|
||||
await props.fetch();
|
||||
await props.fetch("Address");
|
||||
// await fetchProvince();
|
||||
});
|
||||
});
|
||||
|
|
@ -326,7 +338,7 @@ const fetchDistrict = async (id: string | null, position: string) => {
|
|||
if (id != null && id != "") {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.orgProvince+`/${id}`)
|
||||
.get(config.API.orgProvince + `/${id}`)
|
||||
.then(async (res) => {
|
||||
const data = res.data.result.districts;
|
||||
let option: optionData[] = [];
|
||||
|
|
@ -372,7 +384,7 @@ const fetchSubDistrict = async (id: string | null, position: string) => {
|
|||
if (id != null && id != "") {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.orgDistrict+`/${id}`)
|
||||
.get(config.API.orgDistrict + `/${id}`)
|
||||
.then(async (res) => {
|
||||
const data = res.data.result.subDistricts;
|
||||
let option: zipCodeOption[] = [];
|
||||
|
|
@ -420,7 +432,6 @@ const fetchSubDistrict = async (id: string | null, position: string) => {
|
|||
const changeBtn = async () => {
|
||||
if (edit.value == true) {
|
||||
if (props.statusEdit === true) {
|
||||
edit.value = false;
|
||||
props.notiNoEdit();
|
||||
} else {
|
||||
emit("update:statusEdit", true);
|
||||
|
|
|
|||
|
|
@ -29,6 +29,12 @@ const props = defineProps({
|
|||
type: Object as PropType<Family>,
|
||||
default: FamilyDataDefualt,
|
||||
},
|
||||
Ops: {
|
||||
type: Object as PropType<any>,
|
||||
},
|
||||
OpsFilter: {
|
||||
type: Object as PropType<any>,
|
||||
},
|
||||
});
|
||||
const emit = defineEmits(["update:statusEdit"]);
|
||||
|
||||
|
|
@ -45,26 +51,18 @@ const {
|
|||
dialogConfirm,
|
||||
} = mixin;
|
||||
const edit = ref<boolean>(false);
|
||||
const onEdit = ref<boolean>(false);
|
||||
|
||||
const myform = ref<QForm | null>(null);
|
||||
const familyData = ref<Family>(props.data);
|
||||
|
||||
const Ops = ref<any>({
|
||||
prefixOps: [],
|
||||
});
|
||||
const OpsFilter = ref<any>({
|
||||
prefixOps: [],
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
await fetchPrefix();
|
||||
|
||||
emit("update:statusEdit", false);
|
||||
});
|
||||
|
||||
const filterSelector = (val: any, update: Function, refData: string) => {
|
||||
update(() => {
|
||||
Ops.value[`${refData}`] = OpsFilter.value[`${refData}`].filter(
|
||||
props.Ops[`${refData}`] = props.OpsFilter[`${refData}`].filter(
|
||||
(v: DataOption) => v.name.indexOf(val) > -1
|
||||
);
|
||||
});
|
||||
|
|
@ -74,29 +72,21 @@ const refreshData = async () => {
|
|||
if (myform.value != null) {
|
||||
myform.value.reset();
|
||||
}
|
||||
emit("update:statusEdit", false);
|
||||
await props.fetch();
|
||||
};
|
||||
|
||||
const fetchPrefix = async () => {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.profileNewMetaMain)
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
let option: DataOption[] = [];
|
||||
data.prefixs.map((r: any) => {
|
||||
option.push({ id: r.name.toString(), name: r.name.toString() });
|
||||
});
|
||||
Ops.value.prefixOps = option;
|
||||
OpsFilter.value.prefixOps = option;
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
if (onEdit.value) {
|
||||
dialogConfirm(
|
||||
$q,
|
||||
async () => {
|
||||
emit("update:statusEdit", false);
|
||||
await props.fetch("Family");
|
||||
edit.value = false;
|
||||
onEdit.value = false;
|
||||
},
|
||||
`ข้อมูลมีการแก้ไข`,
|
||||
`ยืนยันยกเลิกการแก้ไขใช่หรือไม่?`
|
||||
);
|
||||
} else {
|
||||
edit.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const editData = async () => {
|
||||
|
|
@ -153,7 +143,7 @@ const editData = async () => {
|
|||
hideLoader();
|
||||
edit.value = false;
|
||||
emit("update:statusEdit", false);
|
||||
await props.fetch();
|
||||
await props.fetch("Family");
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -9,10 +9,6 @@ import type {
|
|||
} from "@/modules/05_placement/components/PersonalDetail/profileType";
|
||||
import { defaultInformation } from "@/modules/05_placement/components/PersonalDetail/profileType";
|
||||
|
||||
import type {
|
||||
InformationOps,
|
||||
optionData,
|
||||
} from "@/modules/05_placement/interface/index/Main";
|
||||
import HeaderTop from "@/modules/05_placement/components/PersonalDetail/Information/top.vue";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
|
|
@ -40,6 +36,12 @@ const props = defineProps({
|
|||
type: Object as PropType<Information>,
|
||||
default: defaultInformation,
|
||||
},
|
||||
Ops: {
|
||||
type: Object as PropType<any>,
|
||||
},
|
||||
OpsFilter: {
|
||||
type: Object as PropType<any>,
|
||||
},
|
||||
});
|
||||
const emit = defineEmits(["update:statusEdit"]);
|
||||
|
||||
|
|
@ -63,39 +65,8 @@ const edit = ref<boolean>(false);
|
|||
const informaData = ref<Information>(props.data);
|
||||
const age = ref<boolean>(true);
|
||||
const myform = ref<QForm | null>(null);
|
||||
const Ops = ref<InformationOps>({
|
||||
prefixOps: [],
|
||||
genderOps: [],
|
||||
bloodOps: [],
|
||||
statusOps: [],
|
||||
religionOps: [],
|
||||
employeeClassOps: [
|
||||
{ id: "gov", name: "งบประมาณเงินอุดหนุนรัฐบาล" },
|
||||
{ id: "bkk", name: "งบประมาณกรุงเทพมหานคร" },
|
||||
],
|
||||
employeeTypeOps: [
|
||||
{ id: "gov", name: "งบประมาณเงินอุดหนุนรัฐบาล" },
|
||||
{ id: "bkk", name: "งบประมาณกรุงเทพมหานคร" },
|
||||
],
|
||||
});
|
||||
const OpsFilter = ref<InformationOps>({
|
||||
prefixOps: [],
|
||||
genderOps: [],
|
||||
bloodOps: [],
|
||||
statusOps: [],
|
||||
religionOps: [],
|
||||
employeeClassOps: [
|
||||
{ id: "gov", name: "งบประมาณเงินอุดหนุนรัฐบาล" },
|
||||
{ id: "bkk", name: "งบประมาณกรุงเทพมหานคร" },
|
||||
],
|
||||
employeeTypeOps: [
|
||||
{ id: "gov", name: "งบประมาณเงินอุดหนุนรัฐบาล" },
|
||||
{ id: "bkk", name: "งบประมาณกรุงเทพมหานคร" },
|
||||
],
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
await fetchPerson();
|
||||
emit("update:statusEdit", false);
|
||||
});
|
||||
|
||||
|
|
@ -103,127 +74,72 @@ const onCancel = async () => {
|
|||
if (myform.value != null) {
|
||||
myform.value.reset();
|
||||
}
|
||||
await props.fetch();
|
||||
};
|
||||
if (onEdit.value) {
|
||||
dialogConfirm(
|
||||
$q,
|
||||
async () => {
|
||||
emit("update:statusEdit", false);
|
||||
await props.fetch("Information");
|
||||
edit.value = false;
|
||||
onEdit.value = false;
|
||||
},
|
||||
`ข้อมูลมีการแก้ไข`,
|
||||
`ยืนยันยกเลิกการแก้ไขใช่หรือไม่?`
|
||||
);
|
||||
|
||||
/**
|
||||
* get รายการ ข้อมูลเกี่ยวกับบุคคล
|
||||
*/
|
||||
const fetchPerson = async () => {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.profileNewMetaMain)
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
|
||||
//กรุ๊ปเลือด
|
||||
let optionbloodGroups: optionData[] = [];
|
||||
data.bloodGroups.map((r: any) => {
|
||||
optionbloodGroups.push({
|
||||
id: r.name ?? "",
|
||||
name: r.name ?? "",
|
||||
});
|
||||
});
|
||||
Ops.value.bloodOps = optionbloodGroups;
|
||||
OpsFilter.value.bloodOps = optionbloodGroups;
|
||||
|
||||
//เพศ
|
||||
let optiongenders: optionData[] = [];
|
||||
data.genders.map((r: any) => {
|
||||
optiongenders.push({
|
||||
id: r.name ?? "",
|
||||
name: r.name ?? "",
|
||||
});
|
||||
});
|
||||
Ops.value.genderOps = optiongenders;
|
||||
OpsFilter.value.genderOps = optiongenders;
|
||||
|
||||
//คำนำหน้าชื่อ
|
||||
let optionprefixs: optionData[] = [];
|
||||
data.prefixs.map((r: any) => {
|
||||
optionprefixs.push({
|
||||
id: r.name ?? "",
|
||||
name: r.name ?? "",
|
||||
});
|
||||
});
|
||||
Ops.value.prefixOps = optionprefixs;
|
||||
OpsFilter.value.prefixOps = optionprefixs;
|
||||
|
||||
//สถานภาพ
|
||||
let optionrelationships: optionData[] = [];
|
||||
data.relationships.map((r: any) => {
|
||||
optionrelationships.push({
|
||||
id: r.name ?? "",
|
||||
name: r.name ?? "",
|
||||
});
|
||||
});
|
||||
Ops.value.statusOps = optionrelationships;
|
||||
OpsFilter.value.statusOps = optionrelationships;
|
||||
|
||||
//ศาสนา
|
||||
let optionreligions: optionData[] = [];
|
||||
data.religions.map((r: any) => {
|
||||
optionreligions.push({
|
||||
id: r.name ?? "",
|
||||
name: r.name ?? "",
|
||||
});
|
||||
});
|
||||
Ops.value.religionOps = optionreligions;
|
||||
OpsFilter.value.religionOps = optionreligions;
|
||||
})
|
||||
.catch((e: any) => {})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
|
||||
} else {
|
||||
edit.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const filterSelector = (val: any, update: Function, refData: string) => {
|
||||
switch (refData) {
|
||||
case "prefixOps":
|
||||
update(() => {
|
||||
Ops.value.prefixOps = OpsFilter.value.prefixOps.filter(
|
||||
props.Ops.prefixOps = props.OpsFilter.prefixOps.filter(
|
||||
(v: DataOption) => v.name.indexOf(val) > -1
|
||||
);
|
||||
});
|
||||
break;
|
||||
case "genderOps":
|
||||
update(() => {
|
||||
Ops.value.genderOps = OpsFilter.value.genderOps.filter(
|
||||
props.Ops.genderOps = props.OpsFilter.genderOps.filter(
|
||||
(v: DataOption) => v.name.indexOf(val) > -1
|
||||
);
|
||||
});
|
||||
break;
|
||||
case "bloodOps":
|
||||
update(() => {
|
||||
Ops.value.bloodOps = OpsFilter.value.bloodOps.filter(
|
||||
props.Ops.bloodOps = props.OpsFilter.bloodOps.filter(
|
||||
(v: DataOption) => v.name.indexOf(val) > -1
|
||||
);
|
||||
});
|
||||
break;
|
||||
case "statusOps":
|
||||
update(() => {
|
||||
Ops.value.statusOps = OpsFilter.value.statusOps.filter(
|
||||
props.Ops.statusOps = props.OpsFilter.statusOps.filter(
|
||||
(v: DataOption) => v.name.indexOf(val) > -1
|
||||
);
|
||||
});
|
||||
break;
|
||||
case "religionOps":
|
||||
update(() => {
|
||||
Ops.value.religionOps = OpsFilter.value.religionOps.filter(
|
||||
props.Ops.religionOps = props.OpsFilter.religionOps.filter(
|
||||
(v: DataOption) => v.name.indexOf(val) > -1
|
||||
);
|
||||
});
|
||||
break;
|
||||
case "employeeClassOps":
|
||||
update(() => {
|
||||
Ops.value.employeeClassOps = OpsFilter.value.employeeClassOps.filter(
|
||||
props.Ops.employeeClassOps = props.OpsFilter.employeeClassOps.filter(
|
||||
(v: DataOption) => v.name.indexOf(val) > -1
|
||||
);
|
||||
});
|
||||
break;
|
||||
case "employeeTypeOps":
|
||||
update(() => {
|
||||
Ops.value.employeeTypeOps = OpsFilter.value.employeeTypeOps.filter(
|
||||
props.Ops.employeeTypeOps = props.OpsFilter.employeeTypeOps.filter(
|
||||
(v: DataOption) => v.name.indexOf(val) > -1
|
||||
);
|
||||
});
|
||||
|
|
@ -237,6 +153,7 @@ const filterSelector = (val: any, update: Function, refData: string) => {
|
|||
const handleDate = async (modelData: Date) => {
|
||||
informaData.value.dateOfBirth = modelData;
|
||||
await calRetire(modelData);
|
||||
onEdit.value = true;
|
||||
};
|
||||
|
||||
const calRetire = async (birth: Date) => {
|
||||
|
|
@ -299,7 +216,7 @@ const editData = async () => {
|
|||
.finally(async () => {
|
||||
edit.value = false;
|
||||
emit("update:statusEdit", false);
|
||||
await props.fetch();
|
||||
await props.fetch("Information");
|
||||
await changeBirth(informaData.value.dateOfBirth ?? new Date());
|
||||
});
|
||||
});
|
||||
|
|
@ -318,7 +235,6 @@ const saveData = async () => {
|
|||
const changeBtn = async () => {
|
||||
if (edit.value == true) {
|
||||
if (props.statusEdit === true) {
|
||||
edit.value = false;
|
||||
props.notiNoEdit();
|
||||
} else {
|
||||
emit("update:statusEdit", true);
|
||||
|
|
@ -334,6 +250,11 @@ const getClass = (val: boolean) => {
|
|||
"full-width cursor-pointer": !val,
|
||||
};
|
||||
};
|
||||
|
||||
const onEdit = ref<boolean>(false);
|
||||
function checkEdit() {
|
||||
onEdit.value = true;
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<q-card flat bordered class="col-12 q-px-lg q-py-md no-border">
|
||||
|
|
@ -368,10 +289,12 @@ const getClass = (val: boolean) => {
|
|||
]"
|
||||
label="เลขประจำตัวประชาชน"
|
||||
mask="#############"
|
||||
@update:modelValue="checkEdit"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-xs-6 col-sm-3 col-md-3">
|
||||
<selector
|
||||
@update:modelValue="checkEdit"
|
||||
:hide-dropdown-icon="!edit"
|
||||
hide-bottom-space
|
||||
:class="getClass(edit)"
|
||||
|
|
@ -408,6 +331,7 @@ const getClass = (val: boolean) => {
|
|||
v-model="informaData.firstname"
|
||||
:rules="[(val:string) => !!val || `${'กรุณากรอก ชื่อ'}`]"
|
||||
:label="`${'ชื่อ'}`"
|
||||
@update:modelValue="checkEdit"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-xs-6 col-sm-3 col-md-3">
|
||||
|
|
@ -422,6 +346,7 @@ const getClass = (val: boolean) => {
|
|||
v-model="informaData.lastname"
|
||||
:rules="[(val:string) => !!val || `${'กรุณากรอก นามสกุล'}`]"
|
||||
:label="`${'นามสกุล'}`"
|
||||
@update:modelValue="checkEdit"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-xs-6 col-sm-3 col-md-3">
|
||||
|
|
@ -486,6 +411,7 @@ const getClass = (val: boolean) => {
|
|||
</div>
|
||||
<div class="col-xs-6 col-sm-3 col-md-3">
|
||||
<selector
|
||||
@update:modelValue="checkEdit"
|
||||
:hide-dropdown-icon="!edit"
|
||||
hide-bottom-space
|
||||
:class="getClass(edit)"
|
||||
|
|
@ -511,6 +437,7 @@ const getClass = (val: boolean) => {
|
|||
</div>
|
||||
<div class="col-xs-6 col-sm-3 col-md-3">
|
||||
<selector
|
||||
@update:modelValue="checkEdit"
|
||||
:hide-dropdown-icon="!edit"
|
||||
hide-bottom-space
|
||||
:class="getClass(edit)"
|
||||
|
|
@ -536,6 +463,7 @@ const getClass = (val: boolean) => {
|
|||
</div>
|
||||
<div class="col-xs-6 col-sm-3 col-md-3">
|
||||
<selector
|
||||
@update:modelValue="checkEdit"
|
||||
:hide-dropdown-icon="!edit"
|
||||
hide-bottom-space
|
||||
:class="getClass(edit)"
|
||||
|
|
@ -561,6 +489,7 @@ const getClass = (val: boolean) => {
|
|||
</div>
|
||||
<div class="col-xs-6 col-sm-3 col-md-3">
|
||||
<q-input
|
||||
@update:modelValue="checkEdit"
|
||||
:class="getClass(edit)"
|
||||
hide-bottom-space
|
||||
:outlined="edit"
|
||||
|
|
@ -575,6 +504,7 @@ const getClass = (val: boolean) => {
|
|||
</div>
|
||||
<div class="col-xs-6 col-sm-3 col-md-3">
|
||||
<q-input
|
||||
@update:modelValue="checkEdit"
|
||||
:class="getClass(edit)"
|
||||
hide-bottom-space
|
||||
:outlined="edit"
|
||||
|
|
@ -589,6 +519,7 @@ const getClass = (val: boolean) => {
|
|||
</div>
|
||||
<div class="col-xs-6 col-sm-3 col-md-3">
|
||||
<selector
|
||||
@update:modelValue="checkEdit"
|
||||
:hide-dropdown-icon="!edit"
|
||||
hide-bottom-space
|
||||
:class="getClass(edit)"
|
||||
|
|
@ -614,6 +545,7 @@ const getClass = (val: boolean) => {
|
|||
</div>
|
||||
<div class="col-xs-6 col-sm-3 col-md-3">
|
||||
<q-input
|
||||
@update:modelValue="checkEdit"
|
||||
hide-bottom-space
|
||||
:outlined="edit"
|
||||
dense
|
||||
|
|
|
|||
|
|
@ -71,7 +71,6 @@ const historyClick = async () => {
|
|||
};
|
||||
|
||||
const ClickCancel = () => {
|
||||
updateEdit(!props.edit);
|
||||
props.cancel();
|
||||
props.changeBtn();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -77,29 +77,30 @@ const onCancel = async () => {
|
|||
};
|
||||
</script>
|
||||
<template>
|
||||
<div class="row col-12 q-px-lg q-pt-lg q-pb-sm no-border">
|
||||
<HeaderTop
|
||||
v-model:edit="edit"
|
||||
header="การคัดกรองคุณสมบัติ"
|
||||
icon="mdi-account-search"
|
||||
:save="saveData"
|
||||
:history="false"
|
||||
:changeBtn="changeBtn"
|
||||
:disable="statusEdit"
|
||||
:cancel="onCancel"
|
||||
/>
|
||||
</div>
|
||||
<div class="row q-px-lg">
|
||||
<div v-for="item of props.data" :key="item.name" class="col-12 q-pt-sm">
|
||||
<q-checkbox
|
||||
size="xs"
|
||||
v-model="item.value"
|
||||
:label="item.name"
|
||||
keep-color
|
||||
color="gray-5"
|
||||
:disable="!statusEdit"
|
||||
<q-form ref="myform" greedy @submit.prevent @validation-success="saveData">
|
||||
<div class="row col-12 q-px-lg q-pt-lg q-pb-sm no-border">
|
||||
<HeaderTop
|
||||
v-model:edit="edit"
|
||||
header="การคัดกรองคุณสมบัติ"
|
||||
icon="mdi-account-search"
|
||||
:history="false"
|
||||
:changeBtn="changeBtn"
|
||||
:disable="statusEdit"
|
||||
:cancel="onCancel"
|
||||
/>
|
||||
<q-separator />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row q-px-lg">
|
||||
<div v-for="item of props.data" :key="item.name" class="col-12 q-pt-sm">
|
||||
<q-checkbox
|
||||
size="xs"
|
||||
v-model="item.value"
|
||||
:label="item.name"
|
||||
keep-color
|
||||
color="gray-5"
|
||||
:disable="!statusEdit"
|
||||
/>
|
||||
<q-separator />
|
||||
</div>
|
||||
</div>
|
||||
</q-form>
|
||||
</template>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue