From a7ac91bc5ae3c2ce0badca1ae9fc7ed57af95758 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期二, 22 十月 2024 15:15:28 +0800
Subject: [PATCH] 1. 添加子任务编辑功能(暂存)

---
 src/views/fysp/task/TaskManage.vue |   38 +++++++++++++++++++++++++++-----------
 1 files changed, 27 insertions(+), 11 deletions(-)

diff --git a/src/views/fysp/task/TaskManage.vue b/src/views/fysp/task/TaskManage.vue
index ae03a36..8940905 100644
--- a/src/views/fysp/task/TaskManage.vue
+++ b/src/views/fysp/task/TaskManage.vue
@@ -39,20 +39,26 @@
           <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
                     :task="curTask.data"
                     @date-change="onDateChange"
                   ></CompMonitorPlan>
                 </el-col>
-                <el-col v-if="curSubTaskList.length > 0" :span="8">
-                  <CompSubTaskList :data="curSubTaskList" height="56vh"></CompSubTaskList>
+                <el-col v-if="curSubTaskList" :span="8">
+                  <CompSubTaskList
+                    create
+                    v-model="curSubTaskList"
+                    :loading="subTaskLoading"
+                    height="56vh"
+                    @add="subTaskDrawer = true"
+                  ></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>
@@ -173,7 +179,8 @@
       // 褰撳墠閫夋嫨鐨勬棩浠诲姟
       curDayTask: {},
       // 褰撳墠閫夋嫨鐨勬棩浠诲姟涓嬬殑瀛愪换鍔�
-      curSubTaskList: [],
+      curSubTaskList: undefined,
+      subTaskLoading: false,
       // 鎬讳换鍔℃柊澧炲脊鍑烘
       topTaskAddVisible: false
     };
@@ -234,6 +241,7 @@
       this.task = task;
       this.sideLoading = false;
       this.mainLoading = true;
+      this.curSubTaskList = undefined;
       taskApi
         .fetchMonitorObjectVersion(task.data.tguid)
         .then((res) => {
@@ -263,11 +271,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;

--
Gitblit v1.9.3