250325 WORK

This commit is contained in:
nevermoregb 2025-03-25 10:52:16 +09:00
parent 8358f60d74
commit 128c0f36b9
3 changed files with 123 additions and 42 deletions

View File

@ -76,6 +76,34 @@ const common = {
};
},
// 오늘 날짜시간 조회
getToday() {
const date = new Date();
return {
year: date.getFullYear(),
month: date.getMonth() + 1,
day: date.getDate(),
hours: date.getHours(),
minutes: date.getMinutes(),
seconds: date.getSeconds(),
};
},
// 해당 월, 일에 맞는 목록 필터링
filterTargetByDate(target, key, month, day) {
if (!Array.isArray(target) || target.length === 0) return [];
return [...target].filter(item => {
if (!item[key]) return false;
const date = new Date(item[key]);
const MatchingMonth = date.getMonth() + 1 === parseInt(month, 10);
const MatchingDay = date.getDate() === parseInt(day, 10);
return MatchingMonth && MatchingDay;
});
},
/**
* 빈값 확인
*
@ -83,9 +111,17 @@ const common = {
* @returns
*/
isNotEmpty(obj) {
if (obj === null || obj === undefined) return false;
if (typeof obj === 'string' && obj.trim() === '') return false;
if ((Array.isArray(obj) || obj === Object(obj)) && Object.keys(obj).length === 0) return false;
if (obj === null || obj === undefined) {
return false;
}
if (typeof obj === 'string' && obj.trim() === '') {
return false;
}
if ((Array.isArray(obj) || obj === Object(obj)) && Object.keys(obj).length === 0) {
return false;
}
return true;
},

View File

@ -23,7 +23,12 @@
ref="workTimeComponentRef"
/>
<MainEventList :categoryList="categoryList" :baseUrl="baseUrl" />
<MainEventList
:categoryList="categoryList"
:baseUrl="baseUrl"
:birthdayList="birthdayList"
:vacationList="vacationList"
/>
<!-- <CommuterProjectList
:categoryList="categoryList"
:project="project"
@ -122,6 +127,9 @@
const commuters = ref([]);
const monthlyCommuters = ref([]);
//
const $common = inject('common');
//
const handleWorkTimeUpdate = () => {
todaysCommuter();
@ -168,6 +176,7 @@
}
};
/************* category ***************/
//
const categoryList = ref([]);
const fetchCategoryList = async () => {
@ -175,6 +184,37 @@
if (data) categoryList.value = [...data.data.filter(categoryInfo => categoryInfo.CMNCODODR != 0)];
};
/************* init ***************/
const monthBirthdayList = ref([]);
const monthVacationList = ref([]);
const birthdayList = ref([]);
const vacationList = ref([]);
// , ,
const fetchEventList = async param => {
const { data } = await $api.get(`main/eventList?${param}`);
const res = data?.data;
//
if (res?.memberBirthdayList?.length) monthBirthdayList.value = [...res.memberBirthdayList];
//
if (res?.memberVacationList?.length) monthVacationList.value = [...res.memberVacationList];
};
//
const useFilterEventList = (month, day) => {
//
if (monthBirthdayList.value) {
birthdayList.value = $common.filterTargetByDate(monthBirthdayList.value, 'MEMBERBTH', month, day);
}
//
if (monthVacationList.value) {
vacationList.value = $common.filterTargetByDate(monthVacationList.value, 'LOCVACUDT', month, day);
}
};
//
const fetchData = async () => {
// FullCalendar API
@ -430,6 +470,17 @@
checkedInProject.value = storedProject;
}
//
await fetchCategoryList();
//
const { year, month, day } = $common.getToday();
const param = new URLSearchParams();
param.append('year', year);
param.append('month', month);
param.append('day', day);
await fetchEventList(param);
useFilterEventList(month, day);
});
</script>

View File

@ -1,7 +1,7 @@
<template>
<div class="">
<template v-for="category in categoryList" :key="category.CMNCODVAL">
<div v-if="true" class="border border-2 mt-3 card p-2">
<div v-if="" class="border border-2 mt-3 card p-2">
<div class="row g-2">
<div class="col-3 mx-0 px-0">
<div class="ratio ratio-1x1">
@ -13,42 +13,30 @@
</div>
</div>
<div class="col-9 d-flex flex-wrap mx-0 px-0">
<!-- <div v-for="commuter in commuters" :key="commuter.COMMUTCMT" class="col-4"> -->
<div class="ratio ratio-1x1">
<template v-if="category.CMNCODVAL === 300201">
<div v-for="member in birthdayList" :key="member.MEMBERSEQ">
<div class="w-25">
<img
:src="`${baseUrl}upload/img/profile/123123`"
:src="`${baseUrl}upload/img/profile/${member.MEMBERPRF}`"
alt="User Profile"
class="rounded-circle"
@error="$event.target.src = '/img/icons/icon.png'"
/>
</div>
<div class="ratio ratio-1x1">
</div>
</template>
<template v-if="category.CMNCODVAL === 300202">
<div v-for="member in vacationList" :key="member.MEMBERSEQ">
<div class="w-25">
<img
:src="`${baseUrl}upload/img/profile/123123`"
:src="`${baseUrl}upload/img/profile/${member.MEMBERPRF}`"
alt="User Profile"
class="rounded-circle"
@error="$event.target.src = '/img/icons/icon.png'"
/>
</div>
<div class="ratio ratio-1x1">
<img
:src="`${baseUrl}upload/img/profile/123123`"
alt="User Profile"
class="rounded-circle"
@error="$event.target.src = '/img/icons/icon.png'"
/>
</div>
<div class="ratio ratio-1x1">
<img
:src="`${baseUrl}upload/img/profile/123123`"
alt="User Profile"
class="rounded-circle"
@error="$event.target.src = '/img/icons/icon.png'"
/>
</div>
</template>
</div>
</div>
</div>
@ -57,7 +45,7 @@
</template>
<script setup>
import { defineProps, defineEmits } from 'vue';
import { defineEmits } from 'vue';
const props = defineProps({
project: {
@ -87,6 +75,12 @@
type: Object,
default: null,
},
birthdayList: {
type: Array,
},
vacationList: {
type: Array,
},
});
const emit = defineEmits(['drop', 'update:selectedProject', 'update:checkedInProject']);