fix map field education display in excel

This commit is contained in:
Warunee Tamkoo 2025-06-24 15:32:31 +07:00
parent 380881c78d
commit 1d0c06697d

View file

@ -604,17 +604,26 @@ async function onSearch() {
gender: item.gender ?? "-",
status: item.relationship ?? "-",
education:
item.Educations.length > 0
? item.Educations.map((e: any) => e.degree)
: [],
item.Educations.length > 0 &&
item.Educations.filter((e: any) => e.degree != null)
? item.Educations.filter((e: any) => e.degree != null).map(
(e: any) => e.degree
)
: null,
educationLevel:
item.Educations.length > 0
? item.Educations.map((e: any) => e.educationLevel)
: [],
item.Educations.length > 0 &&
item.Educations.filter((e: any) => e.educationLevel != null)
? item.Educations.filter((e: any) => e.educationLevel != null).map(
(e: any) => e.educationLevel
)
: null,
field:
item.Educations.length > 0
? item.Educations.map((e: any) => e.field)
: [],
item.Educations.length > 0 &&
item.Educations.filter((e: any) => e.field != null)
? item.Educations.filter((e: any) => e.field != null).map(
(e: any) => e.field
)
: null,
dateAppoint: item.dateAppoint ?? "-",
age: item.age ?? "-",
@ -654,24 +663,55 @@ async function onSearch() {
}
function exportToExcel() {
const newData = rows.value.map((e: any) => {
const {
profileId,
empType,
positionArea,
positionExecutive,
posExecutiveDate,
...rest
} = e;
return {
...rest,
dateAppoint: date2Thai(e.dateAppoint),
dateRetireLaw: date2Thai(e.dateRetireLaw),
education: e.education.map((e: string) => `${e}`).join(", "),
educationLevel: e.educationLevel.map((e: string) => `${e}`).join(", "),
field: e.field.map((e: string) => `${e}`).join(", "),
};
});
const newData =
employeeClass.value === "officer"
? rows.value.map((e: any) => {
const { profileId, empType, ...rest } = e;
return {
...rest,
dateAppoint: date2Thai(e.dateAppoint),
dateRetireLaw: date2Thai(e.dateRetireLaw),
education:
e.education && e.education.length > 0
? e.education.map((e: string) => `${e}`).join(", ")
: "-",
educationLevel:
e.educationLevel && e.educationLevel.length > 0
? e.educationLevel.map((e: string) => `${e}`).join(", ")
: "-",
field:
e.field && e.field.length > 0
? e.field.map((e: string) => `${e}`).join(", ")
: "-",
};
})
: rows.value.map((e: any) => {
const {
profileId,
empType,
positionArea,
positionExecutive,
posExecutiveDate,
...rest
} = e;
return {
...rest,
dateAppoint: date2Thai(e.dateAppoint),
dateRetireLaw: date2Thai(e.dateRetireLaw),
education:
e.education && e.education.length > 0
? e.education.map((e: string) => `${e}`).join(", ")
: "-",
educationLevel:
e.educationLevel && e.educationLevel.length > 0
? e.educationLevel.map((e: string) => `${e}`).join(", ")
: "-",
field:
e.field && e.field.length > 0
? e.field.map((e: string) => `${e}`).join(", ")
: "-",
};
});
const headers =
employeeClass.value === "officer"
@ -1558,7 +1598,7 @@ watch(
<div class="col-12"><q-separator /></div>
<div class="col-12">
<div class="">
<div>
<q-radio
v-model="typeTerm"
val="position"
@ -1570,6 +1610,8 @@ watch(
size="xs"
class="text-grey-8"
/>
</div>
<div>
<q-radio
v-model="typeTerm"
val="level"
@ -1577,6 +1619,8 @@ watch(
size="xs"
class="text-grey-8"
/>
</div>
<div>
<q-radio
v-if="employeeClass === 'officer'"
v-model="typeTerm"