popup ทะเบียนประวัติ
This commit is contained in:
parent
e7d87e5488
commit
16c916f26e
2 changed files with 226 additions and 20 deletions
|
|
@ -8,7 +8,10 @@ import { checkPermissionGet } from "@/utils/permissions";
|
|||
|
||||
/** importType*/
|
||||
import type { PersonalImformation } from "@/components/information/interface/response/Information";
|
||||
import type { Goverment } from "@/components/information/interface/response/Government";
|
||||
import type {
|
||||
Goverment,
|
||||
GovermentEmpTemp,
|
||||
} from "@/components/information/interface/response/Government";
|
||||
import type { Avatar } from "@/components/information/interface/response/avatar";
|
||||
|
||||
/** importStore*/
|
||||
|
|
@ -74,6 +77,24 @@ const goverment = reactive<Goverment>({
|
|||
dateRetireLaw: "",
|
||||
});
|
||||
|
||||
const govermentTemp = reactive<GovermentEmpTemp>({
|
||||
positionEmployeeGroupId: "",
|
||||
positionEmployeeLineId: "",
|
||||
positionEmployeePositionId: "",
|
||||
employeeOc: "",
|
||||
employeeTypeIndividual: "",
|
||||
employeeWage: "",
|
||||
employeeMoneyIncrease: "",
|
||||
employeeMoneyAllowance: "",
|
||||
employeeMoneyEmployee: "",
|
||||
employeeMoneyEmployer: "",
|
||||
});
|
||||
|
||||
/**
|
||||
* function คำนวนอายุ
|
||||
* @param birthDate วันเดือนปีเกิด
|
||||
* @returns อายุ
|
||||
*/
|
||||
function calculateAge(birthDate: Date | null) {
|
||||
if (!birthDate) return null;
|
||||
const birthDateTimeStamp = new Date(birthDate).getTime();
|
||||
|
|
@ -130,11 +151,19 @@ async function fetchInformation(id: string) {
|
|||
avatar.fullname = `${data.prefix}${data.firstName} ${data.lastName}`;
|
||||
|
||||
avatar.position = data.position ? data.position : "-";
|
||||
//ถ้ามีรูปเรียก Function fetchProfile เรียกข้อมูลรูปโปรไฟล์
|
||||
if (data.avatarName) {
|
||||
await fetchProfile(data.id as string, data.avatarName);
|
||||
} else {
|
||||
avatar.avatar = "";
|
||||
}
|
||||
|
||||
if (props.id) {
|
||||
// employeeClass.value === "TEMP" เรียกข้อมูลลูกจ้างชั่วคราว ไม่ใช่ เรียกข้อมูลข้อมูลราชการ
|
||||
employeeClass.value === "TEMP"
|
||||
? await fetchProfileGovTemp(props.id)
|
||||
: await fetchProfileGov(props.id);
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
|
|
@ -149,7 +178,6 @@ async function fetchInformation(id: string) {
|
|||
* @param id profileID
|
||||
*/
|
||||
async function fetchProfileGov(id: string) {
|
||||
showLoader();
|
||||
await http
|
||||
.get(
|
||||
config.API.profileNewGovernmentCard(
|
||||
|
|
@ -184,9 +212,45 @@ async function fetchProfileGov(id: string) {
|
|||
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* function fetch ข้อมูลลูกจ้างชั่วคราว
|
||||
* @param id profileID
|
||||
*/
|
||||
async function fetchProfileGovTemp(id: string) {
|
||||
await http
|
||||
.get(config.API.informationEmployee(id))
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
govermentTemp.positionEmployeeGroupId = data.positionEmployeeGroupId;
|
||||
govermentTemp.positionEmployeeLineId = data.positionEmployeeLineId;
|
||||
govermentTemp.positionEmployeePositionId =
|
||||
data.positionEmployeePositionId;
|
||||
govermentTemp.employeeOc = data.employeeOc;
|
||||
govermentTemp.employeeTypeIndividual = data.employeeTypeIndividual;
|
||||
govermentTemp.employeeWage = data.employeeWage;
|
||||
govermentTemp.employeeMoneyIncrease = data.employeeMoneyIncrease;
|
||||
govermentTemp.employeeMoneyAllowance = data.employeeMoneyAllowance;
|
||||
govermentTemp.employeeMoneyEmployee = data.employeeMoneyEmployee;
|
||||
govermentTemp.employeeMoneyEmployer = data.employeeMoneyEmployer;
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* function เรียกไฟล์รูป
|
||||
* @param id profileID
|
||||
* @param avatarName ชื่อไฟล์
|
||||
*/
|
||||
async function fetchProfile(id: string, avatarName: string) {
|
||||
await http
|
||||
.get(config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, avatarName))
|
||||
.then(async (res) => {
|
||||
avatar.avatar = await res.data.downloadUrl;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -215,10 +279,7 @@ watch(
|
|||
? "employee"
|
||||
: "officer";
|
||||
|
||||
await Promise.all([
|
||||
fetchInformation(props.id),
|
||||
fetchProfileGov(props.id),
|
||||
]);
|
||||
await fetchInformation(props.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -229,14 +290,6 @@ watch(modal, (newValue) => {
|
|||
emit("update:modal", false);
|
||||
}
|
||||
});
|
||||
|
||||
async function fetchProfile(id: string, avatarName: string) {
|
||||
await http
|
||||
.get(config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, avatarName))
|
||||
.then(async (res) => {
|
||||
avatar.avatar = await res.data.downloadUrl;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
@ -386,14 +439,21 @@ async function fetchProfile(id: string, avatarName: string) {
|
|||
<div class="q-pa-md">
|
||||
<div class="text-weight-bold row items-center">
|
||||
<q-icon name="mdi-account-tie" color="grey-7" />
|
||||
<span class="q-ml-md">ข้อมูลราชการ </span>
|
||||
<span class="q-ml-md">
|
||||
{{
|
||||
employeeClass !== "TEMP"
|
||||
? "ข้อมูลราชการ"
|
||||
: "ข้อมูลลูกจ้างชั่วคราว"
|
||||
}}
|
||||
</span>
|
||||
</div>
|
||||
<div class="row q-pa-sm">
|
||||
|
||||
<div class="row q-pa-sm" v-if="employeeClass !== 'TEMP'">
|
||||
<div class="col-xs-12 col-md-12 text-html">
|
||||
<q-input
|
||||
borderless
|
||||
readonly
|
||||
:model-value="goverment.oc === '' ? '-' : goverment.oc"
|
||||
:model-value="goverment.oc ? goverment.oc : '-'"
|
||||
label="สังกัด"
|
||||
autogrow
|
||||
></q-input>
|
||||
|
|
@ -504,6 +564,139 @@ async function fetchProfile(id: string, avatarName: string) {
|
|||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row q-pa-sm" v-else>
|
||||
<div class="col-xs-12 col-md-12 text-html">
|
||||
<q-input
|
||||
borderless
|
||||
readonly
|
||||
:model-value="
|
||||
govermentTemp.employeeOc
|
||||
? govermentTemp.employeeOc
|
||||
: '-'
|
||||
"
|
||||
label="สังกัด"
|
||||
autogrow
|
||||
></q-input>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-6 col-md-6">
|
||||
<q-input
|
||||
borderless
|
||||
readonly
|
||||
:model-value="
|
||||
govermentTemp.positionEmployeeGroupId
|
||||
? govermentTemp.positionEmployeeGroupId
|
||||
: '-'
|
||||
"
|
||||
label="กลุ่มงาน"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-6 col-md-6">
|
||||
<q-input
|
||||
borderless
|
||||
readonly
|
||||
:model-value="
|
||||
govermentTemp.positionEmployeeLineId
|
||||
? govermentTemp.positionEmployeeLineId
|
||||
: '-'
|
||||
"
|
||||
label="สายงาน"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-6 col-md-6">
|
||||
<q-input
|
||||
borderless
|
||||
readonly
|
||||
:model-value="
|
||||
govermentTemp.positionEmployeePositionId
|
||||
? govermentTemp.positionEmployeePositionId
|
||||
: '-'
|
||||
"
|
||||
label="ตำแหน่งทางสายงาน"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-6 col-md-6">
|
||||
<q-input
|
||||
borderless
|
||||
readonly
|
||||
:model-value="
|
||||
govermentTemp.employeeTypeIndividual
|
||||
? govermentTemp.employeeTypeIndividual
|
||||
: '-'
|
||||
"
|
||||
label="ประเภทบุคคล"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-6 col-md-6">
|
||||
<q-input
|
||||
borderless
|
||||
readonly
|
||||
:model-value="
|
||||
govermentTemp.employeeWage
|
||||
? govermentTemp.employeeWage
|
||||
: '-'
|
||||
"
|
||||
label="ค่าจ้าง"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-6 col-md-6">
|
||||
<q-input
|
||||
borderless
|
||||
readonly
|
||||
:model-value="
|
||||
govermentTemp.employeeMoneyIncrease
|
||||
? govermentTemp.employeeMoneyIncrease
|
||||
: '-'
|
||||
"
|
||||
label="เงินเพิ่มการครองชีพชั่วคราว"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-6 col-md-6">
|
||||
<q-input
|
||||
borderless
|
||||
readonly
|
||||
:model-value="
|
||||
govermentTemp.employeeMoneyAllowance
|
||||
? govermentTemp.employeeMoneyAllowance
|
||||
: '-'
|
||||
"
|
||||
label="เงินช่วยเหลือการครองชีพชั่วคราว"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-6 col-md-6">
|
||||
<q-input
|
||||
borderless
|
||||
readonly
|
||||
:model-value="
|
||||
govermentTemp.employeeMoneyEmployee
|
||||
? govermentTemp.employeeMoneyEmployee
|
||||
: '-'
|
||||
"
|
||||
label="เงินสมทบประกันสังคม (ลูกจ้าง)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-6 col-md-6">
|
||||
<q-input
|
||||
borderless
|
||||
readonly
|
||||
:model-value="
|
||||
govermentTemp.employeeMoneyEmployer
|
||||
? govermentTemp.employeeMoneyEmployer
|
||||
: '-'
|
||||
"
|
||||
label="เงินสมทบประกันสังคม (นายจ้าง)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</q-card>
|
||||
|
||||
|
|
|
|||
|
|
@ -34,4 +34,17 @@ interface Goverment {
|
|||
dateRetireLaw: string;
|
||||
}
|
||||
|
||||
export type { ResponseObject, Goverment };
|
||||
interface GovermentEmpTemp {
|
||||
positionEmployeeGroupId: string;
|
||||
positionEmployeeLineId: string;
|
||||
positionEmployeePositionId: string;
|
||||
employeeOc: string;
|
||||
employeeTypeIndividual: string;
|
||||
employeeWage: string;
|
||||
employeeMoneyIncrease: string;
|
||||
employeeMoneyAllowance: string;
|
||||
employeeMoneyEmployee: string;
|
||||
employeeMoneyEmployer: string;
|
||||
}
|
||||
|
||||
export type { ResponseObject, Goverment, GovermentEmpTemp };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue