diff --git a/src/components/CardProfile.vue b/src/components/CardProfile.vue index 2d391d2e9..9bd8a66e9 100644 --- a/src/components/CardProfile.vue +++ b/src/components/CardProfile.vue @@ -36,7 +36,9 @@ const modalPersonal = ref(false); const profileId = ref(""); function fetchDataProfile(data: DataProfile) { - fetchProfile(data.profileId); + if (data.profileId) { + fetchProfile(data.profileId); + } profile.id = data.profileId; profile.fullName = `${data.prefix}${data.firstName} ${data.lastName}`; profile.position = diff --git a/src/modules/04_registryNew/components/detail/PersonalInformation/01_Profile.vue b/src/modules/04_registryNew/components/detail/PersonalInformation/01_Profile.vue index a22ac5703..06b5c71ee 100644 --- a/src/modules/04_registryNew/components/detail/PersonalInformation/01_Profile.vue +++ b/src/modules/04_registryNew/components/detail/PersonalInformation/01_Profile.vue @@ -26,6 +26,10 @@ const { dialogMessageNotify, } = mixin; const { calculateAge, fetchPerson, filterSelector } = store; +const props = defineProps({ + fetchDataPersonal: { type: Function, require: true }, +}); + const profileId = ref( route.params.id ? route.params.id.toString() : "" ); @@ -291,6 +295,7 @@ async function editData() { .then((res) => { success($q, "บันทึกข้อมูลสำเร็จ"); getData(), (modal.value = false); + props.fetchDataPersonal?.(); }) .catch((e) => { messageError($q, e); diff --git a/src/modules/04_registryNew/components/detail/PersonalInformation/02_NameChangeHistory.vue b/src/modules/04_registryNew/components/detail/PersonalInformation/02_NameChangeHistory.vue index 8689ca3fc..3b39eeaa8 100644 --- a/src/modules/04_registryNew/components/detail/PersonalInformation/02_NameChangeHistory.vue +++ b/src/modules/04_registryNew/components/detail/PersonalInformation/02_NameChangeHistory.vue @@ -33,6 +33,9 @@ const profileId = ref(route.params.id.toString()); const empType = ref( route.name === "registryNewByid" ? "" : "-employee" ); +const props = defineProps({ + fetchDataPersonal: { type: Function, require: true }, +}); const editId = ref(""); const dialog = ref(false); @@ -371,6 +374,7 @@ async function addData() { subId.value = res.data.result; fetchData(profileId.value); + props?.fetchDataPersonal?.(); success($q, "บันทึกข้อมูลสำเร็จ"); }) .catch((err) => { @@ -392,6 +396,7 @@ function editData(idData: string) { ) .then(() => { fetchData(profileId.value); + props.fetchDataPersonal?.(); success($q, "บันทึกข้อมูลสำเร็จ"); }) .catch((err) => { diff --git a/src/modules/04_registryNew/components/detail/PersonalInformation/04_FamilyNew.vue b/src/modules/04_registryNew/components/detail/PersonalInformation/04_FamilyNew.vue index 39fa919f2..53c2b06d2 100644 --- a/src/modules/04_registryNew/components/detail/PersonalInformation/04_FamilyNew.vue +++ b/src/modules/04_registryNew/components/detail/PersonalInformation/04_FamilyNew.vue @@ -7,6 +7,7 @@ import http from "@/plugins/http"; import config from "@/app.config"; import type { QTableProps } from "quasar"; +import type { DataOption } from "@/modules/04_registryNew/interface/index/Main"; import DialogHeader from "@/components/DialogHeader.vue"; @@ -18,15 +19,8 @@ const route = useRoute(); const store = useProfileDataStore(); const { fetchPerson, filterSelector } = store; -const { - dialogRemove, - dialogConfirm, - showLoader, - hideLoader, - messageError, - success, - date2Thai, -} = useCounterMixin(); +const { dialogConfirm, showLoader, hideLoader, messageError, success } = + useCounterMixin(); const profileId = ref( route.params.id ? route.params.id.toString() : "" @@ -34,6 +28,8 @@ const profileId = ref( const empType = ref( route.name === "registryNewByid" ? "" : "-employee" ); + +/** TableHisoty*/ const visibleColumns = ref([ "citizenId", "prefix", @@ -102,8 +98,7 @@ const columns = ref([ ]); const rows = ref([]); -const childData = ref([{}]); -const coupleData = ref([{}]); +/** ข้อมูล*/ const fatherData = ref({ isLive: 1, citizenId: "1231231231231", @@ -112,7 +107,7 @@ const fatherData = ref({ lastName: "หวังดี", job: "จอมพล", }); -const momData = ref({ +const motherData = ref({ isLive: 0, citizenId: "1572476458930", prefix: "นาง", @@ -120,6 +115,17 @@ const momData = ref({ lastName: "มาดี", job: "พยาบาล", }); +const coupleData = ref({ + isLive: 1, + citizenId: "1231231231231", + prefix: "นาย", + firstName: "ตรีชาไทย", + lastName: "หวังดี", + job: "จอมพล", + lastNameOld: "หวังดี", + statusMarital: "แต่งงานแล้ว", +}); +const childData = ref([{}]); const modal = ref(false); const modalHistory = ref(false); @@ -129,8 +135,8 @@ const titleForm = ref(""); const typeForm = ref(""); const isEdit = ref(false); -const optionRelationshipMain = ref([]); -const optionRelationship = ref([]); +const optionRelationshipMain = ref([]); +const optionRelationship = ref([]); const fromData = reactive({ isLive: 0, @@ -203,7 +209,7 @@ function fetchDataChildren() { function onSubmit(type: string) { dialogConfirm($q, () => { if (type === "father") { - } else if (type === "mom") { + } else if (type === "mother") { } else if (type === "couple") { } else if (type === "child") { submitChildren(); @@ -244,15 +250,15 @@ function onOpenDialogForm( fromData.lastName = fatherData.value.lastName; fromData.job = fatherData.value.job; } - } else if (type === "mom") { + } else if (type === "mother") { titleForm.value = "มารดา"; if (isStatusEdit) { - fromData.isLive = momData.value.isLive; - fromData.citizenId = momData.value.citizenId; - fromData.prefix = momData.value.prefix; - fromData.firstName = momData.value.firstName; - fromData.lastName = momData.value.lastName; - fromData.job = momData.value.job; + fromData.isLive = motherData.value.isLive; + fromData.citizenId = motherData.value.citizenId; + fromData.prefix = motherData.value.prefix; + fromData.firstName = motherData.value.firstName; + fromData.lastName = motherData.value.lastName; + fromData.job = motherData.value.job; } } else if (type === "couple") { titleForm.value = "คู่สมรส"; @@ -269,38 +275,9 @@ function onOpenDialogForm( function onOpenDialogHistory(type: string) { modalHistory.value = true; + console.log(type); } -// function fetchData() { -// const data = [ -// { -// isLive: 0, -// citizenId: "123456789101", -// prefix: "นาง", -// firstName: "บุษดี", -// lastName: "มาดีหกหฟก", -// job: "12", -// lastNameOld: "", -// statusMarital: "แต่งงาน", -// }, -// ]; -// const data2 = [ -// { -// isLive: 1, -// citizenId: "123456789101", -// prefix: "นาง", -// firstName: "บุษดี", -// lastName: "มาดีหกหฟก", -// job: "12", -// lastNameOld: "", -// statusMarital: "แต่งงาน", -// }, -// ]; - -// coupleData.value = data; -// childData.value = data2; -// } - function fetchDataRelationship() { showLoader(); http @@ -362,6 +339,8 @@ function submitChildren() { }); } +function fetchHistory() {} + onMounted(() => { fetchDataFather(); fetchDataMother(); @@ -457,7 +436,7 @@ onMounted(() => { icon="mdi-pencil-outline" size="14px" dense - @click="onOpenDialogForm('mom', true)" + @click="onOpenDialogForm('mother', true)" > แก้ไขข้อมูล @@ -468,7 +447,7 @@ onMounted(() => { color="info" icon="mdi-history" size="14px" - @click="onOpenDialogHistory('mom')" + @click="onOpenDialogHistory('mother')" > ประวัติการแก้ไขข้อมูลครอบครัว @@ -481,21 +460,21 @@ onMounted(() => {
เลขบัตรประจำตัวประชาชน
- {{ momData.citizenId ? momData.citizenId : "-" }} + {{ motherData.citizenId ? motherData.citizenId : "-" }}
ชื่อ-นามสกุล
{{ - momData.prefix - ? momData.prefix + momData.firstName + " " + momData.lastName + motherData.prefix + ? motherData.prefix + motherData.firstName + " " + motherData.lastName : "-" }}
อาชีพ
- {{ momData.job ? momData.job : "-" }} + {{ motherData.job ? motherData.job : "-" }}
@@ -503,7 +482,7 @@ onMounted(() => { สถานภาพการมีชีวิต
-
มีชีวิตอยู่
+
มีชีวิตอยู่
ถึงแก่กรรม
@@ -545,59 +524,56 @@ onMounted(() => { -
- -
-
- คู่สมรสที่ : {{ index + 1 }} + +
+
คู่สมรส
+
+ +
+
+
+
สถานภาพการสมรส
+
+
+ {{ coupleData.statusMarital }}
- -
-
-
-
สถานภาพการสมรส
-
-
- {{ item.statusMarital }} -
+
+
+
เลขบัตรประจำตัวประชาชน
-
-
-
เลขบัตรประจำตัวประชาชน
-
-
- {{ item.citizenId }} -
-
-
-
- ชื่อ-นามสกุล -
-
- {{ - item.prefix - ? item.prefix + item.firstName + " " + item.lastName - : "-" - }} -
-
อาชีพ
-
- {{ item.job }} -
-
-
-
- สถานภาพการมีชีวิต -
-
-
มีชีวิตอยู่
-
ถึงแก่กรรม
-
+
+ {{ coupleData.citizenId }}
- -
+
+
ชื่อ-นามสกุล
+
+ {{ + coupleData.prefix + ? coupleData.prefix + + coupleData.firstName + + " " + + coupleData.lastName + : "-" + }} +
+
อาชีพ
+
+ {{ coupleData.job }} +
+
+
+
+ สถานภาพการมีชีวิต +
+
+
มีชีวิตอยู่
+
ถึงแก่กรรม
+
+
+
+
diff --git a/src/modules/04_registryNew/components/detail/PersonalInformation/05_Education.vue b/src/modules/04_registryNew/components/detail/PersonalInformation/05_Education.vue index ce0c78a82..c6ee665ff 100644 --- a/src/modules/04_registryNew/components/detail/PersonalInformation/05_Education.vue +++ b/src/modules/04_registryNew/components/detail/PersonalInformation/05_Education.vue @@ -637,6 +637,8 @@ async function addData() { startYear: undefined, endYear: undefined, isDate: isDate.value === "false" ? false : true, + profileId: empType.value === "" ? id.value : undefined, + profileEmployeeId: empType.value !== "" ? id.value : undefined, }) .then(() => { fetchData(id.value); diff --git a/src/modules/04_registryNew/components/detail/PersonalInformation/06_SpecialSkill.vue b/src/modules/04_registryNew/components/detail/PersonalInformation/06_SpecialSkill.vue index 2ba68f56d..577cc3273 100644 --- a/src/modules/04_registryNew/components/detail/PersonalInformation/06_SpecialSkill.vue +++ b/src/modules/04_registryNew/components/detail/PersonalInformation/06_SpecialSkill.vue @@ -228,7 +228,7 @@ function editForm(row: any) { async function fetchData(id: string) { showLoader(); await http - .get(config.API.profileNewAbilityByProfileId(id,empType.value)) + .get(config.API.profileNewAbilityByProfileId(id, empType.value)) .then(async (res) => { rows.value = res.data.result; }) @@ -243,7 +243,7 @@ async function fetchData(id: string) { async function fetchHistoryData(id: string) { showLoader(); await http - .get(config.API.profileNewAbilityHisByAbilityId(id,empType.value)) + .get(config.API.profileNewAbilityHisByAbilityId(id, empType.value)) .then(async (res) => { historyRows.value = res.data.result; }) @@ -261,6 +261,8 @@ async function addData() { ...specialSkill, dateStart: null, dateEnd: null, + profileId: empType.value === "" ? id.value : undefined, + profileEmployeeId: empType.value !== "" ? id.value : undefined, }) .then(() => { fetchData(id.value); @@ -276,7 +278,7 @@ async function addData() { async function editData(idData: string) { await http - .patch(config.API.profileNewAbilityByAbilityId(idData,empType.value), { + .patch(config.API.profileNewAbilityByAbilityId(idData, empType.value), { ...specialSkill, dateStart: null, dateEnd: null, @@ -297,7 +299,7 @@ async function editData(idData: string) { async function deleteData(idData: string) { dialogRemove($q, () => http - .delete(config.API.profileNewAbilityByAbilityId(idData,empType.value)) + .delete(config.API.profileNewAbilityByAbilityId(idData, empType.value)) .then(() => { fetchData(id.value); success($q, "ลบข้อมูลสำเร็จ"); diff --git a/src/modules/04_registryNew/components/detail/PersonalInformation/Main.vue b/src/modules/04_registryNew/components/detail/PersonalInformation/Main.vue index 0903c410d..93480c550 100644 --- a/src/modules/04_registryNew/components/detail/PersonalInformation/Main.vue +++ b/src/modules/04_registryNew/components/detail/PersonalInformation/Main.vue @@ -12,6 +12,9 @@ import SpecialSkill from "@/modules/04_registryNew/components/detail/PersonalInf import FamilyNew from "@/modules/04_registryNew/components/detail/PersonalInformation/04_FamilyNew.vue"; const tab = ref("1"); +const props = defineProps({ + fetchDataPersonal: { type: Function, require: true }, +});