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 storeMenu = useMenuDataStore();
|
||||||
|
|
||||||
const { messageError, showLoader, hideLoader, date2Thai, formatDatePosition } =
|
const {
|
||||||
useCounterMixin();
|
messageError,
|
||||||
|
showLoader,
|
||||||
|
hideLoader,
|
||||||
|
date2Thai,
|
||||||
|
formatDatePositionReport,
|
||||||
|
} = useCounterMixin();
|
||||||
|
|
||||||
const loadingBtn = ref<boolean>(false);
|
const loadingBtn = ref<boolean>(false);
|
||||||
const total = ref<number>(0);
|
const total = ref<number>(0);
|
||||||
|
|
@ -560,13 +565,13 @@ async function onSearch() {
|
||||||
dateAppoint: item.dateAppoint ?? "-",
|
dateAppoint: item.dateAppoint ?? "-",
|
||||||
age: item.age ?? "-",
|
age: item.age ?? "-",
|
||||||
positionDate:
|
positionDate:
|
||||||
formatDatePosition(
|
formatDatePositionReport(
|
||||||
item.positionDate?.Years,
|
item.positionDate?.Years,
|
||||||
item.positionDate?.Months,
|
item.positionDate?.Months,
|
||||||
item.positionDate?.Days
|
item.positionDate?.Days
|
||||||
) ?? "-",
|
) ?? "-",
|
||||||
levelDate:
|
levelDate:
|
||||||
formatDatePosition(
|
formatDatePositionReport(
|
||||||
item.levelDate?.posExecutiveYears,
|
item.levelDate?.posExecutiveYears,
|
||||||
item.levelDate?.posExecutiveMonths,
|
item.levelDate?.posExecutiveMonths,
|
||||||
item.levelDate?.posExecutiveDays
|
item.levelDate?.posExecutiveDays
|
||||||
|
|
|
||||||
|
|
@ -1163,6 +1163,20 @@ export const useCounterMixin = defineStore("mixin", () => {
|
||||||
// return `${y} ปี ${m} เดือน ${d} วัน`;
|
// 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 {
|
return {
|
||||||
calAge,
|
calAge,
|
||||||
date2Thai,
|
date2Thai,
|
||||||
|
|
@ -1210,5 +1224,6 @@ export const useCounterMixin = defineStore("mixin", () => {
|
||||||
|
|
||||||
onSearchDataTable,
|
onSearchDataTable,
|
||||||
formatDatePosition,
|
formatDatePosition,
|
||||||
|
formatDatePositionReport,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue