PrinceLee 5 anni fa
parent
commit
281eddf5e7

+ 18 - 26
src/views/workbench/person/calendarFormDialog.vue

@@ -65,11 +65,12 @@
     </template>
   </el-dialog>
 </template>
-
 <script>
-import workbenchApi from '@/api/workbench.js'
 import { settingGetBizList } from '@/api/defectManage'
-// import dayjs from 'dayjs'
+import {
+  createSelfSchedule,
+  updateSelfSchedule
+} from '@/api/workSchedule.js'
 
 export default {
   props: {
@@ -155,21 +156,7 @@ export default {
           }
         }
         if (valid || bizIdValid) {
-          if (this.title === '新建日程') {
-            this.createSelfSchedule()
-              .then(res => {
-                if (res.code === 200) {
-                  this.$emit('confirm', false)
-                }
-              })
-          } else {
-            this.updateSelfSchedule()
-              .then(res => {
-                if (res.code === 200) {
-                  this.$emit('confirm', false)
-                }
-              })
-          }
+          this.title === '新建日程' ? this.createSelfSchedule() : this.updateSelfSchedule()
         }
       })
     },
@@ -178,22 +165,27 @@ export default {
       this.form.endTime = this.form.time[1]
     },
     // 新建日程
-    createSelfSchedule() {
+    async createSelfSchedule() {
       this.dateFomat()
       if (this.form.isJoin === 0) {
         this.form.bizId = null
       }
-      return workbenchApi.createSelfSchedule(this.form)
+      const res = await createSelfSchedule(this.form)
+      if (res.code === 200) {
+        this.$emit('confirm', false)
+      }
     },
     // 编辑日程
-    updateSelfSchedule() {
+    async updateSelfSchedule() {
       this.dateFomat()
-      return workbenchApi.updateSelfSchedule(this.form)
+      const res = await updateSelfSchedule(this.form)
+      if (res.code === 200) {
+        this.$emit('confirm', false)
+      }
     },
-    settingGetBizList() {
-      settingGetBizList({}).then(res => {
-        this.businesslines = res.data
-      })
+    async settingGetBizList() {
+      const res = await settingGetBizList({})
+      res.code === 200 ? this.businesslines = res.data : this.businesslines = []
     }
   }
 }

+ 0 - 0
src/views/workbench/person/components/calender.vue → src/views/workbench/person/components/calenderList.vue