index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509
  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 class="map-legend chat-legend" v-show="!legendImg">
  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. // 重置时间轴
  153. // eventBus.emit("map_click_alarm")
  154. if (mapName === "植保机") {
  155. staticMapLayers.show("分散种植", true)
  156. staticMapPointLayers.showPoint()
  157. } else if (mapName) {
  158. // staticMapLayers.show("作物种类")
  159. staticMapLayers.show(mapName, true)
  160. }
  161. }
  162. const toggleChatMapLayer = () => {
  163. hideChatMapLayer.value = true
  164. eventBus.emit("chat:hideMapLayer");
  165. staticMapLayers.hideAll()
  166. }
  167. const destroyPopup = () => {
  168. eventBus.emit("map:destroyPopup");
  169. };
  170. const props1 = {
  171. checkStrictly: true,
  172. };
  173. const toggleArea = (v) => {
  174. activeBoxName.value = null;
  175. const val = v[v.length - 1];
  176. if (val === "3" || val === "3186") {
  177. eventBus.emit("warningHome:toggleArea", val);
  178. }
  179. };
  180. const activeBoxName = ref(null);
  181. const toggleBox = (name) => {
  182. activeBoxName.value = name;
  183. legendImg.value = warningLayers.value[`${name}图例`];
  184. eventBus.emit("warningHome:toggleMapLayer", name);
  185. };
  186. </script>
  187. <style lang="scss" scoped>
  188. .base-container {
  189. width: 100%;
  190. height: 100vh;
  191. color: #fff;
  192. position: absolute;
  193. box-sizing: border-box;
  194. z-index: 1;
  195. ::v-deep {
  196. .focus-farm {
  197. top: 42px;
  198. }
  199. }
  200. .content {
  201. width: 100%;
  202. height: calc(100% - 74px - 48px);
  203. padding: 0 20px 0 27px;
  204. display: flex;
  205. justify-content: space-between;
  206. box-sizing: border-box;
  207. position: relative;
  208. .left,
  209. .right {
  210. width: calc(376px + 54px);
  211. height: 100%;
  212. padding-top: 10px;
  213. box-sizing: border-box;
  214. // display: flex;
  215. }
  216. .right {
  217. // width: 395px;
  218. width: 500px;
  219. position: relative;
  220. .list {
  221. width: 100%;
  222. height: 100%;
  223. }
  224. }
  225. .warning-r {
  226. .map-legend {
  227. position: absolute;
  228. bottom: -33px;
  229. left: -455px;
  230. width: 340px;
  231. img {
  232. width: 340px;
  233. opacity: 0.6;
  234. }
  235. }
  236. .chat-legend {
  237. bottom: -12px;
  238. }
  239. }
  240. .warning-search {
  241. position: absolute;
  242. right: 400px;
  243. top: -34px;
  244. display: flex;
  245. align-items: center;
  246. .focus-farm {
  247. padding-left: 15px;
  248. }
  249. ::v-deep {
  250. .el-select__wrapper {
  251. background: rgba(255, 212, 137, 0.2);
  252. box-shadow: 0 0 0 1px rgba(255, 212, 137, 0.3) inset;
  253. height: 50px;
  254. line-height: 50px;
  255. .el-select__caret {
  256. color: #ffd489;
  257. }
  258. }
  259. .el-select__placeholder {
  260. color: #f7be5a;
  261. font-size: 20px;
  262. font-family: "PangMenZhengDao";
  263. text-align: center;
  264. }
  265. }
  266. }
  267. .warning-top {
  268. display: flex;
  269. width: max-content;
  270. align-items: center;
  271. .back-icon {
  272. cursor: pointer;
  273. margin-right: 20px;
  274. height: 50px;
  275. display: flex;
  276. align-items: center;
  277. padding: 0 20px;
  278. border: 1px solid rgba(255, 255, 255, 0.6);
  279. background: rgba(0, 0, 0, 0.2);
  280. border-radius: 4px;
  281. img {
  282. width: 17px;
  283. margin-right: 10px;
  284. }
  285. }
  286. .top-l {
  287. display: flex;
  288. flex-direction: column;
  289. align-items: center;
  290. .type-box {
  291. margin-top: 10px;
  292. background: rgba(29, 29, 29, 0.54);
  293. border: 1px solid rgba(255, 212, 137, 0.3);
  294. border-radius: 2px;
  295. text-align: center;
  296. line-height: 48px;
  297. height: 48px;
  298. width: 184px;
  299. }
  300. ::v-deep {
  301. .el-input__wrapper {
  302. background: rgba(29, 29, 29, 0.54);
  303. box-shadow: 0 0 0 1px rgba(255, 212, 137, 0.3) inset;
  304. height: 50px;
  305. line-height: 50px;
  306. padding: 0 10px;
  307. .el-input__inner {
  308. color: #f7be5a;
  309. font-size: 20px;
  310. font-family: "PangMenZhengDao";
  311. text-align: center;
  312. }
  313. }
  314. .el-select__wrapper {
  315. background: rgba(29, 29, 29, 0.54);
  316. box-shadow: 0 0 0 1px rgba(255, 212, 137, 0.3) inset;
  317. height: 50px;
  318. line-height: 50px;
  319. .el-select__caret {
  320. color: #ffd489;
  321. }
  322. }
  323. .el-select__placeholder {
  324. color: #f7be5a;
  325. font-size: 20px;
  326. font-family: "PangMenZhengDao";
  327. text-align: center;
  328. }
  329. }
  330. }
  331. .top-r {
  332. display: flex;
  333. .data-box {
  334. cursor: pointer;
  335. margin-left: 20px;
  336. width: 200px;
  337. height: 104px;
  338. background: url("@/assets/images/warningHome/box-bg.png") no-repeat center center / 100% 100%;
  339. display: flex;
  340. flex-direction: column;
  341. align-items: center;
  342. &.active {
  343. position: relative;
  344. &::before {
  345. content: "";
  346. position: absolute;
  347. bottom: -26px;
  348. left: 0;
  349. right: 0;
  350. width: 35px;
  351. height: 17px;
  352. margin: 0 auto;
  353. background: url("@/assets/images/warningHome/triangle.png") no-repeat center center / cover;
  354. }
  355. }
  356. .data-value {
  357. padding-top: 15px;
  358. font-size: 20px;
  359. color: rgba(255, 212, 137, 0.4);
  360. font-family: "PangMenZhengDao";
  361. span {
  362. font-size: 38px;
  363. color: #f7be5a;
  364. padding-right: 2px;
  365. }
  366. }
  367. .data-name {
  368. color: #cecece;
  369. font-size: 16px;
  370. }
  371. }
  372. }
  373. }
  374. .warning-alarm {
  375. width: 88px;
  376. padding-top: 14px;
  377. }
  378. .time-wrap {
  379. position: absolute;
  380. bottom: -20px;
  381. left: 140px;
  382. width: 46vw;
  383. min-width: 700px;
  384. height: 71px;
  385. }
  386. }
  387. }
  388. .bottom-map {
  389. width: 100%;
  390. height: 100vh;
  391. position: absolute;
  392. z-index: 0;
  393. }
  394. </style>
  395. <style lang="less">
  396. .ol-scale-line {
  397. left: auto;
  398. right: 430px;
  399. bottom: 38px;
  400. .ol-scale-line-inner {
  401. max-width: 80px;
  402. width: 80px !important;
  403. color: #fff;
  404. border-color: #fff;
  405. }
  406. }
  407. .focus-farm-select {
  408. &.el-popper.is-light {
  409. background: #232323;
  410. border-color: rgba(255, 212, 137, 0.3);
  411. box-shadow: 0px 0px 12px rgba(255, 212, 137, 0.3);
  412. .el-select-dropdown__item {
  413. background: none;
  414. color: rgba(255, 212, 137, 0.6);
  415. }
  416. .el-select-dropdown__item.is-selected {
  417. background: rgba(255, 212, 137, 0.2);
  418. color: #ffd489;
  419. }
  420. }
  421. &.el-popper.is-light .el-popper__arrow:before {
  422. background: #232323;
  423. border-color: rgba(255, 212, 137, 0.3);
  424. }
  425. }
  426. .ol-popup-warning {
  427. position: relative;
  428. width: 295px;
  429. background: rgb(35, 35, 35, 0.86);
  430. color: #fff;
  431. font-size: 16px;
  432. border-radius: 4px;
  433. .warning-info-title {
  434. display: flex;
  435. padding: 6px 10px;
  436. background: rgba(255, 255, 255, 0.05);
  437. font-size: 18px;
  438. border-radius: 4px 4px 0 0;
  439. .icon {
  440. padding-right: 6px;
  441. }
  442. .close {
  443. position: absolute;
  444. right: 12px;
  445. top: 4px;
  446. }
  447. }
  448. .info-content {
  449. padding: 16px 20px 40px 20px;
  450. line-height: 26px;
  451. text-indent: 2em;
  452. }
  453. }
  454. .area-cascader {
  455. &.el-popper.is-light {
  456. background: #232323;
  457. border-color: rgba(255, 212, 137, 0.3);
  458. box-shadow: 0px 0px 12px rgba(255, 212, 137, 0.3);
  459. .el-cascader-menu {
  460. color: rgba(255, 212, 137, 0.6);
  461. border-color: rgba(255, 212, 137, 0.3);
  462. }
  463. .el-cascader-node.in-active-path,
  464. .el-cascader-node.is-active,
  465. .el-cascader-node.is-selectable.in-checked-path {
  466. color: #f7be5a;
  467. background: transparent;
  468. }
  469. .el-radio__input.is-checked .el-radio__inner {
  470. background: #f7be5a;
  471. border-color: #f7be5a;
  472. }
  473. .el-cascader-node:not(.is-disabled):hover,
  474. .el-cascader-node:not(.is-disabled):focus,
  475. .el-cascader-node:not(.is-disabled):hover {
  476. background: rgba(255, 212, 137, 0.2);
  477. }
  478. }
  479. .el-radio__inner {
  480. background-color: rgba(255, 212, 137, 0.3);
  481. border-color: rgba(255, 212, 137, 0.6);
  482. }
  483. &.el-popper.is-light .el-popper__arrow:before {
  484. background: #232323;
  485. border-color: rgba(255, 212, 137, 0.3);
  486. }
  487. }
  488. </style>