fix report & export to excel of registry system

This commit is contained in:
Warunee Tamkoo 2025-06-24 13:24:15 +07:00
parent 3d858a7a2f
commit d7f2a62d7e

View file

@ -342,7 +342,10 @@ const columns = computed<QTableProps["columns"]>(() => {
{
name: "positionDate",
align: "left",
label: "ระยะเวลาดำรงตำแหน่ง (สายงาน) ปัจจุบัน",
label:
employeeClass.value === "officer"
? "ระยะเวลาดำรงตำแหน่ง (สายงาน) ปัจจุบัน"
: "ระยะเวลาดำรงตำแหน่งปัจจุบัน",
sortable: true,
field: "positionDate",
headerStyle: "font-size: 14px",
@ -379,7 +382,10 @@ const visibleColumns = computed<string[]>(() => {
return employeeClass.value === "officer"
? visibleColumnsBase.value
: visibleColumnsBase.value.filter(
(e: string) => e !== "positionExecutive" && e !== "positionArea"
(e: string) =>
e !== "positionExecutive" &&
e !== "positionArea" &&
e !== "posExecutiveDate"
);
});
@ -649,7 +655,14 @@ async function onSearch() {
function exportToExcel() {
const newData = rows.value.map((e: any) => {
const { profileId, empType, positionArea, positionExecutive, ...rest } = e;
const {
profileId,
empType,
positionArea,
positionExecutive,
posExecutiveDate,
...rest
} = e;
return {
...rest,
dateAppoint: date2Thai(e.dateAppoint),
@ -661,12 +674,17 @@ function exportToExcel() {
});
const headers =
columns.value
?.filter(
(x: any) =>
x.field !== "positionExecutive" && x.field !== "positionArea"
)
.map((item: any) => item.label) || []; //
employeeClass.value === "officer"
? columns.value?.map((item: any) => item.label) || []
: columns.value
?.filter(
(x: any) =>
x.field !== "positionExecutive" &&
x.field !== "positionArea" &&
x.field !== "posExecutiveDate"
)
.map((item: any) => item.label) || []; //
const worksheet = XLSX.utils.json_to_sheet(newData, {
header: visibleColumns.value,
});
@ -1544,7 +1562,11 @@ watch(
<q-radio
v-model="typeTerm"
val="position"
label="ระยะเวลาดำรงตำแหน่ง (สายงาน) ปัจจุบัน"
:label="
employeeClass === 'officer'
? 'ระยะเวลาดำรงตำแหน่ง (สายงาน) ปัจจุบัน'
: 'ระยะเวลาดำรงตำแหน่งปัจจุบัน'
"
size="xs"
class="text-grey-8"
/>
@ -1556,6 +1578,7 @@ watch(
class="text-grey-8"
/>
<q-radio
v-if="employeeClass === 'officer'"
v-model="typeTerm"
val="tenureType"
label="ระยะเวลาดำรงตำแหน่ง (บริหาร) ปัจจุบัน"
@ -1687,6 +1710,7 @@ watch(
</q-list>
</q-btn-dropdown>
</div>
<d-table
:columns="columns"
:rows="rows"