Merge branch 'nice' into develop

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-05-17 13:16:30 +07:00
commit 0de1e4d525
2 changed files with 56 additions and 12 deletions

View file

@ -2,12 +2,15 @@
import { reactive, ref, onMounted } from "vue";
import { useQuasar } from "quasar";
import { useRoute } from "vue-router";
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 type {
FormPerson,
FormChildren,
} from "@/modules/04_registryNew/interface/index/family";
import DialogHeader from "@/components/DialogHeader.vue";
@ -109,7 +112,7 @@ const columns = ref<QTableProps["columns"]>([
const rows = ref<any[]>([]);
/** ข้อมูล*/
const fatherData = reactive<any>({
const fatherData = reactive<FormPerson>({
isLive: null,
citizenId: "",
prefix: "",
@ -117,7 +120,7 @@ const fatherData = reactive<any>({
lastName: "",
job: "",
});
const motherData = reactive<any>({
const motherData = reactive<FormPerson>({
isLive: null,
citizenId: "",
prefix: "",
@ -125,7 +128,7 @@ const motherData = reactive<any>({
lastName: "",
job: "",
});
const coupleData = reactive<any>({
const coupleData = reactive<FormPerson>({
isLive: null,
citizenId: "",
prefix: "",
@ -135,7 +138,7 @@ const coupleData = reactive<any>({
lastNameOld: "",
statusMarital: "",
});
const childData = ref<any[]>([{}]);
const childData = ref<FormChildren[]>([]);
const modal = ref<boolean>(false);
const modalHistory = ref<boolean>(false);
@ -150,7 +153,7 @@ const optionRelationshipMain = ref<DataOption[]>([]);
const optionRelationship = ref<DataOption[]>([]);
const fromData = reactive({
isLive: 0,
isLive: 1,
citizenId: "",
prefix: "",
firstName: "",
@ -300,7 +303,7 @@ function onSubmit(type: string) {
function closeDialog() {
modal.value = false;
modalHistory.value = false;
fromData.isLive = 0;
fromData.isLive = 1;
fromData.citizenId = "";
fromData.prefix = "";
fromData.firstName = "";
@ -322,8 +325,10 @@ function onOpenDialogForm(
if (type === "father") {
titleForm.value = "บิดา";
console.log(fatherData.isLive);
fromData.isLive = fatherData.isLive ? 1 : 0;
fromData.isLive =
fatherData.isLive === null ? 1 : fatherData.isLive ? 1 : 0;
fromData.citizenId = fatherData.citizenId;
fromData.prefix = fatherData.prefix;
fromData.firstName = fatherData.firstName;
@ -332,7 +337,8 @@ function onOpenDialogForm(
} else if (type === "mother") {
titleForm.value = "มารดา";
fromData.isLive = motherData.isLive ? 1 : 0;
fromData.isLive =
motherData.isLive === null ? 1 : motherData.isLive ? 1 : 0;
fromData.citizenId = motherData.citizenId;
fromData.prefix = motherData.prefix;
fromData.firstName = motherData.firstName;
@ -340,11 +346,13 @@ function onOpenDialogForm(
fromData.job = motherData.job;
} else if (type === "couple") {
titleForm.value = "คู่สมรส";
fromData.isLive = 1;
} else if (type === "children") {
titleForm.value = "บุตร";
if (isStatusEdit) {
childernId.value = data.id;
fromData.isLive = data.childrenLive ? 1 : 0;
fromData.isLive =
data.childrenLive === null ? 1 : data.childrenLive ? 1 : 0;
fromData.citizenId = data.childrenCitizenId;
fromData.prefix = data.childrenPrefix;
fromData.firstName = data.childrenFirstName;
@ -593,7 +601,7 @@ onMounted(() => {
>
</div>
<q-space />
<div class="row q-col-gutter-sm">
<div class="row q-col-gutter-sm" v-if="coupleData.statusMarital">
<q-btn
round
flat
@ -651,6 +659,12 @@ onMounted(() => {
{{ coupleData.job ?? "-" }}
</div>
</div>
<div class="row items-center" v-if="coupleData.lastNameOld">
<div class="col-2 text-grey-6 text-weight-medium">นามสกลเด</div>
<div class="col">
{{ coupleData.lastNameOld }}
</div>
</div>
<div class="row items-center">
<div class="col-2 text-grey-6 text-weight-medium">
สถานภาพการม
@ -775,7 +789,7 @@ onMounted(() => {
<q-form @submit.prevent greedy @validation-success="onSubmit(typeForm)">
<DialogHeader
:tittle="
isEdit ? `แก้ไขข้อมูล${titleForm}` : `เพิ้มข้อมูล${titleForm}`
isEdit ? `แก้ไขข้อมูล${titleForm}` : `เพิ้มข้อมูล${titleForm}`
"
:close="closeDialog"
/>

View file

@ -0,0 +1,30 @@
interface FormPerson {
isLive: null | number | boolean | string;
citizenId: string;
prefix: string;
firstName: string;
lastName: string;
job: string;
lastNameOld?: string;
statusMarital?: string;
}
interface FormChildren {
id: string;
createdAt: string;
createdUserId: string;
lastUpdatedAt: string;
lastUpdateUserId: string;
createdFullName: string;
lastUpdateFullName: string;
childrenCareer: string;
childrenFirstName: string;
childrenLastName: string;
childrenPrefix: string;
childrenLive: boolean | number | null;
childrenCitizenId: string;
profileId: string | null;
profileEmployeeId: string | null;
}
export type { FormPerson, FormChildren };