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. 310
      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();
}
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 (
config.Holidays.indexOf(`${date[0]}${clockFactory(date[1])}${clockFactory(date[2])}`) >
-1

30
src/api/calendar/config.ts

@ -164,6 +164,36 @@ export default {
'20241005',
'20241006',
'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',
],
/**
*

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

@ -3,15 +3,14 @@
@ 时间: 2024-07-12 09:27:42
@ 备注: 日历
-->
<script lang='ts' setup>
import DateClass from '@/api/calendar/DateClass';
import { clockFactory } from '@/api/calendar/utils';
<script lang="ts" setup>
import DateClass from "@/api/calendar/DateClass";
import { clockFactory } from "@/api/calendar/utils";
//
import MonthPage from './monthPage.vue'
import WeekPage from './weekPage.vue'
import DayPage from './dayPage.vue'
import MonthPage from "./monthPage.vue";
import WeekPage from "./weekPage.vue";
import DayPage from "./dayPage.vue";
const props = defineProps({
data: {
@ -20,151 +19,186 @@ const props = defineProps({
return {};
},
},
bodyHight:Number,
searchSend:{
type:Object,
default(){
return {}
}
bodyHight: Number,
searchSend: {
type: Object,
default() {
return {};
},
},
drawerWith: {
type: Number,
default: 0,
},
viewSetup: {
type: Object,
default() {
return {};
},
drawerWith:{
type:Number,
default:0
},
viewSetup:{
type:Object,
default(){
return {}
}
}
});
const taday = ref<any>([]);
const curtteDayType = ref(1)
const curtteDay = ref(1)
const curtteDayType = ref(1);
const curtteDay = ref(1);
const monthPageRef = ref(null)
const weekPageRef = ref(null)
const dayPageRef = ref(null)
const monthPageRef = ref(null);
const weekPageRef = ref(null);
const dayPageRef = ref(null);
onMounted(() => {
if(taday.value.length <= 0){
taday.value = DateClass.getCurrent()
if (taday.value.length <= 0) {
taday.value = DateClass.getCurrent();
}
// console.log("",taday.value)
})
});
const curttWeek = computed(()=>{
if(taday.value.length <= 0){
taday.value = DateClass.getCurrent()
const curttWeek = computed(() => {
if (taday.value.length <= 0) {
taday.value = DateClass.getCurrent();
}
if(curtteDayType.value != 2){
return DateClass.getWeek(DateClass.solarWeek(taday.value[0],taday.value[1],taday.value[2]))
}else{
return taday.value.start[1] + "月" + taday.value.start[2] + "-" + taday.value.end[1] + "月" + taday.value.end[2]
if (curtteDayType.value != 2) {
return DateClass.getWeek(
DateClass.solarWeek(taday.value[0], taday.value[1], taday.value[2])
);
} else {
return (
taday.value.start[1] +
"月" +
taday.value.start[2] +
"-" +
taday.value.end[1] +
"月" +
taday.value.end[2]
);
}
})
});
const curtteMonth = computed(()=>{
if(taday.value.length <= 0){
taday.value = DateClass.getCurrent()
const curtteMonth = computed(() => {
if (taday.value.length <= 0) {
taday.value = DateClass.getCurrent();
}
if(curtteDayType.value != 2){
if(taday.value.length >= 2){
return taday.value[0]+"年"+taday.value[1]+"月"
if (curtteDayType.value != 2) {
if (taday.value.length >= 2) {
return taday.value[0] + "年" + taday.value[1] + "月";
}
}else{
if(taday.value.start != undefined){
return taday.value.start[0]+"年"
}else{
return taday.value[0]+"年"+taday.value[1]+"月"
} else {
if (taday.value.start != undefined) {
return taday.value.start[0] + "年";
} else {
return taday.value[0] + "年" + taday.value[1] + "月";
}
}
})
});
/**
@ 作者: 秦东
@ 时间: 2024-07-12 11:12:12
@ 功能: 后退时间
*/
const backTime = () =>{
if(taday.value.length <= 0){
taday.value = DateClass.getCurrent()
const backTime = () => {
if (taday.value.length <= 0) {
taday.value = DateClass.getCurrent();
}
if(curtteDayType.value != 2){
taday.value = DateClass.gobackTime(taday.value[0],taday.value[1],taday.value[2],curtteDayType.value,-1)
}else{
let weekObject = DateClass.gobackTime(taday.value.start[0],taday.value.start[1],taday.value.start[2],curtteDayType.value,-1)
taday.value = weekObject
if (curtteDayType.value != 2) {
taday.value = DateClass.gobackTime(
taday.value[0],
taday.value[1],
taday.value[2],
curtteDayType.value,
-1
);
} else {
let weekObject = DateClass.gobackTime(
taday.value.start[0],
taday.value.start[1],
taday.value.start[2],
curtteDayType.value,
-1
);
taday.value = weekObject;
}
}
};
/**
@ 作者: 秦东
@ 时间: 2024-07-12 14:04:06
@ 功能: 前进时间
*/
const forwardTime = () =>{
if(taday.value.length <= 0){
taday.value = DateClass.getCurrent()
const forwardTime = () => {
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
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;
}
}
};
/**
@ 作者: 秦东
@ 时间: 2024-07-13 08:33:01
@ 功能: 选择时间
*/
const pickTime = (val:number) => {
curtteDayType.value = val
const pickTime = (val: number) => {
curtteDayType.value = val;
switch (val) {
case 2:
taday.value = DateClass.getCurrent()
let weekObject = DateClass.gobackTime(taday.value[0],taday.value[1],taday.value[2],curtteDayType.value)
taday.value = weekObject
taday.value = DateClass.getCurrent();
let weekObject = DateClass.gobackTime(
taday.value[0],
taday.value[1],
taday.value[2],
curtteDayType.value
);
taday.value = weekObject;
// curtteMonth.value = taday.value[0]+""
// curttWeek.value = taday.value[1]+""+taday.value[2]+""
// console.log("formEl---------4--------->",curttWeek.value )
break;
case 3:
taday.value = DateClass.getCurrent()
taday.value = DateClass.getCurrent();
break;
default:
taday.value = DateClass.getCurrent()
taday.value = DateClass.getCurrent();
break;
}
}
};
/**
@ 作者: 秦东
@ 时间: 2024-07-13 16:58:07
@ 功能: 回到今日
*/
const emit = defineEmits(['getDate']);
const emit = defineEmits(["getDate"]);
const goTady = () => {
taday.value = DateClass.getCurrent()
let time = taday.value[0] + "-" + clockFactory(taday.value[1]) + "-" + clockFactory(taday.value[2])
emit('getDate', time);
}
taday.value = DateClass.getCurrent();
let time =
taday.value[0] +
"-" +
clockFactory(taday.value[1]) +
"-" +
clockFactory(taday.value[2]);
emit("getDate", time);
};
/**
@ 作者: 秦东
@ 时间: 2024-07-16 13:06:23
@ 功能: 查询数据
*/
const calendarSearchData = (val:any) => {
switch(curtteDayType.value){
const calendarSearchData = (val: any) => {
switch (curtteDayType.value) {
case 2:
weekPageRef.value.searchatWeekList(val)
weekPageRef.value.searchatWeekList(val);
break;
case 3:
dayPageRef.value.searchatDayList(val);
@ -172,59 +206,105 @@ const calendarSearchData = (val:any) => {
monthPageRef.value.searchatMonthList(val);
break;
}
console.log("查询数据",curtteDayType.value,props.searchSend)
}
console.log("查询数据", curtteDayType.value, props.searchSend);
};
defineExpose({
calendarSearchData
})
calendarSearchData,
});
</script>
<template>
<div class="calBox" :style="'height:calc(100vh - '+ props.bodyHight +'px)'">
<div class="calBox" :style="'height:calc(100vh - ' + props.bodyHight + 'px)'">
<!--日历头部-->
<div class="calHead">
<div>
<i class="fa fa-calendar icont"></i>
<el-text class="day">{{curtteMonth}}</el-text>
<el-text class="week">{{curttWeek}}</el-text>
<el-text class="day">{{ curtteMonth }}</el-text>
<el-text class="week">{{ curttWeek }}</el-text>
</div>
<div>
<el-button-group class="ml-4">
<el-button size="small" @click="goTady()">今天</el-button>
<el-button :color="curtteDayType==1?'#a0cfff':''" @click="pickTime(1)" size="small" ></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
:color="curtteDayType == 1 ? '#a0cfff' : ''"
@click="pickTime(1)"
size="small"
></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>
</div>
</div>
<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" />
<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" />
<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"
/>
<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>
</template>
<style lang='scss' scoped>
.calBox{
<style lang="scss" scoped>
.calBox {
width: 100%;
.calHead{
.calHead {
padding: 10px 0;
border-bottom: 1px solid #ccc;
display: flex;
align-items: center;
justify-content: space-between;
.icont{
font-size:20px;
.icont {
font-size: 20px;
}
.day{
font-size:20px;
.day {
font-size: 20px;
padding: 0 10px;
font-weight: bold;
}
}
.weekNumber{
.weekNumber {
}
}
</style>

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

@ -236,6 +236,45 @@ const forwardTime = () => {
const goTady = () => {
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