index.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642
  1. <template>
  2. <div class="base-container no-events">
  3. <fnHeader :hideShadow="true"></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. <!-- <el-cascader
  13. style="width: 184px"
  14. :show-all-levels="false"
  15. v-model="areaVal"
  16. :props="props1"
  17. :options="areaListOptions"
  18. @change="toggleArea"
  19. popper-class="area-cascader"
  20. /> -->
  21. <div class="select-wrap">
  22. <el-select
  23. v-model="areaVal"
  24. placeholder="请选择"
  25. style="width: 180px"
  26. >
  27. <el-option
  28. v-for="item in areaOptions"
  29. :key="item.value"
  30. :label="item.label"
  31. :value="item.value"
  32. />
  33. </el-select>
  34. </div>
  35. <div class="select-wrap">
  36. <el-select
  37. v-model="typeVal"
  38. placeholder="请选择"
  39. style="width: 180px"
  40. >
  41. <el-option
  42. v-for="item in typeOptions"
  43. :key="item.value"
  44. :label="item.label"
  45. :value="item.value"
  46. />
  47. </el-select>
  48. </div>
  49. </div>
  50. <!-- <div class="top-r yes-events">
  51. <div class="data-box" @click="toggleBox('面积')" :class="{ active: activeBoxName === '面积' }">
  52. <div class="data-value"><span>{{areaVal.includes('3186') ? 31.2 : 419.89}}</span>万亩</div>
  53. <div class="data-name">种植面积</div>
  54. </div>
  55. <div
  56. class="data-box"
  57. v-if="areaVal.includes('3186')"
  58. @click="toggleBox('从化荔枝')"
  59. :class="{ active: activeBoxName === '从化荔枝' }"
  60. >
  61. <div class="data-value"><span>11.9</span>万亩</div>
  62. <div class="data-name">疑似失管面积</div>
  63. </div>
  64. <div class="data-box" @click="toggleBox('产量')" :class="{ active: activeBoxName === '产量' }">
  65. <div class="data-value"><span>{{areaVal.includes('3186') ? 10.4 : 192.12}}</span>万吨</div>
  66. <div class="data-name">预估产量</div>
  67. </div>
  68. </div> -->
  69. </div>
  70. <div class="warning-alarm yes-events" v-show="hideChatMapLayer">
  71. <alarm-list></alarm-list>
  72. </div>
  73. <!-- <div class="time-wrap yes-events">
  74. <time-line></time-line>
  75. </div> -->
  76. </div>
  77. <div class="warning-c yes-events">
  78. <div class="center-content">
  79. <div class="warning-item">
  80. <div class="item-val">
  81. 526
  82. <span class="unit">亩</span>
  83. </div>
  84. <div class="item-text">种植面积</div>
  85. </div>
  86. <div class="warning-item">
  87. <div class="item-val">
  88. 526
  89. <span class="unit">户</span>
  90. </div>
  91. <div class="item-text">种植户数</div>
  92. </div>
  93. <div class="warning-item">
  94. <div class="item-val">
  95. 526
  96. <span class="unit">亩</span>
  97. </div>
  98. <div class="item-text">种植产量</div>
  99. </div>
  100. </div>
  101. <img class="center-title-bg" src="@/assets/images/warningHome/center-title.png" alt="">
  102. </div>
  103. <div class="warning-r right yes-events">
  104. <!-- <album></album> -->
  105. <chat></chat>
  106. <!-- 地图图例 -->
  107. <div class="map-legend" v-if="legendImg">
  108. <img :src="legendImg" />
  109. </div>
  110. <div class="map-legend chat-legend" v-show="!legendImg">
  111. <StaticMapLegend></StaticMapLegend>
  112. </div>
  113. <!-- 农场确权 -->
  114. <div class="authentic-btn yes-events PangMenZhengDao-FONT" @click="toAuthentic">
  115. 农场确权
  116. <el-icon class="right-icon" size="18"><CaretRight /></el-icon>
  117. </div>
  118. </div>
  119. <!-- <div class="warning-search yes-events">
  120. <img src="@/assets/images/warningHome/search-img.png" />
  121. <div class="focus-farm">
  122. <el-select
  123. v-model="farmVal"
  124. placeholder="我的关注农场"
  125. style="width: 189px"
  126. popper-class="focus-farm-select"
  127. @change="toggleFarm"
  128. >
  129. <el-option label="荔博园" :value="1" />
  130. <el-option label="井冈红糯基地" :value="2" />
  131. </el-select>
  132. </div>
  133. </div> -->
  134. </div>
  135. </div>
  136. <div ref="mapRef" class="bottom-map"></div>
  137. <div id="popup" class="ol-popup-warning">
  138. <div class="warning-info-title">
  139. <div class="icon">
  140. <img src="@/assets/images/common/chart-icon.png" />
  141. </div>
  142. <div id="popup-title"></div>
  143. <div class="close" @click="destroyPopup">
  144. <img src="@/assets/images/warningHome/close-btn.png" />
  145. </div>
  146. </div>
  147. <div id="popup-content" class="info-content"></div>
  148. </div>
  149. <track-dialog></track-dialog>
  150. </template>
  151. <script setup>
  152. import "./map/mockFarmLayer";
  153. import StaticMapLayers from "@/components/static_map_change/Layers.js"
  154. import StaticMapLegend from "@/components/static_map_change/legend.vue"
  155. import StaticMapPointLayers from "@/components/static_map_change/pointLayer.js"
  156. import { onMounted, ref } from "vue";
  157. import fnHeader from "@/components/fnHeader.vue";
  158. import WarningMap from "./warningMap";
  159. import AlarmLayer from "./map/alarmLayer";
  160. import album from "./components/album.vue";
  161. import trackDialog from "./components/trackDialog.vue";
  162. import chat from "./components/chat_components/index.vue";
  163. import alarmList from "./components/alarmList.vue";
  164. import timeLine from "./components/timeLine.vue";
  165. import { useRouter } from "vue-router";
  166. import eventBus from "@/api/eventBus";
  167. import { areaListOptions } from "./area";
  168. import { useStore } from "vuex";
  169. let store = useStore();
  170. let warningMap = new WarningMap();
  171. let alarmLayer = null;
  172. let staticMapLayers = null;
  173. let staticMapPointLayers = null;
  174. const router = useRouter();
  175. const areaVal = ref(1);
  176. const areaOptions = ref([
  177. {label: "百色",value: 1}
  178. ])
  179. const typeVal = ref(1);
  180. const typeOptions = ref([
  181. {label: "八角",value: 1},
  182. {label: "油茶",value: 2},
  183. ])
  184. const mapRef = ref();
  185. const legendImg = ref("");
  186. const warningLayers = ref({})
  187. onMounted(() => {
  188. warningMap.initMap(store.getters.userinfo.location, mapRef.value);
  189. console.log('store.getters.userinfo', store.getters.userinfo.userId)
  190. warningMap.getGardenList(store.getters.userinfo.userId)
  191. alarmLayer = new AlarmLayer(warningMap.kmap);
  192. staticMapLayers = new StaticMapLayers(warningMap.kmap);
  193. staticMapPointLayers = new StaticMapPointLayers(warningMap.kmap);
  194. // setTimeout(() => {
  195. // staticMapLayers.show("testpng")
  196. // },2000)
  197. // 图例数据
  198. eventBus.on("alarmList:warningLayers", (data) => {
  199. warningLayers.value = data
  200. });
  201. eventBus.on("alarmList:changeMapLayer", ({name, legendUrl}) => {
  202. if(legendUrl){
  203. legendImg.value = legendUrl;
  204. }else{
  205. legendImg.value = warningLayers.value[`${name}图例`];
  206. }
  207. });
  208. // ai与地图交互
  209. eventBus.on("chat:showMapLayer", handleMapLayer)
  210. });
  211. // ai与地图交互
  212. const hideChatMapLayer = ref(true)
  213. const handleMapLayer = ({mapName}) => {
  214. hideChatMapLayer.value = false
  215. console.log('mapName', mapName);
  216. staticMapPointLayers.hidePoint()
  217. staticMapLayers.hideAll()
  218. // 重置时间轴
  219. // eventBus.emit("map_click_alarm")
  220. if (mapName === "植保机") {
  221. staticMapLayers.show("分散种植", true)
  222. staticMapPointLayers.showPoint()
  223. } else if (mapName) {
  224. // staticMapLayers.show("作物种类")
  225. staticMapLayers.show(mapName, true)
  226. }
  227. }
  228. const toggleChatMapLayer = () => {
  229. hideChatMapLayer.value = true
  230. eventBus.emit("chat:hideMapLayer");
  231. staticMapLayers.hideAll()
  232. }
  233. const destroyPopup = () => {
  234. eventBus.emit("map:destroyPopup");
  235. };
  236. const props1 = {
  237. checkStrictly: true,
  238. };
  239. const toggleArea = (v) => {
  240. activeBoxName.value = null;
  241. const val = v[v.length - 1];
  242. if (val === "3" || val === "3186") {
  243. eventBus.emit("warningHome:toggleArea", val);
  244. }
  245. };
  246. const activeBoxName = ref(null);
  247. const toggleBox = (name) => {
  248. activeBoxName.value = name;
  249. legendImg.value = warningLayers.value[`${name}图例`];
  250. eventBus.emit("warningHome:toggleMapLayer", name);
  251. };
  252. function toAuthentic() {
  253. router.push('/authentic')
  254. }
  255. </script>
  256. <style lang="scss" scoped>
  257. .base-container {
  258. width: 100%;
  259. height: 100vh;
  260. color: #fff;
  261. position: absolute;
  262. box-sizing: border-box;
  263. z-index: 1;
  264. ::v-deep {
  265. .focus-farm {
  266. top: 42px;
  267. }
  268. }
  269. .content {
  270. width: 100%;
  271. height: calc(100% - 74px - 48px);
  272. padding: 0 20px 0 27px;
  273. display: flex;
  274. justify-content: space-between;
  275. box-sizing: border-box;
  276. position: relative;
  277. .left,
  278. .right {
  279. width: calc(376px + 54px);
  280. height: 100%;
  281. padding-top: 10px;
  282. box-sizing: border-box;
  283. // display: flex;
  284. }
  285. .right {
  286. // width: 395px;
  287. width: 500px;
  288. position: relative;
  289. .list {
  290. width: 100%;
  291. height: 100%;
  292. }
  293. }
  294. .warning-c {
  295. width: 600px;
  296. display: flex;
  297. justify-content: space-around;
  298. position: absolute;
  299. left: 50%;
  300. transform: translateX(-50%);
  301. .center-content {
  302. position: relative;
  303. width: 600px;
  304. display: flex;
  305. justify-content: space-around;
  306. z-index: 2;
  307. }
  308. .center-title-bg {
  309. position: absolute;
  310. top: -100px;
  311. }
  312. .warning-item {
  313. height: 78px;
  314. display: flex;
  315. flex-direction: column;
  316. align-items: center;
  317. justify-content: center;
  318. .item-text {
  319. color: #55E5C8;
  320. font-size: 20px;
  321. }
  322. .item-val {
  323. font-family: "PangMenZhengDao";
  324. font-size: 36px;
  325. background: linear-gradient(180deg, #9CFFF3, #FFFFFF);
  326. -webkit-background-clip: text;
  327. color: transparent;
  328. .unit {
  329. font-size: 17px;
  330. }
  331. }
  332. }
  333. }
  334. .warning-r {
  335. .map-legend {
  336. position: absolute;
  337. bottom: -33px;
  338. left: -352px;
  339. width: 340px;
  340. img {
  341. width: 340px;
  342. opacity: 0.6;
  343. }
  344. }
  345. .chat-legend {
  346. bottom: -12px;
  347. }
  348. .authentic-btn {
  349. position: absolute;
  350. top: -34px;
  351. left: 78px;
  352. width: 200px;
  353. height: 40px;
  354. background: url('@/assets/images/warningHome/select-bg-right.png') no-repeat center;
  355. display: flex;
  356. align-items: center;
  357. justify-content: center;
  358. font-size: 20px;
  359. color: #fff;
  360. cursor: pointer;
  361. }
  362. }
  363. .warning-search {
  364. position: absolute;
  365. right: 400px;
  366. top: -34px;
  367. display: flex;
  368. align-items: center;
  369. .focus-farm {
  370. padding-left: 15px;
  371. }
  372. ::v-deep {
  373. .el-select__wrapper {
  374. background: rgba(255, 212, 137, 0.2);
  375. box-shadow: 0 0 0 1px rgba(255, 212, 137, 0.3) inset;
  376. height: 50px;
  377. line-height: 50px;
  378. .el-select__caret {
  379. color: #55E5C6;
  380. }
  381. }
  382. .el-select__placeholder {
  383. color: #55E5C6;
  384. font-size: 20px;
  385. font-family: "PangMenZhengDao";
  386. text-align: center;
  387. }
  388. }
  389. }
  390. .warning-top {
  391. display: flex;
  392. width: max-content;
  393. align-items: center;
  394. .back-icon {
  395. cursor: pointer;
  396. margin-right: 20px;
  397. height: 50px;
  398. display: flex;
  399. align-items: center;
  400. padding: 0 20px;
  401. border: 1px solid rgba(255, 255, 255, 0.6);
  402. background: rgba(0, 0, 0, 0.2);
  403. border-radius: 4px;
  404. img {
  405. width: 17px;
  406. margin-right: 10px;
  407. }
  408. }
  409. .top-l {
  410. display: flex;
  411. // flex-direction: column;
  412. align-items: center;
  413. position: relative;
  414. top: -40px;
  415. .type-box {
  416. margin-top: 10px;
  417. background: rgba(29, 29, 29, 0.54);
  418. border: 1px solid rgba(255, 212, 137, 0.3);
  419. border-radius: 2px;
  420. text-align: center;
  421. line-height: 48px;
  422. height: 48px;
  423. width: 184px;
  424. }
  425. .select-wrap {
  426. background: url("@/assets/images/warningHome/select-bg.png") no-repeat center;
  427. width: 200px;
  428. }
  429. ::v-deep {
  430. .el-input__wrapper {
  431. background: rgba(29, 29, 29, 0.54);
  432. box-shadow: 0 0 0 1px rgba(255, 212, 137, 0.3) inset;
  433. height: 50px;
  434. line-height: 50px;
  435. padding: 0 10px;
  436. .el-input__inner {
  437. color: #55E5C6;
  438. font-size: 20px;
  439. font-family: "PangMenZhengDao";
  440. text-align: center;
  441. }
  442. }
  443. .el-select__wrapper {
  444. background: transparent;
  445. box-shadow: none;
  446. height: 40px;
  447. line-height: 40px;
  448. .el-select__caret {
  449. color: #fff;
  450. }
  451. }
  452. .el-select__placeholder {
  453. color: #fff;
  454. font-size: 20px;
  455. font-family: "PangMenZhengDao";
  456. text-align: center;
  457. }
  458. }
  459. }
  460. .top-r {
  461. display: flex;
  462. .data-box {
  463. cursor: pointer;
  464. margin-left: 20px;
  465. width: 200px;
  466. height: 104px;
  467. background: url("@/assets/images/warningHome/box-bg.png") no-repeat center center / 100% 100%;
  468. display: flex;
  469. flex-direction: column;
  470. align-items: center;
  471. &.active {
  472. position: relative;
  473. &::before {
  474. content: "";
  475. position: absolute;
  476. bottom: -26px;
  477. left: 0;
  478. right: 0;
  479. width: 35px;
  480. height: 17px;
  481. margin: 0 auto;
  482. background: url("@/assets/images/warningHome/triangle.png") no-repeat center center / cover;
  483. }
  484. }
  485. .data-value {
  486. padding-top: 15px;
  487. font-size: 20px;
  488. color: rgba(255, 212, 137, 0.4);
  489. font-family: "PangMenZhengDao";
  490. span {
  491. font-size: 38px;
  492. color: #55E5C6;
  493. padding-right: 2px;
  494. }
  495. }
  496. .data-name {
  497. color: #cecece;
  498. font-size: 16px;
  499. }
  500. }
  501. }
  502. }
  503. .warning-alarm {
  504. width: 88px;
  505. padding-top: calc(40%);
  506. }
  507. .time-wrap {
  508. position: absolute;
  509. bottom: -20px;
  510. left: 140px;
  511. width: 46vw;
  512. min-width: 700px;
  513. height: 71px;
  514. }
  515. }
  516. }
  517. .bottom-map {
  518. width: 100%;
  519. height: 100vh;
  520. position: absolute;
  521. z-index: 0;
  522. }
  523. </style>
  524. <style lang="less">
  525. .ol-scale-line {
  526. left: auto;
  527. right: 430px;
  528. bottom: 38px;
  529. .ol-scale-line-inner {
  530. max-width: 80px;
  531. width: 80px !important;
  532. color: #fff;
  533. border-color: #fff;
  534. }
  535. }
  536. .focus-farm-select {
  537. &.el-popper.is-light {
  538. background: #232323;
  539. border-color: rgba(255, 212, 137, 0.3);
  540. box-shadow: 0px 0px 12px rgba(255, 212, 137, 0.3);
  541. .el-select-dropdown__item {
  542. background: none;
  543. color: rgba(9, 243, 200, 0.6);
  544. }
  545. .el-select-dropdown__item.is-selected {
  546. background: rgba(255, 212, 137, 0.2);
  547. color: #55E5C6;
  548. }
  549. }
  550. &.el-popper.is-light .el-popper__arrow:before {
  551. background: #232323;
  552. border-color: rgba(255, 212, 137, 0.3);
  553. }
  554. }
  555. .ol-popup-warning {
  556. position: relative;
  557. width: 295px;
  558. background: rgb(35, 35, 35, 0.86);
  559. color: #fff;
  560. font-size: 16px;
  561. border-radius: 4px;
  562. .warning-info-title {
  563. display: flex;
  564. padding: 6px 10px;
  565. background: rgba(255, 255, 255, 0.05);
  566. font-size: 18px;
  567. border-radius: 4px 4px 0 0;
  568. .icon {
  569. padding-right: 6px;
  570. }
  571. .close {
  572. position: absolute;
  573. right: 12px;
  574. top: 4px;
  575. }
  576. }
  577. .info-content {
  578. padding: 16px 20px 40px 20px;
  579. line-height: 26px;
  580. text-indent: 2em;
  581. }
  582. }
  583. .area-cascader {
  584. &.el-popper.is-light {
  585. background: #232323;
  586. border-color: rgba(255, 212, 137, 0.3);
  587. box-shadow: 0px 0px 12px rgba(255, 212, 137, 0.3);
  588. .el-cascader-menu {
  589. color: rgba(9, 243, 200, 0.6);
  590. border-color: rgba(255, 212, 137, 0.3);
  591. }
  592. .el-cascader-node.in-active-path,
  593. .el-cascader-node.is-active,
  594. .el-cascader-node.is-selectable.in-checked-path {
  595. color: #55E5C6;
  596. background: transparent;
  597. }
  598. .el-radio__input.is-checked .el-radio__inner {
  599. background: #55E5C6;
  600. border-color: #55E5C6;
  601. }
  602. .el-cascader-node:not(.is-disabled):hover,
  603. .el-cascader-node:not(.is-disabled):focus,
  604. .el-cascader-node:not(.is-disabled):hover {
  605. background: rgba(255, 212, 137, 0.2);
  606. }
  607. }
  608. .el-radio__inner {
  609. background-color: rgba(255, 212, 137, 0.3);
  610. border-color: rgba(9, 243, 200, 0.6);
  611. }
  612. &.el-popper.is-light .el-popper__arrow:before {
  613. background: #232323;
  614. border-color: rgba(255, 212, 137, 0.3);
  615. }
  616. }
  617. </style>