RightTop.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  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 v-if="notifications.length > 0" 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 v-else class="tip">暂无数据</div>
  38. </div>
  39. <!-- 资源调度部分保持不变 -->
  40. <div v-else-if="activeTab === '资源调度'" class="resource-scheduling">
  41. <!-- 资源调度内容,可以根据需要进行填充 -->
  42. <p>资源调度内容正在开发中...</p>
  43. </div>
  44. </div>
  45. </div>
  46. </template>
  47. <script lang="ts" setup>
  48. import { onMounted, ref, reactive } from 'vue';
  49. import { taskList } from '@/api/duty/eventing';
  50. import RenWuGenZong from '@/views/emergencyCommandMap/RightSection/RenWuGenZong.vue'; // 确保 eventing.ts 的路径正确
  51. const props = defineProps<{
  52. eventId?: string; // 使用可选属性
  53. }>();
  54. // 定义 tabs
  55. const tabs = reactive([
  56. { id: '任务跟踪', label: '任务跟踪' },
  57. { id: '预案通知', label: '预案通知' },
  58. { id: '资源调度', label: '资源调度' }
  59. ]);
  60. const activeTab = ref('任务跟踪');
  61. const setActiveTab = (id) => {
  62. activeTab.value = id;
  63. };
  64. // 定义 notifications
  65. const notifications = ref([]);
  66. // 请求数据
  67. const fetchData = async () => {
  68. try {
  69. if (!props.eventId) {
  70. console.error('eventId 未找到');
  71. return;
  72. }
  73. const response = await taskList({ eventId: props.eventId });
  74. // const response = await taskList({ eventId: "YJSJ3295457527" });
  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. watch(
  96. () => props.eventId,
  97. () => {
  98. if (!!props.eventId) {
  99. fetchData();
  100. }
  101. },
  102. {
  103. immediate: true
  104. }
  105. );
  106. </script>
  107. <style lang="scss" scoped>
  108. .tabs {
  109. display: flex;
  110. justify-content: flex-start; /* 选项卡靠左对齐 */
  111. padding: 0;
  112. margin-left: 80px;
  113. margin-top: 75px;
  114. .active {
  115. background: url('@/assets/images/emergencyCommandMap/tabActive.png') no-repeat;
  116. }
  117. li {
  118. cursor: pointer;
  119. padding: 20px;
  120. font-size: 44px;
  121. color: #fff;
  122. width: 349px;
  123. height: 118px;
  124. background: url('@/assets/images/emergencyCommandMap/tab.png') no-repeat;
  125. display: flex;
  126. justify-content: center;
  127. align-items: flex-end;
  128. font-family: YouSheBiaoTiHei;
  129. &:hover {
  130. background: url('@/assets/images/emergencyCommandMap/tabActive.png') no-repeat;
  131. }
  132. }
  133. }
  134. .preplan-notification {
  135. width: 100%;
  136. .table-content {
  137. height: 600px;
  138. overflow-y: auto;
  139. .box1 {
  140. width: 100%;
  141. display: flex;
  142. align-items: center;
  143. &:last-child {
  144. margin-bottom: 0;
  145. }
  146. .success-icon,
  147. .error-icon {
  148. margin-right: -50px;
  149. width: 123px;
  150. height: 79px;
  151. background-repeat: no-repeat;
  152. background-size: contain;
  153. }
  154. .success-icon {
  155. background-image: url('@/assets/images/taskTracking/success.png');
  156. }
  157. .error-icon {
  158. background-image: url('@/assets/images/taskTracking/processing.png');
  159. }
  160. .box2 {
  161. flex: 1;
  162. background-image: url('@/assets/images/taskTracking/box1.png');
  163. background-repeat: no-repeat;
  164. background-size: 1642px 377px;
  165. background-position: bottom left;
  166. padding: 20px 20px 20px 60px;
  167. margin-top: 20px;
  168. position: relative;
  169. &:first-child {
  170. margin-top: 0;
  171. }
  172. .box-header {
  173. display: flex;
  174. justify-content: space-between;
  175. align-items: center;
  176. .header-left {
  177. display: flex;
  178. align-items: center; // 垂直居中对齐
  179. }
  180. .box-title {
  181. font-size: 44px;
  182. font-family: YouSheBiaoTiHei;
  183. color: #ffffff;
  184. background-image: url('@/assets/images/taskTracking/titleBox.png');
  185. background-repeat: no-repeat;
  186. background-size: 311px 56px;
  187. background-position: bottom left;
  188. padding-left: 50px;
  189. }
  190. .time {
  191. font-size: 32px;
  192. color: #00e8ff;
  193. margin-left: 70px;
  194. }
  195. .status {
  196. width: 354px;
  197. height: 56px;
  198. line-height: 56px;
  199. font-size: 32px;
  200. color: #ffffff;
  201. border-radius: 10px;
  202. text-align: center;
  203. margin-left: 30px;
  204. }
  205. .success {
  206. background-color: #38c95a;
  207. }
  208. .error {
  209. background-color: #ff4d4f;
  210. }
  211. }
  212. .box-content {
  213. color: #fff;
  214. width: 80%;
  215. font-size: 38px;
  216. line-height: 1.5;
  217. margin-top: 10px;
  218. }
  219. }
  220. }
  221. }
  222. }
  223. .duty-card {
  224. width: 1968px;
  225. height: 812px;
  226. background: url('@/assets/images/commandDynamic/dialog.png') no-repeat;
  227. position: relative;
  228. color: #fff;
  229. .card-content {
  230. display: flex;
  231. flex-wrap: wrap;
  232. padding: 0 80px;
  233. width: 100%;
  234. }
  235. }
  236. .title {
  237. position: absolute;
  238. top: 6px;
  239. left: 141px;
  240. font-size: 60px;
  241. }
  242. .resource-scheduling {
  243. width: 100%;
  244. display: flex;
  245. justify-content: center;
  246. align-items: center;
  247. font-size: 36px;
  248. color: #fff;
  249. }
  250. .tip {
  251. font-size: 44px;
  252. text-align: center;
  253. }
  254. </style>