miaofuhao 2 mēneši atpakaļ
vecāks
revīzija
d059cde176

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

1
 <template>
1
 <template>
2
     <div class="wrap">
2
     <div class="wrap">
3
-        <div class="header">随访详情</div>
3
+        <div class="header" >随访详情</div>
4
         <div class="card-body">
4
         <div class="card-body">
5
             <el-row :gutter="20">
5
             <el-row :gutter="20">
6
                 <el-col :span="12" class="card-item">
6
                 <el-col :span="12" class="card-item">
122
     if (timer) clearInterval(timer); // 清除计时器
122
     if (timer) clearInterval(timer); // 清除计时器
123
     
123
     
124
     route.push({
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
           </td> -->
180
           </td> -->
181
 
181
 
182
           <td class="list-item" v-if="item.way === 1">
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
           </td>
185
           </td>
186
 
186
 
187
           <td class="list-item" v-if="item.way === 2 && item.state">
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
           </td>
190
           </td>
191
           <td class="list-item">
191
           <td class="list-item">
192
             
192
             
229
   </div>
229
   </div>
230
 </template>
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
 import { Search } from '@element-plus/icons-vue'
234
 import { Search } from '@element-plus/icons-vue'
235
-import { useRouter } from 'vue-router';
235
+import { useRouter, useRoute, onBeforeRouteUpdate } from 'vue-router';
236
 import { getTasks, getSelfTaskReport } from  '@/api/patient/task'
236
 import { getTasks, getSelfTaskReport } from  '@/api/patient/task'
237
 import { getPlans } from  '@/api/patient/plan'
237
 import { getPlans } from  '@/api/patient/plan'
238
 import { taskResults,taskMsgResults } from "@/utils/commonDic.js";
238
 import { taskResults,taskMsgResults } from "@/utils/commonDic.js";
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
 const taskResultsMap = ArrayToMap(taskResults, 'value');
412
 const taskResultsMap = ArrayToMap(taskResults, 'value');
394
 
413