รายงานทะเบียนประวัติเพิ่มแสดงฟิลด์ด้าน/สาขา (positionArea) & fixing export data of emp

This commit is contained in:
Warunee Tamkoo 2025-03-11 11:25:29 +07:00
parent e5b9299ee9
commit a48a096e41

View file

@ -126,6 +126,7 @@ const visibleColumnsBase = ref<string[]>([
"position",
"posType",
"posLevel",
"positionArea",
"org",
"positionExecutive",
"gender",
@ -189,7 +190,7 @@ const columns = computed<QTableProps["columns"]>(() => {
{
name: "posType",
align: "left",
label: "ตำแหน่งประเภท",
label: employeeClass.value === "officer" ? "ตำแหน่งประเภท" : "กลุ่มงาน",
sortable: true,
field: "posType",
headerStyle: "font-size: 14px",
@ -200,7 +201,7 @@ const columns = computed<QTableProps["columns"]>(() => {
{
name: "posLevel",
align: "left",
label: "ระดับ",
label: employeeClass.value === "officer" ? "ระดับ" : "ระดับชั้นงาน",
sortable: true,
field: "posLevel",
headerStyle: "font-size: 14px",
@ -208,6 +209,17 @@ const columns = computed<QTableProps["columns"]>(() => {
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "positionArea",
align: "left",
label: "ด้าน/สาขา",
sortable: true,
field: "positionArea",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "org",
align: "left",
@ -354,7 +366,9 @@ const columns = computed<QTableProps["columns"]>(() => {
const visibleColumns = computed<string[]>(() => {
return employeeClass.value === "officer"
? visibleColumnsBase.value
: visibleColumnsBase.value.filter((e: string) => e !== "positionExecutive");
: visibleColumnsBase.value.filter(
(e: string) => e !== "positionExecutive" && e !== "positionArea"
);
});
const typeTerm = ref<string>("");
@ -600,6 +614,7 @@ async function onSearch() {
) ?? "-",
empType: employeeClass.value,
dateRetireLaw: item.dateRetireLaw ?? "-",
positionArea: item.positionArea ?? "-",
}));
})
.catch((e) => {
@ -616,7 +631,7 @@ async function onSearch() {
function exportToExcel() {
const newData = rows.value.map((e: any) => {
const { profileId, empType, ...rest } = e;
const { profileId, empType, positionArea, positionExecutive, ...rest } = e;
return {
...rest,
dateAppoint: date2Thai(e.dateAppoint),
@ -627,7 +642,13 @@ function exportToExcel() {
};
});
const headers = columns.value?.map((item: any) => item.label) || []; //
const headers =
columns.value
?.filter(
(x: any) =>
x.field !== "positionExecutive" && x.field !== "positionArea"
)
.map((item: any) => item.label) || []; //
const worksheet = XLSX.utils.json_to_sheet(newData, {
header: visibleColumns.value,
});
@ -826,28 +847,7 @@ watch(
>
</q-select>
</div>
<!-- <div class="col-lg-9 col-md-8 col-sm-8 col-xs-11">
<q-input
outlined
dense
:model-value="org"
autogrow
label="สังกัด"
@click="onOpenOrg"
>
<template v-if="org" v-slot:append>
<q-icon
name="cancel"
@click.stop.prevent="
(org = ''),
(storeReport.formFilter.node = null),
(storeReport.formFilter.nodeId = null)
"
class="cursor-pointer"
/>
</template>
</q-input>
</div> -->
<q-space />
<div>
<q-btn
@ -859,52 +859,7 @@ watch(
v-if="checkPermission($route)?.attrIsGet"
:disable="rows.length == 0"
@click="exportToExcel()"
>
<!-- <q-menu>
<q-list style="min-width: 150px">
<q-item
clickable
v-close-popup
@click="
genReportXLSX(
detailReport,
`${
employeeClass == 'officer'
? 'รายงานสถิติข้อมูลข้าราชการ กทม. สามัญ'
: 'รายงานสถิติข้อมูลลูกจ้างประจำ กทม.'
}`,
'pdf'
)
"
>
<q-item-section avatar
><q-icon color="red" name="mdi-file-pdf"
/></q-item-section>
<q-item-section>ไฟล .pdf</q-item-section>
</q-item>
<q-item
clickable
v-close-popup
@click="
genReportXLSX(
detailReport,
`${
employeeClass == 'officer'
? 'รายงานสถิติข้อมูลข้าราชการ กทม. สามัญ'
: 'รายงานสถิติข้อมูลลูกจ้างประจำ กทม.'
}`,
'xlsx'
)
"
>
<q-item-section avatar
><q-icon color="green" name="mdi-file-excel"
/></q-item-section>
<q-item-section>ไฟล .xlsx</q-item-section>
</q-item>
</q-list>
</q-menu> -->
</q-btn>
/>
</div>
</div>
</q-card>
@ -1354,7 +1309,7 @@ watch(
dense
v-model="positionArea"
borderless
label=" ด้านสาขา"
label=" ด้าน/สาขา"
class="bg-white full-width"
>
<template v-if="positionArea" v-slot:append>