index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592
  1. <template>
  2. <div class="left-section">
  3. <div class="weather-card">
  4. <div class="card-content">
  5. <div class="weather-box">
  6. <div class="weather-item">
  7. <div class="weatherBox1">天气</div>
  8. <div class="weatherBox2">{{ weatherDescription }}</div>
  9. </div>
  10. <div class="weather-item">
  11. <div class="weatherBox1">温度</div>
  12. <div class="weatherBox2">{{ temperature }}℃</div>
  13. </div>
  14. <div class="weather-item">
  15. <div class="weatherBox1">湿度</div>
  16. <div class="weatherBox2">{{ humidity }}%</div>
  17. </div>
  18. <div class="weather-item">
  19. <div class="weatherBox1">风力风向</div>
  20. <div class="weatherBox2">{{ windDirection }} {{ windLevel }}级</div>
  21. </div>
  22. <div class="weather-item">
  23. <div class="weatherBox1">降雨量</div>
  24. <div class="weatherBox2">{{ rainfall }}mm</div>
  25. </div>
  26. </div>
  27. </div>
  28. </div>
  29. <div class="event-card">
  30. <div class="title gradient-text">灾害信息</div>
  31. <div class="card-content">
  32. <div class="eventBox1">
  33. <div class="line"></div>
  34. <div class="duration-box">
  35. <div class="time-box">
  36. <div class="gradient-text text">响应时间:</div>
  37. <span class="time-text">{{ duration.days }}</span>
  38. <span>天</span>
  39. <span class="time-text">{{ duration.hours }}</span>
  40. <span>小时</span>
  41. <span class="time-text">{{ duration.minutes }}</span>
  42. <span>分</span>
  43. <span class="time-text">{{ duration.seconds }}</span>
  44. <span>秒</span>
  45. </div>
  46. </div>
  47. <div class="line2"></div>
  48. <div class="finish-btn" @click="closeCommand">
  49. <div class="finish-icon"></div>
  50. <div class="finish-text">结束处置</div>
  51. </div>
  52. </div>
  53. <div class="event-box">
  54. <div class="event-item">
  55. <div class="eventBox2">灾害事件</div>
  56. <div class="eventBox3">{{ eventData.event_title }}</div>
  57. </div>
  58. <div class="event-item">
  59. <div class="eventBox2">灾害地点</div>
  60. <div class="eventBox3">{{ eventData.address }}</div>
  61. </div>
  62. <div class="event-item">
  63. <div class="eventBox2">灾害级别</div>
  64. <div class="eventBox3">
  65. <dict-tag :options="mm_event_level" :value="eventData.event_level" />
  66. </div>
  67. </div>
  68. </div>
  69. </div>
  70. </div>
  71. <div class="duty-card">
  72. <div class="card-content">
  73. <div class="box1">
  74. <div class="icon1"></div>
  75. <div>{{ comprehensiveDutyState.time1 }}</div>
  76. <div style="margin-left: 20px">{{ comprehensiveDutyState.time2 }}</div>
  77. </div>
  78. <div class="user-box">
  79. <div class="user-item">
  80. <div class="box2">
  81. <div class="icon2"></div>
  82. 带班领导
  83. </div>
  84. <div class="box3">{{ comprehensiveDutyState.classLeader }}</div>
  85. </div>
  86. <div class="user-item">
  87. <div class="box2">
  88. <div class="icon2"></div>
  89. 主班人员
  90. </div>
  91. <div class="box3">{{ comprehensiveDutyState.mainShiftPerson }}</div>
  92. </div>
  93. <div class="user-item">
  94. <div class="box2">
  95. <div class="icon2"></div>
  96. 副班人员
  97. </div>
  98. <div class="box3">{{ comprehensiveDutyState.deputyShiftPerson }}</div>
  99. </div>
  100. <div class="user-item">
  101. <div class="box2">
  102. <div class="icon2"></div>
  103. 备班人员
  104. </div>
  105. <div class="box3">{{ comprehensiveDutyState.backupPerson }}</div>
  106. </div>
  107. </div>
  108. </div>
  109. </div>
  110. <VideoMonitor />
  111. <CloseCommand v-model="closeCommandState.show" :title="closeCommandState.title" :event-id="eventId" @update:model-value="fetchEventDetail" />
  112. </div>
  113. </template>
  114. <script lang="ts" setup name="LeftSection">
  115. import { getEventDetail, getWeather } from '@/api/duty/eventing';
  116. import VideoMonitor from '@/views/emergencyCommandMap/LeftSection/VideoMonitor.vue';
  117. import { ref, onMounted, onUnmounted, computed } from 'vue';
  118. import CloseCommand from './CloseCommand.vue';
  119. import axios from 'axios';
  120. const route = useRoute();
  121. const router = useRouter();
  122. const { proxy } = getCurrentInstance() as ComponentInternalInstance;
  123. const { mm_event_type, mm_event_level, mm_event_state, region } = toRefs<any>(
  124. proxy?.useDict('mm_event_type', 'mm_event_level', 'mm_event_state', 'region')
  125. );
  126. const weatherDescription = ref('');
  127. const temperature = ref('');
  128. const humidity = ref('');
  129. const windDirection = ref('');
  130. const windLevel = ref('');
  131. const rainfall = ref('');
  132. // 获取天气数据
  133. async function fetchWeatherData() {
  134. try {
  135. const response = await getWeather({});
  136. if (response && response.rows && response.rows.length > 0) {
  137. const weatherData = response.rows[0];
  138. weatherDescription.value = weatherData.sk_s;
  139. temperature.value = weatherData.sk_t;
  140. humidity.value = weatherData.sk_h;
  141. windDirection.value = getWindDirection(weatherData.sk_wd);
  142. windLevel.value = weatherData.sk_wp_level;
  143. rainfall.value = weatherData.sk_r1h;
  144. }
  145. } catch (error) {
  146. console.error('Failed to fetch weather data:', error);
  147. }
  148. }
  149. // 根据风向角度获取风向名称
  150. function getWindDirection(angle) {
  151. const directions = [
  152. '北',
  153. '北偏北',
  154. '北偏东北',
  155. '东北',
  156. '东偏东北',
  157. '东偏东',
  158. '东',
  159. '东偏东南',
  160. '东南',
  161. '南偏东南',
  162. '南偏南',
  163. '南',
  164. '南偏西南',
  165. '西南',
  166. '西偏西南',
  167. '西偏西',
  168. '西',
  169. '西偏西北',
  170. '西北',
  171. '北偏西北'
  172. ];
  173. const index = Math.floor(((angle + 11.25) % 360) / 22.5);
  174. return directions[index];
  175. }
  176. let eventId = ref('');
  177. // 事件信息
  178. const eventData = ref({
  179. event_title: '',
  180. event_type: '',
  181. event_level: '',
  182. address: '',
  183. event_status: '',
  184. event_source: '',
  185. event_time: '',
  186. report_time: ''
  187. });
  188. const fetchEventDetail = () => {
  189. console.log('fetchEventDetail');
  190. getEventDetail({ event_id: eventId.value }).then((res) => {
  191. eventData.value = res.data;
  192. });
  193. };
  194. // 综合值守
  195. const comprehensiveDutyState = ref({
  196. time1: '',
  197. time2: '',
  198. classLeader: '',
  199. deputyShiftPerson: '',
  200. mainShiftPerson: '',
  201. backupPerson: ''
  202. });
  203. //结束指挥弹窗
  204. const closeCommandState = reactive({
  205. show: false,
  206. title: ''
  207. });
  208. const closeCommand = () => {
  209. console.log('CloseCommand');
  210. closeCommandState.title = '结束指挥';
  211. closeCommandState.show = true;
  212. };
  213. // 分析研判
  214. const analyzeJudge = ref({});
  215. const initData = () => {
  216. // 事件信息
  217. eventData.value = {
  218. event_title: '',
  219. type: '',
  220. grade: '',
  221. address: '',
  222. status: '',
  223. unit: '',
  224. time: '',
  225. event_time: ''
  226. };
  227. // 综合值守
  228. comprehensiveDutyState.value = {
  229. // 值班时间
  230. time1: '2024/5/21',
  231. time2: '08:30-17:30',
  232. // 带班领导
  233. classLeader: '张珊珊',
  234. // 副班人员
  235. deputyShiftPerson: '王珊珊',
  236. // 主班人员
  237. mainShiftPerson: '林珊珊',
  238. // 备班人员
  239. backupPerson: '刘珊珊'
  240. };
  241. // 分析研判
  242. analyzeJudge.value = [
  243. {
  244. label: '基础数据',
  245. children: [
  246. { icon: 'user', label: '人口', data: 200, unit: '万人' },
  247. { icon: 'user', label: '人口密度', data: 23, unit: '人/km²' }
  248. ]
  249. },
  250. {
  251. label: '协同应急',
  252. children: [
  253. { icon: 'user', label: '专家', data: 10, unit: '个' },
  254. { icon: 'user', label: '救援队伍', data: 10, unit: '支' },
  255. { icon: 'user', label: '通信机构', data: 10, unit: '所' },
  256. { icon: 'user', label: '医疗机构', data: 10, unit: '间' },
  257. { icon: 'user', label: '救援车辆', data: 10, unit: '辆' }
  258. ]
  259. },
  260. {
  261. label: '重点场所',
  262. children: [
  263. { icon: 'user', label: '救助站', data: 10, unit: '个' },
  264. { icon: 'user', label: '应急庇护场所', data: 10, unit: '个' },
  265. { icon: 'user', label: '人防工程', data: 10, unit: '个' },
  266. { icon: 'user', label: '水利工程', data: 10, unit: '个' },
  267. { icon: 'user', label: '物资仓库', data: 10, unit: '个' }
  268. ]
  269. },
  270. {
  271. label: '重点防护场所',
  272. children: [
  273. { icon: 'user', label: '高危企业', data: 10, unit: '个' },
  274. { icon: 'user', label: '加油站', data: 10, unit: '个' },
  275. { icon: 'user', label: '学校', data: 10, unit: '个' },
  276. { icon: 'user', label: '养老院', data: 10, unit: '个' }
  277. ]
  278. }
  279. ];
  280. };
  281. const elapsedTime = ref(0);
  282. let intervalId = null;
  283. const updateTime = () => {
  284. if (eventData.value.event_time && typeof eventData.value.event_time === 'string') {
  285. const eventTime = new Date(eventData.value.event_time);
  286. if (!isNaN(eventTime.getTime())) {
  287. elapsedTime.value = Date.now() - eventTime.getTime();
  288. } else {
  289. console.error('Invalid date format:', eventData.value.event_time);
  290. }
  291. }
  292. };
  293. const duration = computed(() => {
  294. if (isNaN(elapsedTime.value) || elapsedTime.value < 0) {
  295. return { days: 0, hours: 0, minutes: 0, seconds: 0 };
  296. }
  297. const totalSeconds = Math.floor(elapsedTime.value / 1000);
  298. const days = Math.floor(totalSeconds / (24 * 3600));
  299. const hours = Math.floor((totalSeconds % (24 * 3600)) / 3600);
  300. const minutes = Math.floor((totalSeconds % 3600) / 60);
  301. const seconds = totalSeconds % 60;
  302. return { days, hours, minutes, seconds };
  303. });
  304. onMounted(() => {
  305. initData();
  306. // setInterval(updateDuration, 800);
  307. eventId.value = route.query.event_id as string;
  308. fetchEventDetail();
  309. fetchWeatherData();
  310. intervalId = setInterval(updateTime, 1000);
  311. });
  312. onUnmounted(() => {
  313. if (intervalId) {
  314. clearInterval(intervalId);
  315. }
  316. });
  317. </script>
  318. <style lang="scss" scoped>
  319. .left-section {
  320. width: 2627px;
  321. height: 100%;
  322. display: flex;
  323. flex-direction: column;
  324. font-size: 74px;
  325. .weather-card {
  326. width: 2599px;
  327. height: 300px;
  328. background: url('@/assets/images/emergencyCommandMap/videoBox1.png') no-repeat 100% 100%;
  329. margin-top: 30px;
  330. display: flex;
  331. justify-content: center;
  332. align-items: center;
  333. .card-content {
  334. width: 2387px;
  335. height: 180px;
  336. margin-top: 30px;
  337. //padding-top: 30px;
  338. padding-left: 200px;
  339. padding-right: 220px;
  340. }
  341. .weather-box {
  342. display: flex;
  343. justify-content: space-between;
  344. align-items: center;
  345. color: #fff;
  346. .weather-item {
  347. font-size: 38px;
  348. margin-top: -20px;
  349. .weatherBox1 {
  350. display: flex;
  351. justify-content: center;
  352. align-items: center;
  353. position: relative;
  354. height: 60px;
  355. padding-left: 60px;
  356. margin-left: -30px;
  357. }
  358. .weatherBox2 {
  359. display: flex;
  360. justify-content: center;
  361. align-items: center;
  362. width: 317px;
  363. height: 82px;
  364. margin-top: 10px;
  365. }
  366. }
  367. }
  368. }
  369. .event-card {
  370. width: 2599px;
  371. height: 400px;
  372. background: rgba(0, 4, 52, 1) no-repeat 100% 100%;
  373. margin-top: 20px;
  374. display: flex;
  375. justify-content: center;
  376. align-items: center;
  377. .title {
  378. position: absolute;
  379. top: 580px;
  380. left: 200px;
  381. font-size: 60px;
  382. }
  383. .card-content {
  384. width: 2387px;
  385. height: 350px;
  386. background: url('@/assets/images/emergencyCommandMap/comprehensiveDutyContent.png') no-repeat 100% 100%;
  387. margin-top: 60px;
  388. //padding-top: 30px;
  389. padding-left: 200px;
  390. padding-right: 220px;
  391. }
  392. .eventBox1 {
  393. display: flex;
  394. justify-content: right;
  395. align-items: center;
  396. font-family: 'BEBAS-1';
  397. font-size: 38px;
  398. color: #00e8ff;
  399. margin-top: -20px;
  400. .icon1 {
  401. width: 143px;
  402. height: 143px;
  403. background: url('@/assets/images/emergencyCommandMap/time.png') no-repeat 100% 100%;
  404. }
  405. }
  406. .event-box {
  407. display: flex;
  408. justify-content: space-between;
  409. align-items: center;
  410. color: #fff;
  411. .event-item {
  412. font-size: 38px;
  413. margin-top: -20px;
  414. .eventBox2 {
  415. display: flex;
  416. justify-content: center;
  417. align-items: center;
  418. position: relative;
  419. height: 60px;
  420. padding-left: 60px;
  421. margin-left: -30px;
  422. }
  423. .eventBox3 {
  424. display: flex;
  425. justify-content: center;
  426. align-items: center;
  427. width: 600px;
  428. height: 82px;
  429. margin-top: 10px;
  430. }
  431. }
  432. }
  433. }
  434. .duty-card {
  435. width: 2599px;
  436. height: 400px;
  437. background: url('@/assets/images/emergencyCommandMap/comprehensiveDutyBox.png') no-repeat 100% 100%;
  438. margin-top: 20px;
  439. display: flex;
  440. justify-content: center;
  441. align-items: center;
  442. .card-content {
  443. width: 2387px;
  444. height: 257px;
  445. background: url('@/assets/images/emergencyCommandMap/comprehensiveDutyContent.png') no-repeat 100% 100%;
  446. margin-top: 90px;
  447. //padding-top: 30px;
  448. padding-left: 200px;
  449. padding-right: 220px;
  450. }
  451. .box1 {
  452. display: flex;
  453. justify-content: center;
  454. align-items: center;
  455. font-family: 'BEBAS-1';
  456. font-size: 38px;
  457. color: #00e8ff;
  458. margin-top: -35px;
  459. .icon1 {
  460. width: 143px;
  461. height: 143px;
  462. background: url('@/assets/images/emergencyCommandMap/time.png') no-repeat 100% 100%;
  463. }
  464. }
  465. .user-box {
  466. display: flex;
  467. justify-content: space-between;
  468. align-items: center;
  469. color: #fff;
  470. .user-item {
  471. font-size: 38px;
  472. margin-top: -20px;
  473. .box2 {
  474. display: flex;
  475. justify-content: center;
  476. align-items: center;
  477. position: relative;
  478. height: 60px;
  479. padding-left: 60px;
  480. margin-left: -30px;
  481. .icon2 {
  482. position: absolute;
  483. top: 50%;
  484. left: 0;
  485. transform: translateY(-50%);
  486. width: 143px;
  487. height: 143px;
  488. background: url('@/assets/images/emergencyCommandMap/classLeader.png') no-repeat 100% 100%;
  489. }
  490. }
  491. .box3 {
  492. display: flex;
  493. justify-content: center;
  494. align-items: center;
  495. width: 317px;
  496. height: 82px;
  497. background: url('@/assets/images/emergencyCommandMap/box.png') no-repeat 100% 100%;
  498. margin-top: 10px;
  499. }
  500. }
  501. }
  502. }
  503. .line {
  504. width: 2px;
  505. height: 143px;
  506. background-repeat: no-repeat;
  507. background-size: 2px 143px;
  508. background-position: center center;
  509. margin-left: 75px;
  510. margin-right: 65px;
  511. }
  512. .line2 {
  513. width: 2px;
  514. height: 143px;
  515. margin-left: 82px;
  516. margin-right: 113px;
  517. }
  518. .duration-box {
  519. width: 1350px;
  520. height: 200px;
  521. padding-left: 250px;
  522. .text {
  523. font-size: 44px;
  524. }
  525. .time-box {
  526. font-size: 30px;
  527. color: #ffffff;
  528. margin-top: -10px;
  529. .time-text {
  530. /* 设置字体透明 */
  531. color: transparent;
  532. /* 设置线性渐变,从红色渐变到蓝色 */
  533. background-image: linear-gradient(to bottom, #fff 20%, #f6d6a7 50%, #e48406 100%);
  534. /* 使用 -webkit-background-clip 属性将背景剪裁至文本形状 */
  535. -webkit-background-clip: text;
  536. /* 非Webkit内核浏览器需要使用标准前缀 */
  537. background-clip: text;
  538. /* 把当前元素设置为行内块,以便能够应用背景 */
  539. display: inline-block;
  540. font-family: 'BEBAS-1';
  541. font-size: 50px;
  542. width: 150px;
  543. text-align: center;
  544. &:first-child {
  545. width: 45px;
  546. text-align: left;
  547. }
  548. }
  549. }
  550. }
  551. .finish-btn {
  552. display: flex;
  553. flex-direction: column;
  554. margin-top: -160px;
  555. justify-content: center;
  556. cursor: pointer;
  557. .finish-text {
  558. font-size: 30.58px;
  559. /* 设置字体透明 */
  560. color: transparent;
  561. /* 设置线性渐变,从红色渐变到蓝色 */
  562. background-image: linear-gradient(to bottom, #fff 20%, #ff2f3c 50%, #ff2f3c 100%);
  563. /* 使用 -webkit-background-clip 属性将背景剪裁至文本形状 */
  564. -webkit-background-clip: text;
  565. /* 非Webkit内核浏览器需要使用标准前缀 */
  566. background-clip: text;
  567. /* 把当前元素设置为行内块,以便能够应用背景 */
  568. display: inline-block;
  569. font-family: 'YouSheBiaoTiHei';
  570. }
  571. }
  572. }
  573. @keyframes slide {
  574. 0% {
  575. transform: translateX(-80%);
  576. }
  577. 80% {
  578. transform: translateX(92px);
  579. }
  580. 80% {
  581. transform: translateX(0);
  582. }
  583. }
  584. </style>