ทะเบียนประวัติ

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-05-16 17:52:44 +07:00
parent 322106631a
commit 6c1b4b2adb
7 changed files with 531 additions and 288 deletions

View file

@ -176,4 +176,6 @@ export default {
//ข้อมูลครอบครับ //ข้อมูลครอบครับ
profileFamily: (empType: string, type: string) => profileFamily: (empType: string, type: string) =>
`${registryNew}${empType}/family/${type}`, `${registryNew}${empType}/family/${type}`,
profileFamilyHistory: (id: string, empType: string, type: string) =>
`${registryNew}${empType}/family/${type}/history/${id}`,
}; };

View file

@ -2,7 +2,6 @@
import { ref, reactive, watch, onMounted } from "vue"; import { ref, reactive, watch, onMounted } from "vue";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import type { import type {
MyObjectRef,
RequestItemsHistoryObject, RequestItemsHistoryObject,
FormMain, FormMain,
} from "@/modules/04_registryNew/interface/index/government"; } from "@/modules/04_registryNew/interface/index/government";
@ -25,6 +24,7 @@ const {
messageError, messageError,
showLoader, showLoader,
hideLoader, hideLoader,
success,
} = mixin; } = mixin;
const profileId = ref<string>(route.params.id.toString()); const profileId = ref<string>(route.params.id.toString());
@ -70,24 +70,6 @@ const containDateRef = ref<object | null>(null);
const workDateRef = ref<object | null>(null); const workDateRef = ref<object | null>(null);
const reasonSameDateRef = ref<object | null>(null); const reasonSameDateRef = ref<object | null>(null);
const objectRef: MyObjectRef = {
containDate: containDateRef,
workDate: workDateRef,
reasonSameDate: reasonSameDateRef,
};
const fieldLabels = {
ocId: "สังกัด",
positionId: "ตำแหน่ง",
numberId: "เลขที่ตำแหน่ง",
positionExecutive: "ตำแหน่งทางการบริหาร",
positionExecutiveSide: "ด้านทางการบริหาร",
positionLine: "สายงาน",
positionLevel: "ระดับ",
positionType: "ประเภท",
positionPathSide: "ด้าน/สาขา",
};
const visibleColumnsHistory = ref<String[]>([ const visibleColumnsHistory = ref<String[]>([
"oc", "oc",
"position", "position",
@ -317,7 +299,6 @@ const columnsHistory = ref<QTableProps["columns"]>([
/** เปิด dialog */ /** เปิด dialog */
function openDialogEdit() { function openDialogEdit() {
modalEdit.value = true; modalEdit.value = true;
containDate.value = formMain.containDate ? formMain.containDate : null; containDate.value = formMain.containDate ? formMain.containDate : null;
workDate.value = formMain.workDate ? formMain.workDate : null; workDate.value = formMain.workDate ? formMain.workDate : null;
reasonSameDate.value = formMain.reasonSameDate reasonSameDate.value = formMain.reasonSameDate
@ -338,23 +319,6 @@ function closeDialog() {
reasonSameDate.value = null; reasonSameDate.value = null;
} }
/** validate check*/
function validateForm() {
const hasError = [];
for (const key in objectRef) {
if (Object.prototype.hasOwnProperty.call(objectRef, key)) {
const property = objectRef[key];
if (property.value && typeof property.value.validate === "function") {
const isValid = property.value.validate();
hasError.push(isValid);
}
}
}
if (hasError.every((result) => result === true)) {
onSubmit();
}
}
function onSubmit() { function onSubmit() {
dialogConfirm($q, () => { dialogConfirm($q, () => {
showLoader(); showLoader();
@ -371,9 +335,10 @@ function onSubmit() {
: reasonSameDate.value, : reasonSameDate.value,
} }
) )
.then((res) => { .then(() => {
closeDialog();
getData(); getData();
success($q, "บันทึกข้อมูลสำเร็จ");
closeDialog();
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
@ -381,8 +346,6 @@ function onSubmit() {
.finally(() => { .finally(() => {
hideLoader(); hideLoader();
}); });
closeDialog();
}); });
} }
@ -393,15 +356,15 @@ function getData() {
.get(config.API.profileNewGovernmentById(profileId.value, empType.value)) .get(config.API.profileNewGovernmentById(profileId.value, empType.value))
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
formMain.ocId = data.org; // formMain.ocId = data.org ?? "-"; //
formMain.positionId = data.position; // formMain.positionId = data.position ?? "-"; //
formMain.positionLine = data.positionField; // formMain.positionLine = data.positionField ?? "-"; //
formMain.positionLevel = data.posLevel; // formMain.positionLevel = data.posLevel ?? "-"; //
formMain.numberId = data.posMasterNo; // formMain.numberId = data.posMasterNo ?? "-"; //
formMain.positionType = data.posType; // formMain.positionType = data.posType ?? "-"; //
formMain.positionExecutive = data.posExecutive; // formMain.positionExecutive = data.posExecutive ?? "-"; //
formMain.positionPathSide = data.positionArea; // formMain.positionPathSide = data.positionArea ?? "-"; //
formMain.positionExecutiveSide = data.positionExecutiveField; // formMain.positionExecutiveSide = data.positionExecutiveField ?? "-"; //
formMain.containDate = data.dateAppoint; formMain.containDate = data.dateAppoint;
formMain.workDate = data.dateStart; formMain.workDate = data.dateStart;
@ -463,16 +426,6 @@ function getDataHistory() {
}); });
} }
// watch(
// () => modalHistory.value,
// (isOpen) => {
// if (isOpen === true) {
// filterKeyword.value = "";
// getDataHistory();
// }
// }
// );
onMounted(() => { onMounted(() => {
getData(); getData();
}); });
@ -505,34 +458,72 @@ onMounted(() => {
<q-card bordered class="bg-grey-1 q-pa-md q-mt-sm"> <q-card bordered class="bg-grey-1 q-pa-md q-mt-sm">
<div class="row q-col-gutter-md"> <div class="row q-col-gutter-md">
<div class="col-12 col-sm-6 col-md-6 q-gutter-y-sm"> <div class="col-12 col-sm-6 col-md-6 q-gutter-y-sm">
<div <div class="row items-center">
class="row" <div class="col-12 col-sm-12 col-md-5 text-grey-6 text-weight-medium">
v-for="(field, index) in Object.keys(fieldLabels).slice(0, 5)" <div>งก</div>
:key="index" </div>
> <div class="col-12 col-sm-12 col-md-7">{{ formMain.ocId }}</div>
<div class="col-12 col-sm-12 col-md-5"> </div>
<span class="text-grey-6 text-weight-medium">{{ <div class="row items-center">
fieldLabels[field as keyof typeof fieldLabels] <div class="col-12 col-sm-12 col-md-5 text-grey-6 text-weight-medium">
}}</span> <div>ตำแหน</div>
</div>
<div class="col-12 col-sm-12 col-md-7">{{ formMain.positionId }}</div>
</div>
<div class="row items-center">
<div class="col-12 col-sm-12 col-md-5 text-grey-6 text-weight-medium">
<div>เลขทตำแหน</div>
</div>
<div class="col-12 col-sm-12 col-md-7">{{ formMain.numberId }}</div>
</div>
<div class="row items-center" v-if="empType === ''">
<div class="col-12 col-sm-12 col-md-5 text-grey-6 text-weight-medium">
<div>ตำแหนงทางการบรหาร</div>
</div> </div>
<div class="col-12 col-sm-12 col-md-7"> <div class="col-12 col-sm-12 col-md-7">
<span>{{ formMain[field] ? formMain[field] : "-" }}</span> {{ formMain.positionExecutive }}
</div>
</div>
<div class="row items-center" v-if="empType === ''">
<div class="col-12 col-sm-12 col-md-5 text-grey-6 text-weight-medium">
<div>านทางการบรหาร</div>
</div>
<div class="col-12 col-sm-12 col-md-7">
{{ formMain.positionExecutiveSide }}
</div> </div>
</div> </div>
</div> </div>
<div class="col-12 col-sm-6 col-md-6 q-gutter-y-sm"> <div class="col-12 col-sm-6 col-md-6 q-gutter-y-sm">
<div <div class="row items-center" v-if="empType === ''">
class="row" <div class="col-12 col-sm-12 col-md-5 text-grey-6 text-weight-medium">
v-for="(field, index) in Object.keys(fieldLabels).slice(5, 9)" <div>สายงาน</div>
:key="index"
>
<div class="col-12 col-sm-12 col-md-5">
<span class="text-grey-6 text-weight-medium">{{
fieldLabels[field as keyof typeof fieldLabels]
}}</span>
</div> </div>
<div class="col-12 col-sm-12 col-md-7"> <div class="col-12 col-sm-12 col-md-7">
<span>{{ formMain[field] ? formMain[field] : "-" }}</span> {{ formMain.positionLine }}
</div>
</div>
<div class="row items-center">
<div class="col-12 col-sm-12 col-md-5 text-grey-6 text-weight-medium">
<div>{{ empType === "" ? "ประเภทตำแหน่ง" : "กลุ่มงาน" }}</div>
</div>
<div class="col-12 col-sm-12 col-md-7">
{{ formMain.positionType }}
</div>
</div>
<div class="row items-center">
<div class="col-12 col-sm-12 col-md-5 text-grey-6 text-weight-medium">
<div>{{ empType === "" ? "ระดับตำแหน่ง" : "ระดับชั้นงาน" }}</div>
</div>
<div class="col-12 col-sm-12 col-md-7">
{{ formMain.positionLevel }}
</div>
</div>
<div class="row items-center" v-if="empType === ''">
<div class="col-12 col-sm-12 col-md-5 text-grey-6 text-weight-medium">
<div>าน/สาขา</div>
</div>
<div class="col-12 col-sm-12 col-md-7">
{{ formMain.positionPathSide }}
</div> </div>
</div> </div>
</div> </div>
@ -665,7 +656,7 @@ onMounted(() => {
<!-- dialog edit --> <!-- dialog edit -->
<q-dialog v-model="modalEdit" persistent> <q-dialog v-model="modalEdit" persistent>
<q-card> <q-card>
<form @submit.prevent="validateForm"> <q-form @submit.prevent greedy @validation-success="onSubmit">
<DialogHeader tittle="แก้ไขข้อมูลราชการ" :close="closeDialog" /> <DialogHeader tittle="แก้ไขข้อมูลราชการ" :close="closeDialog" />
<q-separator color="grey-4" /> <q-separator color="grey-4" />
@ -785,7 +776,7 @@ onMounted(() => {
<q-tooltip>นทกขอม</q-tooltip> <q-tooltip>นทกขอม</q-tooltip>
</q-btn> </q-btn>
</q-card-actions> </q-card-actions>
</form> </q-form>
</q-card> </q-card>
</q-dialog> </q-dialog>

View file

@ -37,6 +37,7 @@ const visibleColumns = ref<String[]>([
"lastName", "lastName",
"job", "job",
"isLive", "isLive",
"lastNameOld",
]); ]);
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
{ {
@ -76,6 +77,15 @@ const columns = ref<QTableProps["columns"]>([
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
}, },
{
name: "lastNameOld",
align: "left",
label: "นามสกุลเดิม",
sortable: true,
field: "lastNameOld",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{ {
name: "job", name: "job",
align: "left", align: "left",
@ -93,37 +103,37 @@ const columns = ref<QTableProps["columns"]>([
field: "isLive", field: "isLive",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
format: (val) => convertisLive(val), format: (val) => (val ? "มีชีวิต" : "ถึงแก่กรรม"),
}, },
]); ]);
const rows = ref<any[]>([]); const rows = ref<any[]>([]);
/** ข้อมูล*/ /** ข้อมูล*/
const fatherData = ref({ const fatherData = reactive<any>({
isLive: 1, isLive: null,
citizenId: "1231231231231", citizenId: "",
prefix: "นาย", prefix: "",
firstName: "ตรีชาไทย", firstName: "",
lastName: "หวังดี", lastName: "",
job: "จอมพล", job: "",
}); });
const motherData = ref({ const motherData = reactive<any>({
isLive: 0, isLive: null,
citizenId: "1572476458930", citizenId: "",
prefix: "นาง", prefix: "",
firstName: "บุษดี", firstName: "",
lastName: "มาดี", lastName: "",
job: "พยาบาล", job: "",
}); });
const coupleData = ref<any>({ const coupleData = reactive<any>({
isLive: 1, isLive: null,
citizenId: "1231231231231", citizenId: "",
prefix: "นาย", prefix: "",
firstName: "ตรีชาไทย", firstName: "",
lastName: "หวังดี", lastName: "",
job: "จอมพล", job: "",
lastNameOld: "หวังดี", lastNameOld: "",
statusMarital: "แต่งงานแล้ว", statusMarital: "",
}); });
const childData = ref<any[]>([{}]); const childData = ref<any[]>([{}]);
@ -134,6 +144,7 @@ const filterHistory = ref<string>("");
const titleForm = ref<string>(""); const titleForm = ref<string>("");
const typeForm = ref<string>(""); const typeForm = ref<string>("");
const isEdit = ref<boolean>(false); const isEdit = ref<boolean>(false);
const childernId = ref<string>("");
const optionRelationshipMain = ref<DataOption[]>([]); const optionRelationshipMain = ref<DataOption[]>([]);
const optionRelationship = ref<DataOption[]>([]); const optionRelationship = ref<DataOption[]>([]);
@ -152,9 +163,20 @@ const fromData = reactive({
function fetchDataFather() { function fetchDataFather() {
showLoader(); showLoader();
http http
.get(config.API.profileFamily(empType.value, "father")) .get(
config.API.profileFamily(empType.value, "father") + `/${profileId.value}`
)
.then((res) => { .then((res) => {
console.log(res); const data = res.data.result;
if (data) {
fatherData.isLive = data.fatherLive;
fatherData.citizenId = data.fatherCitizenId;
fatherData.prefix = data.fatherPrefix;
fatherData.firstName = data.fatherFirstName;
fatherData.lastName = data.fatherLastName;
fatherData.job = data.fatherCareer;
}
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
@ -166,9 +188,19 @@ function fetchDataFather() {
function fetchDataMother() { function fetchDataMother() {
showLoader(); showLoader();
http http
.get(config.API.profileFamily(empType.value, "mother ")) .get(
config.API.profileFamily(empType.value, "mother") + `/${profileId.value}`
)
.then((res) => { .then((res) => {
console.log(res); const data = res.data.result;
if (data) {
motherData.isLive = data.motherLive;
motherData.citizenId = data.motherCitizenId;
motherData.prefix = data.motherPrefix;
motherData.firstName = data.motherFirstName;
motherData.lastName = data.motherLastName;
motherData.job = data.motherCareer;
}
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
@ -180,9 +212,21 @@ function fetchDataMother() {
function fetchDataCouple() { function fetchDataCouple() {
showLoader(); showLoader();
http http
.get(config.API.profileFamily(empType.value, "couple")) .get(
config.API.profileFamily(empType.value, "couple") + `/${profileId.value}`
)
.then((res) => { .then((res) => {
console.log(res); const data = res.data.result;
if (data) {
coupleData.isLive = data.coupleLive;
coupleData.citizenId = data.coupleCitizenId;
coupleData.prefix = data.couplePrefix;
coupleData.firstName = data.coupleFirstName;
coupleData.lastName = data.coupleLastName;
coupleData.job = data.coupleCareer;
coupleData.lastNameOld = data.coupleLastNameOld;
coupleData.statusMarital = data.relationship;
}
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
@ -194,9 +238,13 @@ function fetchDataCouple() {
function fetchDataChildren() { function fetchDataChildren() {
showLoader(); showLoader();
http http
.get(config.API.profileFamily(empType.value, "children")) .get(
config.API.profileFamily(empType.value, "children") +
`/${profileId.value}`
)
.then((res) => { .then((res) => {
console.log(res); const data = res.data.result;
childData.value = data;
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
@ -207,14 +255,45 @@ function fetchDataChildren() {
} }
function onSubmit(type: string) { function onSubmit(type: string) {
dialogConfirm($q, () => { dialogConfirm($q, async () => {
if (type === "father") { showLoader();
} else if (type === "mother") {
} else if (type === "couple") { const formBody = {
} else if (type === "child") { profileId:
submitChildren(); !isEdit.value && empType.value === "" ? profileId.value : undefined,
profileEmployeeId:
!isEdit.value && empType.value !== "" ? profileId.value : undefined,
[`${type}CitizenId`]: fromData.citizenId,
[`${type}Prefix`]: fromData.prefix,
[`${type}FirstName`]: fromData.firstName,
[`${type}LastName`]: fromData.lastName,
[`${type}Career`]: fromData.job,
[`${type}Live`]: fromData.isLive === 1 ? true : false,
relationship: type === "couple" ? fromData.statusMarital : undefined,
coupleLastNameOld: type === "couple" ? fromData.lastNameOld : undefined,
};
const url =
isEdit.value && type === "children"
? config.API.profileFamily(empType.value, type) + `/${childernId.value}`
: config.API.profileFamily(empType.value, type);
const method = isEdit.value && type === "children" ? "patch" : "post";
try {
await http[method](url, formBody);
success($q, "บันทึกข้อมูลสำเร็จ");
type === "father"
? fetchDataFather()
: type === "mother"
? fetchDataMother()
: type === "couple"
? fetchDataCouple()
: fetchDataChildren();
closeDialog();
} catch (e) {
messageError($q, e);
} finally {
hideLoader();
} }
closeDialog();
}); });
} }
@ -239,43 +318,47 @@ function onOpenDialogForm(
modal.value = true; modal.value = true;
typeForm.value = type; typeForm.value = type;
isEdit.value = isStatusEdit; isEdit.value = isStatusEdit;
console.log(data);
if (type === "father") { if (type === "father") {
titleForm.value = "บิดา"; titleForm.value = "บิดา";
if (isStatusEdit) {
fromData.isLive = fatherData.value.isLive; fromData.isLive = fatherData.isLive ? 1 : 0;
fromData.citizenId = fatherData.value.citizenId; fromData.citizenId = fatherData.citizenId;
fromData.prefix = fatherData.value.prefix; fromData.prefix = fatherData.prefix;
fromData.firstName = fatherData.value.firstName; fromData.firstName = fatherData.firstName;
fromData.lastName = fatherData.value.lastName; fromData.lastName = fatherData.lastName;
fromData.job = fatherData.value.job; fromData.job = fatherData.job;
}
} else if (type === "mother") { } else if (type === "mother") {
titleForm.value = "มารดา"; titleForm.value = "มารดา";
if (isStatusEdit) {
fromData.isLive = motherData.value.isLive; fromData.isLive = motherData.isLive ? 1 : 0;
fromData.citizenId = motherData.value.citizenId; fromData.citizenId = motherData.citizenId;
fromData.prefix = motherData.value.prefix; fromData.prefix = motherData.prefix;
fromData.firstName = motherData.value.firstName; fromData.firstName = motherData.firstName;
fromData.lastName = motherData.value.lastName; fromData.lastName = motherData.lastName;
fromData.job = motherData.value.job; fromData.job = motherData.job;
}
} else if (type === "couple") { } else if (type === "couple") {
titleForm.value = "คู่สมรส"; titleForm.value = "คู่สมรส";
} else if (type === "child") { } else if (type === "children") {
titleForm.value = "บุตร"; titleForm.value = "บุตร";
fromData.isLive = data.isLive; if (isStatusEdit) {
fromData.citizenId = data.citizenId; childernId.value = data.id;
fromData.prefix = data.prefix; fromData.isLive = data.childrenLive ? 1 : 0;
fromData.firstName = data.firstName; fromData.citizenId = data.childrenCitizenId;
fromData.lastName = data.lastName; fromData.prefix = data.childrenPrefix;
fromData.job = data.job; fromData.firstName = data.childrenFirstName;
fromData.lastName = data.childrenLastName;
fromData.job = data.childrenCareer;
}
} }
} }
function onOpenDialogHistory(type: string) { function onOpenDialogHistory(type: string, id: string = "") {
modalHistory.value = true; modalHistory.value = true;
console.log(type); typeForm.value = type;
const historyId = type === "children" ? id : profileId.value;
fetchHistory(historyId, type);
} }
function fetchDataRelationship() { function fetchDataRelationship() {
@ -305,42 +388,30 @@ const filterSelectorRelation = (val: any, update: Function) => {
}); });
}; };
function convertisLive(status: number) { function fetchHistory(id: string, type: string) {
switch (status) { hideLoader();
case 1:
return "ถึงแก่กรรม";
case 2:
return "มีชีวิต";
default:
break;
}
}
function submitChildren() {
const body = {
profileId: empType.value === "" ? profileId.value : undefined,
profileEmployeeId: empType.value !== "" ? profileId.value : undefined,
childrenCareer: fromData.job,
childrenFirstName: fromData.firstName,
childrenLastName: fromData.lastName,
childrenPrefix: fromData.prefix,
childrenLive: fromData.isLive === 1 ? true : false,
childrenCitizenId: fromData.citizenId,
};
http http
.post(config.API.profileFamily(empType.value, "children"), body) .get(config.API.profileFamilyHistory(id, empType.value, type))
.then(() => { .then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ"); const data = res.data.result;
rows.value = data.map((e: any) => ({
citizenId: e[`${type}CitizenId`],
prefix: e[`${type}Prefix`],
firstName: e[`${type}FirstName`],
lastName: e[`${type}LastName`],
job: e[`${type}Career`],
isLive: e[`${type}Live`],
lastNameOld: type === "couple" ? e.coupleLastNameOld : undefined,
}));
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
})
.finally(() => {
hideLoader();
}); });
} }
function fetchHistory() {}
onMounted(() => { onMounted(() => {
fetchDataFather(); fetchDataFather();
fetchDataMother(); fetchDataMother();
@ -366,7 +437,7 @@ onMounted(() => {
icon="mdi-pencil-outline" icon="mdi-pencil-outline"
size="14px" size="14px"
dense dense
@click="onOpenDialogForm('father', true)" @click="onOpenDialogForm('father')"
> >
<q-tooltip>แกไขขอม</q-tooltip></q-btn <q-tooltip>แกไขขอม</q-tooltip></q-btn
> >
@ -415,8 +486,13 @@ onMounted(() => {
สถานภาพการม สถานภาพการม
</div> </div>
<div class="col-10"> <div class="col-10">
<div v-if="fatherData.isLive">มีชีวิตอยู่</div> {{
<div v-else>ถึงแก่กรรม</div> fatherData.isLive === true
? "มีชีวิตอยู่"
: fatherData.isLive === false
? "ถึงแก่กรรม"
: "-"
}}
</div> </div>
</div> </div>
</q-card> </q-card>
@ -436,7 +512,7 @@ onMounted(() => {
icon="mdi-pencil-outline" icon="mdi-pencil-outline"
size="14px" size="14px"
dense dense
@click="onOpenDialogForm('mother', true)" @click="onOpenDialogForm('mother')"
> >
<q-tooltip>แกไขขอม</q-tooltip></q-btn <q-tooltip>แกไขขอม</q-tooltip></q-btn
> >
@ -468,7 +544,10 @@ onMounted(() => {
<div class="col-6"> <div class="col-6">
{{ {{
motherData.prefix motherData.prefix
? motherData.prefix + motherData.firstName + " " + motherData.lastName ? motherData.prefix +
motherData.firstName +
" " +
motherData.lastName
: "-" : "-"
}} }}
</div> </div>
@ -482,8 +561,13 @@ onMounted(() => {
สถานภาพการม สถานภาพการม
</div> </div>
<div class="col-10"> <div class="col-10">
<div v-if="motherData.isLive">มีชีวิตอยู่</div> {{
<div v-else>ถึงแก่กรรม</div> motherData.isLive === true
? "มีชีวิตอยู่"
: motherData.isLive === false
? "ถึงแก่กรรม"
: "-"
}}
</div> </div>
</div> </div>
</q-card> </q-card>
@ -524,7 +608,11 @@ onMounted(() => {
</div> </div>
</q-toolbar> </q-toolbar>
<q-card bordered class="bg-grey-1 q-pb-md"> <q-card
bordered
class="bg-grey-1 q-pb-md"
v-if="coupleData.statusMarital"
>
<div class="col-12 row q-py-sm q-px-md bg-grey-2 items-center"> <div class="col-12 row q-py-sm q-px-md bg-grey-2 items-center">
<div class="text-weight-medium q-pr-md">สมรส</div> <div class="text-weight-medium q-pr-md">สมรส</div>
</div> </div>
@ -535,7 +623,7 @@ onMounted(() => {
<div>สถานภาพการสมรส</div> <div>สถานภาพการสมรส</div>
</div> </div>
<div class="col-10"> <div class="col-10">
{{ coupleData.statusMarital }} {{ coupleData.statusMarital ?? "-" }}
</div> </div>
</div> </div>
<div class="row items-center"> <div class="row items-center">
@ -543,7 +631,7 @@ onMounted(() => {
<div>เลขบตรประจำตวประชาชน</div> <div>เลขบตรประจำตวประชาชน</div>
</div> </div>
<div class="col-10"> <div class="col-10">
{{ coupleData.citizenId }} {{ coupleData.citizenId ?? "-" }}
</div> </div>
</div> </div>
<div class="row items-center"> <div class="row items-center">
@ -560,7 +648,7 @@ onMounted(() => {
</div> </div>
<div class="col-1 text-grey-6 text-weight-medium">อาช</div> <div class="col-1 text-grey-6 text-weight-medium">อาช</div>
<div class="col"> <div class="col">
{{ coupleData.job }} {{ coupleData.job ?? "-" }}
</div> </div>
</div> </div>
<div class="row items-center"> <div class="row items-center">
@ -568,8 +656,13 @@ onMounted(() => {
สถานภาพการม สถานภาพการม
</div> </div>
<div class="col"> <div class="col">
<div v-if="coupleData.isLive">มีชีวิตอยู่</div> {{
<div v-else>ถึงแก่กรรม</div> coupleData.isLive === true
? "มีชีวิตอยู่"
: coupleData.isLive === false
? "ถึงแก่กรรม"
: "-"
}}
</div> </div>
</div> </div>
</div> </div>
@ -588,7 +681,7 @@ onMounted(() => {
color="primary" color="primary"
icon="add" icon="add"
size="14px" size="14px"
@click="onOpenDialogForm('child')" @click="onOpenDialogForm('children')"
> >
<q-tooltip>เพมบตร</q-tooltip></q-btn <q-tooltip>เพมบตร</q-tooltip></q-btn
> >
@ -597,7 +690,7 @@ onMounted(() => {
</q-toolbar> </q-toolbar>
<div v-for="(item, index) in childData" :key="index"> <div v-for="(item, index) in childData" :key="index">
<q-card bordered class="bg-grey-1 q-pb-md"> <q-card bordered class="bg-grey-1 q-pb-md q-mb-sm">
<div class="col-12 row q-py-sm q-px-md bg-grey-2 items-center"> <div class="col-12 row q-py-sm q-px-md bg-grey-2 items-center">
<div class="text-weight-medium q-pr-md"> <div class="text-weight-medium q-pr-md">
ตรคนท : {{ index + 1 }} ตรคนท : {{ index + 1 }}
@ -611,7 +704,7 @@ onMounted(() => {
icon="mdi-pencil-outline" icon="mdi-pencil-outline"
size="14px" size="14px"
dense dense
@click="onOpenDialogForm('child', true, item)" @click="onOpenDialogForm('children', true, item)"
> >
<q-tooltip>แกไขขอม</q-tooltip></q-btn <q-tooltip>แกไขขอม</q-tooltip></q-btn
> >
@ -622,7 +715,7 @@ onMounted(() => {
color="info" color="info"
icon="mdi-history" icon="mdi-history"
size="14px" size="14px"
@click="onOpenDialogHistory('child')" @click="onOpenDialogHistory('children', item.id)"
> >
<q-tooltip>ประวการแกไขขอมลครอบคร</q-tooltip></q-btn <q-tooltip>ประวการแกไขขอมลครอบคร</q-tooltip></q-btn
> >
@ -635,7 +728,7 @@ onMounted(() => {
<div>เลขบตรประจำตวประชาชน</div> <div>เลขบตรประจำตวประชาชน</div>
</div> </div>
<div class="col-10"> <div class="col-10">
{{ item.citizenId }} {{ item.childrenCitizenId }}
</div> </div>
</div> </div>
<div class="row items-center"> <div class="row items-center">
@ -644,14 +737,17 @@ onMounted(() => {
</div> </div>
<div class="col-6"> <div class="col-6">
{{ {{
item.prefix item.childrenPrefix
? item.prefix + item.firstName + " " + item.lastName ? item.childrenPrefix +
item.childrenFirstName +
" " +
item.childrenLastName
: "-" : "-"
}} }}
</div> </div>
<div class="col-1 text-grey-6 text-weight-medium">อาช</div> <div class="col-1 text-grey-6 text-weight-medium">อาช</div>
<div class="col"> <div class="col">
{{ item.job }} {{ item.childrenCareer }}
</div> </div>
</div> </div>
<div class="row items-center"> <div class="row items-center">
@ -659,8 +755,13 @@ onMounted(() => {
สถานภาพการม สถานภาพการม
</div> </div>
<div class="col"> <div class="col">
<div v-if="item.isLive">มีชีวิตอยู่</div> {{
<div v-else>ถึงแก่กรรม</div> item.childrenLive === true
? "มีชีวิตอยู่"
: item.childrenLive === false
? "ถึงแก่กรรม"
: "-"
}}
</div> </div>
</div> </div>
</div> </div>
@ -680,13 +781,6 @@ onMounted(() => {
/> />
<q-separator color="grey-4" /> <q-separator color="grey-4" />
<q-card-section> <q-card-section>
<!-- <div class="col-12 row q-pb-sm">
<div
class="q-mr-md q-pl-md text-weight-bold text-primary text-subtitle1"
>
{{ titleForm }}
</div>
</div> -->
<div class="q-col-gutter-sm"> <div class="q-col-gutter-sm">
<div class="row col" v-if="typeForm === 'couple'"> <div class="row col" v-if="typeForm === 'couple'">
<q-select <q-select
@ -861,7 +955,18 @@ onMounted(() => {
<q-dialog v-model="modalHistory" class="dialog" persistent> <q-dialog v-model="modalHistory" class="dialog" persistent>
<q-card style="min-width: 80%"> <q-card style="min-width: 80%">
<DialogHeader tittle="ประวัติแก้ไขข้อมูลครอบครัว" :close="closeDialog" /> <DialogHeader
:tittle="`ประวัติแก้ไขข้อมูล${
typeForm === 'father'
? 'บิดา'
: typeForm === 'mother'
? 'มารดา'
: typeForm === 'couple'
? 'คู่สมรส'
: 'บุตร'
}`"
:close="closeDialog"
/>
<q-separator color="grey-4" /> <q-separator color="grey-4" />
<q-card-section> <q-card-section>
<div class="row q-gutter-sm q-mb-sm"> <div class="row q-gutter-sm q-mb-sm">
@ -899,7 +1004,11 @@ onMounted(() => {
:display-value="$q.lang.table.columns" :display-value="$q.lang.table.columns"
emit-value emit-value
map-options map-options
:options="columns" :options="
typeForm === 'couple'
? columns
: columns?.filter((e) => e.name !== 'lastNameOld')
"
option-value="name" option-value="name"
options-cover options-cover
style="min-width: 150px" style="min-width: 150px"
@ -910,7 +1019,11 @@ onMounted(() => {
flat flat
bordered bordered
dense dense
:columns="columns" :columns="
typeForm === 'couple'
? columns
: columns?.filter((e) => e.name !== 'lastNameOld')
"
:rows="rows" :rows="rows"
:paging="true" :paging="true"
:rows-per-page-options="[10, 25, 50, 100]" :rows-per-page-options="[10, 25, 50, 100]"

View file

@ -653,6 +653,8 @@ async function addData() {
} }
function editData(idData: string) { function editData(idData: string) {
console.log(educationData);
http http
.patch(config.API.profileNewEducationByEducationId(idData, empType.value), { .patch(config.API.profileNewEducationByEducationId(idData, empType.value), {
...educationData, ...educationData,
@ -660,6 +662,8 @@ function editData(idData: string) {
startYear: undefined, startYear: undefined,
endYear: undefined, endYear: undefined,
isDate: isDate.value === "false" ? false : true, isDate: isDate.value === "false" ? false : true,
durationYear:
educationData.durationYear === "" ? null : educationData.durationYear,
}) })
.then(() => { .then(() => {
fetchData(id.value); fetchData(id.value);
@ -797,7 +801,7 @@ onMounted(async () => {
<q-tr :props="props" class="cursor-pointer"> <q-tr :props="props" class="cursor-pointer">
<q-td v-for="col in props.cols" :key="col.id"> <q-td v-for="col in props.cols" :key="col.id">
<div> <div>
{{ col.value === "" ? "-" : col.value }} {{ col.value === ""|| col.value === null ? "-" : col.value }}
</div> </div>
</q-td> </q-td>
<q-td auto-width> <q-td auto-width>

View file

@ -143,7 +143,6 @@ const formFilter = reactive({
pageSize: 10, pageSize: 10,
keyword: "", keyword: "",
}); });
const maxPage = ref<number>(1);
const pagination = ref({ const pagination = ref({
page: 1, page: 1,
@ -176,11 +175,17 @@ const salaryId = ref<string>("");
const dataLevel = ref<any[]>([]); const dataLevel = ref<any[]>([]);
const posNoOptions = ref<DataOption2[]>(store.optionTemplatePos); const posNoOptions = ref<DataOption2[]>(store.optionTemplatePos);
const positionLineOptions = ref<DataOption2[]>(store.optionTemplatePos);
const posTypeOptions = ref<DataOption[]>([]); const posTypeOptions = ref<DataOption[]>([]);
const posTypeOptionsMain = ref<DataOption[]>([]); const posTypeOptionsMain = ref<DataOption[]>([]);
const posLevelOption = ref<DataOption[]>([]); const posLevelOption = ref<DataOption[]>([]);
const posLevelOptionMain = ref<DataOption[]>([]); const posLevelOptionMain = ref<DataOption[]>([]);
const positionFielOptiond = ref<DataOption[]>([]);
const positionFielOptiondMain = ref<DataOption[]>([]);
const positionAreaOptiond = ref<DataOption[]>([]);
const positionAreaOptiondMain = ref<DataOption[]>([]);
const posExecutiveOption = ref<DataOption[]>([]);
const posExecutiveOptionMain = ref<DataOption[]>([]);
const docOption = ref<DataOption2[]>(store.optionTemplateDoc); const docOption = ref<DataOption2[]>(store.optionTemplateDoc);
@ -219,18 +224,26 @@ async function updateSelectType(val: string, status: boolean = false) {
const listLevel = await dataLevel.value.find( const listLevel = await dataLevel.value.find(
(e: any) => e.posTypeName === val (e: any) => e.posTypeName === val
); );
if (listLevel) { if (listLevel) {
posLevelOptionMain.value = listLevel.posLevels.map((e: any) => ({ posLevelOptionMain.value = listLevel.posLevels.map((e: any) => ({
id: e.id, id: e.id,
name: e.posLevelName, name: e.posLevelName.toString(),
})); }));
posLevelOption.value = posLevelOptionMain.value;
formDataSalary.positionLevel = !status ? "" : formDataSalary.positionLevel; formDataSalary.positionLevel = !status ? "" : formDataSalary.positionLevel;
} }
} }
async function onClickOpenDialog(statusEdit: boolean = false, data: any = []) { async function onClickOpenDialog(statusEdit: boolean = false, data: any = []) {
dataLevel.value.length === 0 && (await fetchType()); if (empType.value === "") {
dataLevel.value.length === 0 && fetchType();
fetchDataOption();
fetchDataOptionExecutive();
} else {
fetchOptionGroup();
}
setTimeout(async () => { setTimeout(async () => {
statusEdit && (await updateSelectType(data.positionType, true)); statusEdit && (await updateSelectType(data.positionType, true));
isStatusEdit.value = statusEdit; isStatusEdit.value = statusEdit;
@ -270,8 +283,8 @@ function filterSelector(val: any, update: Function, filtername: string) {
break; break;
case "positionLine": case "positionLine":
update(() => { update(() => {
positionLineOptions.value = store.optionTemplatePos.filter( positionFielOptiond.value = positionFielOptiondMain.value.filter(
(v: DataOption2) => v.name.indexOf(val) > -1 (v: DataOption) => v.name.indexOf(val) > -1
); );
}); });
break; break;
@ -296,6 +309,21 @@ function filterSelector(val: any, update: Function, filtername: string) {
); );
}); });
break; break;
case "positionPathSide":
update(() => {
positionAreaOptiond.value = positionAreaOptiondMain.value.filter(
(v: DataOption) => v.name.indexOf(val) > -1
);
});
break;
case "positionExecutive":
update(() => {
posExecutiveOption.value = posExecutiveOptionMain.value.filter(
(v: DataOption) => v.name.indexOf(val) > -1
);
});
break;
default: default:
break; break;
@ -318,14 +346,19 @@ function onSubmit() {
async function submit() { async function submit() {
const formData = { const formData = {
profileId: isStatusEdit.value || empType.value !== ''? undefined : profileId.value, profileEmployeeId:
profileEmployeeId: empType.value !== "" ? profileId.value : undefined, !isStatusEdit.value && empType.value !== "" ? profileId.value : undefined,
profileId:
!isStatusEdit.value && empType.value === "" ? profileId.value : undefined,
date: formDataSalary.date, // date: formDataSalary.date, //
posNo: formDataSalary.posNo, // posNo: formDataSalary.posNo, //
position: formDataSalary.position, // position: formDataSalary.position, //
positionLine: formDataSalary.positionLine, // positionLine:
positionPathSide: formDataSalary.positionPathSide, // / empType.value === "" ? formDataSalary.positionLine : undefined, //
positionExecutive: formDataSalary.positionExecutive, // positionPathSide:
empType.value === "" ? formDataSalary.positionPathSide : undefined, // /
positionExecutive:
empType.value === "" ? formDataSalary.positionExecutive : undefined, //
positionType: formDataSalary.positionType, // positionType: formDataSalary.positionType, //
positionLevel: formDataSalary.positionLevel, // positionLevel: formDataSalary.positionLevel, //
amount: amount:
@ -395,6 +428,95 @@ function onClikcHistory(id: string) {
modalHistory.value = true; modalHistory.value = true;
} }
async function fetchDataOption() {
showLoader();
await http
.get(config.API.orgPosPosition + `?keyword=&type=ALL`)
.then((res) => {
const data = res.data.result;
console.log(res);
const seen = new Set();
const seen2 = new Set();
const listPositionField = data.filter((item: any) => {
if (seen.has(item.positionField)) {
return false;
} else {
seen.add(item.positionField);
return true;
}
});
positionFielOptiondMain.value = listPositionField.map((e: any) => ({
id: e.positionField,
name: e.positionField,
}));
const listPositionArea = data.filter((item: any) => {
if (
item.positionArea === null ||
item.positionArea === "" ||
item.positionArea === "-" ||
seen2.has(item.positionArea)
) {
return false;
} else {
seen2.add(item.positionArea);
return true;
}
});
positionAreaOptiondMain.value = listPositionArea.map((e: any) => ({
id: e.positionArea,
name: e.positionArea,
}));
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
function fetchDataOptionExecutive() {
showLoader();
http
.get(config.API.orgPosExecutive)
.then((res) => {
const data = res.data.result;
posExecutiveOptionMain.value = data.map((e: any) => ({
id: e.posExecutiveName,
name: e.posExecutiveName,
}));
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
async function fetchOptionGroup() {
showLoader();
await http
.get(config.API.orgEmployeeType)
.then(async (res) => {
dataLevel.value = res.data.result;
posTypeOptionsMain.value = res.data.result.map((e: any) => ({
id: e.id,
name: e.posTypeName,
}));
posTypeOptions.value = posTypeOptionsMain.value;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
onMounted(() => { onMounted(() => {
fetchListSalary(); fetchListSalary();
}); });
@ -535,7 +657,7 @@ onMounted(() => {
</d-table> </d-table>
<q-dialog v-model="modalDialogSalary" persistent> <q-dialog v-model="modalDialogSalary" persistent>
<q-card> <q-card style="width: 900px; max-width: 80vw">
<q-form greedy @submit.prevent @validation-success="onSubmit"> <q-form greedy @submit.prevent @validation-success="onSubmit">
<DialogHeader <DialogHeader
:tittle=" :tittle="
@ -640,59 +762,6 @@ onMounted(() => {
/> />
</div> </div>
<div class="col-xs-6 col-sm-6 col-md-4">
<q-input
outlined
dense
lazy-rules
v-model="formDataSalary.positionLine"
hide-bottom-space
:label="`${'สายงาน'}`"
/>
<!-- <q-select
outlined
dense
lazy-rules
borderless
v-model="formDataSalary.positionLine"
:label="`${'สายงาน'}`"
emit-value
map-options
option-label="name"
:options="positionLineOptions"
option-value="id"
hide-bottom-space
use-input
input-debounce="0"
@filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, 'positionLine'
)"
/> -->
</div>
<div class="col-xs-6 col-sm-6 col-md-4">
<q-input
outlined
dense
lazy-rules
v-model="formDataSalary.positionPathSide"
hide-bottom-space
:label="`${'ด้าน/สาขา'}`"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-4">
<q-input
outlined
dense
lazy-rules
borderless
v-model="formDataSalary.positionExecutive"
hide-bottom-space
:label="`${'ตำแหน่งทางการบริหาร'}`"
>
</q-input>
</div>
<div class="col-xs-6 col-sm-6 col-md-4"> <div class="col-xs-6 col-sm-6 col-md-4">
<q-select <q-select
ref="positionType Ref" ref="positionType Ref"
@ -701,7 +770,7 @@ onMounted(() => {
lazy-rules lazy-rules
borderless borderless
v-model="formDataSalary.positionType" v-model="formDataSalary.positionType"
:label="`${'ตำแหน่งประเภท'}`" :label="empType == '' ? 'ตำแหน่งประเภท' : 'กลุ่มงาน'"
emit-value emit-value
map-options map-options
option-label="name" option-label="name"
@ -711,7 +780,7 @@ onMounted(() => {
use-input use-input
input-debounce="0" input-debounce="0"
@update:model-value="updateSelectType" @update:model-value="updateSelectType"
:rules="[(val: string) => !!val || `${'กรุณาเลือกตำแหน่งประเภท'}`]" :rules="empType == '' ? [(val: string) => !!val || 'กรุณาเลือกตำแหน่งประเภท' ]:[(val: string) => !!val || 'กรุณาเลือกกลุ่มงาน' ]"
@filter="(inputValue: any, @filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, 'posType' doneFn: Function) => filterSelector(inputValue, doneFn, 'posType'
)" )"
@ -726,8 +795,8 @@ onMounted(() => {
lazy-rules lazy-rules
borderless borderless
v-model="formDataSalary.positionLevel" v-model="formDataSalary.positionLevel"
:rules="[(val: string) => !!val || `${'กรุณาเลือกระดับตำแหน่ง'}`]" :rules="empType == '' ? [(val: string) => !!val || 'กรุณาเลือกระดับตำแหน่ง' ] : [(val: string) => !!val || 'กรุณาเลือกระดับชั้นงาน']"
:label="`${'ระดับตำแหน่ง'}`" :label="empType == '' ? 'ระดับตำแหน่ง' : 'ระดับชั้นงาน'"
emit-value emit-value
map-options map-options
option-label="name" option-label="name"
@ -742,6 +811,76 @@ onMounted(() => {
/> />
</div> </div>
<div class="col-md-4"></div> <div class="col-md-4"></div>
<div class="col-xs-6 col-sm-6 col-md-4" v-if="empType == ''">
<q-select
outlined
dense
lazy-rules
borderless
v-model="formDataSalary.positionLine"
:label="`${'สายงาน'}`"
emit-value
map-options
option-label="name"
:options="positionFielOptiond"
option-value="id"
hide-bottom-space
use-input
clearable
input-debounce="0"
@filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, 'positionLine'
)"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-4" v-if="empType == ''">
<q-select
outlined
dense
lazy-rules
borderless
v-model="formDataSalary.positionPathSide"
:label="`${'ด้าน/สาขา'}`"
emit-value
map-options
option-label="name"
:options="positionAreaOptiond"
option-value="id"
hide-bottom-space
use-input
clearable
input-debounce="0"
@filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, 'positionPathSide'
)"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-4" v-if="empType == ''">
<q-select
outlined
dense
lazy-rules
borderless
v-model="formDataSalary.positionExecutive"
:label="`${'ตำแหน่งทางการบริหาร'}`"
emit-value
map-options
option-label="name"
:options="posExecutiveOption"
option-value="id"
hide-bottom-space
use-input
input-debounce="0"
clearable
@filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, 'positionExecutive'
)"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-4"> <div class="col-xs-6 col-sm-6 col-md-4">
<q-input <q-input
ref="salaryRef" ref="salaryRef"
@ -771,6 +910,7 @@ onMounted(() => {
hide-bottom-space hide-bottom-space
/> />
</div> </div>
<div class="col-xs-6 col-sm-6 col-md-4"> <div class="col-xs-6 col-sm-6 col-md-4">
<q-input <q-input
ref="amountRef" ref="amountRef"

View file

@ -24,13 +24,6 @@ interface GovAgeForm {
day: number; day: number;
} }
interface MyObjectRef {
containDate: object | null;
workDate: object | null;
reasonSameDate: object | null;
[key: string]: any;
}
interface RequestItemsHistoryObject { interface RequestItemsHistoryObject {
lastUpdatedAt: Date; lastUpdatedAt: Date;
lastUpdateFullName: string; lastUpdateFullName: string;
@ -54,4 +47,4 @@ interface RequestItemsHistoryObject {
createdFullName: string | null; createdFullName: string | null;
createdAt: Date; createdAt: Date;
} }
export type { MyObjectRef, RequestItemsHistoryObject, FormMain }; export type { RequestItemsHistoryObject, FormMain };

View file

@ -15,7 +15,7 @@ interface RequestItemsObject {
country: string; country: string;
other: string; other: string;
duration: string; duration: string;
durationYear: number | null; durationYear: number | null | string;
note: string; note: string;
educationLevelId: string; educationLevelId: string;
positionPath: string; positionPath: string;