diff --git a/src/modules/02_organization/views/main.vue b/src/modules/02_organization/views/main.vue index f580aad73..1824a137d 100644 --- a/src/modules/02_organization/views/main.vue +++ b/src/modules/02_organization/views/main.vue @@ -1,6 +1,7 @@ - เพิ่มข้อมูล @@ -449,6 +458,7 @@ onMounted(async () => { { > ประวัติแก้ไขวินัย - @@ -505,6 +502,7 @@ onMounted(async () => { import { ref, reactive, onMounted } from "vue"; +import { checkPermission } from "@/utils/permissions"; + import { useRoute } from "vue-router"; import { useQuasar, type QTableProps } from "quasar"; @@ -457,7 +459,14 @@ onMounted(() => { - เพิ่มข้อมูล @@ -560,6 +569,7 @@ onMounted(() => { { import { ref, reactive, onMounted } from "vue"; +import { checkPermission } from "@/utils/permissions"; + import { useQuasar, type QTableProps } from "quasar"; import type { FormFilter, @@ -301,7 +303,14 @@ onMounted(async () => { - เพิ่มข้อมูล @@ -405,6 +414,7 @@ onMounted(async () => { { > ประวัติแก้ไขปฏิบัติราชการพิเศษ - @@ -462,6 +459,7 @@ onMounted(async () => { import { useQuasar, type QTableProps } from "quasar"; +import { checkPermission } from "@/utils/permissions"; import { ref, onMounted, reactive } from "vue"; import type { RowList, @@ -214,7 +215,14 @@ onMounted(() => { - เพิ่มข้อมูล @@ -316,6 +324,7 @@ onMounted(() => { { { import { ref, onMounted } from "vue"; +import { checkPermission } from "@/utils/permissions"; + import { useRoute } from "vue-router"; import http from "@/plugins/http"; import config from "@/app.config"; @@ -179,6 +181,7 @@ onMounted(() => { import { onMounted, watch, ref, reactive } from "vue"; +import { checkPermission } from "@/utils/permissions"; import { useRoute } from "vue-router"; import { useQuasar } from "quasar"; -import type { QTableColumn, QForm } from "quasar"; import http from "@/plugins/http"; import config from "@/app.config"; -import { useCounterMixin } from "@/stores/mixin"; -import { useProfileDataStore } from "@/modules/04_registryPerson/stores/profile"; -import DialogHeader from "@/components/DialogHeader.vue"; +/** + * importType + */ +import type { QTableColumn, QForm } from "quasar"; import type { RequestObject } from "@/modules/04_registryPerson/interface/request/Profile"; import type { ResponseObject } from "@/modules/04_registryPerson/interface/response/Profile"; +/** + * importComponents + */ +import DialogHeader from "@/components/DialogHeader.vue"; + +/** + * importStore + */ +import { useCounterMixin } from "@/stores/mixin"; +import { useProfileDataStore } from "@/modules/04_registryPerson/stores/profile"; + +/** + * use + */ const $q = useQuasar(); const route = useRoute(); -const mixin = useCounterMixin(); const store = useProfileDataStore(); +const { calculateAge, fetchPerson, filterSelector } = store; const { success, showLoader, @@ -24,8 +39,11 @@ const { messageError, dialogConfirm, dialogMessageNotify, -} = mixin; -const { calculateAge, fetchPerson, filterSelector } = store; +} = useCounterMixin(); + +/** + * props + */ const props = defineProps({ fetchDataPersonal: { type: Function, require: true }, }); @@ -37,23 +55,16 @@ const empType = ref( route.name === "registryNewByid" ? "" : "-employee" ); -const currentPage = ref(1); -const maxPage = ref(1); const modal = ref(false); const informaData = ref(); const rowsHistory = ref([]); const filterHistory = ref(""); const modalHistory = ref(false); - const id = ref(""); const age = ref(""); const formData = reactive(store.defaultProfile); -const pagination = ref({ - page: 1, - rowsPerPage: 10, -}); - +/** ข้อมูล Label*/ const dataLabel = { citizenId: "เลขประจำตัวประชาชน", name: "ชื่อ - สกุล", @@ -73,6 +84,7 @@ const dataLabel = { lastName: "นามสกุล", }; +/** ข้อมูล Table ประวัติแการก้ไขข้อมูลส่วนตัว*/ const columnsHistory = ref([ { name: "citizenId", @@ -244,7 +256,6 @@ const columnsHistory = ref([ a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), }, ]); - const visibleColumnsHistory = ref([ "citizenId", "prefix", @@ -262,8 +273,17 @@ const visibleColumnsHistory = ref([ "createdFullName", "createdAt", ]); +const pagination = ref({ + page: 1, + rowsPerPage: 10, + sortBy: "createdAt", + descending: true, +}); -async function getData() { +/** + * function เรียกข้อมูลข้อมูลส่วนตัว + */ +function getData() { showLoader(); http .get(config.API.registryNewByProfileId(profileId.value, empType.value)) @@ -272,10 +292,7 @@ async function getData() { id.value = res.data.result.id; if (res.data.result.birthDate) { - console.log("birthDate===>", res.data.result.birthDate); - age.value = calculateAge(res.data.result.birthDate); - console.log("age===>", age.value); } }) .catch((e) => { @@ -286,37 +303,12 @@ async function getData() { }); } -const calculateMaxDate = () => { - const today = new Date(); - today.setFullYear(today.getFullYear() - 18); - return today; -}; - -async function editData() { - showLoader(); - await http - .put(config.API.profileNewProfileById(id.value, empType.value), { - ...formData, - employeeClass: route.name === "registry-employeeId" ? "TEMP" : undefined, - }) - .then(() => { - success($q, "บันทึกข้อมูลสำเร็จ"); - getData(), (modal.value = false); - props.fetchDataPersonal?.(); - }) - .catch((e) => { - messageError($q, e); - }) - .finally(() => { - hideLoader(); - }); -} - +/** + * function แก้ไขข้อมูลประวัติส่วนตัว + */ function onClickOpenDialog() { if (!informaData.value) return; modal.value = true; - console.log("onClickOpenDialog birthDate===>", informaData.value.birthDate); - id.value = informaData.value.id; age.value = calculateAge(informaData.value.birthDate); formData.citizenId = informaData.value.citizenId; @@ -334,21 +326,45 @@ function onClickOpenDialog() { formData.phone = informaData.value.phone; } +/** + * function ยืนยันการบันทึกข้อมูล + */ function onSubmit() { dialogConfirm( $q, async () => { - editData(); - modal.value = false; + showLoader(); + http + .put(config.API.profileNewProfileById(id.value, empType.value), { + ...formData, + employeeClass: + route.name === "registry-employeeId" ? "TEMP" : undefined, + }) + .then(async () => { + await getData(); + await props.fetchDataPersonal?.(); + modal.value = false; + success($q, "บันทึกข้อมูลสำเร็จ"); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); }, "ยืนยันการบันทึกข้อมูล", "ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?" ); } -async function clickHistory() { +/** + * function ดูข้อมูลประวัติแก้ไขข้อมูลส่วนตัว + */ +function clickHistory() { modalHistory.value = true; - await http + filterHistory.value = ""; + http .get(config.API.profileNewProfileHisById(id.value, empType.value)) .then((res) => { rowsHistory.value = res.data.result; @@ -361,6 +377,10 @@ async function clickHistory() { }); } +/** + * function เช็คเลขประจำตัวประชาชนช้ำ + * @param citizenId เลขประจำตัวประชาชน + */ function changeCardID(citizenId: string | number | null) { if (citizenId != null && typeof citizenId == "string") { if (citizenId.length == 13 && citizenId) { @@ -380,29 +400,29 @@ function changeCardID(citizenId: string | number | null) { } } +/** + * function เช็คอายุไม่เกิน 18 ปี + */ +function calculateMaxDate() { + const today = new Date(); + today.setFullYear(today.getFullYear() - 18); + return today; +} + watch( () => formData.birthDate, (v) => { - console.log("v===>", v); - if (v) { age.value = calculateAge(v); } } ); -onMounted(async () => { - await getData(); - +onMounted(() => { + getData(); if (store.Ops && store.Ops.prefixOps && store.Ops.prefixOps.length === 0) { fetchPerson(); } - - // store.Ops.prefixOps.length === 0 || - // store.Ops.genderOps.length === 0 || - // store.Ops.bloodOps.length === 0 || - // store.Ops.statusOps.length === 0 || - // store.Ops.religionOps.length === 0 }); @@ -410,6 +430,7 @@ onMounted(async () => { { :options="store.Ops.prefixOps" :label="dataLabel.prefix" :rules="[(val: string) => !!val || `${'กรุณาเลือก คำนำหน้าชื่อ'}`]" - @filter="(inputValue: any, + @filter="(inputValue: string, doneFn: Function) => filterSelector(inputValue, doneFn, 'prefixOps' )" /> @@ -574,7 +595,7 @@ onMounted(async () => { class="inputgreen" :options="store.Ops.rankOps" :label="dataLabel.rank" - @filter="(inputValue: any, + @filter="(inputValue: string, doneFn: Function) => filterSelector(inputValue, doneFn, 'rankOps' )" /> @@ -676,7 +697,7 @@ onMounted(async () => { class="inputgreen" :options="store.Ops.genderOps" :label="dataLabel.gender" - @filter="(inputValue: any, + @filter="(inputValue: string, doneFn: Function) => filterSelector(inputValue, doneFn, 'genderOps' )" /> @@ -698,7 +719,7 @@ onMounted(async () => { v-model="formData.relationship" :options="store.Ops.statusOps" :label="dataLabel.relationship" - @filter="(inputValue: any, + @filter="(inputValue: string, doneFn: Function) => filterSelector(inputValue, doneFn, 'statusOps' )" /> @@ -742,7 +763,7 @@ onMounted(async () => { class="inputgreen" :options="store.Ops.religionOps" :label="dataLabel.religion" - @filter="(inputValue: any, + @filter="(inputValue: string, doneFn: Function) => filterSelector(inputValue, doneFn, 'religionOps' )" /> @@ -764,7 +785,7 @@ onMounted(async () => { class="inputgreen" :options="store.Ops.bloodOps" :label="dataLabel.bloodGroup" - @filter="(inputValue: any, + @filter="(inputValue: string, doneFn: Function) => filterSelector(inputValue, doneFn, 'bloodOps' )" /> @@ -820,6 +841,7 @@ onMounted(async () => { outlined placeholder="ค้นหา" debounce="300" + clearable > { @click.stop.prevent="filterHistory = ''" class="cursor-pointer" /> - import { onMounted, ref, useAttrs, reactive, watch } from "vue"; +import { checkPermission } from "@/utils/permissions"; import { useRoute } from "vue-router"; import { useQuasar } from "quasar"; import axios from "axios"; -import type { QTableProps } from "quasar"; import http from "@/plugins/http"; import config from "@/app.config"; -import dialogHeader from "@/components/DialogHeader.vue"; -import { useCounterMixin } from "@/stores/mixin"; -import type { ResponseObject } from "@/components/information/interface/response/OldName"; -import type { Pagination } from "@/modules/04_registryPerson/interface/index/Main"; -import type { RequestItemsObject } from "@/components/information/interface/request/OldName"; -import { useProfileDataStore } from "@/modules/04_registryPerson/stores/profile"; +/** + * importType + */ +import type { QTableProps } from "quasar"; +import type { ResponseObject } from "@/components/information/interface/response/OldName"; + +/** + * importComponents + */ +import dialogHeader from "@/components/DialogHeader.vue"; + +/** + * importStore + */ +import { useProfileDataStore } from "@/modules/04_registryPerson/stores/profile"; +import { useCounterMixin } from "@/stores/mixin"; + +/** + * use + */ const $q = useQuasar(); const route = useRoute(); -const mixin = useCounterMixin(); const store = useProfileDataStore(); const attrs = ref(useAttrs()); +const { fetchPerson } = store; const { date2Thai, success, @@ -25,27 +39,29 @@ const { messageError, showLoader, hideLoader, - dialogRemove, -} = mixin; -const submitDisable = ref(true); -const { fetchPerson } = store; -const profileId = ref(route.params.id.toString()); -const empType = ref( - route.name === "registryNewByid" ? "" : "-employee" -); +} = useCounterMixin(); + +/** + * props + */ const props = defineProps({ fetchDataPersonal: { type: Function, require: true }, }); +const submitDisable = ref(true); +const profileId = ref(route.params.id.toString()); +const empType = ref( + route.name === "registryNewByid" ? "" : "-employee" +); const editId = ref(""); const dialog = ref(false); const dialogStatus = ref("create"); const filterSearch = ref(""); -const filterHistory = ref(""); + const historyDialog = ref(false); const historyKeyword = ref(""); -const rowsHistory = ref([]); -const changeNameData = reactive({ + +const changeNameData = reactive({ profileId: profileId.value, prefixId: "", prefix: "", @@ -79,7 +95,6 @@ const statusOptionFilter = ref([ "เปลี่ยนคำนำหน้าชื่อ และชื่อ-นามสกุล", ]); const alertUpload = ref(false); -const tittleHistory = ref("ประวัติการเปลี่ยนชื่อ-นามสกุล"); const visibleColumns = ref([ "prefix", "firstName", @@ -213,9 +228,7 @@ const historyColumns = ref([ }, ]); const uploadUrl = ref(""); -const initialPagination = ref({ - rowsPerPage: 0, -}); + const subId = ref(""); const fileUpload = ref(); const pagination = ref({ @@ -248,18 +261,16 @@ function closeDialog() { dialog.value = false; } -async function onSubmit() { +function onSubmit() { if (!!fileUpload.value || dialogStatus.value === "edit") { - await dialogConfirm( + dialogConfirm( $q, - async () => { + () => { showLoader(); - dialogStatus.value === "create" - ? await addData() - : await editData(editId.value); + dialogStatus.value === "create" ? addData() : editData(editId.value); closeDialog(); if (!!fileUpload.value) { - await uploadProfile(fileUpload.value); + uploadProfile(fileUpload.value); } }, "ยืนยันการบันทึกข้อมูล", @@ -307,8 +318,6 @@ async function uploadFileURL(uploadUrl: string, file: any) { }, }) .then(() => { - // fetchProfile(profileId.value); - // success($q, "อัปโหลดไฟล์สำเร็จ"); fileUpload.value = undefined; }) .catch((err) => { @@ -407,44 +416,6 @@ function editData(idData: string) { }); } -// function deleteData(idData: string) { -// dialogRemove($q, () => -// http -// .delete(config.API.profileNewChangeNameByChangeNameId(idData)) -// .then(() => { -// fetchData(profileId.value); -// success($q, "ลบข้อมูลสำเร็จ"); -// }) -// .catch((err) => { -// messageError($q, err); -// }) -// .finally(() => { -// hideLoader(); -// }) -// ); -// } - -function deleteFileData(idData: string) { - http - .delete( - config.API.subFile( - "ทะเบียนประวัติ", - "ประวัติการเปลี่ยนชื่อ-นามสกุล", - profileId.value, - idData - ) - ) - .then(() => { - fetchData(profileId.value); - }) - .catch((err) => { - messageError($q, err); - }) - .finally(() => { - hideLoader(); - }); -} - async function fetchHistoryData(id: string) { showLoader(); await http @@ -460,14 +431,6 @@ async function fetchHistoryData(id: string) { }); } -const paginationLabel = (start: string, end: string, total: string) => { - return start + "-" + end + " ใน " + total; -}; - -async function openFile(val: string | null) { - if (val != null) window.open(val); -} - function closeHistoryDialog() { historyDialog.value = false; } @@ -487,26 +450,12 @@ async function fetchData(id: string) { }); } -onMounted(async () => { - if ( - store.Ops.prefixOps.length === 0 || - store.Ops.genderOps.length === 0 || - store.Ops.bloodOps.length === 0 || - store.Ops.statusOps.length === 0 || - store.Ops.religionOps.length === 0 - ) { - await fetchPerson(); - } - - fetchData(profileId.value); - fetchDataPersonal(); -}); function filterSelector(val: string, update: Function, refData: string) { switch (refData) { case "statusOptions": update(() => { statusOption.value = statusOptionFilter.value.filter( - (v: any) => v.indexOf(val) > -1 + (v: string) => v.indexOf(val) > -1 ); }); break; @@ -522,6 +471,21 @@ function filterSelector(val: string, update: Function, refData: string) { } } +onMounted(async () => { + if ( + store.Ops.prefixOps.length === 0 || + store.Ops.genderOps.length === 0 || + store.Ops.bloodOps.length === 0 || + store.Ops.statusOps.length === 0 || + store.Ops.religionOps.length === 0 + ) { + await fetchPerson(); + } + + fetchData(profileId.value); + fetchDataPersonal(); +}); + watch( () => changeNameData.prefix, () => { @@ -559,6 +523,7 @@ watch( ดาวน์โหลด import { onMounted, ref, reactive, watch } from "vue"; +import { checkPermission } from "@/utils/permissions"; + import { useRoute } from "vue-router"; import { useQuasar } from "quasar"; import type { QTableProps } from "quasar"; @@ -485,6 +487,7 @@ onMounted(async () => { -import { ref, reactive, onMounted } from "vue"; -import dialogHeader from "@/components/DialogHeader.vue"; -import { useCounterMixin } from "@/stores/mixin"; -import { QForm, useQuasar } from "quasar"; -import http from "@/plugins/http"; -import config from "@/app.config"; -import { useRoute } from "vue-router"; -import { useProfileDataStore } from "@/modules/04_registryPerson/stores/profile"; -const mixin = useCounterMixin(); -const $q = useQuasar(); -const { - dialogRemove, - dialogConfirm, - showLoader, - hideLoader, - messageError, - success, - date2Thai, -} = mixin; - -const store = useProfileDataStore(); -const { fetchPerson, filterSelector } = store; -const route = useRoute(); -const id = ref(route.params.id.toString()); -const empType = ref( - route.name === "registryNewByid" ? "" : "-employee" -); -const dialog = ref(false); -const historyDialog = ref(false); -const fatherIsHaveInfo = ref(false); -const motherIsHaveInfo = ref(false); -const spouseIsHave = ref(false); -const fatherIsLive = ref(false); -const motherIsLive = ref(false); -const spouseIsLive = ref(false); -const index = ref(1); -const fatherData = reactive({ - isHaveInfo: 1, - isLive: 0, - citizenId: "", - prefix: "", - firstName: "", - lastName: "", - job: "", -}); - -const fatherDataEdit = reactive({ - isHaveInfo: 1, - isLive: 0, - citizenId: "", - prefix: "", - firstName: "", - lastName: "", - job: "", -}); - -const motherData = reactive({ - isHaveInfo: 1, - isLive: 0, - citizenId: "", - prefix: "", - firstName: "", - lastName: "", - job: "", -}); - -const motherDataEdit = reactive({ - isHaveInfo: 1, - isLive: 0, - citizenId: "", - prefix: "", - firstName: "", - lastName: "", - job: "", -}); - -const spouseData = reactive({ - isHave: 1, - isLive: 0, - citizenId: "", - prefix: "", - firstName: "", - lastName: "", - job: "", -}); - -const spouseDataEdit = reactive({ - isHave: 1, - isLive: 0, - citizenId: "", - prefix: "", - firstName: "", - lastName: "", - job: "", -}); - -const rows = ref([]); -const historyRows = ref([]); -const prefixFilter = ref([]); -const childrenData: any = reactive({ - childrens: [], -}); -const childrenDataEdit: any = reactive({ - childrens: [], -}); - -function editForm(rows: any) { - if (rows !== null) { - fatherDataEdit.isHaveInfo = rows.fatherFirstName !== null ? 1 : 0; - fatherDataEdit.isLive = rows.fatherLive ? 1 : 0; - fatherDataEdit.citizenId = rows.fatherCitizenId; - fatherDataEdit.prefix = rows.fatherPrefix; - fatherDataEdit.firstName = rows.fatherFirstName; - fatherDataEdit.lastName = rows.fatherLastName; - fatherDataEdit.job = rows.fatherCareer; - motherDataEdit.isHaveInfo = rows.motherLive ? 1 : 0; - motherDataEdit.isLive = rows.firstName !== null ? 1 : 0; - motherDataEdit.citizenId = rows.motherCitizenId; - motherDataEdit.prefix = rows.motherPrefix; - motherDataEdit.firstName = rows.motherFirstName; - motherDataEdit.lastName = rows.motherLastName; - motherDataEdit.job = rows.motherCareer; - spouseDataEdit.isLive = rows.coupleFirstName !== null ? 1 : 0; - spouseDataEdit.citizenId = rows.coupleCitizenId; - spouseDataEdit.prefix = rows.couplePrefix; - spouseDataEdit.firstName = rows.coupleFirstName; - spouseDataEdit.lastName = rows.coupleLastName; - spouseDataEdit.job = rows.coupleCareer; - spouseDataEdit.isHave = rows.couple ? 1 : 0; - childrenDataEdit.childrens = rows.children.map((e: any) => ({ - ...e, - childrenLive: e.childrenLive ? 1 : 0, - })); - } -} - -async function fetchData(id: string) { - showLoader(); - await http - .get(config.API.profileNewFamilyByProfileId(id, empType.value)) - .then(async (res) => { - const data = res.data.result; - rows.value = res.data.result; - if (rows.value !== null) { - fatherData.isLive = data.fatherLive ? 1 : 0; - fatherData.citizenId = data.fatherCitizenId; - fatherData.prefix = data.fatherPrefix; - fatherData.firstName = data.fatherFirstName; - fatherData.lastName = data.fatherLastName; - fatherData.job = data.fatherCareer; - motherData.isLive = data.motherLive ? 1 : 0; - motherData.citizenId = data.motherCitizenId; - motherData.prefix = data.motherPrefix; - motherData.firstName = data.motherFirstName; - motherData.lastName = data.motherLastName; - motherData.job = data.motherCareer; - spouseData.isLive = data.coupleLive ? 1 : 0; - spouseData.citizenId = data.coupleCitizenId; - spouseData.prefix = data.couplePrefix; - spouseData.firstName = data.coupleFirstName; - spouseData.lastName = data.coupleLastName; - spouseData.job = data.coupleCareer; - spouseData.isHave = data.couple ? 1 : 0; - childrenData.childrens = data.children.map((e: any) => ({ - ...e, - childrenLive: e.childrenLive ? 1 : 0, - })); - } - }) - .catch((err) => { - messageError($q, err); - }) - .finally(() => { - hideLoader(); - }); -} - -async function fetchHistoryData(id: string) { - showLoader(); - await http - .get(config.API.profileNewFamilyHisByFamilyId(id, empType.value)) - .then(async (res) => { - historyRows.value = res.data.result; - }) - .catch((err) => { - messageError($q, err); - }) - .finally(() => { - index.value = 1; - historyDialog.value = true; - hideLoader(); - }); -} - -async function addData() { - fatherIsHaveInfo.value = fatherDataEdit.isHaveInfo === 1 ? true : false; - motherIsHaveInfo.value = motherDataEdit.isHaveInfo === 1 ? true : false; - spouseIsHave.value = spouseDataEdit.isHave === 1 ? true : false; - fatherIsLive.value = fatherDataEdit.isLive === 1 ? true : false; - motherIsLive.value = motherDataEdit.isLive === 1 ? true : false; - spouseIsLive.value = spouseDataEdit.isLive === 1 ? true : false; - const children = childrenDataEdit.childrens.map((e: any) => ({ - childrenLive: !!e.childrenLive, - childrenCareer: e.childrenCareer, - childrenCitizenId: e.childrenCitizenId, - childrenFirstName: e.childrenFirstName, - childrenLastName: e.childrenLastName, - childrenPrefix: e.childrenPrefix, - id: e.id, - })); - const url = - rows.value === null - ? config.API.profileNewFamily(empType.value) - : config.API.profileNewFamilyByProfileId(id.value, empType.value); - const method = rows.value === null ? "post" : "patch"; - - await http[method](url, { - profileId: - rows.value === null && empType.value === "" ? id.value : undefined, - profileEmployeeId: empType.value !== "" ? id.value : undefined, - motherLive: motherIsHaveInfo.value ? motherIsLive.value : null, - motherCitizenId: motherIsHaveInfo.value ? motherDataEdit.citizenId : null, - motherPrefix: motherIsHaveInfo.value ? motherDataEdit.prefix : null, - motherFirstName: motherIsHaveInfo.value ? motherDataEdit.firstName : null, - motherLastName: motherIsHaveInfo.value ? motherDataEdit.lastName : null, - motherCareer: motherIsHaveInfo.value ? motherDataEdit.job : null, - fatherLive: fatherIsHaveInfo.value ? fatherIsLive.value : null, - fatherCitizenId: fatherIsHaveInfo.value ? fatherDataEdit.citizenId : null, - fatherPrefix: fatherIsHaveInfo.value ? fatherDataEdit.prefix : null, - fatherFirstName: fatherIsHaveInfo.value ? fatherDataEdit.firstName : null, - fatherLastName: fatherIsHaveInfo.value ? fatherDataEdit.lastName : null, - fatherCareer: fatherIsHaveInfo.value ? fatherDataEdit.job : null, - coupleLive: spouseIsHave.value ? spouseIsLive.value : null, - coupleCitizenId: spouseIsHave.value ? spouseDataEdit.citizenId : null, - couplePrefix: spouseIsHave.value ? spouseDataEdit.prefix : null, - coupleFirstName: spouseIsHave.value ? spouseDataEdit.firstName : null, - coupleLastName: spouseIsHave.value ? spouseDataEdit.lastName : null, - coupleLastNameOld: spouseIsHave.value ? spouseDataEdit.lastName : null, - coupleCareer: spouseIsHave.value ? spouseDataEdit.job : null, - couple: spouseIsHave.value, - children: children, - }) - - .then(() => { - fetchData(id.value); - success($q, "บันทึกข้อมูลสำเร็จ"); - }) - .catch((err) => { - messageError($q, err); - }) - .finally(() => { - hideLoader(); - }); -} - -const childrenOptionPrefix = ["นาย", "นาง", "นางสาว"]; - -function closeDialog() { - dialog.value = false; -} - -function closeHistoryDialog() { - historyDialog.value = false; -} - -async function onSubmit() { - dialogConfirm( - $q, - async () => { - addData(); - closeDialog(); - }, - "ยืนยันการบันทึกข้อมูล", - "ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?" - ); -} - -const addChildren = async () => { - childrenDataEdit.childrens.push({ - childrenLive: 0, - childrenCitizenId: "", - childrenPrefix: "", - childrenFirstName: "", - childrenLastName: "", - childrenCareer: "", - id: "", - }); -}; - -function deleteChildren(items: any) { - const index = childrenDataEdit.childrens.findIndex( - (r: any) => r.id == items.id - ); - - childrenDataEdit.childrens.splice(index, 1); -} - -onMounted(async () => { - if ( - store.Ops.prefixOps.length === 0 || - store.Ops.genderOps.length === 0 || - store.Ops.bloodOps.length === 0 || - store.Ops.statusOps.length === 0 || - store.Ops.religionOps.length === 0 - ) { - await fetchPerson(); - } - await fetchData(id.value); -}); - - - - - - { - editForm(rows); - dialog = true; - } - " - > - แก้ไขข้อมูล - { - fetchHistoryData(id); - } - " - > - ประวัติการแก้ไขข้อมูลครอบครัว - - - - - • บิดา - - - - - - เลขประจำตัวประชาชน - - - {{ fatherData.citizenId ? fatherData.citizenId : "-" }} - - - - ชื่อ-นามสกุล - - {{ - fatherData.prefix - ? fatherData.prefix + - fatherData.firstName + - " " + - fatherData.lastName - : "-" - }} - - อาชีพ - - {{ fatherData.job ? fatherData.job : "-" }} - - - - - สถานภาพการมีชีวิต - - - มีชีวิตอยู่ - ถึงแก่กรรม - - - - - - - - - • มารดา - - - - - - เลขประจำตัวประชาชน - - - {{ motherData.citizenId ? motherData.citizenId : "-" }} - - - - ชื่อ-นามสกุล - - {{ - motherData.prefix - ? motherData.prefix + - motherData.firstName + - " " + - motherData.lastName - : "-" - }} - - อาชีพ - - {{ motherData.job ? motherData.job : "-" }} - - - - - สถานภาพการมีชีวิต - - - มีชีวิตอยู่ - ถึงแก่กรรม - - - - - - - - - • คู่สมรส - - - - - - เลขประจำตัวประชาชน - - - {{ spouseData.citizenId ? spouseData.citizenId : "-" }} - - - - ชื่อ-นามสกุล - - {{ - spouseData.prefix - ? spouseData.prefix + - spouseData.firstName + - " " + - spouseData.lastName - : "-" - }} - - อาชีพ - - {{ spouseData.job ? spouseData.job : "-" }} - - - - - สถานภาพการมีชีวิต - - - มีชีวิตอยู่ - ถึงแก่กรรม - - - - - - - - - • บุตร - - - - - - - บุตรคนที่ : {{ index + 1 }} - - - - - - - เลขประจำตัวประชาชน - - - {{ children.childrenCitizenId }} - - - - - ชื่อ-นามสกุล - - - {{ - children.childrenPrefix - ? children.childrenPrefix + - children.childrenFirstName + - " " + - children.childrenLastName - : "-" - }} - - อาชีพ - - {{ children.childrenCareer }} - - - - - สถานภาพการมีชีวิต - - - มีชีวิตอยู่ - ถึงแก่กรรม - - - - - - - - - - - - - - - - - • บิดา - - - - - - - - - - - - - filterSelector(inputValue, doneFn,'prefixOps' - ) " - /> - - - - - - - - - - - - - สถานภาพการมีชีวิต - - - - - - - - - - • มารดา - - - - - - - - - - - - - filterSelector(inputValue, doneFn,'prefixOps' - ) " - /> - - - - - - - - - - - - - สถานภาพการมีชีวิต - - - - - - - - - - • คู่สมรส - - - - - - - - - - - - - filterSelector(inputValue, doneFn, 'prefixOps' - )" - /> - - - - - - - - - - - - - สถานภาพการมีชีวิต - - - - - - - - - - • บุตร - - - เพิ่มข้อมูล - - - - - - - - บุตรคนที่ : {{ index + 1 }} - - - ลบข้อมูลบุตรคนที่ {{ index + 1 }} - - - - - - - - - - filterSelector(inputValue, doneFn,'prefixOps' - ) " - /> - - - - - - - - - - - - - สถานภาพการมีชีวิต - - - - - - - - - - - - - - บันทึกข้อมูล - - - - - - - - - - - - ไม่พบข้อมูล - - - ลำดับที่ {{ index }} - : แก้ไขโดย - {{ - historyRows[index - 1].lastUpdateFullName - }} - วันที่แก้ไข - {{ - date2Thai(historyRows[index - 1].lastUpdatedAt) - }} - - - - - • บิดา - - - - - - เลขประจำตัวประชาชน - - - {{ historyRows[index - 1].fatherCitizenId }} - - - - - ชื่อ-นามสกุล - - - {{ - historyRows[index - 1].fatherPrefix + - historyRows[index - 1].fatherFirstName + - " " + - historyRows[index - 1].fatherLastName - }} - - อาชีพ - - {{ historyRows[index - 1].fatherCareer }} - - - - - สถานภาพการมีชีวิต - - - - มีชีวิตอยู่ - - ถึงแก่กรรม - - - - - - - • มารดา - - - - - - เลขประจำตัวประชาชน - - - {{ historyRows[index - 1].motherCitizenId }} - - - - - ชื่อ-นามสกุล - - - {{ - historyRows[index - 1].motherPrefix + - historyRows[index - 1].motherFirstName + - " " + - historyRows[index - 1].motherLastName - }} - - อาชีพ - - {{ historyRows[index - 1].motherCareer }} - - - - - สถานภาพการมีชีวิต - - - - มีชีวิตอยู่ - - ถึงแก่กรรม - - - - - - - • คู่สมรส - - - - - - เลขประจำตัวประชาชน - - - {{ historyRows[index - 1].coupleCitizenId }} - - - - - ชื่อ-นามสกุล - - - {{ - historyRows[index - 1].couplePrefix + - historyRows[index - 1].coupleFirstName + - " " + - historyRows[index - 1].coupleLastName - }} - - อาชีพ - - {{ historyRows[index - 1].coupleCareer }} - - - - - สถานภาพการมีชีวิต - - - - มีชีวิตอยู่ - - ถึงแก่กรรม - - - - - - - • บุตร - - - - - - - บุตรคนที่ : {{ index + 1 }} - - - - - - - เลขประจำตัวประชาชน - - - {{ children.childrenCitizenId }} - - - - - ชื่อ-นามสกุล - - - {{ - children.childrenPrefix + - children.childrenFirstName + - " " + - children.childrenLastName - }} - - - อาชีพ - - - {{ children.childrenCareer }} - - - - - สถานภาพการมีชีวิต - - - มีชีวิตอยู่ - ถึงแก่กรรม - - - - - - - - - - - - - - - - - - - diff --git a/src/modules/04_registryPerson/components/detail/PersonalInformation/04_FamilyNew.vue b/src/modules/04_registryPerson/components/detail/PersonalInformation/04_FamilyNew.vue index a4b8b5711..7a002a854 100644 --- a/src/modules/04_registryPerson/components/detail/PersonalInformation/04_FamilyNew.vue +++ b/src/modules/04_registryPerson/components/detail/PersonalInformation/04_FamilyNew.vue @@ -1,5 +1,7 @@ @@ -677,7 +727,6 @@ onMounted(async () => { }} - @@ -691,6 +740,7 @@ onMounted(async () => { { - - @@ -1034,6 +1012,7 @@ h2.title { .bg-toolbar { background-color: #f2fbfa; + height: 60px; } .btnEditImg { position: absolute; diff --git a/src/modules/08_registryEmployee/views/Main.vue b/src/modules/08_registryEmployee/views/Main.vue index 79827d1af..f19ed42f2 100644 --- a/src/modules/08_registryEmployee/views/Main.vue +++ b/src/modules/08_registryEmployee/views/Main.vue @@ -1,5 +1,6 @@