RightTop.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. <template>
  2. <div class="duty-card">
  3. <div class="title gradient-text">指挥动态</div>
  4. <ul class="tabs">
  5. <li v-for="(tab, index) in tabs" :key="index" :class="{ active: tab.id === activeTab }" @click="setActiveTab(tab.id)">
  6. {{ tab.label }}
  7. </li>
  8. </ul>
  9. <div class="card-content">
  10. <!-- 任务跟踪部分 -->
  11. <RenWuGenZong v-if="activeTab === '任务跟踪'" :event-id="eventId" />
  12. <!-- 预案通知部分修改为卡片式布局 -->
  13. <div v-else-if="activeTab === '预案通知'" class="preplan-notification">
  14. <div class="table-content">
  15. <div v-for="(notification, index) in notifications" :key="index" class="box1">
  16. <div :class="notification.status === '发送失败' ? 'error-icon' : 'success-icon'"></div>
  17. <div class="box2">
  18. <div class="box-header">
  19. <div class="header-left">
  20. <div class="box-title">{{ notification.unit }}</div>
  21. <div class="time">{{ notification.date }}</div>
  22. <div :class="notification.status === '发送失败' ? 'status error' : 'status success'">
  23. {{ notification.status === '发送失败' ? '发送失败' : `接收人:${notification.receiver}` }}
  24. </div>
  25. </div>
  26. <!-- 如果需要更新按钮,可以取消注释以下代码 -->
  27. <!--
  28. <div class="btn" @click="openUpdateDialog(notification)">
  29. 更新
  30. </div>
  31. -->
  32. </div>
  33. <div class="box-content">{{ notification.content }}</div>
  34. </div>
  35. </div>
  36. </div>
  37. </div>
  38. <!-- 资源调度部分保持不变 -->
  39. <div v-else-if="activeTab === '资源调度'" class="resource-scheduling">
  40. <!-- 资源调度内容,可以根据需要进行填充 -->
  41. <p>资源调度内容正在开发中...</p>
  42. </div>
  43. </div>
  44. </div>
  45. </template>
  46. <script lang="ts" setup>
  47. import { onMounted, ref, reactive } from 'vue';
  48. import { taskList } from '@/api/duty/eventing';
  49. import RenWuGenZong from '@/views/emergencyCommandMap/RightSection/RenWuGenZong.vue'; // 确保 eventing.ts 的路径正确
  50. const props = defineProps<{
  51. eventId?: string; // 使用可选属性
  52. }>();
  53. // 输出 eventId 以验证是否正确获取
  54. console.log('Received eventId in RightTop:', props.eventId);
  55. // 定义 tabs
  56. const tabs = reactive([
  57. { id: '任务跟踪', label: '任务跟踪' },
  58. { id: '预案通知', label: '预案通知' },
  59. { id: '资源调度', label: '资源调度' }
  60. ]);
  61. const activeTab = ref('任务跟踪');
  62. const setActiveTab = (id) => {
  63. activeTab.value = id;
  64. };
  65. // 定义 notifications
  66. const notifications = ref([]);
  67. // 请求数据
  68. const fetchData = async () => {
  69. try {
  70. if (!props.eventId) {
  71. console.error('eventId 未找到');
  72. return;
  73. }
  74. const response = await taskList({ eventId: props.eventId });
  75. if (response.code === 200) {
  76. console.log('查询成功预案:', response.data);
  77. updateTaskList(response.data);
  78. } else {
  79. console.error('预案查询失败:', response.msg);
  80. }
  81. } catch (error) {
  82. console.error('请求失败:', error);
  83. }
  84. };
  85. // 更新任务列表
  86. const updateTaskList = (tasks) => {
  87. notifications.value = tasks.map((task) => ({
  88. unit: task.dept_name,
  89. date: task.sent_time,
  90. status: task.sent_status === 0 ? '暂未发送' : '已发送',
  91. content: task.yzy_content,
  92. receiver: task.nick_name // 假设所有的任务都有接收者
  93. }));
  94. };
  95. // 在组件挂载时获取数据
  96. onMounted(() => {
  97. console.log('Mounting RightTop component');
  98. if (props.eventId) {
  99. fetchData();
  100. } else {
  101. console.warn('RightTop did not receive eventId:', props.eventId);
  102. }
  103. });
  104. </script>
  105. <style lang="scss" scoped>
  106. .tabs {
  107. display: flex;
  108. justify-content: flex-start; /* 选项卡靠左对齐 */
  109. padding: 0;
  110. margin-left: 80px;
  111. margin-top: 75px;
  112. .active {
  113. background: url('@/assets/images/emergencyCommandMap/tabActive.png') no-repeat;
  114. }
  115. li {
  116. cursor: pointer;
  117. padding: 20px;
  118. font-size: 38px;
  119. color: #fff;
  120. width: 349px;
  121. height: 118px;
  122. background: url('@/assets/images/emergencyCommandMap/tab.png') no-repeat;
  123. display: flex;
  124. justify-content: center;
  125. align-items: flex-end;
  126. font-family: YouSheBiaoTiHei;
  127. &:hover {
  128. background: url('@/assets/images/emergencyCommandMap/tabActive.png') no-repeat;
  129. }
  130. }
  131. }
  132. .preplan-notification {
  133. width: 100%;
  134. .table-content {
  135. height: 600px;
  136. overflow-y: auto;
  137. .box1 {
  138. display: flex;
  139. align-items: flex-start;
  140. margin-bottom: 20px;
  141. &:last-child {
  142. margin-bottom: 0;
  143. }
  144. .success-icon,
  145. .error-icon {
  146. width: 123px;
  147. height: 79px;
  148. background-repeat: no-repeat;
  149. background-size: contain;
  150. margin-right: 20px;
  151. }
  152. .success-icon {
  153. background-image: url('@/assets/images/taskTracking/success.png');
  154. }
  155. .error-icon {
  156. background-image: url('@/assets/images/taskTracking/processing.png');
  157. }
  158. .box2 {
  159. flex: 1;
  160. background-image: url('@/assets/images/taskTracking/box1.png');
  161. background-repeat: no-repeat;
  162. background-size: 100% 377px; /* 适应容器宽度 */
  163. padding: 20px 60px 20px 20px;
  164. position: relative;
  165. .box-header {
  166. display: flex;
  167. justify-content: space-between;
  168. align-items: center;
  169. .header-left {
  170. display: flex;
  171. align-items: center;
  172. .box-title {
  173. font-size: 38px;
  174. font-family: YouSheBiaoTiHei;
  175. color: #ffffff;
  176. background-image: url('@/assets/images/taskTracking/titleBox.png');
  177. background-repeat: no-repeat;
  178. background-size: 311px 56px;
  179. background-position: bottom left;
  180. padding-left: 50px;
  181. }
  182. .time {
  183. font-size: 32px;
  184. color: #00e8ff;
  185. margin-left: 70px;
  186. }
  187. }
  188. .status {
  189. width: 154px;
  190. height: 56px;
  191. line-height: 56px;
  192. font-size: 32px;
  193. color: #ffffff;
  194. border-radius: 10px;
  195. text-align: center;
  196. margin-left: 30px;
  197. }
  198. .success {
  199. background-color: #38c95a;
  200. }
  201. .error {
  202. background-color: #ff4d4f;
  203. }
  204. /* 如果需要更新按钮,可以添加样式 */
  205. /*
  206. .btn {
  207. background-color: #247dff;
  208. cursor: pointer;
  209. }
  210. */
  211. }
  212. .box-content {
  213. color: #fff;
  214. font-size: 38px;
  215. line-height: 1.5;
  216. margin-top: 10px;
  217. }
  218. }
  219. }
  220. }
  221. }
  222. .duty-card {
  223. width: 1966px;
  224. height: 879px;
  225. background: url('@/assets/images/commandDynamic/dialog.png') no-repeat;
  226. position: relative;
  227. color: #fff;
  228. .card-content {
  229. display: flex;
  230. flex-wrap: wrap;
  231. padding-left: 80px;
  232. width: 2500px;
  233. }
  234. }
  235. .title {
  236. position: absolute;
  237. top: 6px;
  238. left: 141px;
  239. font-size: 60px;
  240. }
  241. .resource-scheduling {
  242. width: 100%;
  243. display: flex;
  244. justify-content: center;
  245. align-items: center;
  246. font-size: 36px;
  247. color: #fff;
  248. }
  249. </style>