lrf402788946 hace 5 años
padre
commit
6b68da8d6a
Se han modificado 2 ficheros con 30 adiciones y 3 borrados
  1. 29 2
      components/calendar.vue
  2. 1 1
      components/wang-editor.vue

+ 29 - 2
components/calendar.vue

@@ -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: {

+ 1 - 1
components/wang-editor.vue

@@ -5,6 +5,7 @@
 import E from 'wangeditor';
 import E from 'wangeditor';
 
 
 const menus = [
 const menus = [
+  'code', // 插入代码
   'head', // 标题
   'head', // 标题
   'bold', // 粗体
   'bold', // 粗体
   'fontSize', // 字号
   'fontSize', // 字号
@@ -21,7 +22,6 @@ const menus = [
   // 'emoticon', // 表情
   // 'emoticon', // 表情
   'table', // 表格
   'table', // 表格
   // 'video', // 插入视频
   // 'video', // 插入视频
-  // 'code', // 插入代码
   'undo', // 撤销
   'undo', // 撤销
   'redo', // 重复
   'redo', // 重复
 ];
 ];