index.vue 15 KB

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