Browse Source

增加25年节假日数据

qin_14
hreenshan112 10 months ago
parent
commit
5f17893e07
  1. 1
      src/api/calendar/DateClass.ts
  2. 30
      src/api/calendar/config.ts
  3. 226
      src/components/DesignForm/app/calendar/calendar1/calendarPage.vue
  4. 39
      src/views/hr/teams/scheduling.vue

1
src/api/calendar/DateClass.ts

@ -29,6 +29,7 @@ class DateClass {
: date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate(); : date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate();
} }
getHolidays(date: number[]) { getHolidays(date: number[]) {
console.log(`${date[0]}${clockFactory(date[1])}${clockFactory(date[2])}`,"<==>",config.Holidays.indexOf(`${date[0]}${clockFactory(date[1])}${clockFactory(date[2])}`))
return ( return (
config.Holidays.indexOf(`${date[0]}${clockFactory(date[1])}${clockFactory(date[2])}`) > config.Holidays.indexOf(`${date[0]}${clockFactory(date[1])}${clockFactory(date[2])}`) >
-1 -1

30
src/api/calendar/config.ts

@ -164,6 +164,36 @@ export default {
'20241005', '20241005',
'20241006', '20241006',
'20241007', '20241007',
'20250101',
'20250128',
'20250129',
'20250130',
'20250131',
'20250201',
'20250202',
'20250203',
'20250204',
'20250404',
'20250405',
'20250406',
'20250501',
'20250502',
'20250503',
'20250504',
'20250505',
'20250531',
'20250601',
'20250602',
'20251001',
'20251002',
'20251002',
'20251003',
'20251004',
'20251005',
'20251006',
'20251007',
'20251008',
'20260101',
], ],
/** /**
* *

226
src/components/DesignForm/app/calendar/calendar1/calendarPage.vue

@ -3,15 +3,14 @@
@ 时间: 2024-07-12 09:27:42 @ 时间: 2024-07-12 09:27:42
@ 备注: 日历 @ 备注: 日历
--> -->
<script lang='ts' setup> <script lang="ts" setup>
import DateClass from '@/api/calendar/DateClass'; import DateClass from "@/api/calendar/DateClass";
import { clockFactory } from '@/api/calendar/utils'; import { clockFactory } from "@/api/calendar/utils";
// //
import MonthPage from './monthPage.vue' import MonthPage from "./monthPage.vue";
import WeekPage from './weekPage.vue' import WeekPage from "./weekPage.vue";
import DayPage from './dayPage.vue' import DayPage from "./dayPage.vue";
const props = defineProps({ const props = defineProps({
data: { data: {
@ -24,65 +23,72 @@ const props = defineProps({
searchSend: { searchSend: {
type: Object, type: Object,
default() { default() {
return {} return {};
} },
}, },
drawerWith: { drawerWith: {
type: Number, type: Number,
default:0 default: 0,
}, },
viewSetup: { viewSetup: {
type: Object, type: Object,
default() { default() {
return {} return {};
} },
} },
}); });
const taday = ref<any>([]); const taday = ref<any>([]);
const curtteDayType = ref(1) const curtteDayType = ref(1);
const curtteDay = ref(1) const curtteDay = ref(1);
const monthPageRef = ref(null) const monthPageRef = ref(null);
const weekPageRef = ref(null) const weekPageRef = ref(null);
const dayPageRef = ref(null) const dayPageRef = ref(null);
onMounted(() => { onMounted(() => {
if (taday.value.length <= 0) { if (taday.value.length <= 0) {
taday.value = DateClass.getCurrent() taday.value = DateClass.getCurrent();
} }
// console.log("",taday.value) // console.log("",taday.value)
}) });
const curttWeek = computed(() => { const curttWeek = computed(() => {
if (taday.value.length <= 0) { if (taday.value.length <= 0) {
taday.value = DateClass.getCurrent() taday.value = DateClass.getCurrent();
} }
if (curtteDayType.value != 2) { if (curtteDayType.value != 2) {
return DateClass.getWeek(DateClass.solarWeek(taday.value[0],taday.value[1],taday.value[2])) return DateClass.getWeek(
DateClass.solarWeek(taday.value[0], taday.value[1], taday.value[2])
);
} else { } else {
return taday.value.start[1] + "月" + taday.value.start[2] + "-" + taday.value.end[1] + "月" + taday.value.end[2] return (
taday.value.start[1] +
"月" +
taday.value.start[2] +
"-" +
taday.value.end[1] +
"月" +
taday.value.end[2]
);
} }
}) });
const curtteMonth = computed(() => { const curtteMonth = computed(() => {
if (taday.value.length <= 0) { if (taday.value.length <= 0) {
taday.value = DateClass.getCurrent() taday.value = DateClass.getCurrent();
} }
if (curtteDayType.value != 2) { if (curtteDayType.value != 2) {
if (taday.value.length >= 2) { if (taday.value.length >= 2) {
return taday.value[0]+"年"+taday.value[1]+"月" return taday.value[0] + "年" + taday.value[1] + "月";
} }
} else { } else {
if (taday.value.start != undefined) { if (taday.value.start != undefined) {
return taday.value.start[0]+"年" return taday.value.start[0] + "年";
} else { } else {
return taday.value[0]+"年"+taday.value[1]+"月" return taday.value[0] + "年" + taday.value[1] + "月";
} }
} }
});
})
/** /**
@ 作者: 秦东 @ 作者: 秦东
@ 时间: 2024-07-12 11:12:12 @ 时间: 2024-07-12 11:12:12
@ -90,19 +96,28 @@ const curtteMonth = computed(()=>{
*/ */
const backTime = () => { const backTime = () => {
if (taday.value.length <= 0) { if (taday.value.length <= 0) {
taday.value = DateClass.getCurrent() taday.value = DateClass.getCurrent();
} }
if (curtteDayType.value != 2) { if (curtteDayType.value != 2) {
taday.value = DateClass.gobackTime(taday.value[0],taday.value[1],taday.value[2],curtteDayType.value,-1) taday.value = DateClass.gobackTime(
taday.value[0],
taday.value[1],
taday.value[2],
curtteDayType.value,
-1
);
} else { } else {
let weekObject = DateClass.gobackTime(
let weekObject = DateClass.gobackTime(taday.value.start[0],taday.value.start[1],taday.value.start[2],curtteDayType.value,-1) taday.value.start[0],
taday.value = weekObject taday.value.start[1],
} taday.value.start[2],
curtteDayType.value,
-1
);
taday.value = weekObject;
} }
};
/** /**
@ 作者: 秦东 @ 作者: 秦东
@ 时间: 2024-07-12 14:04:06 @ 时间: 2024-07-12 14:04:06
@ -110,51 +125,70 @@ const backTime = () =>{
*/ */
const forwardTime = () => { const forwardTime = () => {
if (taday.value.length <= 0) { if (taday.value.length <= 0) {
taday.value = DateClass.getCurrent() taday.value = DateClass.getCurrent();
} }
if (curtteDayType.value != 2) { if (curtteDayType.value != 2) {
taday.value = DateClass.moveTime(taday.value[0],taday.value[1],taday.value[2],curtteDayType.value) taday.value = DateClass.moveTime(
taday.value[0],
taday.value[1],
taday.value[2],
curtteDayType.value
);
} else { } else {
let weekObject = DateClass.moveTime(
let weekObject = DateClass.moveTime(taday.value.start[0],taday.value.start[1],taday.value.start[2],curtteDayType.value) taday.value.start[0],
taday.value = weekObject taday.value.start[1],
} taday.value.start[2],
curtteDayType.value
);
taday.value = weekObject;
} }
};
/** /**
@ 作者: 秦东 @ 作者: 秦东
@ 时间: 2024-07-13 08:33:01 @ 时间: 2024-07-13 08:33:01
@ 功能: 选择时间 @ 功能: 选择时间
*/ */
const pickTime = (val: number) => { const pickTime = (val: number) => {
curtteDayType.value = val curtteDayType.value = val;
switch (val) { switch (val) {
case 2: case 2:
taday.value = DateClass.getCurrent() taday.value = DateClass.getCurrent();
let weekObject = DateClass.gobackTime(taday.value[0],taday.value[1],taday.value[2],curtteDayType.value) let weekObject = DateClass.gobackTime(
taday.value = weekObject taday.value[0],
taday.value[1],
taday.value[2],
curtteDayType.value
);
taday.value = weekObject;
// curtteMonth.value = taday.value[0]+"" // curtteMonth.value = taday.value[0]+""
// curttWeek.value = taday.value[1]+""+taday.value[2]+"" // curttWeek.value = taday.value[1]+""+taday.value[2]+""
// console.log("formEl---------4--------->",curttWeek.value ) // console.log("formEl---------4--------->",curttWeek.value )
break; break;
case 3: case 3:
taday.value = DateClass.getCurrent() taday.value = DateClass.getCurrent();
break; break;
default: default:
taday.value = DateClass.getCurrent() taday.value = DateClass.getCurrent();
break; break;
} }
} };
/** /**
@ 作者: 秦东 @ 作者: 秦东
@ 时间: 2024-07-13 16:58:07 @ 时间: 2024-07-13 16:58:07
@ 功能: 回到今日 @ 功能: 回到今日
*/ */
const emit = defineEmits(['getDate']); const emit = defineEmits(["getDate"]);
const goTady = () => { const goTady = () => {
taday.value = DateClass.getCurrent() taday.value = DateClass.getCurrent();
let time = taday.value[0] + "-" + clockFactory(taday.value[1]) + "-" + clockFactory(taday.value[2]) let time =
emit('getDate', time); taday.value[0] +
} "-" +
clockFactory(taday.value[1]) +
"-" +
clockFactory(taday.value[2]);
emit("getDate", time);
};
/** /**
@ 作者: 秦东 @ 作者: 秦东
@ -164,7 +198,7 @@ const goTady = () => {
const calendarSearchData = (val: any) => { const calendarSearchData = (val: any) => {
switch (curtteDayType.value) { switch (curtteDayType.value) {
case 2: case 2:
weekPageRef.value.searchatWeekList(val) weekPageRef.value.searchatWeekList(val);
break; break;
case 3: case 3:
dayPageRef.value.searchatDayList(val); dayPageRef.value.searchatDayList(val);
@ -172,11 +206,11 @@ const calendarSearchData = (val:any) => {
monthPageRef.value.searchatMonthList(val); monthPageRef.value.searchatMonthList(val);
break; break;
} }
console.log("查询数据",curtteDayType.value,props.searchSend) console.log("查询数据", curtteDayType.value, props.searchSend);
} };
defineExpose({ defineExpose({
calendarSearchData calendarSearchData,
}) });
</script> </script>
<template> <template>
<div class="calBox" :style="'height:calc(100vh - ' + props.bodyHight + 'px)'"> <div class="calBox" :style="'height:calc(100vh - ' + props.bodyHight + 'px)'">
@ -190,22 +224,69 @@ defineExpose({
<div> <div>
<el-button-group class="ml-4"> <el-button-group class="ml-4">
<el-button size="small" @click="goTady()">今天</el-button> <el-button size="small" @click="goTady()">今天</el-button>
<el-button :color="curtteDayType==1?'#a0cfff':''" @click="pickTime(1)" size="small" ></el-button> <el-button
<el-button :color="curtteDayType==2?'#a0cfff':''" @click="pickTime(2)" size="small" ></el-button> :color="curtteDayType == 1 ? '#a0cfff' : ''"
<el-button :color="curtteDayType==3?'#a0cfff':''" @click="pickTime(3)" size="small" ></el-button> @click="pickTime(1)"
<el-button size="small" class="fa fa-angle-left" @click="backTime()"></el-button> size="small"
<el-button size="small" class="fa fa-angle-right" @click="forwardTime()"></el-button> ></el-button
>
<el-button
:color="curtteDayType == 2 ? '#a0cfff' : ''"
@click="pickTime(2)"
size="small"
></el-button
>
<el-button
:color="curtteDayType == 3 ? '#a0cfff' : ''"
@click="pickTime(3)"
size="small"
></el-button
>
<el-button
size="small"
class="fa fa-angle-left"
@click="backTime()"
></el-button>
<el-button
size="small"
class="fa fa-angle-right"
@click="forwardTime()"
></el-button>
</el-button-group> </el-button-group>
</div> </div>
</div> </div>
<div class="weekNumber"> <div class="weekNumber">
<MonthPage ref="monthPageRef" v-if="curtteDayType==1" :body-hight="props.bodyHight" :ta-day="taday" :search-send="props.searchSend" :drawer-with="props.drawerWith" :view-setup="props.viewSetup" /> <MonthPage
<WeekPage ref="weekPageRef" v-if="curtteDayType==2" :body-hight="props.bodyHight" :ta-day="taday" :search-send="props.searchSend" :drawer-with="props.drawerWith" :view-setup="props.viewSetup" /> ref="monthPageRef"
<DayPage ref="dayPageRef" v-if="curtteDayType==3" :body-hight="props.bodyHight" :ta-day="taday" :search-send="props.searchSend" :drawer-with="props.drawerWith" :view-setup="props.viewSetup" /> v-if="curtteDayType == 1"
:body-hight="props.bodyHight"
:ta-day="taday"
:search-send="props.searchSend"
:drawer-with="props.drawerWith"
:view-setup="props.viewSetup"
/>
<WeekPage
ref="weekPageRef"
v-if="curtteDayType == 2"
:body-hight="props.bodyHight"
:ta-day="taday"
:search-send="props.searchSend"
:drawer-with="props.drawerWith"
:view-setup="props.viewSetup"
/>
<DayPage
ref="dayPageRef"
v-if="curtteDayType == 3"
:body-hight="props.bodyHight"
:ta-day="taday"
:search-send="props.searchSend"
:drawer-with="props.drawerWith"
:view-setup="props.viewSetup"
/>
</div> </div>
</div> </div>
</template> </template>
<style lang='scss' scoped> <style lang="scss" scoped>
.calBox { .calBox {
width: 100%; width: 100%;
.calHead { .calHead {
@ -224,7 +305,6 @@ defineExpose({
} }
} }
.weekNumber { .weekNumber {
} }
} }
</style> </style>

39
src/views/hr/teams/scheduling.vue

@ -236,6 +236,45 @@ const forwardTime = () => {
const goTady = () => { const goTady = () => {
taday.value = DateClass.getCurrent(); taday.value = DateClass.getCurrent();
if (taday.value.length <= 0) {
taday.value = DateClass.getCurrent();
}
if (curtteDayType.value != 2) {
taday.value = DateClass.moveTime(
taday.value[0],
taday.value[1],
taday.value[2],
curtteDayType.value
);
} else {
let weekObject = DateClass.moveTime(
taday.value.start[0],
taday.value.start[1],
taday.value.start[2],
curtteDayType.value
);
taday.value = weekObject;
}
console.log("curtteDayType.value--------->", curtteDayType.value);
nextTick(() => {
switch (curtteDayType.value) {
case 1:
console.log("curtteDayType.value-----1---->", curtteDayType.value);
monthPageRef.value.analyban();
break;
case 2:
console.log("curtteDayType.value---2------>", curtteDayType.value);
weekPageRef.value.analysisWeek();
break;
case 3:
console.log("curtteDayType.value---3------>", curtteDayType.value);
dayPageRef.value.analysisDays();
break;
default:
console.log("curtteDayType.value---4------>", curtteDayType.value);
}
});
}; };
/** /**
@ 作者: 秦东 @ 作者: 秦东

Loading…
Cancel
Save