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