fixing
This commit is contained in:
parent
4b160bb48c
commit
e7eb440ca6
2 changed files with 24 additions and 4 deletions
|
|
@ -38,8 +38,13 @@ const { fetchStructureTree } = useStructureTree();
|
|||
|
||||
const storeMenu = useMenuDataStore();
|
||||
|
||||
const { messageError, showLoader, hideLoader, date2Thai, formatDatePosition } =
|
||||
useCounterMixin();
|
||||
const {
|
||||
messageError,
|
||||
showLoader,
|
||||
hideLoader,
|
||||
date2Thai,
|
||||
formatDatePositionReport,
|
||||
} = useCounterMixin();
|
||||
|
||||
const loadingBtn = ref<boolean>(false);
|
||||
const total = ref<number>(0);
|
||||
|
|
@ -560,13 +565,13 @@ async function onSearch() {
|
|||
dateAppoint: item.dateAppoint ?? "-",
|
||||
age: item.age ?? "-",
|
||||
positionDate:
|
||||
formatDatePosition(
|
||||
formatDatePositionReport(
|
||||
item.positionDate?.Years,
|
||||
item.positionDate?.Months,
|
||||
item.positionDate?.Days
|
||||
) ?? "-",
|
||||
levelDate:
|
||||
formatDatePosition(
|
||||
formatDatePositionReport(
|
||||
item.levelDate?.posExecutiveYears,
|
||||
item.levelDate?.posExecutiveMonths,
|
||||
item.levelDate?.posExecutiveDays
|
||||
|
|
|
|||
|
|
@ -1163,6 +1163,20 @@ export const useCounterMixin = defineStore("mixin", () => {
|
|||
// return `${y} ปี ${m} เดือน ${d} วัน`;
|
||||
}
|
||||
|
||||
function formatDatePositionReport(year: string, month: string, day: string) {
|
||||
const y = parseInt(year);
|
||||
const m = parseInt(month);
|
||||
const d = parseInt(day);
|
||||
|
||||
const parts = [];
|
||||
if (y > 0) parts.push(`${y} ปี`);
|
||||
if (m > 0) parts.push(`${m} เดือน`);
|
||||
if (d > 0) parts.push(`${d} วัน`);
|
||||
|
||||
return parts.length > 0 ? parts.join(" ") : ""; // กรณีที่ทั้งหมดเป็น 0
|
||||
// return `${y} ปี ${m} เดือน ${d} วัน`;
|
||||
}
|
||||
|
||||
return {
|
||||
calAge,
|
||||
date2Thai,
|
||||
|
|
@ -1210,5 +1224,6 @@ export const useCounterMixin = defineStore("mixin", () => {
|
|||
|
||||
onSearchDataTable,
|
||||
formatDatePosition,
|
||||
formatDatePositionReport,
|
||||
};
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue