123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509 |
- <template>
- <div class="base-container no-events">
- <fnHeader showDate></fnHeader>
- <div class="content">
- <div class="warning-l left">
- <div class="warning-top">
- <div class="back-icon yes-events" v-if="!hideChatMapLayer" @click="toggleChatMapLayer">
- <img src="@/assets/images/common/back-icon.png" />
- 返回
- </div>
- <div class="top-l yes-events">
- <div>
- <el-cascader
- style="width: 184px"
- :show-all-levels="false"
- v-model="areaVal"
- :props="props1"
- :options="areaListOptions"
- @change="toggleArea"
- popper-class="area-cascader"
- />
- </div>
- <div class="type-box"><img src="@/assets/images/warningHome/lz.png" /></div>
- </div>
- <div class="top-r yes-events">
- <div class="data-box" @click="toggleBox('面积')" :class="{ active: activeBoxName === '面积' }">
- <div class="data-value"><span>{{areaVal.includes('3186') ? 31.2 : 419.89}}</span>万亩</div>
- <div class="data-name">种植面积</div>
- </div>
- <div
- class="data-box"
- v-if="areaVal.includes('3186')"
- @click="toggleBox('从化荔枝')"
- :class="{ active: activeBoxName === '从化荔枝' }"
- >
- <div class="data-value"><span>11.9</span>万亩</div>
- <div class="data-name">疑似失管面积</div>
- </div>
- <div class="data-box" @click="toggleBox('产量')" :class="{ active: activeBoxName === '产量' }">
- <div class="data-value"><span>{{areaVal.includes('3186') ? 10.4 : 192.12}}</span>万吨</div>
- <div class="data-name">预估产量</div>
- </div>
- </div>
- </div>
- <div class="warning-alarm yes-events" v-show="hideChatMapLayer">
- <alarm-list></alarm-list>
- </div>
- <div class="time-wrap yes-events">
- <time-line></time-line>
- </div>
- </div>
- <div class="warning-r right yes-events">
- <!-- <album></album> -->
- <chat></chat>
- <!-- 地图图例 -->
- <div class="map-legend" v-if="legendImg">
- <img :src="legendImg" />
- </div>
- <div class="map-legend chat-legend" v-show="!legendImg">
- <StaticMapLegend></StaticMapLegend>
- </div>
- </div>
- <div class="warning-search yes-events">
- <img src="@/assets/images/warningHome/search-img.png" />
- <!-- <div class="focus-farm">
- <el-select
- v-model="farmVal"
- placeholder="我的关注农场"
- style="width: 189px"
- popper-class="focus-farm-select"
- @change="toggleFarm"
- >
- <el-option label="荔博园" :value="1" />
- <el-option label="井冈红糯基地" :value="2" />
- </el-select>
- </div> -->
- </div>
- </div>
- </div>
- <div ref="mapRef" class="bottom-map"></div>
- <div id="popup" class="ol-popup-warning">
- <div class="warning-info-title">
- <div class="icon">
- <img src="@/assets/images/common/chart-icon.png" />
- </div>
- <div id="popup-title"></div>
- <div class="close" @click="destroyPopup">
- <img src="@/assets/images/warningHome/close-btn.png" />
- </div>
- </div>
- <div id="popup-content" class="info-content"></div>
- </div>
- <track-dialog></track-dialog>
- </template>
- <script setup>
- import "./map/mockFarmLayer";
- import StaticMapLayers from "@/components/static_map_change/Layers.js"
- import StaticMapLegend from "@/components/static_map_change/legend.vue"
- import StaticMapPointLayers from "@/components/static_map_change/pointLayer.js"
- import { onMounted, ref } from "vue";
- import fnHeader from "@/components/fnHeader.vue";
- import WarningMap from "./warningMap";
- import AlarmLayer from "./map/alarmLayer";
- import album from "./components/album.vue";
- import trackDialog from "./components/trackDialog.vue";
- import chat from "./components/chat_components/index.vue";
- import alarmList from "./components/alarmList.vue";
- import timeLine from "./components/timeLine.vue";
- import { useRouter } from "vue-router";
- import eventBus from "@/api/eventBus";
- import { areaListOptions } from "./area";
- import { useStore } from "vuex";
- let store = useStore();
- let warningMap = new WarningMap();
- let alarmLayer = null;
- let staticMapLayers = null;
- let staticMapPointLayers = null;
- const router = useRouter();
- const areaVal = ref(["3"]);
- const mapRef = ref();
- const legendImg = ref("");
- const warningLayers = ref({})
- onMounted(() => {
- warningMap.initMap(store.getters.userinfo.location, mapRef.value);
- alarmLayer = new AlarmLayer(warningMap.kmap);
- staticMapLayers = new StaticMapLayers(warningMap.kmap);
- staticMapPointLayers = new StaticMapPointLayers(warningMap.kmap);
- // setTimeout(() => {
- // staticMapLayers.show("testpng")
- // },2000)
- // 图例数据
- eventBus.on("alarmList:warningLayers", (data) => {
- warningLayers.value = data
- });
- eventBus.on("alarmList:changeMapLayer", ({name, legendUrl}) => {
- if(legendUrl){
- legendImg.value = legendUrl;
- }else{
- legendImg.value = warningLayers.value[`${name}图例`];
- }
- });
- // ai与地图交互
- eventBus.on("chat:showMapLayer", handleMapLayer)
- });
- // ai与地图交互
- const hideChatMapLayer = ref(true)
- const handleMapLayer = ({mapName}) => {
- hideChatMapLayer.value = false
- console.log('mapName', mapName);
- staticMapPointLayers.hidePoint()
- staticMapLayers.hideAll()
- // 重置时间轴
- // eventBus.emit("map_click_alarm")
- if (mapName === "植保机") {
- staticMapLayers.show("分散种植", true)
- staticMapPointLayers.showPoint()
- } else if (mapName) {
- // staticMapLayers.show("作物种类")
- staticMapLayers.show(mapName, true)
- }
- }
- const toggleChatMapLayer = () => {
- hideChatMapLayer.value = true
- eventBus.emit("chat:hideMapLayer");
- staticMapLayers.hideAll()
- }
- const destroyPopup = () => {
- eventBus.emit("map:destroyPopup");
- };
- const props1 = {
- checkStrictly: true,
- };
- const toggleArea = (v) => {
- activeBoxName.value = null;
- const val = v[v.length - 1];
- if (val === "3" || val === "3186") {
- eventBus.emit("warningHome:toggleArea", val);
- }
- };
- const activeBoxName = ref(null);
- const toggleBox = (name) => {
- activeBoxName.value = name;
- legendImg.value = warningLayers.value[`${name}图例`];
- eventBus.emit("warningHome:toggleMapLayer", name);
- };
- </script>
- <style lang="scss" scoped>
- .base-container {
- width: 100%;
- height: 100vh;
- color: #fff;
- position: absolute;
- box-sizing: border-box;
- z-index: 1;
- ::v-deep {
- .focus-farm {
- top: 42px;
- }
- }
- .content {
- width: 100%;
- height: calc(100% - 74px - 48px);
- padding: 0 20px 0 27px;
- display: flex;
- justify-content: space-between;
- box-sizing: border-box;
- position: relative;
- .left,
- .right {
- width: calc(376px + 54px);
- height: 100%;
- padding-top: 10px;
- box-sizing: border-box;
- // display: flex;
- }
- .right {
- // width: 395px;
- width: 500px;
- position: relative;
- .list {
- width: 100%;
- height: 100%;
- }
- }
- .warning-r {
- .map-legend {
- position: absolute;
- bottom: -33px;
- left: -455px;
- width: 340px;
- img {
- width: 340px;
- opacity: 0.6;
- }
- }
- .chat-legend {
- bottom: -12px;
- }
- }
- .warning-search {
- position: absolute;
- right: 400px;
- top: -34px;
- display: flex;
- align-items: center;
- .focus-farm {
- padding-left: 15px;
- }
- ::v-deep {
- .el-select__wrapper {
- background: rgba(255, 212, 137, 0.2);
- box-shadow: 0 0 0 1px rgba(255, 212, 137, 0.3) inset;
- height: 50px;
- line-height: 50px;
- .el-select__caret {
- color: #ffd489;
- }
- }
- .el-select__placeholder {
- color: #f7be5a;
- font-size: 20px;
- font-family: "PangMenZhengDao";
- text-align: center;
- }
- }
- }
- .warning-top {
- display: flex;
- width: max-content;
- align-items: center;
- .back-icon {
- cursor: pointer;
- margin-right: 20px;
- height: 50px;
- display: flex;
- align-items: center;
- padding: 0 20px;
- border: 1px solid rgba(255, 255, 255, 0.6);
- background: rgba(0, 0, 0, 0.2);
- border-radius: 4px;
- img {
- width: 17px;
- margin-right: 10px;
- }
- }
- .top-l {
- display: flex;
- flex-direction: column;
- align-items: center;
- .type-box {
- margin-top: 10px;
- background: rgba(29, 29, 29, 0.54);
- border: 1px solid rgba(255, 212, 137, 0.3);
- border-radius: 2px;
- text-align: center;
- line-height: 48px;
- height: 48px;
- width: 184px;
- }
- ::v-deep {
- .el-input__wrapper {
- background: rgba(29, 29, 29, 0.54);
- box-shadow: 0 0 0 1px rgba(255, 212, 137, 0.3) inset;
- height: 50px;
- line-height: 50px;
- padding: 0 10px;
- .el-input__inner {
- color: #f7be5a;
- font-size: 20px;
- font-family: "PangMenZhengDao";
- text-align: center;
- }
- }
- .el-select__wrapper {
- background: rgba(29, 29, 29, 0.54);
- box-shadow: 0 0 0 1px rgba(255, 212, 137, 0.3) inset;
- height: 50px;
- line-height: 50px;
- .el-select__caret {
- color: #ffd489;
- }
- }
- .el-select__placeholder {
- color: #f7be5a;
- font-size: 20px;
- font-family: "PangMenZhengDao";
- text-align: center;
- }
- }
- }
- .top-r {
- display: flex;
- .data-box {
- cursor: pointer;
- margin-left: 20px;
- width: 200px;
- height: 104px;
- background: url("@/assets/images/warningHome/box-bg.png") no-repeat center center / 100% 100%;
- display: flex;
- flex-direction: column;
- align-items: center;
- &.active {
- position: relative;
- &::before {
- content: "";
- position: absolute;
- bottom: -26px;
- left: 0;
- right: 0;
- width: 35px;
- height: 17px;
- margin: 0 auto;
- background: url("@/assets/images/warningHome/triangle.png") no-repeat center center / cover;
- }
- }
- .data-value {
- padding-top: 15px;
- font-size: 20px;
- color: rgba(255, 212, 137, 0.4);
- font-family: "PangMenZhengDao";
- span {
- font-size: 38px;
- color: #f7be5a;
- padding-right: 2px;
- }
- }
- .data-name {
- color: #cecece;
- font-size: 16px;
- }
- }
- }
- }
- .warning-alarm {
- width: 88px;
- padding-top: 14px;
- }
- .time-wrap {
- position: absolute;
- bottom: -20px;
- left: 140px;
- width: 46vw;
- min-width: 700px;
- height: 71px;
- }
- }
- }
- .bottom-map {
- width: 100%;
- height: 100vh;
- position: absolute;
- z-index: 0;
- }
- </style>
- <style lang="less">
- .ol-scale-line {
- left: auto;
- right: 430px;
- bottom: 38px;
- .ol-scale-line-inner {
- max-width: 80px;
- width: 80px !important;
- color: #fff;
- border-color: #fff;
- }
- }
- .focus-farm-select {
- &.el-popper.is-light {
- background: #232323;
- border-color: rgba(255, 212, 137, 0.3);
- box-shadow: 0px 0px 12px rgba(255, 212, 137, 0.3);
- .el-select-dropdown__item {
- background: none;
- color: rgba(255, 212, 137, 0.6);
- }
- .el-select-dropdown__item.is-selected {
- background: rgba(255, 212, 137, 0.2);
- color: #ffd489;
- }
- }
- &.el-popper.is-light .el-popper__arrow:before {
- background: #232323;
- border-color: rgba(255, 212, 137, 0.3);
- }
- }
- .ol-popup-warning {
- position: relative;
- width: 295px;
- background: rgb(35, 35, 35, 0.86);
- color: #fff;
- font-size: 16px;
- border-radius: 4px;
- .warning-info-title {
- display: flex;
- padding: 6px 10px;
- background: rgba(255, 255, 255, 0.05);
- font-size: 18px;
- border-radius: 4px 4px 0 0;
- .icon {
- padding-right: 6px;
- }
- .close {
- position: absolute;
- right: 12px;
- top: 4px;
- }
- }
- .info-content {
- padding: 16px 20px 40px 20px;
- line-height: 26px;
- text-indent: 2em;
- }
- }
- .area-cascader {
- &.el-popper.is-light {
- background: #232323;
- border-color: rgba(255, 212, 137, 0.3);
- box-shadow: 0px 0px 12px rgba(255, 212, 137, 0.3);
- .el-cascader-menu {
- color: rgba(255, 212, 137, 0.6);
- border-color: rgba(255, 212, 137, 0.3);
- }
- .el-cascader-node.in-active-path,
- .el-cascader-node.is-active,
- .el-cascader-node.is-selectable.in-checked-path {
- color: #f7be5a;
- background: transparent;
- }
- .el-radio__input.is-checked .el-radio__inner {
- background: #f7be5a;
- border-color: #f7be5a;
- }
- .el-cascader-node:not(.is-disabled):hover,
- .el-cascader-node:not(.is-disabled):focus,
- .el-cascader-node:not(.is-disabled):hover {
- background: rgba(255, 212, 137, 0.2);
- }
- }
- .el-radio__inner {
- background-color: rgba(255, 212, 137, 0.3);
- border-color: rgba(255, 212, 137, 0.6);
- }
- &.el-popper.is-light .el-popper__arrow:before {
- background: #232323;
- border-color: rgba(255, 212, 137, 0.3);
- }
- }
- </style>
|