Pārlūkot izejas kodu

调试预案通知接口

zhangyihao 5 mēneši atpakaļ
vecāks
revīzija
1215d9e22e

+ 28 - 3
src/views/emergencyCommandMap/RightSection/RightTop.vue

@@ -32,8 +32,10 @@
                 -->
               </div>
               <div class="box-content">{{ notification.content }}</div>
-              <div class="box-content">赶赴现场人员:{{ notification.name1 }}</div>
-              <div class="box-content">指挥部值守人员:{{ notification.name2 }}</div>
+              <template v-if="notification.leaders && notification.leaders.length">
+                <div class="box-content">赶赴现场人员:{{ notification.name1 }} ({{ notification.phone1 }})</div>
+                <div class="box-content">指挥部值守人员:{{ notification.name2 }} ({{ notification.phone2 }})</div>
+              </template>
               <div v-if="!!notification.comment" class="box-content2">领导批示:{{ notification.comment }}</div>
             </div>
           </div>
@@ -110,11 +112,34 @@ const updateTaskList = (tasks) => {
     status: task.sent_status === 0 ? '暂未发送' : '已发送',
     content: task.yzy_content,
     comment: task.comment,
-    receiver: task.nick_name // 假设所有的任务都有接收者
+    receiver: task.nick_name, // 假设所有的任务都有接收者
+    name1: getLeaderNames(task.leaders, '赶赴现场人员'), // 赶赴现场人员姓名
+    phone1: getLeaderPhones(task.leaders, '赶赴现场人员'), // 赶赴现场人员电话
+    name2: getLeaderNames(task.leaders, '指挥部值守人员'), // 指挥部值守人员姓名
+    phone2: getLeaderPhones(task.leaders, '指挥部值守人员'), // 指挥部值守人员电话
+    leaders: task.leaders // 保留原始 leaders 数据用于模板中的条件判断
   }));
   nextFetchData();
 };
+// 获取特定类型的领导人姓名
+const getLeaderNames = (leaders, userType) => {
+  return (
+    leaders
+      .filter((leader) => leader.user_type === userType)
+      .map((leader) => leader.user_name)
+      .join('、') || '-'
+  );
+};
 
+// 获取特定类型的领导人电话
+const getLeaderPhones = (leaders, userType) => {
+  return (
+    leaders
+      .filter((leader) => leader.user_type === userType)
+      .map((leader) => leader.mobile)
+      .join('、') || '-'
+  );
+};
 // 设置定时器
 const fetchInterval = process.env.NODE_ENV === 'development' ? 60000 : 1500; // 每60秒刷新一次(刷新太频繁影响调试)