whj 1 year ago
parent
commit
26fd49d339
1 changed files with 21 additions and 38 deletions
  1. 21 38
      src/views/repair/calendar/Calendar.vue

+ 21 - 38
src/views/repair/calendar/Calendar.vue

@@ -78,7 +78,7 @@ import '@toast-ui/calendar/dist/toastui-calendar.min.css'
 import 'tui-date-picker/dist/tui-date-picker.min.css'
 import 'tui-time-picker/dist/tui-time-picker.min.css'
 import { TZDate } from '@toast-ui/calendar'
-import { getCalendar } from '@/api/repair/application-form'
+import { getCalendar, pushCalendar } from '@/api/repair/application-form'
 
 export default {
   components: {
@@ -231,40 +231,6 @@ export default {
   },
   created () {
     this.getInfo()
-    this.events = [
-      {
-        id: '1',
-        calendarId: '1',
-        title: '11',
-        category: 'milestone',
-        start: this.today,
-        end: this.addHours(this.today, 3)
-      },
-      {
-        id: '2',
-        calendarId: '2',
-        title: '22',
-        category: 'milestone',
-        start: this.addDate(this.today, 1),
-        end: this.addDate(this.today, 1)
-      },
-      {
-        id: '3',
-        calendarId: '2',
-        title: 'FE 33',
-        category: 'milestone',
-        start: this.subtractDate(this.today, 2),
-        end: this.subtractDate(this.today, 1)
-      },
-      {
-        id: '4',
-        calendarId: '3',
-        title: '44',
-        category: 'milestone',
-        start: this.today,
-        end: this.addHours(this.today, 1)
-      }
-    ]
   },
   mounted () {
     this.setDateRangeText()
@@ -286,13 +252,18 @@ export default {
             return item.id
           }
         })
+        this.dataList = res.data.scheduleList.map(item => {
+          // item.isReadOnly = true
+          return item
+        })
+        this.events = this.dataList
       })
     },
     getTemplateForMilestone (event) {
       return `<span style="color: #fff; background-color: ${event.backgroundColor};">${event.title}</span>`
     },
     getTemplateForAllday (event) {
-      return `[All day] ${event.title}`
+      return `${event.title}`
     },
     onSelectDateTime ({ start, end }) {
       console.group('onSelectDateTime')
@@ -319,7 +290,16 @@ export default {
     onBeforeUpdateEvent (updateData) {
       const targetEvent = updateData.event
       const changes = { ...updateData.changes }
-      this.calendarInstance.updateEvent(targetEvent.id, targetEvent.calendarId, changes)
+      console.log(updateData)
+      pushCalendar({
+        id: targetEvent.id,
+        calendarDate: this.BaseTool.Date.formatter(changes.start.d.d, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+      }).then(res => {
+      // this.calendarInstance.updateEvent(targetEvent.id, targetEvent.calendarId, changes)
+        this.getInfo()
+      }).catch((err) => {
+        this.$$message.error(err.message)
+      })
     },
 
     onBeforeDeleteEvent ({ title, id, calendarId }) {
@@ -398,7 +378,7 @@ export default {
       return date
     },
     onSelect (keys, e) {
-      console.log(keys)
+      this.events = this.dataList.filter(item => this.checkedKeys.includes(item.calendarId))
     }
   }
 }
@@ -423,4 +403,7 @@ export default {
 /deep/.ant-tree li .ant-tree-node-content-wrapper{
   color:inherit;
 }
+/deep/.toastui-calendar-detail-container .toastui-calendar-section-button{
+  display: none;
+}
 </style>