index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  1. <template>
  2. <div class="disaster-container">
  3. <div class="left-box">
  4. <div class="data-box1">
  5. <div class="title-box">
  6. <div class="gradient-text">分析服务</div>
  7. </div>
  8. <div class="box-content">
  9. <div class="btn-box">
  10. <div :class="activeIndex === '1' ? 'text-active text' : 'text'" @click="handleClick('1')">风险分析</div>
  11. <div class="line">|</div>
  12. <div :class="activeIndex === '2' ? 'text-active text' : 'text'" @click="handleClick('2')">历史分析</div>
  13. </div>
  14. <div class="tag-box1">
  15. <div
  16. v-for="(item, index) in analysisServices"
  17. :key="index"
  18. :class="activeIndex1 === index ? 'tag-item tag-active' : 'tag-item'"
  19. @click="handleClick1(item.value)"
  20. >
  21. <i :class="item.icon" />
  22. {{ item.name }}
  23. </div>
  24. </div>
  25. </div>
  26. </div>
  27. <div class="data-box1">
  28. <div class="title-box">
  29. <div class="gradient-text">图层分析</div>
  30. </div>
  31. <div class="box-content2">
  32. <div class="tag-box2">
  33. <div
  34. v-for="(item, index) in layerService"
  35. :key="index"
  36. :class="activeIndex2 === index ? 'tag-item tag-active' : 'tag-item'"
  37. @click="handleClick2(item, index)"
  38. >
  39. <i :class="item.icon" />
  40. {{ item.name }}
  41. </div>
  42. </div>
  43. </div>
  44. </div>
  45. <div class="data-box1">
  46. <div class="title-box">
  47. <div class="gradient-text">基础服务</div>
  48. </div>
  49. <BaseService @change="handleChange" />
  50. </div>
  51. </div>
  52. <div class="middle-box">
  53. <DistributionMap
  54. :active-map="activeMap"
  55. :distributionData="distributionData"
  56. :points="points"
  57. />
  58. <div class="map-title">{{ mapTitle }}</div>
  59. <div class="map-time">{{ mapTime }}</div>
  60. </div>
  61. <div class="right-box">
  62. <RightSection v-show="activeIndex === '1'" id="mapId" :time="mapTime" />
  63. <HistoricalAnalysis v-show="activeIndex === '2'" />
  64. </div>
  65. <!--风险趋势分析-->
  66. <RiskTrendAnalysis v-if="showRiskTrendAnalysis" v-model="showRiskTrendAnalysis" @confirm="handleRiskConfirm" />
  67. </div>
  68. </template>
  69. <script lang="ts" setup name="forestFire">
  70. // 分析服务
  71. import RightSection from './RightSection.vue';
  72. import BaseService from './BaseService.vue';
  73. import RiskTrendAnalysis from '@/views/censusDataAnalysis/RiskTrendAnalysis.vue';
  74. import { parseTime } from '@/utils/ruoyi';
  75. import HistoricalAnalysis from '@/views/censusDataAnalysis/HistoricalAnalysis.vue';
  76. let activeIndex = ref('1');
  77. let activeIndex1 = ref(0);
  78. const analysisServices = ref([
  79. { name: '风险实时分析', value: '1', icon: 'icon1' },
  80. { name: '风险趋势分析', value: '2', icon: 'icon2' }
  81. ]);
  82. let showRiskTrendAnalysis = ref(false);
  83. const handleClick = (index) => {
  84. activeIndex.value = index;
  85. };
  86. // 点击分析服务
  87. const handleClick1 = (index) => {
  88. if (index === '2') {
  89. showRiskTrendAnalysis.value = true;
  90. }
  91. };
  92. // 图层服务
  93. const activeIndex2 = ref(0);
  94. const layerService = ref([]);
  95. // 中部
  96. // 使用地图地图
  97. let activeMap = ref('imageMap');
  98. let mapTitle = ref('森林火灾风险等级分布图');
  99. let mapTime = ref('');
  100. let distributionData = ref([]);
  101. let points = ref([]);
  102. // 点击图层分析
  103. const handleClick2 = (item, index) => {
  104. if (activeIndex2.value === index) return;
  105. activeIndex2.value = index;
  106. getDistributionData();
  107. console.log('点击', item);
  108. };
  109. // 分布图数据
  110. const getDistributionData = () => {
  111. const tempData2 = [
  112. {
  113. name: '高',
  114. color: '#ff2f3c',
  115. points: []
  116. },
  117. {
  118. name: '较高',
  119. color: '#ffaf00',
  120. points: [
  121. [
  122. [110.718235, 21.96198],
  123. [110.796045, 22.020253],
  124. [110.915004, 21.964755],
  125. [110.727213, 21.818969],
  126. [110.597389, 22.030205],
  127. [110.677, 22.072317],
  128. [110.718235, 21.96198],
  129. [110.718235, 21.96198]
  130. ],
  131. [
  132. [110.891302, 22.335445],
  133. [111.02116, 22.266791],
  134. [110.893363, 22.224818],
  135. [110.823281, 22.310657],
  136. [110.891302, 22.335445]
  137. ]
  138. ]
  139. },
  140. {
  141. name: '较低',
  142. color: '#ffd800',
  143. points: []
  144. },
  145. {
  146. name: '低',
  147. color: '#40c75f',
  148. points: [
  149. [
  150. [110.491302, 22.035445],
  151. [110.52116, 22.166791],
  152. [110.593363, 22.024818],
  153. [110.491302, 22.035445]
  154. ]
  155. ]
  156. }
  157. ];
  158. distributionData.value = tempData2;
  159. };
  160. // 分布图打点
  161. const handleChange = (data) => {
  162. points.value = data;
  163. };
  164. const handleRiskConfirm = (data) => {
  165. mapTime.value = data.title;
  166. showRiskTrendAnalysis.value = false;
  167. };
  168. // 加载数据
  169. const initData = () => {
  170. layerService.value = [
  171. { name: '森林火灾风险等级分布图', value: '1', icon: 'icon1' },
  172. { name: '森林火灾减灾能力薄弱隐患等级分布图', value: '2', icon: 'icon2' },
  173. { name: '森林火灾防治区划图', value: '3', icon: 'icon3' },
  174. { name: '可燃物载量分布图', value: '4', icon: 'icon4' }
  175. ];
  176. getDistributionData();
  177. const now = new Date();
  178. const currentHour = now.getHours();
  179. now.setHours(currentHour, 0, 0, 0);
  180. mapTime.value = parseTime(now, '{y}年{m}月{d}日 {h}:{i}:{s}');
  181. };
  182. onMounted(() => {
  183. initData();
  184. });
  185. </script>
  186. <style lang="scss" scoped>
  187. .disaster-container {
  188. overflow: hidden;
  189. display: flex;
  190. .left-box {
  191. width: 536px !important;
  192. height: 100%;
  193. padding-left: 20px;
  194. overflow: hidden;
  195. }
  196. .middle-box {
  197. flex: 1;
  198. position: relative;
  199. .map-title {
  200. position: absolute;
  201. top: 20px;
  202. left: 50%;
  203. transform: translateX(-50%);
  204. font-size: 24px;
  205. font-weight: bold;
  206. color: #ffffff;
  207. }
  208. .map-time {
  209. position: absolute;
  210. top: 60px;
  211. left: 50%;
  212. transform: translateX(-50%);
  213. font-size: 18px;
  214. color: #ffffff;
  215. }
  216. }
  217. .right-box {
  218. width: 535px !important;
  219. height: 100%;
  220. overflow: hidden;
  221. }
  222. .data-box1 {
  223. &::after {
  224. content: '';
  225. display: block;
  226. width: 517px;
  227. height: 19px;
  228. background: url('@/assets/images/censusDataAnalysis/line.png') no-repeat;
  229. background-size: 100% 100%;
  230. margin-top: -8px;
  231. }
  232. .title-box {
  233. width: 516px;
  234. height: 40px;
  235. background: url('@/assets/images/censusDataAnalysis/titleBox.png') no-repeat;
  236. background-size: 100% 100%;
  237. padding-left: 50px;
  238. .gradient-text {
  239. font-size: 24px;
  240. }
  241. }
  242. .box-content {
  243. width: 100%;
  244. min-height: 54px;
  245. background: url('@/assets/images/censusDataAnalysis/box.png') no-repeat;
  246. background-size: 100% 100%;
  247. .btn-box {
  248. display: flex;
  249. justify-content: flex-end;
  250. align-items: center;
  251. margin-top: -20px;
  252. padding-right: 45px;
  253. .line {
  254. margin: 0 5px;
  255. }
  256. .text {
  257. font-size: 14px;
  258. color: #ffffff;
  259. cursor: pointer;
  260. }
  261. .text-active {
  262. color: #00fce7;
  263. }
  264. }
  265. }
  266. .box-content2 {
  267. width: 100%;
  268. height: 195px;
  269. background: url('@/assets/images/censusDataAnalysis/box.png') no-repeat;
  270. background-size: 100% 100%;
  271. padding: 5px 0;
  272. display: flex;
  273. align-items: center;
  274. justify-content: space-between;
  275. overflow-y: auto;
  276. }
  277. }
  278. .tag-box1 {
  279. height: 55px;
  280. display: flex;
  281. flex-wrap: wrap;
  282. align-items: center;
  283. cursor: pointer;
  284. padding: 0 5px;
  285. margin-top: 3px;
  286. .tag-item {
  287. box-sizing: border-box;
  288. text-align: center;
  289. padding: 8px 0;
  290. width: 218px;
  291. height: 41px;
  292. background: url('@/assets/images/censusDataAnalysis/tag.png') no-repeat;
  293. background-size: 100% 100%;
  294. font-size: 14px;
  295. color: #ffffff;
  296. display: flex;
  297. justify-content: center;
  298. align-items: center;
  299. &:first-child {
  300. margin-right: 30px;
  301. }
  302. .icon1 {
  303. display: inline-block;
  304. width: 37px;
  305. height: 40px;
  306. background: url('@/assets/images/censusDataAnalysis/icon1.png') no-repeat;
  307. background-size: 100% 100%;
  308. margin-right: 15px;
  309. }
  310. .icon2 {
  311. display: inline-block;
  312. width: 38px;
  313. height: 40px;
  314. background: url('@/assets/images/censusDataAnalysis/icon2.png') no-repeat;
  315. background-size: 100% 100%;
  316. margin-right: 15px;
  317. }
  318. &:hover {
  319. background: url('@/assets/images/censusDataAnalysis/tagActive.png') no-repeat;
  320. background-size: 100% 100%;
  321. }
  322. }
  323. }
  324. .tag-box2 {
  325. display: flex;
  326. flex-direction: column;
  327. cursor: pointer;
  328. .tag-item {
  329. box-sizing: border-box;
  330. width: 470px;
  331. height: 41px;
  332. padding: 8px 0;
  333. margin-top: 7px;
  334. background: url('@/assets/images/censusDataAnalysis/tag2.png') no-repeat;
  335. background-size: 100% 100%;
  336. font-size: 14px;
  337. color: #ffffff;
  338. display: flex;
  339. justify-content: center;
  340. align-items: center;
  341. &:first-child {
  342. margin-top: 0;
  343. }
  344. .icon1 {
  345. display: inline-block;
  346. width: 38px;
  347. height: 40px;
  348. background: url('@/assets/images/censusDataAnalysis/forestFire/icon1.png') no-repeat;
  349. background-size: 100% 100%;
  350. margin-right: 15px;
  351. }
  352. .icon2 {
  353. display: inline-block;
  354. width: 38px;
  355. height: 40px;
  356. background: url('@/assets/images/censusDataAnalysis/forestFire/icon2.png') no-repeat;
  357. background-size: 100% 100%;
  358. margin-right: 15px;
  359. }
  360. .icon3 {
  361. display: inline-block;
  362. width: 38px;
  363. height: 40px;
  364. background: url('@/assets/images/censusDataAnalysis/forestFire/icon3.png') no-repeat;
  365. background-size: 100% 100%;
  366. margin-right: 15px;
  367. }
  368. .icon4 {
  369. display: inline-block;
  370. width: 38px;
  371. height: 40px;
  372. background: url('@/assets/images/censusDataAnalysis/forestFire/icon4.png') no-repeat;
  373. background-size: 100% 100%;
  374. margin-right: 15px;
  375. }
  376. &:hover {
  377. background: url('@/assets/images/censusDataAnalysis/tagActive2.png') no-repeat;
  378. background-size: 100% 100%;
  379. }
  380. }
  381. }
  382. .tag-active {
  383. background: url('@/assets/images/censusDataAnalysis/tagActive2.png') no-repeat !important;
  384. background-size: 100% 100% !important;
  385. }
  386. }
  387. </style>