index.vue 16 KB

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