|
|
@@ -26,7 +26,9 @@ import { ref, onMounted } from 'vue';
|
|
|
|
|
|
const weeks = ['日', '一', '二', '三', '四', '五', '六'];
|
|
|
const calendars = ref([]);
|
|
|
-const calendarsCopy = ref([]);
|
|
|
+const calendarsCopy = ref([]);
|
|
|
+const startDay = ref('')
|
|
|
+const endDay = ref('')
|
|
|
|
|
|
const createCalendar = (months) => {
|
|
|
return new Promise((resolve,reject)=>{
|
|
|
@@ -94,16 +96,21 @@ const createCalendar = (months) => {
|
|
|
const setStartEndDay = type => {//type 0:全部时间 1:一周内 2:一月内 3:本周末
|
|
|
let d = new Date();
|
|
|
let s = new Date().Format('yyyy-MM-dd');
|
|
|
+ startDay.value = s;
|
|
|
let e = null;
|
|
|
switch(type){
|
|
|
case 0:
|
|
|
s = e = '';
|
|
|
+ startDay.value = '';
|
|
|
+ endDay.value = '';
|
|
|
break;
|
|
|
case 1:
|
|
|
e = new Date(d.setDate(d.getDate(s)+6)).Format('yyyy-MM-dd');
|
|
|
+ endDay.value = e;
|
|
|
break;
|
|
|
case 2:
|
|
|
e = new Date(d.setDate(d.getDate(s)+30)).Format('yyyy-MM-dd');
|
|
|
+ endDay.value = e;
|
|
|
break;
|
|
|
case 3:
|
|
|
let sw = new Date(s).getDay();
|
|
|
@@ -114,6 +121,8 @@ const setStartEndDay = type => {//type 0:全部时间 1:一周内 2:一月
|
|
|
s = new Date(d.setDate(d.getDate(s)+(6-sw))).Format('yyyy-MM-dd');
|
|
|
e = new Date(d.setDate(d.getDate(s)+1)).Format('yyyy-MM-dd');
|
|
|
}
|
|
|
+ startDay.value = s;
|
|
|
+ endDay.value = e;
|
|
|
break;
|
|
|
}
|
|
|
calendarsCopy.value = JSON.parse(JSON.stringify(calendars.value));
|
|
|
@@ -138,7 +147,9 @@ onMounted(async () => {
|
|
|
});
|
|
|
|
|
|
defineExpose({
|
|
|
- setStartEndDay
|
|
|
+ setStartEndDay,
|
|
|
+ startDay,
|
|
|
+ endDay
|
|
|
})
|
|
|
</script>
|
|
|
|