index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  1. <template>
  2. <div class="base-container no-events">
  3. <fnHeader showDate></fnHeader>
  4. <div class="content">
  5. <div class="warning-l left">
  6. <div class="warning-top">
  7. <div class="top-l yes-events">
  8. <div>
  9. <el-cascader
  10. style="width: 184px"
  11. :show-all-levels="false"
  12. v-model="areaVal"
  13. :props="props1"
  14. :options="areaListOptions"
  15. @change="toggleArea"
  16. popper-class="area-cascader"
  17. />
  18. <!-- <el-select
  19. v-model="areaVal"
  20. placeholder=""
  21. style="width: 184px"
  22. popper-class="area-select"
  23. @change="toggleArea"
  24. >
  25. <el-option label="广东省" :value="3" />
  26. <el-option label="广东省-从化" :value="3186" />
  27. </el-select> -->
  28. </div>
  29. <div class="type-box"><img src="@/assets/images/warningHome/lz.png" /></div>
  30. </div>
  31. <div class="top-r yes-events">
  32. <div class="data-box" @click="toggleBox('面积')" :class="{ active: activeBoxName === '面积' }">
  33. <div class="data-value"><span>526</span>亩</div>
  34. <div class="data-name">种植面积</div>
  35. </div>
  36. <div
  37. class="data-box"
  38. v-if="areaVal.includes('3186')"
  39. @click="toggleBox('失管')"
  40. :class="{ active: activeBoxName === '失管' }"
  41. >
  42. <div class="data-value"><span>526</span>亩</div>
  43. <div class="data-name">疑似失管面积</div>
  44. </div>
  45. <div class="data-box" @click="toggleBox('产量')" :class="{ active: activeBoxName === '产量' }">
  46. <div class="data-value"><span>526</span>亩</div>
  47. <div class="data-name">预估产量</div>
  48. </div>
  49. <div class="data-box" @click="toggleBox('产值')" :class="{ active: activeBoxName === '产值' }">
  50. <div class="data-value"><span>526</span>万元</div>
  51. <div class="data-name">预估总产值</div>
  52. </div>
  53. </div>
  54. </div>
  55. <div class="warning-alarm yes-events">
  56. <alarm-list></alarm-list>
  57. </div>
  58. <div class="time-wrap yes-events">
  59. <time-line></time-line>
  60. </div>
  61. </div>
  62. <div class="warning-r right yes-events">
  63. <album></album>
  64. <!-- 地图图例 -->
  65. <div class="map-legend" v-if="legendImg">
  66. <img :src="legendImg" />
  67. </div>
  68. </div>
  69. <div class="warning-search yes-events">
  70. <img src="@/assets/images/warningHome/search-img.png" />
  71. <!-- <div class="focus-farm">
  72. <el-select
  73. v-model="farmVal"
  74. placeholder="我的关注农场"
  75. style="width: 189px"
  76. popper-class="focus-farm-select"
  77. @change="toggleFarm"
  78. >
  79. <el-option label="荔博园" :value="1" />
  80. <el-option label="井冈红糯基地" :value="2" />
  81. </el-select>
  82. </div> -->
  83. </div>
  84. </div>
  85. </div>
  86. <div ref="mapRef" class="bottom-map"></div>
  87. <div id="popup" class="ol-popup-warning">
  88. <div class="warning-info-title">
  89. <div class="icon">
  90. <img src="@/assets/images/common/chart-icon.png" />
  91. </div>
  92. <div id="popup-title"></div>
  93. <div class="close" @click="destroyPopup">
  94. <img src="@/assets/images/warningHome/close-btn.png" />
  95. </div>
  96. </div>
  97. <div id="popup-content" class="info-content"></div>
  98. </div>
  99. </template>
  100. <script setup>
  101. import "./map/mockFarmLayer";
  102. import { onMounted, ref } from "vue";
  103. import fnHeader from "@/components/fnHeader.vue";
  104. import WarningMap from "./warningMap";
  105. import AlarmLayer from "./map/alarmLayer";
  106. import album from "./components/album.vue";
  107. import alarmList from "./components/alarmList.vue";
  108. import timeLine from "./components/timeLine.vue";
  109. import { useRouter } from "vue-router";
  110. import eventBus from "@/api/eventBus";
  111. import { areaListOptions } from "./area";
  112. import { useStore } from "vuex";
  113. let store = useStore();
  114. let warningMap = new WarningMap();
  115. let alarmLayer = null;
  116. const router = useRouter();
  117. const areaVal = ref(["3"]);
  118. const mapRef = ref();
  119. const legendImg = ref("");
  120. const warningLayers = ref({})
  121. onMounted(() => {
  122. warningMap.initMap(store.getters.userinfo.location, mapRef.value);
  123. alarmLayer = new AlarmLayer(warningMap.kmap);
  124. // 图例数据
  125. eventBus.on("alarmList:warningLayers", (data) => {
  126. warningLayers.value = data
  127. });
  128. });
  129. const destroyPopup = () => {
  130. eventBus.emit("map:destroyPopup");
  131. };
  132. const props1 = {
  133. checkStrictly: true,
  134. };
  135. const toggleArea = (v) => {
  136. activeBoxName.value = null;
  137. const val = v[v.length - 1];
  138. if (val === "3" || val === "3186") {
  139. eventBus.emit("warningHome:toggleArea", val);
  140. }
  141. };
  142. const activeBoxName = ref(null);
  143. const toggleBox = (name) => {
  144. activeBoxName.value = name;
  145. legendImg.value = warningLayers.value[`${name}图例`];
  146. eventBus.emit("warningHome:toggleMapLayer", name);
  147. };
  148. </script>
  149. <style lang="scss" scoped>
  150. .base-container {
  151. width: 100%;
  152. height: 100vh;
  153. color: #fff;
  154. position: absolute;
  155. box-sizing: border-box;
  156. z-index: 1;
  157. ::v-deep {
  158. .focus-farm {
  159. top: 42px;
  160. }
  161. }
  162. .content {
  163. width: 100%;
  164. height: calc(100% - 74px - 48px);
  165. padding: 0 20px 0 27px;
  166. display: flex;
  167. justify-content: space-between;
  168. box-sizing: border-box;
  169. position: relative;
  170. .left,
  171. .right {
  172. width: calc(376px + 54px);
  173. height: 100%;
  174. padding-top: 10px;
  175. box-sizing: border-box;
  176. // display: flex;
  177. }
  178. .right {
  179. width: 395px;
  180. position: relative;
  181. .list {
  182. width: 100%;
  183. height: 100%;
  184. }
  185. }
  186. .warning-r {
  187. .map-legend {
  188. position: absolute;
  189. bottom: -33px;
  190. left: -455px;
  191. width: 340px;
  192. img {
  193. width: 340px;
  194. opacity: 0.6;
  195. }
  196. }
  197. }
  198. .warning-search {
  199. position: absolute;
  200. right: 400px;
  201. top: -34px;
  202. display: flex;
  203. align-items: center;
  204. .focus-farm {
  205. padding-left: 15px;
  206. }
  207. ::v-deep {
  208. .el-select__wrapper {
  209. background: rgba(255, 212, 137, 0.2);
  210. box-shadow: 0 0 0 1px rgba(255, 212, 137, 0.3) inset;
  211. height: 50px;
  212. line-height: 50px;
  213. .el-select__caret {
  214. color: #ffd489;
  215. }
  216. }
  217. .el-select__placeholder {
  218. color: #f7be5a;
  219. font-size: 20px;
  220. font-family: "PangMenZhengDao";
  221. text-align: center;
  222. }
  223. }
  224. }
  225. .warning-top {
  226. display: flex;
  227. .top-l {
  228. display: flex;
  229. flex-direction: column;
  230. align-items: center;
  231. .type-box {
  232. margin-top: 10px;
  233. background: rgba(29, 29, 29, 0.54);
  234. border: 1px solid rgba(255, 212, 137, 0.3);
  235. border-radius: 2px;
  236. text-align: center;
  237. line-height: 48px;
  238. height: 48px;
  239. width: 184px;
  240. }
  241. ::v-deep {
  242. .el-input__wrapper {
  243. background: rgba(29, 29, 29, 0.54);
  244. box-shadow: 0 0 0 1px rgba(255, 212, 137, 0.3) inset;
  245. height: 50px;
  246. line-height: 50px;
  247. padding: 0 10px;
  248. .el-input__inner {
  249. color: #f7be5a;
  250. font-size: 20px;
  251. font-family: "PangMenZhengDao";
  252. text-align: center;
  253. }
  254. }
  255. .el-select__wrapper {
  256. background: rgba(29, 29, 29, 0.54);
  257. box-shadow: 0 0 0 1px rgba(255, 212, 137, 0.3) inset;
  258. height: 50px;
  259. line-height: 50px;
  260. .el-select__caret {
  261. color: #ffd489;
  262. }
  263. }
  264. .el-select__placeholder {
  265. color: #f7be5a;
  266. font-size: 20px;
  267. font-family: "PangMenZhengDao";
  268. text-align: center;
  269. }
  270. }
  271. }
  272. .top-r {
  273. display: flex;
  274. .data-box {
  275. cursor: pointer;
  276. margin-left: 20px;
  277. width: 200px;
  278. height: 104px;
  279. background: url("@/assets/images/warningHome/box-bg.png") no-repeat center center / cover;
  280. display: flex;
  281. flex-direction: column;
  282. align-items: center;
  283. &.active {
  284. position: relative;
  285. &::before {
  286. content: "";
  287. position: absolute;
  288. bottom: -26px;
  289. left: 0;
  290. right: 0;
  291. width: 35px;
  292. height: 17px;
  293. margin: 0 auto;
  294. background: url("@/assets/images/warningHome/triangle.png") no-repeat center center / cover;
  295. }
  296. }
  297. .data-value {
  298. padding-top: 15px;
  299. font-size: 20px;
  300. color: rgba(255, 212, 137, 0.4);
  301. font-family: "PangMenZhengDao";
  302. span {
  303. font-size: 38px;
  304. color: #f7be5a;
  305. padding-right: 2px;
  306. }
  307. }
  308. .data-name {
  309. color: #cecece;
  310. font-size: 16px;
  311. }
  312. }
  313. }
  314. }
  315. .warning-alarm {
  316. width: 88px;
  317. padding-top: 14px;
  318. }
  319. .time-wrap {
  320. position: absolute;
  321. bottom: -20px;
  322. left: 140px;
  323. width: 46vw;
  324. min-width: 700px;
  325. height: 71px;
  326. }
  327. }
  328. }
  329. .bottom-map {
  330. width: 100%;
  331. height: 100vh;
  332. position: absolute;
  333. z-index: 0;
  334. }
  335. </style>
  336. <style lang="less">
  337. .ol-scale-line {
  338. left: auto;
  339. right: 430px;
  340. bottom: 38px;
  341. .ol-scale-line-inner {
  342. max-width: 80px;
  343. width: 80px !important;
  344. color: #fff;
  345. border-color: #fff;
  346. }
  347. }
  348. .focus-farm-select {
  349. &.el-popper.is-light {
  350. background: #232323;
  351. border-color: rgba(255, 212, 137, 0.3);
  352. box-shadow: 0px 0px 12px rgba(255, 212, 137, 0.3);
  353. .el-select-dropdown__item {
  354. background: none;
  355. color: rgba(255, 212, 137, 0.6);
  356. }
  357. .el-select-dropdown__item.is-selected {
  358. background: rgba(255, 212, 137, 0.2);
  359. color: #ffd489;
  360. }
  361. }
  362. &.el-popper.is-light .el-popper__arrow:before {
  363. background: #232323;
  364. border-color: rgba(255, 212, 137, 0.3);
  365. }
  366. }
  367. .ol-popup-warning {
  368. position: relative;
  369. width: 295px;
  370. background: rgb(35, 35, 35, 0.86);
  371. color: #fff;
  372. font-size: 16px;
  373. border-radius: 4px;
  374. .warning-info-title {
  375. display: flex;
  376. padding: 6px 10px;
  377. background: rgba(255, 255, 255, 0.05);
  378. font-size: 18px;
  379. border-radius: 4px 4px 0 0;
  380. .icon {
  381. padding-right: 6px;
  382. }
  383. .close {
  384. position: absolute;
  385. right: 12px;
  386. top: 4px;
  387. }
  388. }
  389. .info-content {
  390. padding: 16px 20px 40px 20px;
  391. line-height: 26px;
  392. text-indent: 2em;
  393. }
  394. }
  395. .area-cascader {
  396. &.el-popper.is-light {
  397. background: #232323;
  398. border-color: rgba(255, 212, 137, 0.3);
  399. box-shadow: 0px 0px 12px rgba(255, 212, 137, 0.3);
  400. .el-cascader-menu {
  401. color: rgba(255, 212, 137, 0.6);
  402. border-color: rgba(255, 212, 137, 0.3);
  403. }
  404. .el-cascader-node.in-active-path,
  405. .el-cascader-node.is-active,
  406. .el-cascader-node.is-selectable.in-checked-path {
  407. color: #f7be5a;
  408. background: transparent;
  409. }
  410. .el-radio__input.is-checked .el-radio__inner {
  411. background: #f7be5a;
  412. border-color: #f7be5a;
  413. }
  414. .el-cascader-node:not(.is-disabled):hover,
  415. .el-cascader-node:not(.is-disabled):focus,
  416. .el-cascader-node:not(.is-disabled):hover {
  417. background: rgba(255, 212, 137, 0.2);
  418. }
  419. }
  420. .el-radio__inner {
  421. background-color: rgba(255, 212, 137, 0.3);
  422. border-color: rgba(255, 212, 137, 0.6);
  423. }
  424. &.el-popper.is-light .el-popper__arrow:before {
  425. background: #232323;
  426. border-color: rgba(255, 212, 137, 0.3);
  427. }
  428. }
  429. </style>