|
@@ -247,8 +247,8 @@
|
|
<template slot="dateCell" slot-scope="{ date, data }">
|
|
<template slot="dateCell" slot-scope="{ date, data }">
|
|
<div class="date-content" @click="issh(date)">
|
|
<div class="date-content" @click="issh(date)">
|
|
<span class="text">{{ getDay(date) }}</span>
|
|
<span class="text">{{ getDay(date) }}</span>
|
|
- <span v-if="isWeek(date)" class="rest">休</span>
|
|
|
|
- <span v-if="isWeekt(date)" class="rest" style="width: 26px; height: 26px; line-height: 26px;">补班</span>
|
|
|
|
|
|
+ <span v-if="isWeekt(date)" class="rest bgb" style="width: 26px; height: 26px; line-height: 26px;">补班</span>
|
|
|
|
+ <span v-else-if="isWeek(date)" class="rest bga">休</span>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
</el-calendar>
|
|
</el-calendar>
|
|
@@ -259,7 +259,7 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-import { listClockSet, getClockSet, delClockSet, addClockSet, updateClockSet } from "@/api/manage/clockSet"
|
|
|
|
|
|
+import { listClockSet, getClockSet, delClockSet, addClockSet, updateClockSet,getHolidays } from "@/api/manage/clockSet"
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: "ClockSet",
|
|
name: "ClockSet",
|
|
@@ -317,6 +317,8 @@ export default {
|
|
},
|
|
},
|
|
tableMaxHeight:'200',
|
|
tableMaxHeight:'200',
|
|
isgsow:true,
|
|
isgsow:true,
|
|
|
|
+ nhgse:[],//需要补班的日期
|
|
|
|
+ xxnhgse:[],//需要放假的节假日
|
|
}
|
|
}
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
@@ -333,8 +335,17 @@ export default {
|
|
height: this.tableMaxHeight + 'px',
|
|
height: this.tableMaxHeight + 'px',
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ },
|
|
|
|
+ watch: {
|
|
|
|
+ //月份切换时触发
|
|
|
|
+ value(newVal, oldVal) {
|
|
|
|
+ if (newVal.getMonth() !== oldVal?.getMonth() || newVal.getFullYear() !== oldVal?.getFullYear()) {
|
|
|
|
+ this.handleMonthChange(newVal);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|
|
|
|
+ this.handleMonthChange(this.value)
|
|
window.onresize = () => {
|
|
window.onresize = () => {
|
|
this.changeTableMaxHeight()
|
|
this.changeTableMaxHeight()
|
|
}
|
|
}
|
|
@@ -359,14 +370,31 @@ export default {
|
|
// 判断是否周六日
|
|
// 判断是否周六日
|
|
isWeek(date) {
|
|
isWeek(date) {
|
|
// 2.优化:三元表达式写法
|
|
// 2.优化:三元表达式写法
|
|
- return date.getDay() === 6 || date.getDay() === 0
|
|
|
|
|
|
+ if(date.getDay() === 6 || date.getDay() === 0){
|
|
|
|
+ return true
|
|
|
|
+ }else{
|
|
|
|
+ var index = this.xxnhgse.findIndex(item => item.holidayDate=== this.gettime(date))
|
|
|
|
+ return index != -1
|
|
|
|
+ }
|
|
},
|
|
},
|
|
isWeekt(date){
|
|
isWeekt(date){
|
|
- let nhgse= [{time:'2025-08-12',name:'中秋节'},{time:'2025-08-15',name:'中秋节'},]
|
|
|
|
- var index = nhgse.findIndex(item => item.time=== this.gettime(date))
|
|
|
|
|
|
+ // let nhgse= [{time:'2025-08-12',name:'中秋节'},{time:'2025-08-15',name:'中秋节'},]
|
|
|
|
+ var index = this.nhgse.findIndex(item => item.holidayDate=== this.gettime(date))
|
|
// 2.优化:三元表达式写法
|
|
// 2.优化:三元表达式写法
|
|
return index != -1
|
|
return index != -1
|
|
},
|
|
},
|
|
|
|
+ handleMonthChange(e){
|
|
|
|
+ // 当前月
|
|
|
|
+ var time=this.gettime(e)
|
|
|
|
+ var params={
|
|
|
|
+ holidayDate:time
|
|
|
|
+ }
|
|
|
|
+ getHolidays(params).then(res=>{
|
|
|
|
+ var timeList=res.data;
|
|
|
|
+ this.nhgse=timeList.filter(ite=>ite.type=='YES')
|
|
|
|
+ this.xxnhgse=timeList.filter(ite=>ite.type=='NO')
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
|
|
handleUpdatet(){
|
|
handleUpdatet(){
|
|
this.opentime = true
|
|
this.opentime = true
|
|
@@ -525,15 +553,21 @@ export default {
|
|
font-size: 14px;
|
|
font-size: 14px;
|
|
}
|
|
}
|
|
.date-content .rest {
|
|
.date-content .rest {
|
|
- color: #fff;
|
|
|
|
|
|
+
|
|
border-radius: 50%;
|
|
border-radius: 50%;
|
|
- background: rgb(250, 124, 77);
|
|
|
|
|
|
+
|
|
width: 20px;
|
|
width: 20px;
|
|
height: 20px;
|
|
height: 20px;
|
|
line-height: 20px;
|
|
line-height: 20px;
|
|
display: inline-block;
|
|
display: inline-block;
|
|
font-size: 12px;
|
|
font-size: 12px;
|
|
margin-left: 10px;
|
|
margin-left: 10px;
|
|
|
|
+ &.bga{
|
|
|
|
+ background: rgb(250, 124, 77);color: #fff;
|
|
|
|
+ }
|
|
|
|
+ &.bgb{
|
|
|
|
+ background: #eee9f5;color: #a86fb6;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
.date-content .text{
|
|
.date-content .text{
|
|
width: 20px;
|
|
width: 20px;
|