|
|
|
|
@ -7,25 +7,28 @@
|
|
|
|
|
<el-button type="primary" @click="searchHoliday">查询节假日</el-button> |
|
|
|
|
<el-button type="primary" @click="refreshHoliday">同步节假日</el-button> |
|
|
|
|
</el-form> |
|
|
|
|
<el-row> |
|
|
|
|
<el-col v-for="(item, index) in defaultCals " :key="item.cal" :span="7" |
|
|
|
|
style="margin-right: 10px;margin-left: 50px;"> |
|
|
|
|
<el-card shadow="hover" style="margin-bottom: 20px;"> |
|
|
|
|
<el-calendar v-model="item.cal" class="holiday" style="pointer-events:none"> |
|
|
|
|
<!-- <el-calendar v-model="item.cal" class="holiday"> --> |
|
|
|
|
<template #date-cell="{ data }"> |
|
|
|
|
<div class="holiday-cell" v-show="data.type === 'current-month'" :id="index + '-' + data.day" |
|
|
|
|
:class="{ 'is-holiday': ifHoliday(data.day) }, { 'is-adjust': ifAdjustDay(data.day) }"> |
|
|
|
|
{{ data.day.split('-')[2] }} |
|
|
|
|
<span class="holiday-text">{{ ifHoliday(data.day) ? '休' : '' }}</span> |
|
|
|
|
<span class="adjust-text">{{ ifAdjustDay(data.day) ? '班' : '' }}</span> |
|
|
|
|
<span class="content-text">{{ dayContent(data.day) }}</span> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
</el-calendar> |
|
|
|
|
</el-card> |
|
|
|
|
</el-col> |
|
|
|
|
</el-row> |
|
|
|
|
<el-scrollbar class="scrollbar-container"> |
|
|
|
|
<el-row> |
|
|
|
|
<el-col v-for="(item, index) in defaultCals " :key="item.cal" :span="7" |
|
|
|
|
style="margin-right: 10px;margin-left: 50px;"> |
|
|
|
|
<el-card shadow="hover" style="margin-bottom: 20px;"> |
|
|
|
|
<el-calendar v-model="item.cal" class="holiday" style="pointer-events:none"> |
|
|
|
|
<!-- <el-calendar v-model="item.cal" class="holiday"> --> |
|
|
|
|
<template #date-cell="{ data }"> |
|
|
|
|
<div class="holiday-cell" v-show="data.type === 'current-month'" |
|
|
|
|
:id="index + '-' + data.day" |
|
|
|
|
:class="{ 'is-holiday': ifHoliday(data.day) }, { 'is-adjust': ifAdjustDay(data.day) }"> |
|
|
|
|
{{ data.day.split('-')[2] }} |
|
|
|
|
<span class="holiday-text">{{ ifHoliday(data.day) ? '休' : '' }}</span> |
|
|
|
|
<span class="adjust-text">{{ ifAdjustDay(data.day) ? '班' : '' }}</span> |
|
|
|
|
<span class="content-text">{{ dayContent(data.day) }}</span> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
</el-calendar> |
|
|
|
|
</el-card> |
|
|
|
|
</el-col> |
|
|
|
|
</el-row> |
|
|
|
|
</el-scrollbar> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
@ -42,7 +45,7 @@ const dayType = ref({
|
|
|
|
|
type: '' |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
const getDateData = (date) => { |
|
|
|
|
const getDateData = () => { |
|
|
|
|
axios.get('/api/outer/holiday/show-holiday').then(res => { |
|
|
|
|
dayType.value = res.data; |
|
|
|
|
loading.value = false; |
|
|
|
|
@ -89,17 +92,17 @@ const searchHoliday = () => {
|
|
|
|
|
|
|
|
|
|
const refreshHoliday = () => { |
|
|
|
|
loading.value = true; |
|
|
|
|
let nowYear = new Date().getFullYear(); |
|
|
|
|
console.log(currenYear.value + '==' + nowYear); |
|
|
|
|
if (currenYear.value === String(nowYear)) { |
|
|
|
|
getDateData(); |
|
|
|
|
axios.post('/api/outer/holiday/refresh-holiday', { year: currenYear.value }, { headers: { 'Content-Type': 'application/json' } }).then(res => { |
|
|
|
|
// console.log(res.data); |
|
|
|
|
dayType.value = res.data.holidayList; |
|
|
|
|
setTimeout(() => { |
|
|
|
|
loading.value = false; |
|
|
|
|
}, 1000); |
|
|
|
|
} else { |
|
|
|
|
ElMessage.info('其他年份尚未拥有数据') |
|
|
|
|
loading.value = false; |
|
|
|
|
} |
|
|
|
|
ElMessage.success('同步成功') |
|
|
|
|
}).catch(err => { |
|
|
|
|
ElMessage.error('同步失败') |
|
|
|
|
console.log(err); |
|
|
|
|
}); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const ifHoliday = (day) => { |
|
|
|
|
@ -211,6 +214,10 @@ const dayContent = (day) => {
|
|
|
|
|
-5px -5px 10px #ffdcdc; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.scrollbar-container { |
|
|
|
|
height: calc(100vh - 150px); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* .is-today { |
|
|
|
|
border-radius: 5px; |
|
|
|
|
background: linear-gradient(145deg, #d9a2a2, #ffc1c1); |
|
|
|
|
|