|
@@ -0,0 +1,243 @@
|
|
|
+<template>
|
|
|
+ <van-floating-panel v-model:height="height" :anchors="anchors" :content-draggable="false">
|
|
|
+ <van-tabs v-model:active="active">
|
|
|
+ <van-tab title="救援队伍">
|
|
|
+ <van-search
|
|
|
+ v-model="queryParams1.query.keyword"
|
|
|
+ class="common-search"
|
|
|
+ :left-icon="searchImg"
|
|
|
+ :right-icon="closeImg"
|
|
|
+ :clearable="false"
|
|
|
+ placeholder="请输入搜索内容"
|
|
|
+ @search="onSearchKeyword1"
|
|
|
+ @click-right-icon.stop="onSearchCancel1"
|
|
|
+ />
|
|
|
+ <van-list
|
|
|
+ v-model:loading="loading1"
|
|
|
+ v-model:error="error1"
|
|
|
+ error-text="请求失败,点击重新加载"
|
|
|
+ :finished="finished1"
|
|
|
+ finished-text="没有更多了"
|
|
|
+ :immediate-check="false"
|
|
|
+ class="list"
|
|
|
+ @load="getList"
|
|
|
+ >
|
|
|
+ <div v-for="(item, index) in dataList1" :key="index" :class="!!item.checked ? 'item item-active' : 'item'" @click="handleClickItem(item)">
|
|
|
+ <div class="text-box">
|
|
|
+ <div class="text1">{{ item.name }}</div>
|
|
|
+ <div class="text2">{{ item.address }}</div>
|
|
|
+ </div>
|
|
|
+ <i class="icon-position" />
|
|
|
+ </div>
|
|
|
+ </van-list>
|
|
|
+ </van-tab>
|
|
|
+ <van-tab title="应急物资">
|
|
|
+ <van-search
|
|
|
+ v-model="queryParams2.query.keyword"
|
|
|
+ class="common-search"
|
|
|
+ :left-icon="searchImg"
|
|
|
+ :right-icon="closeImg"
|
|
|
+ :clearable="false"
|
|
|
+ placeholder="请输入搜索内容"
|
|
|
+ @search="onSearchKeyword2"
|
|
|
+ @click-right-icon.stop="onSearchCancel2"
|
|
|
+ />
|
|
|
+ <van-list
|
|
|
+ v-model:loading="loading2"
|
|
|
+ v-model:error="error2"
|
|
|
+ error-text="请求失败,点击重新加载"
|
|
|
+ :finished="finished2"
|
|
|
+ finished-text="没有更多了"
|
|
|
+ :immediate-check="false"
|
|
|
+ class="list"
|
|
|
+ @load="getList2"
|
|
|
+ >
|
|
|
+ <div v-for="(item, index) in dataList2" :key="index" :class="!!item.checked ? 'item item-active' : 'item'" @click="handleClickItem(item)">
|
|
|
+ <div class="text-box">
|
|
|
+ <div class="text1">{{ item.name }}</div>
|
|
|
+ <div class="text2">{{ item.address }}</div>
|
|
|
+ </div>
|
|
|
+ <i class="icon-position" />
|
|
|
+ </div>
|
|
|
+ </van-list>
|
|
|
+ </van-tab>
|
|
|
+ </van-tabs>
|
|
|
+ </van-floating-panel>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script lang="ts" setup name="MaterialManage">
|
|
|
+import {computed, inject, onMounted, reactive, ref} from "vue";
|
|
|
+import searchImg from "@/assets/images/search.png";
|
|
|
+import closeImg from "@/assets/images/close.png";
|
|
|
+import {getRescueMateriaWarehouseList, getRescueUnitsList} from "@/api/globalMap";
|
|
|
+
|
|
|
+const emits = defineEmits(['update:modelValue']);
|
|
|
+const props = defineProps({
|
|
|
+ modelValue: String
|
|
|
+});
|
|
|
+const height = computed({
|
|
|
+ get() {
|
|
|
+ return props.modelValue
|
|
|
+ },
|
|
|
+ set(newValue) {
|
|
|
+ emits('update:modelValue', newValue);
|
|
|
+ }
|
|
|
+});
|
|
|
+const getMapUtils = inject('getMapUtils');
|
|
|
+const anchors = ref([0, 300, window.innerHeight * 0.6, window.innerHeight * 0.95]);
|
|
|
+let markers = ref([]);
|
|
|
+let active = ref('1');
|
|
|
+const queryParams1 = reactive({
|
|
|
+ current: 0,
|
|
|
+ size: 15,
|
|
|
+ query: {
|
|
|
+ keyword: ''
|
|
|
+ }
|
|
|
+});
|
|
|
+const total1 = ref(0);
|
|
|
+let loading1 = ref(false);
|
|
|
+let error1 = ref(false);
|
|
|
+let finished1 = ref(false);
|
|
|
+let dataList1 = ref([]);
|
|
|
+const onSearchKeyword1 = (val) => {
|
|
|
+ queryParams1.query.keyword = val;
|
|
|
+ queryParams1.current = 0;
|
|
|
+ getList();
|
|
|
+};
|
|
|
+const onSearchCancel1 = () => {
|
|
|
+ queryParams1.query.keyword = '';
|
|
|
+ queryParams1.current = 0;
|
|
|
+ getList();
|
|
|
+}
|
|
|
+const getList = () => {
|
|
|
+ queryParams1.current++;
|
|
|
+ getRescueUnitsList(queryParams1).then((res: any) => {
|
|
|
+ const items = res.rows || [];
|
|
|
+ total1.value = res.total;
|
|
|
+ if (queryParams1.current == 1) {
|
|
|
+ dataList1.value = [];
|
|
|
+ }
|
|
|
+ items.forEach((val) => {
|
|
|
+ dataList1.value.push(val);
|
|
|
+ });
|
|
|
+ if (queryParams1.size * queryParams1.current >= total1.value) {
|
|
|
+ finished1.value = true;
|
|
|
+ } else {
|
|
|
+ finished1.value = false;
|
|
|
+ }
|
|
|
+ })
|
|
|
+};
|
|
|
+
|
|
|
+const queryParams2 = reactive({
|
|
|
+ current: 0,
|
|
|
+ size: 15,
|
|
|
+ query: {
|
|
|
+ keyword: ''
|
|
|
+ }
|
|
|
+});
|
|
|
+const total2 = ref(0);
|
|
|
+let loading2 = ref(false);
|
|
|
+let error2 = ref(false);
|
|
|
+let finished2 = ref(false);
|
|
|
+let dataList2 = ref([]);
|
|
|
+const onSearchKeyword2 = (val) => {
|
|
|
+ queryParams1.query.keyword = val;
|
|
|
+ queryParams1.current = 0;
|
|
|
+ getList2();
|
|
|
+};
|
|
|
+const onSearchCancel2 = () => {
|
|
|
+ queryParams1.query.keyword = '';
|
|
|
+ queryParams1.current = 0;
|
|
|
+ getList2();
|
|
|
+}
|
|
|
+const getList2 = () => {
|
|
|
+ queryParams2.current++;
|
|
|
+ getRescueMateriaWarehouseList(queryParams2).then((res: any) => {
|
|
|
+ const items = res.rows || [];
|
|
|
+ total2.value = res.total;
|
|
|
+ if (queryParams2.current == 1) {
|
|
|
+ dataList2.value = [];
|
|
|
+ }
|
|
|
+ items.forEach((val) => {
|
|
|
+ dataList2.value.push(val);
|
|
|
+ });
|
|
|
+ if (queryParams2.size * queryParams2.current >= total2.value) {
|
|
|
+ finished2.value = true;
|
|
|
+ } else {
|
|
|
+ finished2.value = false;
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
+const handleClickItem = (item) => {
|
|
|
+ item.checked = !item.checked;
|
|
|
+ let points = [];
|
|
|
+ dataList1.value.forEach((item2) => {
|
|
|
+ if (!!item2.checked) {
|
|
|
+ points.push({
|
|
|
+ icon: 'https://webapi.amap.com/theme/v1.3/markers/n/mark_b.png',
|
|
|
+ image: 'https://webapi.amap.com/theme/v1.3/markers/n/mark_b.png',
|
|
|
+ imageHover: 'https://webapi.amap.com/theme/v1.3/markers/n/mark_b.png',
|
|
|
+ size: [19, 31],
|
|
|
+ lnglat: [item2.longitude, item2.latitude],
|
|
|
+ longitude: item2.longitude,
|
|
|
+ latitude: item2.latitude
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ dataList2.value.forEach((item2) => {
|
|
|
+ if (!!item2.checked) {
|
|
|
+ points.push({
|
|
|
+ icon: 'https://webapi.amap.com/theme/v1.3/markers/n/mark_b.png',
|
|
|
+ image: 'https://webapi.amap.com/theme/v1.3/markers/n/mark_b.png',
|
|
|
+ imageHover: 'https://webapi.amap.com/theme/v1.3/markers/n/mark_b.png',
|
|
|
+ size: [19, 31],
|
|
|
+ lnglat: [item2.longitude, item2.latitude],
|
|
|
+ longitude: item2.longitude,
|
|
|
+ latitude: item2.latitude
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ getMapUtils().addMarker(points);
|
|
|
+}
|
|
|
+onMounted(() => {
|
|
|
+ getList();
|
|
|
+ getList2();
|
|
|
+})
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.list {
|
|
|
+ padding: 0 10px;
|
|
|
+ .item {
|
|
|
+ padding: 10px;
|
|
|
+ background: #f8f9fc;
|
|
|
+ margin-top: 10px;
|
|
|
+ border-radius: 4px;
|
|
|
+ border: 1px solid #f8f9fc;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ align-items: center;
|
|
|
+ .text-box {
|
|
|
+ .text1 {
|
|
|
+ font-size: 16px;
|
|
|
+ font-weight: bold;
|
|
|
+ }
|
|
|
+ .text2 {
|
|
|
+ font-size: 14px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .icon-position {
|
|
|
+ display: inline-block;
|
|
|
+ width: 20px;
|
|
|
+ height: 20px;
|
|
|
+ background: url('@/assets/images/map/position1.png') no-repeat;
|
|
|
+ background-size: 100% 100%;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .item-active {
|
|
|
+ background-color: #f2fcfd;
|
|
|
+ border: 1px solid #cef0f5;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+</style>
|