|
@@ -0,0 +1,199 @@
|
|
|
+<template>
|
|
|
+ <div class="container">
|
|
|
+ <van-notice-bar
|
|
|
+ v-show="noticeBarState.show"
|
|
|
+ :left-icon="noticeImg"
|
|
|
+ scrollable
|
|
|
+ background="linear-gradient(180deg, #F3F7FF 0%, #FDFEFF 100%)"
|
|
|
+ mode="closeable"
|
|
|
+ :text="noticeBarState.event_title"
|
|
|
+ class="notice"
|
|
|
+ @click="handleNoticeBar"
|
|
|
+ />
|
|
|
+ <div ref="searchBoxRef" class="search-box">
|
|
|
+ <van-search
|
|
|
+ v-model="queryParams.keywords"
|
|
|
+ class="common-search"
|
|
|
+ :left-icon="searchImg"
|
|
|
+ :right-icon="closeImg"
|
|
|
+ :clearable="false"
|
|
|
+ placeholder="请输入位置信息"
|
|
|
+ @search="onSearchKeyword"
|
|
|
+ @click-right-icon.stop="onSearchCancel"
|
|
|
+ />
|
|
|
+ <div v-show="showSearch" class="search-list">
|
|
|
+ <van-list
|
|
|
+ v-model:loading="loading"
|
|
|
+ v-model:error="error"
|
|
|
+ error-text="请求失败,点击重新加载"
|
|
|
+ :finished="finished"
|
|
|
+ finished-text="没有更多了"
|
|
|
+ :immediate-check="false"
|
|
|
+ @load="getSearchList"
|
|
|
+ >
|
|
|
+ <div
|
|
|
+ v-for="(item, index) in searchList"
|
|
|
+ :key="index"
|
|
|
+ class="item"
|
|
|
+ @click="handleClickItem(item)"
|
|
|
+ >
|
|
|
+ {{ item.name }}
|
|
|
+ </div>
|
|
|
+ </van-list>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <Map ref="mapRef" class="map" active-map="vectorgraph" :point-type="pointType" :event-details="eventDetails" />
|
|
|
+ <Chart :option="option1" style="height: 200px" />
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script lang="ts" setup name="cityEmergencyEvent">
|
|
|
+import noticeImg from "@/assets/images/notice.png";
|
|
|
+import {onMounted, reactive, ref} from "vue";
|
|
|
+import {useRouter} from "vue-router";
|
|
|
+import {getActiveEventList} from "@/api/event";
|
|
|
+import searchImg from "@/assets/images/search.png";
|
|
|
+import closeImg from "@/assets/images/close.png";
|
|
|
+import {getPointInfoComprehensiveSearch} from "@/api/globalMap";
|
|
|
+import {onClickOutside} from "@vueuse/core";
|
|
|
+import {chartOption1} from "@/views/disasterRiskMonitor/chartOptions";
|
|
|
+
|
|
|
+const router = useRouter();
|
|
|
+const noticeBarState = reactive({
|
|
|
+ show: false,
|
|
|
+ event_id: "",
|
|
|
+ event_title: ""
|
|
|
+});
|
|
|
+const handleNoticeBar = () => {
|
|
|
+
|
|
|
+};
|
|
|
+// 搜索
|
|
|
+const searchBoxRef = ref();
|
|
|
+let showSearch = ref();
|
|
|
+const total = ref(0);
|
|
|
+let loading = ref(false);
|
|
|
+let error = ref(false);
|
|
|
+let finished = ref(false);
|
|
|
+const queryParams = reactive({
|
|
|
+ page: 0,
|
|
|
+ page_size: 10,
|
|
|
+ keywords: ''
|
|
|
+});
|
|
|
+const searchList = ref([]);
|
|
|
+onClickOutside(searchBoxRef, event => {
|
|
|
+ showSearch.value = false;
|
|
|
+});
|
|
|
+const getSearchList = () => {
|
|
|
+ if (!queryParams.keywords) {
|
|
|
+ return (loading.value = false);
|
|
|
+ }
|
|
|
+ queryParams.page++;
|
|
|
+ getPointInfoComprehensiveSearch(queryParams)
|
|
|
+ .then(res => {
|
|
|
+ const items = res.data.list || [];
|
|
|
+ total.value = res.data.total;
|
|
|
+ if (queryParams.page == 1) {
|
|
|
+ searchList.value = [];
|
|
|
+ }
|
|
|
+ items.forEach(val => {
|
|
|
+ searchList.value.push(val);
|
|
|
+ });
|
|
|
+ if (queryParams.page_size * queryParams.page >= total.value) {
|
|
|
+ finished.value = true;
|
|
|
+ } else {
|
|
|
+ finished.value = false;
|
|
|
+ }
|
|
|
+ showSearch.value = true;
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ error.value = true;
|
|
|
+ finished.value = false;
|
|
|
+ })
|
|
|
+ .finally(() => {
|
|
|
+ loading.value = false;
|
|
|
+ });
|
|
|
+};
|
|
|
+const onSearchKeyword = (val) => {
|
|
|
+ queryParams.keywords = val;
|
|
|
+ queryParams.page = 0;
|
|
|
+ getSearchList();
|
|
|
+};
|
|
|
+const onSearchCancel = () => {
|
|
|
+ showSearch.value = false;
|
|
|
+ queryParams.keywords = "";
|
|
|
+ queryParams.page = 0;
|
|
|
+ finished.value = false;
|
|
|
+ searchList.value = [];
|
|
|
+};
|
|
|
+const handleClickItem = item => {
|
|
|
+ showSearch.value = false;
|
|
|
+ queryParams.keywords = "";
|
|
|
+ queryParams.page = 0;
|
|
|
+ finished.value = false;
|
|
|
+ searchList.value = [];
|
|
|
+};
|
|
|
+let pointType = ref([]);
|
|
|
+let eventDetails = ref({});
|
|
|
+const initData = () => {
|
|
|
+ // 通知栏数据
|
|
|
+ getActiveEventList().then(res => {
|
|
|
+ if (res.data.event_id != noticeBarState.event_id) {
|
|
|
+ noticeBarState.show = true;
|
|
|
+ noticeBarState.event_id = res.data.event_id;
|
|
|
+ noticeBarState.event_title = res.data.event_title;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // 菜单数据
|
|
|
+};
|
|
|
+
|
|
|
+const option1 = ref(chartOption1);
|
|
|
+
|
|
|
+onMounted(() => {
|
|
|
+ initData();
|
|
|
+});
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.container {
|
|
|
+ .map {
|
|
|
+ width: 100%;
|
|
|
+ height: 250px;
|
|
|
+ }
|
|
|
+}
|
|
|
+.search-box {
|
|
|
+ margin-bottom: 10px;
|
|
|
+}
|
|
|
+.search-list {
|
|
|
+ position: absolute;
|
|
|
+ top: 50px;
|
|
|
+ left: 0;
|
|
|
+ z-index: 9;
|
|
|
+ width: 100%;
|
|
|
+ height: calc(100vh - 400px);
|
|
|
+ overflow-y: auto;
|
|
|
+ background-color: #ffffff;
|
|
|
+ border-top: 1px solid #eeeeee;
|
|
|
+ .item {
|
|
|
+ padding: 8px 15px;
|
|
|
+ border-bottom: 1px solid #eeeeee;
|
|
|
+ }
|
|
|
+}
|
|
|
+.common-search {
|
|
|
+ border: 1px solid #ededed;
|
|
|
+ :deep(.van-field__left-icon) {
|
|
|
+ .van-icon__image {
|
|
|
+ width: 12px;
|
|
|
+ height: 12px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ :deep(.van-field__right-icon) {
|
|
|
+ width: 30px;
|
|
|
+ height: 30px;
|
|
|
+ padding: 0;
|
|
|
+ .van-icon__image {
|
|
|
+ width: 30px;
|
|
|
+ height: 30px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|