|
@@ -7,7 +7,7 @@
|
|
|
<el-date-picker v-model="month" type="month" :clearable="false" placeholder="请选择月份" @change="selectMonth" />
|
|
|
</div>
|
|
|
<el-button-group>
|
|
|
- <el-button type="primary" @click="setHoliday" :disabled="!multipleDates.length"> <SvgIcon name="ele-Sunny" class="mr3"/> 设定节假日</el-button>
|
|
|
+ <el-button type="primary" @click="setHoliday" :disabled="!multipleDates.length"> <SvgIcon name="ele-Sunny" class="mr3"/> 设定休息日</el-button>
|
|
|
<el-button type="primary" @click="setWorkDay" :disabled="!multipleDates.length"> <SvgIcon name="ele-Monitor" class="mr3"/> 设定工作日</el-button>
|
|
|
<el-button type="primary" @click="clearSelect" :disabled="!multipleDates.length"><SvgIcon name="ele-Delete" class="mr3"/> 清空选择</el-button>
|
|
|
</el-button-group>
|
|
@@ -20,7 +20,7 @@
|
|
|
<div v-if="data.day === item.currantTime" class="h100">
|
|
|
<el-checkbox v-model="item.checked" class="w100 h100">
|
|
|
<div>
|
|
|
- {{dayjs(data.day).format('D')}}<span :style="item.isWorkDay ? 'color:var(--el-color-info)' : 'color:var(--el-color-success)'">({{ item.isWorkDay ? '工作日' :'节假日'}})</span>
|
|
|
+ {{dayjs(data.day).format('D')}}<span :style="item.isWorkDay ? 'color:var(--el-color-primary)' : 'color:var(--el-color-success)'">({{ item.isWorkDay ? '工作日' :'休息日'}})</span>
|
|
|
</div>
|
|
|
<div class="lunar" :style="isFestival( data) ? 'color:var(--el-color-danger);font-weight:bold;' :''">{{ solarToLunar(data) }}</div>
|
|
|
</el-checkbox>
|
|
@@ -34,12 +34,12 @@
|
|
|
<el-form :model="state.ruleForm" ref="ruleFormRef" label-width="120px">
|
|
|
<el-row :gutter="35">
|
|
|
<el-col>
|
|
|
- <el-form-item label="节假日工作时间" prop="orgName" :rules="[{ required: true, message: '请选择节假日工作时间', trigger: 'change' }]">
|
|
|
+ <el-form-item label="休息日工作时间" prop="time" :rules="[{ required: true, message: '请选择休息日工作时间', trigger: 'change' }]">
|
|
|
<el-time-picker v-model="state.ruleForm.time" is-range range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col>
|
|
|
- <el-form-item label="工作日工作时间" prop="orgName" :rules="[{ required: true, message: '请选择工作日工作时间', trigger: 'change' }]">
|
|
|
+ <el-form-item label="工作日工作时间" prop="time1" :rules="[{ required: true, message: '请选择工作日工作时间', trigger: 'change' }]">
|
|
|
<el-time-picker v-model="state.ruleForm.time1" is-range range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
@@ -68,7 +68,8 @@ const dialogVisible = ref(false); // 是否显示弹窗
|
|
|
const loading = ref(false); // 加载状态
|
|
|
const state = reactive<any>({
|
|
|
ruleForm: {
|
|
|
- orgName: '',
|
|
|
+ time: '',
|
|
|
+ time1: '',
|
|
|
},
|
|
|
calendarData : [] // 日历数据
|
|
|
});
|
|
@@ -78,7 +79,8 @@ const selectMonth = async (val: Date) => {
|
|
|
const days: number = dayjs(val).daysInMonth();
|
|
|
state.calendarData = Array.from({ length: days }, (_, i) => ({
|
|
|
currantTime: dayjs(val).startOf('month').add(i, 'day').format('YYYY-MM-DD'),
|
|
|
- checked: false
|
|
|
+ checked: false,
|
|
|
+ isWorkDay:![0,6].includes(dayjs(val).startOf('month').add(i, 'day').day())
|
|
|
}));
|
|
|
dateRange.value = [new Date(dayjs(val).startOf('month').format('YYYY-MM-DD')),
|
|
|
new Date(dayjs(val).endOf('month').format('YYYY-MM-DD'))];
|
|
@@ -88,10 +90,10 @@ const selectMonth = async (val: Date) => {
|
|
|
// 日期范围
|
|
|
const dateRange = ref([new Date(dayjs(today.value).startOf('month').format('YYYY-MM-DD')),
|
|
|
new Date(dayjs(today.value).endOf('month').format('YYYY-MM-DD'))]); // 日期范围
|
|
|
-// 设置节假日
|
|
|
+// 设置休息日
|
|
|
const setHoliday = () => {
|
|
|
ElMessageBox.confirm(
|
|
|
- `您确定要将【${multipleDates.value.map((item:any) => dayjs(item).format('YYYY-MM-DD')).join(',')}】设为节假日吗?`,
|
|
|
+ `您确定要将【${multipleDates.value.map((item:any) => dayjs(item).format('YYYY-MM-DD')).join(',')}】设为休息日吗?`,
|
|
|
'提示',
|
|
|
{
|
|
|
type: 'warning',
|
|
@@ -138,9 +140,6 @@ const clearSelect = () => {
|
|
|
const multipleDates = computed(() => {
|
|
|
return state.calendarData.filter((item:any) => item.checked).map((item:any) => item.currantTime);
|
|
|
});
|
|
|
-const changeChecked = (item:any)=>{
|
|
|
- item.checked = !item.checked;
|
|
|
-}
|
|
|
// 表单ref
|
|
|
const ruleFormRef = ref<RefType>();
|
|
|
// 表单提交
|
|
@@ -151,7 +150,7 @@ const onSubmit = (formEl: FormInstance | undefined) => {
|
|
|
|
|
|
});
|
|
|
};
|
|
|
-// 获取节假日设置
|
|
|
+// 获取休息日设置
|
|
|
const getSetting = async ( dateYear: string,dateMoth: string) => {
|
|
|
loading.value = true;
|
|
|
try {
|
|
@@ -168,7 +167,7 @@ const getSetting = async ( dateYear: string,dateMoth: string) => {
|
|
|
loading.value = false;
|
|
|
}
|
|
|
};
|
|
|
-// 是否节假日
|
|
|
+// 是否休息日
|
|
|
const isFestival = (slotData:any)=> {
|
|
|
let solarDayArr = slotData.day.split('-');
|
|
|
let lunarDay:any = calendar.solar2lunar(solarDayArr[0], solarDayArr[1], solarDayArr[2])
|
|
@@ -186,6 +185,7 @@ onMounted(async ()=>{
|
|
|
const days: number = dayjs(today.value).daysInMonth();
|
|
|
state.calendarData = Array.from({ length: days }, (_, i) => ({
|
|
|
currantTime: dayjs(today.value).startOf('month').add(i, 'day').format('YYYY-MM-DD'),
|
|
|
+ isWorkDay:![0,6].includes(dayjs(today.value).startOf('month').add(i, 'day').day()),
|
|
|
checked: false
|
|
|
}));
|
|
|
await getSetting(dayjs(today.value).format('YYYY'),dayjs(today.value).format('MM'));
|