ปรับหน้ารายการช่วยราชการ
This commit is contained in:
parent
7af4eb7a45
commit
e9e618ad41
3 changed files with 79 additions and 14 deletions
|
|
@ -31,6 +31,8 @@ const {
|
||||||
hideLoader,
|
hideLoader,
|
||||||
success,
|
success,
|
||||||
dialogRemove,
|
dialogRemove,
|
||||||
|
findOrgName,
|
||||||
|
findPosMasterNo,
|
||||||
} = mixin;
|
} = mixin;
|
||||||
|
|
||||||
//ค้นหา คอลัมน์ คอลัมน์ที่แสดง
|
//ค้นหา คอลัมน์ คอลัมน์ที่แสดง
|
||||||
|
|
@ -89,7 +91,7 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
{
|
{
|
||||||
name: "positionLevel",
|
name: "positionLevel",
|
||||||
align: "left",
|
align: "left",
|
||||||
label: "ระดับ",
|
label: "ประเภทตำแหน่ง",
|
||||||
sortable: true,
|
sortable: true,
|
||||||
field: "positionLevel",
|
field: "positionLevel",
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
|
|
@ -196,9 +198,14 @@ const getData = async () => {
|
||||||
rows.value = data.map((item: officerType) => ({
|
rows.value = data.map((item: officerType) => ({
|
||||||
id: item.id,
|
id: item.id,
|
||||||
fullname: `${item.prefix}${item.firstName} ${item.lastName}`,
|
fullname: `${item.prefix}${item.firstName} ${item.lastName}`,
|
||||||
position: item.position,
|
position: item.position != null ? item.position : "-",
|
||||||
posNo: item.posNo,
|
posNo: findPosMasterNo(item),
|
||||||
positionLevel: item.positionLevel,
|
positionLevel:
|
||||||
|
item.posTypeName == null && item.posLevelName == null
|
||||||
|
? "-"
|
||||||
|
: (item.posTypeName != null ? item.posTypeName : "") +
|
||||||
|
" " +
|
||||||
|
(item.posLevelName != null ? ` (${item.posLevelName})` : ""),
|
||||||
createdAt: date2Thai(item.createdAt),
|
createdAt: date2Thai(item.createdAt),
|
||||||
organization: item.organization,
|
organization: item.organization,
|
||||||
reason: item.reason,
|
reason: item.reason,
|
||||||
|
|
@ -209,13 +216,14 @@ const getData = async () => {
|
||||||
positionTypeOld: item.positionTypeOld,
|
positionTypeOld: item.positionTypeOld,
|
||||||
positionLevelOld: item.positionLevelOld,
|
positionLevelOld: item.positionLevelOld,
|
||||||
positionNumberOld: item.positionNumberOld,
|
positionNumberOld: item.positionNumberOld,
|
||||||
organizationPositionOld: item.organizationPositionOld,
|
organizationPositionOld: findOrgName(item),
|
||||||
isActive: item.isActive,
|
isActive: item.isActive,
|
||||||
dateEnd: item.dateEnd == null ? "-" : date2Thai(new Date(item.dateEnd)),
|
dateEnd: item.dateEnd == null ? "" : date2Thai(new Date(item.dateEnd)),
|
||||||
dateStart:
|
dateStart:
|
||||||
item.dateStart == null ? "-" : date2Thai(new Date(item.dateStart)),
|
item.dateStart == null ? "" : date2Thai(new Date(item.dateStart)),
|
||||||
}));
|
}));
|
||||||
})
|
})
|
||||||
|
|
||||||
.catch((e) => {})
|
.catch((e) => {})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
hideLoader();
|
hideLoader();
|
||||||
|
|
@ -243,6 +251,7 @@ onMounted(async () => {
|
||||||
await getData();
|
await getData();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="toptitle text-dark col-12 row items-center">รายการช่วยราชการ</div>
|
<div class="toptitle text-dark col-12 row items-center">รายการช่วยราชการ</div>
|
||||||
<q-card flat bordered class="col-12 q-mt-sm">
|
<q-card flat bordered class="col-12 q-mt-sm">
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,9 @@ interface officerType {
|
||||||
isActive: boolean;
|
isActive: boolean;
|
||||||
dateEnd: string;
|
dateEnd: string;
|
||||||
dateStart: string;
|
dateStart: string;
|
||||||
dateRepatriation: Date
|
dateRepatriation: Date;
|
||||||
|
posTypeName?: string;
|
||||||
|
posLevelName?: string;
|
||||||
}
|
}
|
||||||
interface ResponseData {
|
interface ResponseData {
|
||||||
data: {
|
data: {
|
||||||
|
|
@ -44,7 +46,7 @@ interface ResponseData {
|
||||||
positionNumberOld: string;
|
positionNumberOld: string;
|
||||||
organizationPositionOld: string;
|
organizationPositionOld: string;
|
||||||
isActive: boolean;
|
isActive: boolean;
|
||||||
dateRepatriation: Date
|
dateRepatriation: Date;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -74,8 +76,4 @@ interface resHelpDetail {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
export type {
|
export type { officerType, ResponseData, resHelpDetail };
|
||||||
officerType,
|
|
||||||
ResponseData,
|
|
||||||
resHelpDetail
|
|
||||||
};
|
|
||||||
|
|
|
||||||
|
|
@ -922,6 +922,62 @@ export const useCounterMixin = defineStore("mixin", () => {
|
||||||
return daydiff;
|
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 {
|
return {
|
||||||
calAge,
|
calAge,
|
||||||
date2Thai,
|
date2Thai,
|
||||||
|
|
@ -959,5 +1015,7 @@ export const useCounterMixin = defineStore("mixin", () => {
|
||||||
convertDate,
|
convertDate,
|
||||||
convertDateDisplay,
|
convertDateDisplay,
|
||||||
diffDay,
|
diffDay,
|
||||||
|
findOrgName,
|
||||||
|
findPosMasterNo,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue