diff --git a/src/modules/14_KPI/router.ts b/src/modules/14_KPI/router.ts index 5340ce8e3..11e95a72e 100644 --- a/src/modules/14_KPI/router.ts +++ b/src/modules/14_KPI/router.ts @@ -1,11 +1,13 @@ const roundPage = () => import("@/modules/14_KPI/views/round.vue"); -const IndicatorByPlan = () => import("@/modules/14_KPI/views/indicatorByPlan.vue"); -const IndicatorByRole = () => import("@/modules/14_KPI/views/indicatorByRole.vue"); +const IndicatorByPlan = () => + import("@/modules/14_KPI/views/indicatorByPlan.vue"); +const IndicatorByRole = () => + import("@/modules/14_KPI/views/indicatorByRole.vue"); const competencyPage = () => import("@/modules/14_KPI/views/competency.vue"); export default [ { - path: "/KPI", + path: "/KPI-round", name: "KPIRound", component: roundPage, meta: { @@ -15,7 +17,7 @@ export default [ }, }, { - path: "/KPI", + path: "/KPI-indicator-plan", name: "KPIIndicatorByPlan", component: IndicatorByPlan, meta: { @@ -25,7 +27,7 @@ export default [ }, }, { - path: "/KPI", + path: "/KPI-indicator-role", name: "KPIIndicatorByRole", component: IndicatorByRole, meta: { @@ -35,7 +37,7 @@ export default [ }, }, { - path: "/KPI", + path: "/KPI-competency", name: "KPICompetency", component: competencyPage, meta: { diff --git a/src/modules/14_KPI/views/indicatorByPlan.vue b/src/modules/14_KPI/views/indicatorByPlan.vue index bc091d4a3..3e30b7bdb 100644 --- a/src/modules/14_KPI/views/indicatorByPlan.vue +++ b/src/modules/14_KPI/views/indicatorByPlan.vue @@ -1,5 +1,249 @@ + + \ No newline at end of file + + + + diff --git a/src/modules/14_KPI/views/indicatorByRole.vue b/src/modules/14_KPI/views/indicatorByRole.vue index ba4eeccc6..5e1b03dbb 100644 --- a/src/modules/14_KPI/views/indicatorByRole.vue +++ b/src/modules/14_KPI/views/indicatorByRole.vue @@ -1,5 +1,242 @@ + + \ No newline at end of file + + + + diff --git a/src/modules/15_development/components/Other.vue b/src/modules/15_development/components/Other.vue index 7cc19ccc3..2829f0ff2 100644 --- a/src/modules/15_development/components/Other.vue +++ b/src/modules/15_development/components/Other.vue @@ -13,8 +13,13 @@ import { useDevelopmentDataStore } from "@/modules/15_development/store/developm const $q = useQuasar(); const store = useDevelopmentDataStore(); -const { showLoader, hideLoader, dialogConfirm, date2Thai, messageError } = - useCounterMixin(); +const { + showLoader, + hideLoader, + calculateDurationYmd, + date2Thai, + messageError, +} = useCounterMixin(); const provinceOp = ref([]); const provinceOpMain = ref([]); @@ -63,10 +68,46 @@ function changeDateStart() { const endDate = new Date(store.formAddProject.dateEnd); if (startDate > endDate) { store.formAddProject.dateEnd = null; + store.formAddProject.totalDate = null; + } else { + daysBetweenDates( + store.formAddProject.dateStart, + store.formAddProject.dateEnd + ); } } } +function changeDateEnd() { + daysBetweenDates( + store.formAddProject.dateStart, + store.formAddProject.dateEnd + ); +} + +async function daysBetweenDates(date1: any, date2: any) { + const newStartDate = resetTimeToMidnight(new Date(date1)); + const newEndDate = resetTimeToMidnight(new Date(date2)); + + const differenceInMilliseconds = + newEndDate.getTime() - newStartDate.getTime(); + + const differenceInDays = Math.floor( + differenceInMilliseconds / (1000 * 60 * 60 * 24) + ); + + store.formAddProject.totalDate = differenceInDays + 1; +} + +function resetTimeToMidnight(date: Date): Date { + const newDate = new Date(date); + newDate.setHours(0); + newDate.setMinutes(0); + newDate.setSeconds(0); + newDate.setMilliseconds(0); + return newDate; +} + /** * Fuction Filter จังหวัด * @param val ค่าตัวพิมพ์ค้นหา @@ -136,6 +177,7 @@ onMounted(() => { :enableTimePicker="false" week-start="0" :min-date="store.formAddProject.dateStart" + @update:model-value="changeDateEnd()" > - - เพิ่ม - - -
+ - - - - - - - {{ - items.label - }} - - - - ดาวน์โหลด + เพิ่ม + - - - - - + +
+
+ + + + + + + + {{ + items.label + }} + + + + ดาวน์โหลด + +
+
+ + + +
+
+ +
+
{ รายการข้าราชการฯที่ได้รับทุนการศึกษา/ฝึกอบรม
- +
- - - - - - +
+ + + + + +
+
+ +
+
+ { > เพิ่ม -
+
- - - - - - - - {{ - items.label - }} - - - - ดาวน์โหลด - - - - - - - +
+ + + + + + + + {{ + items.label + }} + + + + ดาวน์โหลด + +
+
+ + + +
+
+ +
diff --git a/src/stores/mixin.ts b/src/stores/mixin.ts index 48ca0e791..16df8875c 100644 --- a/src/stores/mixin.ts +++ b/src/stores/mixin.ts @@ -915,6 +915,13 @@ export const useCounterMixin = defineStore("mixin", () => { return ""; } + function diffDay(startDate: any, endDate: any) { + var d1 = moment(startDate); + var d2 = moment(endDate); + const daydiff = Math.ceil(moment.duration(d2.diff(d1)).asDays()); + return daydiff; + } + return { calAge, date2Thai, @@ -951,5 +958,6 @@ export const useCounterMixin = defineStore("mixin", () => { fails, convertDate, convertDateDisplay, + diffDay, }; });