|
@@ -22,11 +22,14 @@
|
|
defaultView="dayGridMonth"
|
|
defaultView="dayGridMonth"
|
|
:plugins="calendarPlugins"
|
|
:plugins="calendarPlugins"
|
|
:selectable="useDraft"
|
|
:selectable="useDraft"
|
|
- :events="events"
|
|
|
|
|
|
+ :events="event"
|
|
@select="drawSelect"
|
|
@select="drawSelect"
|
|
:eventOrder="`start`"
|
|
:eventOrder="`start`"
|
|
@eventClick="clickEvent"
|
|
@eventClick="clickEvent"
|
|
:views="views"
|
|
:views="views"
|
|
|
|
+ :displayEventEnd="true"
|
|
|
|
+ :displayEventTime="true"
|
|
|
|
+ :allday="true"
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
@@ -35,6 +38,7 @@
|
|
import FullCalendar from '@fullcalendar/vue';
|
|
import FullCalendar from '@fullcalendar/vue';
|
|
import dayGridPlugin from '@fullcalendar/daygrid';
|
|
import dayGridPlugin from '@fullcalendar/daygrid';
|
|
import interactionPlugin from '@fullcalendar/interaction';
|
|
import interactionPlugin from '@fullcalendar/interaction';
|
|
|
|
+var moment = require('moment');
|
|
import _ from 'lodash';
|
|
import _ from 'lodash';
|
|
export default {
|
|
export default {
|
|
props: {
|
|
props: {
|
|
@@ -44,6 +48,7 @@ export default {
|
|
useEvent: { type: Boolean, default: true },
|
|
useEvent: { type: Boolean, default: true },
|
|
selfBtn: { type: Object, default: () => {} },
|
|
selfBtn: { type: Object, default: () => {} },
|
|
eventLimit: { type: null, default: false },
|
|
eventLimit: { type: null, default: false },
|
|
|
|
+ vacation: { type: Array, default: () => [] },
|
|
},
|
|
},
|
|
components: {
|
|
components: {
|
|
FullCalendar, // make the <FullCalendar> tag available
|
|
FullCalendar, // make the <FullCalendar> tag available
|
|
@@ -78,7 +83,12 @@ export default {
|
|
this.$emit('click', arg);
|
|
this.$emit('click', arg);
|
|
},
|
|
},
|
|
drawSelect(arg) {
|
|
drawSelect(arg) {
|
|
- this.$emit('draft', arg);
|
|
|
|
|
|
+ arg.endStr = moment(arg.endStr)
|
|
|
|
+ .subtract(1, 'days')
|
|
|
|
+ .format('YYYY-MM-DD');
|
|
|
|
+ let is_possbile = this.$checkDate({ ...arg, vacation: this.vacation });
|
|
|
|
+ if (is_possbile == true) this.$emit('draft', arg);
|
|
|
|
+ else this.$message.error('您选择的时间段与假期重合,请您重新选择');
|
|
},
|
|
},
|
|
clickEvent(arg) {
|
|
clickEvent(arg) {
|
|
if (this.useEvent) this.$emit('eventClick', arg);
|
|
if (this.useEvent) this.$emit('eventClick', arg);
|
|
@@ -105,6 +115,23 @@ export default {
|
|
rangeEnd() {
|
|
rangeEnd() {
|
|
return `${this.year}-12-31`;
|
|
return `${this.year}-12-31`;
|
|
},
|
|
},
|
|
|
|
+ event() {
|
|
|
|
+ let nv = this.vacation.map(i => {
|
|
|
|
+ let object = JSON.parse(JSON.stringify(i));
|
|
|
|
+ object.end = moment(i.end)
|
|
|
|
+ .add(1, 'days')
|
|
|
|
+ .format('YYYY-MM-DD');
|
|
|
|
+ return object;
|
|
|
|
+ });
|
|
|
|
+ let ne = this.events.map(i => {
|
|
|
|
+ let object = JSON.parse(JSON.stringify(i));
|
|
|
|
+ object.end = moment(i.end)
|
|
|
|
+ .add(1, 'days')
|
|
|
|
+ .format('YYYY-MM-DD');
|
|
|
|
+ return object;
|
|
|
|
+ });
|
|
|
|
+ return nv.concat(ne);
|
|
|
|
+ },
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
selfBtn: {
|
|
selfBtn: {
|