index.vue 15 KB

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