peopleDetailDialog.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. <template>
  2. <div class="container">
  3. <!-- 遮罩层区域 -->
  4. <div class="mask" @click="handleClick"></div>
  5. <!-- 弹窗内容区域 -->
  6. <div class="people_detail">
  7. <!-- 顶部标题区域 -->
  8. <div class="detail_top">
  9. <div class="top_title">
  10. <div class="title_icon"></div>
  11. <div class="title_text">靖安进出人流详情</div>
  12. </div>
  13. <!-- 关闭按钮区域 -->
  14. <div class="top_icon" @click="handleClick"></div>
  15. </div>
  16. <!-- 内容区域 -->
  17. <div class="detail_center">
  18. <!-- 折线图区域 -->
  19. <PeopleChart />
  20. <!-- 路口详细信息区域 -->
  21. <PeopleSlot
  22. :class="{ mr0: index === 3, ml200: index > 3 }"
  23. v-for="(item, index) in slotList"
  24. :key="index"
  25. :soltObj="item"
  26. />
  27. </div>
  28. </div>
  29. </div>
  30. </template>
  31. <script setup lang="ts">
  32. import { ref, onMounted, onUnmounted } from "vue";
  33. import PeopleChart from "./peopleChart.vue";
  34. import PeopleSlot from "./peopleSlot.vue";
  35. // 引入路口数据
  36. import { junctionData } from "@/components/map/junctionData";
  37. // 引入路口相关的接口
  38. import {
  39. reqJtNumByDay,
  40. reqJtNumByTotal,
  41. reqJtTableData,
  42. } from "@/api/junction/index";
  43. const $emit = defineEmits(["changeShowClosePeople"]);
  44. // 路口详细信息数组
  45. const slotList = ref<any>([]);
  46. // 定时器标识
  47. const timer = ref();
  48. onMounted(() => {
  49. // 获取路口数组数据
  50. getList();
  51. // 每5秒刷新数据
  52. timer.value = setInterval(() => {
  53. getList();
  54. }, 5000);
  55. });
  56. onUnmounted(() => {
  57. // 页面卸载时清除定时器
  58. clearInterval(timer.value);
  59. });
  60. // 获取路口数组数据
  61. const getList = () => {
  62. slotList.value = junctionData;
  63. slotList.value.forEach(async (ele: any) => {
  64. // 获取累计人数
  65. ele.addUp = await getAddUp(ele.title);
  66. // 获取当日人数
  67. ele.currentDay = await getCurrentDay(ele.title);
  68. // 获取表格数据
  69. const res = await reqJtTableData(ele.title);
  70. ele.table = res.data;
  71. });
  72. // console.log(slotList.value);
  73. };
  74. // 获取累计人数
  75. const getAddUp = async (place: string) => {
  76. const res = await reqJtNumByTotal();
  77. // console.log(res);
  78. // 匹配出累计人数
  79. let count = 0;
  80. res.data.forEach((ele: any) => {
  81. if (ele.place_name === place) {
  82. count = ele.num;
  83. }
  84. });
  85. return count;
  86. };
  87. // 获取当日人数
  88. const getCurrentDay = async (place: string) => {
  89. const res = await reqJtNumByDay();
  90. // console.log(res);
  91. // 匹配出当日人数
  92. let count = 0;
  93. res.data.forEach((ele: any) => {
  94. if (ele.place_name === place) {
  95. count = ele.num;
  96. }
  97. });
  98. return count;
  99. };
  100. // 点击关闭图标回调
  101. const handleClick = () => {
  102. $emit("changeShowClosePeople", false);
  103. };
  104. </script>
  105. <style lang="scss" scoped>
  106. .container {
  107. z-index: 9999;
  108. position: absolute;
  109. top: -254px;
  110. left: -1526px;
  111. width: 7072px;
  112. height: 1872px;
  113. display: flex;
  114. justify-content: center;
  115. align-items: center;
  116. background-color: rgba($color: #000000, $alpha: 0.6);
  117. .mask {
  118. position: absolute;
  119. top: 0;
  120. width: 7072px;
  121. height: 1872px;
  122. }
  123. .people_detail {
  124. position: relative;
  125. width: 2687px;
  126. height: 1302px;
  127. background-image: url(@/assets/images/9.png);
  128. background-size: 100% 100%;
  129. .detail_top {
  130. display: flex;
  131. align-items: center;
  132. margin-top: 51px;
  133. height: 96px;
  134. .top_title {
  135. display: flex;
  136. align-items: center;
  137. margin-left: 51px;
  138. width: 2521px;
  139. height: 96px;
  140. font-size: 40px;
  141. font-family: "庞门正道标题体";
  142. background-image: url(@/assets/images/10.png);
  143. background-size: 100% 100%;
  144. .title_icon {
  145. margin: 15px 22px 0 11px;
  146. width: 65px;
  147. height: 85px;
  148. background-image: url(@/assets/images/11.png);
  149. background-size: 100% 100%;
  150. }
  151. .title_text {
  152. background-image: linear-gradient(#00dbff, #00b3ff);
  153. background-clip: text;
  154. -webkit-background-clip: text;
  155. -webkit-text-fill-color: transparent;
  156. }
  157. }
  158. .top_icon {
  159. margin-left: 18px;
  160. width: 82px;
  161. height: 82px;
  162. cursor: pointer;
  163. background-image: url(@/assets/images/12.png);
  164. background-size: 100% 100%;
  165. }
  166. }
  167. .detail_center {
  168. display: flex;
  169. flex-wrap: wrap;
  170. padding-top: 61px;
  171. margin-left: 55px;
  172. width: 2577px;
  173. height: 1117px;
  174. overflow: hidden;
  175. .mr0 {
  176. margin: 0;
  177. }
  178. .ml200 {
  179. margin-left: 200px;
  180. }
  181. }
  182. }
  183. }
  184. </style>