Merge commit '1d0c06697d' into nice
This commit is contained in:
commit
d45a2f8412
1 changed files with 98 additions and 30 deletions
|
|
@ -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"
|
||||
);
|
||||
});
|
||||
|
||||
|
|
@ -598,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 ?? "-",
|
||||
|
|
@ -648,25 +663,68 @@ async function onSearch() {
|
|||
}
|
||||
|
||||
function exportToExcel() {
|
||||
const newData = rows.value.map((e: any) => {
|
||||
const { profileId, empType, positionArea, positionExecutive, ...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 =
|
||||
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,
|
||||
});
|
||||
|
|
@ -1540,14 +1598,20 @@ watch(
|
|||
|
||||
<div class="col-12"><q-separator /></div>
|
||||
<div class="col-12">
|
||||
<div class="">
|
||||
<div>
|
||||
<q-radio
|
||||
v-model="typeTerm"
|
||||
val="position"
|
||||
label="ระยะเวลาดำรงตำแหน่ง (สายงาน) ปัจจุบัน"
|
||||
:label="
|
||||
employeeClass === 'officer'
|
||||
? 'ระยะเวลาดำรงตำแหน่ง (สายงาน) ปัจจุบัน'
|
||||
: 'ระยะเวลาดำรงตำแหน่งปัจจุบัน'
|
||||
"
|
||||
size="xs"
|
||||
class="text-grey-8"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<q-radio
|
||||
v-model="typeTerm"
|
||||
val="level"
|
||||
|
|
@ -1555,7 +1619,10 @@ watch(
|
|||
size="xs"
|
||||
class="text-grey-8"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<q-radio
|
||||
v-if="employeeClass === 'officer'"
|
||||
v-model="typeTerm"
|
||||
val="tenureType"
|
||||
label="ระยะเวลาดำรงตำแหน่ง (บริหาร) ปัจจุบัน"
|
||||
|
|
@ -1687,6 +1754,7 @@ watch(
|
|||
</q-list>
|
||||
</q-btn-dropdown>
|
||||
</div>
|
||||
|
||||
<d-table
|
||||
:columns="columns"
|
||||
:rows="rows"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue