From 4f238e1ff525b6aa1f8c9981f044d606a89734ce Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期四, 24 十月 2024 08:27:19 +0800
Subject: [PATCH] 1. 新增完成展示下载的excel文件功能

---
 src/views/fysp/task/TaskManage.vue |   46 +++++++++++++++++++++++++++++++++-------------
 1 files changed, 33 insertions(+), 13 deletions(-)

diff --git a/src/views/fysp/task/TaskManage.vue b/src/views/fysp/task/TaskManage.vue
index 68efe34..5685aa5 100644
--- a/src/views/fysp/task/TaskManage.vue
+++ b/src/views/fysp/task/TaskManage.vue
@@ -39,24 +39,28 @@
           <el-tabs model-value="first">
             <el-tab-pane label="鐩戠璁″垝" name="first">
               <el-row>
-                <el-col :span="curSubTaskList.length > 0 ? 16 : 24">
+                <el-col :span="curSubTaskList ? 16 : 24">
                   <CompMonitorPlan
+                    ref="planRef"
                     :task="curTask.data"
                     @date-change="onDateChange"
                   ></CompMonitorPlan>
                 </el-col>
-                <el-col v-if="curSubTaskList.length > 0" :span="8">
+                <el-col v-if="curSubTaskList" :span="8">
                   <CompSubTaskList
-                    :data="curSubTaskList"
+                    create
+                    v-model="curSubTaskList"
+                    :loading="subTaskLoading"
                     height="56vh"
                     @add="subTaskDrawer = true"
+                    @submit="handleSubtaskSubmit"
                   ></CompSubTaskList>
                 </el-col>
               </el-row>
             </el-tab-pane>
-            <el-tab-pane label="鐩戠鍦板浘" name="second">
+            <!-- <el-tab-pane label="鐩戠鍦板浘" name="second">
               <CompTaskMap></CompTaskMap>
-            </el-tab-pane>
+            </el-tab-pane> -->
           </el-tabs>
         </el-row>
         <el-divider></el-divider>
@@ -91,6 +95,7 @@
     <CompDayTask
       :day-task="curDayTask"
       :mObjList="curMonitorObjList"
+      @submit="handleSubtaskSubmit"
     ></CompDayTask>
   </el-drawer>
   <el-dialog
@@ -177,7 +182,8 @@
       // 褰撳墠閫夋嫨鐨勬棩浠诲姟
       curDayTask: {},
       // 褰撳墠閫夋嫨鐨勬棩浠诲姟涓嬬殑瀛愪换鍔�
-      curSubTaskList: [],
+      curSubTaskList: undefined,
+      subTaskLoading: false,
       // 鎬讳换鍔℃柊澧炲脊鍑烘
       topTaskAddVisible: false
     };
@@ -238,12 +244,12 @@
       this.task = task;
       this.sideLoading = false;
       this.mainLoading = true;
-      this.curSubTaskList = []
+      this.curSubTaskList = undefined;
+      this.curTask = task;
       taskApi
         .fetchMonitorObjectVersion(task.data.tguid)
         .then((res) => {
           this.curMonitorObjList = res;
-          this.curTask = task;
         })
         .finally(() => {
           this.mainLoading = false;
@@ -268,11 +274,19 @@
       });
     },
     onDateChange(dayTask) {
-      // this.subTaskDrawer = true;
-      this.curDayTask = dayTask;
-      taskApi.fetchSubtaskByDayTask(dayTask.guid).then((res) => {
-        this.curSubTaskList = res;
-      });
+      if (dayTask) {
+        this.subTaskLoading = true;
+        // this.subTaskDrawer = true;
+        this.curDayTask = dayTask;
+        taskApi
+          .fetchSubtaskByDayTask(dayTask.guid)
+          .then((res) => {
+            this.curSubTaskList = res;
+          })
+          .finally(() => (this.subTaskLoading = false));
+      } else {
+        this.curSubTaskList = [];
+      }
     },
     navToTaskCreate(value) {
       this.topTaskAddVisible = false;
@@ -282,6 +296,12 @@
           task: encodeURIComponent(JSON.stringify(value))
         }
       });
+    },
+    handleSubtaskSubmit() {
+      this.subTaskLoading = true;
+      this.$refs.planRef
+        .fetchDayTasks()
+        .finally(() => (this.subTaskLoading = false));
     }
   },
   mounted() {

--
Gitblit v1.9.3