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