ปรับหน้ารายการช่วยราชการ

This commit is contained in:
Warunee Tamkoo 2024-05-01 16:39:17 +07:00
parent 7af4eb7a45
commit e9e618ad41
3 changed files with 79 additions and 14 deletions

View file

@ -31,6 +31,8 @@ const {
hideLoader,
success,
dialogRemove,
findOrgName,
findPosMasterNo,
} = mixin;
//
@ -89,7 +91,7 @@ const columns = ref<QTableProps["columns"]>([
{
name: "positionLevel",
align: "left",
label: "ระดับ",
label: "ประเภทตำแหน่ง",
sortable: true,
field: "positionLevel",
headerStyle: "font-size: 14px",
@ -196,9 +198,14 @@ const getData = async () => {
rows.value = data.map((item: officerType) => ({
id: item.id,
fullname: `${item.prefix}${item.firstName} ${item.lastName}`,
position: item.position,
posNo: item.posNo,
positionLevel: item.positionLevel,
position: item.position != null ? item.position : "-",
posNo: findPosMasterNo(item),
positionLevel:
item.posTypeName == null && item.posLevelName == null
? "-"
: (item.posTypeName != null ? item.posTypeName : "") +
" " +
(item.posLevelName != null ? ` (${item.posLevelName})` : ""),
createdAt: date2Thai(item.createdAt),
organization: item.organization,
reason: item.reason,
@ -209,13 +216,14 @@ const getData = async () => {
positionTypeOld: item.positionTypeOld,
positionLevelOld: item.positionLevelOld,
positionNumberOld: item.positionNumberOld,
organizationPositionOld: item.organizationPositionOld,
organizationPositionOld: findOrgName(item),
isActive: item.isActive,
dateEnd: item.dateEnd == null ? "-" : date2Thai(new Date(item.dateEnd)),
dateEnd: item.dateEnd == null ? "" : date2Thai(new Date(item.dateEnd)),
dateStart:
item.dateStart == null ? "-" : date2Thai(new Date(item.dateStart)),
item.dateStart == null ? "" : date2Thai(new Date(item.dateStart)),
}));
})
.catch((e) => {})
.finally(() => {
hideLoader();
@ -243,6 +251,7 @@ onMounted(async () => {
await getData();
});
</script>
<template>
<div class="toptitle text-dark col-12 row items-center">รายการชวยราชการ</div>
<q-card flat bordered class="col-12 q-mt-sm">

View file

@ -19,7 +19,9 @@ interface officerType {
isActive: boolean;
dateEnd: string;
dateStart: string;
dateRepatriation: Date
dateRepatriation: Date;
posTypeName?: string;
posLevelName?: string;
}
interface ResponseData {
data: {
@ -44,7 +46,7 @@ interface ResponseData {
positionNumberOld: string;
organizationPositionOld: string;
isActive: boolean;
dateRepatriation: Date
dateRepatriation: Date;
};
};
}
@ -74,8 +76,4 @@ interface resHelpDetail {
};
};
}
export type {
officerType,
ResponseData,
resHelpDetail
};
export type { officerType, ResponseData, resHelpDetail };

View file

@ -922,6 +922,62 @@ export const useCounterMixin = defineStore("mixin", () => {
return daydiff;
}
function findOrgName(obj: any) {
if (obj) {
let name =
obj.child4 != null && obj.child3 != null
? obj.child4 + "/"
: obj.child4 != null
? obj.child4
: "";
name +=
obj.child3 != null && obj.child2 != null
? obj.child3 + "/"
: obj.child3 !== null
? obj.child3
: "";
name +=
obj.child2 != null && obj.child1 != null
? obj.child2 + "/"
: obj.child2 != null
? obj.child2
: "";
name +=
obj.child1 != null && obj.root != null
? obj.child1 + "/"
: obj.child1 != null
? obj.child1
: "";
name += obj.root != null ? obj.root : "";
return name == "" ? "-" : name;
} else {
return "";
}
}
function findPosMasterNo(obj: any) {
if (obj) {
let shortName =
(obj.child4ShortName != null
? obj.child4ShortName
: obj.child3ShortName != null
? obj.child3ShortName
: obj.child2ShortName != null
? obj.child2ShortName
: obj.child1ShortName != null
? obj.child1ShortName
: obj.rootShortName != null
? obj.rootShortName
: "") + (obj.posMasterNo != null ? obj.posMasterNo : "");
return shortName == "" ? "-" : shortName;
} else {
return "";
}
}
return {
calAge,
date2Thai,
@ -959,5 +1015,7 @@ export const useCounterMixin = defineStore("mixin", () => {
convertDate,
convertDateDisplay,
diffDay,
findOrgName,
findPosMasterNo,
};
});