miaofuhao 2 months ago
parent
commit
d059cde176

+ 3 - 2
src/views/main/followUp/followUpTask/cpns/taskDetails.vue

@@ -1,6 +1,6 @@
1 1
 <template>
2 2
     <div class="wrap">
3
-        <div class="header">随访详情</div>
3
+        <div class="header" >随访详情</div>
4 4
         <div class="card-body">
5 5
             <el-row :gutter="20">
6 6
                 <el-col :span="12" class="card-item">
@@ -122,7 +122,8 @@ const closePage = () => {
122 122
     if (timer) clearInterval(timer); // 清除计时器
123 123
     
124 124
     route.push({
125
-        path: '/followUp/followUpTask'
125
+        path: '/followUp/followUpTask',
126
+        query: { refresh: 'true' } // 添加刷新参数
126 127
     });
127 128
 
128 129
 }

+ 26 - 7
src/views/main/followUp/followUpTask/followUpTask.vue

@@ -180,13 +180,13 @@
180 180
           </td> -->
181 181
 
182 182
           <td class="list-item" v-if="item.way === 1">
183
-            <div class="item-dot" :style="[{ 'background': taskResultsMap[item.callState || ''].color }]"></div>
184
-            <div class="item-state">{{ taskResultsMap[item.callState || ''].title }}</div>
183
+            <div class="item-dot" :style="[{ 'background': (taskResultsMap[item.callState || ''] || {}).color || '#999999' }]"></div>
184
+            <div class="item-state">{{ (taskResultsMap[item.callState || ''] || {}).title || '-' }}</div>
185 185
           </td>
186 186
 
187 187
           <td class="list-item" v-if="item.way === 2 && item.state">
188
-            <div class="item-dot" :style="[{ 'background': taskMsgResults[item.state].color }]"></div>
189
-            <div class="item-state">{{ taskMsgResults[item.state].title }}</div>
188
+            <div class="item-dot" :style="[{ 'background': (taskMsgResults[item.state] || {}).color || '#999999' }]"></div>
189
+            <div class="item-state">{{ (taskMsgResults[item.state] || {}).title || '-' }}</div>
190 190
           </td>
191 191
           <td class="list-item">
192 192
             
@@ -229,10 +229,10 @@
229 229
   </div>
230 230
 </template>
231 231
 
232
-<script setup>
233
-import { onMounted, ref } from 'vue';
232
+<script setup name="FollowUpTask">
233
+import { onMounted, ref, watch } from 'vue';
234 234
 import { Search } from '@element-plus/icons-vue'
235
-import { useRouter } from 'vue-router';
235
+import { useRouter, useRoute, onBeforeRouteUpdate } from 'vue-router';
236 236
 import { getTasks, getSelfTaskReport } from  '@/api/patient/task'
237 237
 import { getPlans } from  '@/api/patient/plan'
238 238
 import { taskResults,taskMsgResults } from "@/utils/commonDic.js";
@@ -389,6 +389,25 @@ const getReport = () => {
389 389
   })
390 390
 }
391 391
 
392
+// 刷新数据函数
393
+const refreshData = () => {
394
+  getTaskList(1);
395
+  getReport();
396
+}
397
+
398
+// 监听路由更新
399
+// 添加计算属性监听路由参数变化作为备选方案
400
+const route = useRoute();
401
+const routeQuery = computed(() => route.query);
402
+
403
+// 监听计算属性变化
404
+watch(routeQuery, (newQuery, oldQuery) => {
405
+  console.log('路由参数变化:', newQuery, oldQuery);
406
+  if (newQuery.refresh === 'true') {
407
+    console.log('检测到refresh参数为true,刷新数据');
408
+    refreshData();
409
+  }
410
+}, { deep: true });
392 411
 
393 412
 const taskResultsMap = ArrayToMap(taskResults, 'value');
394 413