Browse Source

try catch接口

wangziqian 5 years ago
parent
commit
58ea0b37f9
1 changed files with 10 additions and 6 deletions
  1. 10 6
      src/views/projectManage/taskList/childrenTask/childrenList.vue

+ 10 - 6
src/views/projectManage/taskList/childrenTask/childrenList.vue

@@ -110,13 +110,17 @@ export default {
         psgeSize: this.pages.pageSize,
         curIndex: this.pages.curIndex
       }
-      const res = await getSubTaskList(param)
-      if (res.code === 200) {
-        this.total = res.total
+      try {
+        const res = await getSubTaskList(param)
+        if (res.code === 200) {
+          this.total = res.total
+          this.loading = false
+          this.all_task = res.data.map(item => {
+            return { ...item, participants: item.participants.split(',') }
+          })
+        }
+      } catch (error) {
         this.loading = false
-        this.all_task = res.data.map(item => {
-          return { ...item, participants: item.participants.split(',') }
-        })
       }
     },
     async getTaskStatus() { // 获取任务状态列表