update 优化地图工具方法,调整地图样式

This commit is contained in:
zk
2024-06-14 18:11:09 +08:00
parent 83f768a4a0
commit 14c50baeed
24 changed files with 1312 additions and 178 deletions
+8 -1
View File
@@ -31,9 +31,10 @@
import { onMounted, ref, watch } from 'vue';
import PublicTitle from '/@/components/publicTitle.vue';
import { list } from '/@/components/body-d-left/left.api';
import { allValueEmpty, timeTab, useSpin, useStatistics } from '/@/components/body-d-left/bodyLeftHooks.ts';
import { timeTab, useSpin, useStatistics } from '/@/components/body-d-left/bodyLeftHooks.ts';
import { useDetailStore } from '/@/store/modules/detailData.ts';
import { useSession, caching } from '/@/hooks/autoRefresh/caching.ts';
import { setTheme } from '/@/assets/theme/themeList.ts';
const { LEFT_KEY1 } = caching;
const props = defineProps({
@@ -43,6 +44,9 @@
setting: {
type: Object,
},
theme: {
type: String,
},
});
const emit = defineEmits(['handleClick']);
const typeTime = ref(timeTab);
@@ -53,6 +57,9 @@
onMounted(() => {
getList();
if (props.theme) {
setTheme(props.theme);
}
});
const useDetail = useDetailStore();
-45
View File
@@ -182,48 +182,3 @@
}
}
</style>
<style lang="less">
.ant-select-dropdown {
background-color: #00152b !important;
border-right: 1px solid #1b7ef2;
border-left: 1px solid #1b7ef2;
border-bottom: 1px solid #1b7ef2;
}
.ant-select-item {
color: #1b7ef2 !important;
}
//框背景色
.ant-select:not(.ant-select-customize-input) .ant-select-selector {
color: #1b7ef2;
background-color: transparent !important;
border: 1px solid #1b7ef2 !important;
}
.ant-select-item-option-selected {
color: #ffffff !important;
}
// 选中字体颜色
.ant-select-selection-item {
color: #1b7ef2 !important;
}
.ant-select-item-option-active {
background-color: transparent !important;
}
.ant-select-item-option-active:hover {
background-color: #002e64 !important;
}
// 箭头颜色
.ant-select-arrow {
color: #1b7ef2 !important;
}
.ant-select-item-option-selected:not(.ant-select-item-option-disabled) {
background-color: #002e64 !important;
}
</style>
+7 -12
View File
@@ -20,7 +20,7 @@
</div>
<Dialog :openVis="openInfor" width="30%" title="健康报警员工信息" @close="handlePoliceClose">
<template #container>
<div class="police-con">
<div class="police-con" :class="[themeType]">
<div class="con-item">
<span>姓名</span>
<span>{{ userInfo?.realName }}</span>
@@ -61,10 +61,12 @@
import { Map } from '/@/assets/mapUtils/map.ts';
import { caching, useSession } from '/@/hooks/autoRefresh/caching.ts';
import { DataType } from '/@/utils/settings.ts';
import { useTheme } from '/@/hooks/theme/useTheme.ts';
const props = defineProps({
setting: Object,
});
const { themeType } = useTheme();
const emit = defineEmits(['emit-view-detail']);
const router = useRouter();
const { setSession, getSession } = useSession();
@@ -82,6 +84,9 @@
warnTime: '',
address: '',
});
onMounted(() => {
getScrollList();
});
/**
* @desc open员工信息
@@ -100,10 +105,6 @@
classOption.value.step = 0.3;
}
onMounted(() => {
getScrollList();
});
/**
* @desc 终端报警
* */
@@ -209,8 +210,6 @@
}
.police-con {
color: #ffffff;
background-color: #00152b;
padding: 2% 0 2% 5%;
.con-item {
@@ -232,11 +231,7 @@
<style lang="less">
.dialog-con {
background-color: #00152b;
//border: 1px solid #129bff;
/*
antd表格样式
*/
// antd表格样式
.ant-table-thead > tr > th {
//border-bottom: 1px solid #1e73c2 !important;
}
+10 -1
View File
@@ -16,7 +16,7 @@
</a-form-item>
<a-form-item>
<a-button class="reset-btn" @click="removeInput">清空</a-button>
<a-button class="search-btn" @click="searchRoute">路线规划</a-button>
<a-button class="search-btn" @click="searchRoute" :loading="searchFlag" :disabled="searchFlag"> 路线规划 </a-button>
</a-form-item>
</a-form>
<div v-show="showRoutePanel" v-click-outside="outClick" class="line-container">
@@ -221,11 +221,15 @@
panelTitle.value = str;
}
let searchFlag = ref(false);
/**
* @desc 路线规划
* @param callback
*/
function searchRoute(callback: ((this: MediaQueryList, ev: MediaQueryListEvent) => any) | null) {
searchFlag.value = true;
showRoutePanel.value = false;
panelTitle.value = '';
if (!formState.value.start) {
@@ -249,13 +253,18 @@
driving.search([{ keyword: formState.value.start }, { keyword: formState.value.end }], function (status, result) {
// result 即是对应的驾车导航信息,相关数据结构文档请参考 https://lbs.amap.com/api/javascript-api/reference/route-search#m_DrivingResult
if (status === 'complete') {
searchFlag.value = false;
// console.log('绘制驾车路线完成');
} else {
searchFlag.value = false;
// console.log('获取驾车数据失败:' + result);
}
});
AMap.Event.addListener(driving, 'complete', (res) => {
const data = JSON.parse(JSON.stringify(res));
searchFlag.value = false;
if (data.info == 'OK') {
const { routes } = data;
setTitle(routes[0]);
+67 -3
View File
@@ -1,12 +1,21 @@
<template>
<a-modal class="dialog" v-model:visible="props.openVis" :title="props.title" :width="props.width" :maskClosable="true" @cancel="handleCancel">
<a-modal
:class="[themeType == ThemeType.dark ? 'dialog-dark' : 'dialog-light']"
v-model:visible="props.openVis"
:title="props.title"
:width="props.width"
:maskClosable="true"
@cancel="handleCancel"
>
<slot name="container"></slot>
<template #footer></template>
</a-modal>
</template>
<script setup lang="ts">
import { defineProps, defineEmits } from 'vue';
import { onMounted, ref } from 'vue';
import { useUserStore } from '/@/store/modules/user.ts';
import { ThemeType } from '/@/utils/settings.ts';
const emit = defineEmits(['close']);
const props = defineProps({
@@ -20,6 +29,11 @@
type: String,
},
});
const store = useUserStore();
const themeType = ref('');
onMounted(() => {
themeType.value = store.getThemeType;
});
function handleCancel() {
emit('close');
@@ -27,7 +41,7 @@
</script>
<style lang="less">
.dialog {
.dialog-dark {
border: 1px solid #0a50a0;
background-color: #00152b;
@@ -53,6 +67,56 @@
.ant-modal-header,
.ant-modal-content {
background-color: transparent !important;
box-shadow: none;
}
.ant-modal-body {
padding: 0 !important;
}
.ant-modal-close-x,
.anticon {
color: #999999 !important;
height: 40px;
line-height: 40px;
}
.ant-modal-footer {
border-top: none !important;
}
.ant-modal-wrap {
//background-color: rgba(0, 0, 0, 0.6);
}
}
.dialog-light {
border: 1px solid #0a50a0;
background-color: #fff;
.ant-modal-title {
position: relative;
display: flex;
align-items: center;
width: 100%;
height: 40px;
background: url('../../assets/images/dialog.png') no-repeat;
background-size: 100% 100%;
color: #ffffff !important;
padding-left: 2%;
font-size: 18px;
font-weight: bold;
}
.ant-modal-header {
padding: 0 !important;
border-bottom: none;
}
.ant-modal-header,
.ant-modal-content {
background-color: transparent !important;
box-shadow: none;
}
.ant-modal-body {
@@ -0,0 +1,120 @@
<template>
<div class="route-panel">
<div v-show="drivingRoute.length" class="has-data">
<div class="line-title">
<div>{{ drivingTitle }}</div>
<div class="close-icon">
<CloseCircleOutlined style="font-size: 16px" @click="outClick" />
</div>
</div>
<div class="line-content">
<div class="start">起点</div>
<div class="line-body">
<div class="line"></div>
<div class="line-desc">
<p v-for="(item, i) in drivingRoute" :key="i">{{ item }}</p>
</div>
</div>
<div class="end">终点</div>
</div>
</div>
<div v-show="!drivingRoute.length" class="empty-data"> 暂无数据</div>
</div>
</template>
<script setup lang="ts">
import { CloseCircleOutlined } from '@ant-design/icons-vue';
const props = defineProps({
drivingRoute: {
type: Array,
default: () => [],
},
drivingTitle: {
type: String,
default: '',
},
});
const emit = defineEmits(['outClick']);
function outClick() {
emit('outClick', false);
}
</script>
<style scoped lang="less">
.route-panel {
.line-title {
position: relative;
margin-bottom: 9px;
font-size: 14px;
font-weight: 700;
color: rgba(255, 255, 255, 0.8);
.close-icon {
position: absolute;
top: 1px;
right: -13px;
}
}
.line-content {
font-size: 12px;
.start {
display: flex;
align-items: center;
&::before {
content: '起';
color: #fff;
width: 20px;
height: 20px;
margin-right: 7px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
background: #1478f5;
}
}
.end {
display: flex;
align-items: center;
&::before {
content: '终';
color: #fff;
width: 20px;
height: 20px;
margin-right: 7px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
background: #1478f5;
}
}
.line-body {
display: flex;
//max-height: 370px;
}
.line {
width: 1px;
//max-height: 370px;
background-color: #1478f5;
margin: 5px 19px 5px 8px;
}
.line-sesc {
flex: 1;
}
}
.empty-data {
margin-top: 30%;
text-align: center;
}
}
</style>
+631
View File
@@ -0,0 +1,631 @@
<template>
<div class="center-map">
<div class="xian-map-box">
<div class="tab-list">
<div v-for="(item, i) in list" :class="[currentIndex == i ? 'active' : '']" class="tab" @click="changeTab(item, i)">
{{ item.name }}
</div>
</div>
<div v-show="currentIndex == list.length - 1" class="route-navigation">
<a-form :model="formState" layout="inline">
<a-form-item class="form-item-self" label="起点">
<a-input v-model:value="formState.start" placeholder="请输入起点"></a-input>
</a-form-item>
<a-form-item class="form-item-self" label="终点">
<a-input v-model:value="formState.end" placeholder="请输入终点"></a-input>
</a-form-item>
<a-form-item>
<a-button class="reset-btn" @click="removeInput">清空</a-button>
<a-button class="search-btn" @click="searchRoute" :loading="searchFlag" :disabled="searchFlag"> 路线规划 </a-button>
</a-form-item>
</a-form>
<div v-show="showRoutePanel" v-click-outside="outClick" class="line-container">
<div v-show="routeList.length" class="has-data">
<div class="line-title"> {{ panelTitle }}</div>
<div class="line-content">
<div class="start">起点</div>
<div class="line-body">
<div class="line"></div>
<div class="line-desc">
<p v-for="(item, i) in routeList" :key="i">{{ item }}</p>
</div>
</div>
<div class="end">终点</div>
</div>
</div>
<div v-show="!routeList.length" class="empty-data"> 暂无数据</div>
</div>
</div>
<div v-show="showHospitalList" class="reset-map" @click="resetMap">
<RedoOutlined title="重置地图" />
</div>
<RoutePanel
class="driving-route-panel"
v-show="showDrivingPanel"
:drivingRoute="drivingRoute"
:drivingTitle="drivingTitle"
@out-click="showDrivingPanel = false"
/>
<div style="flex: 1; overflow: hidden; margin: 0 0 10px">
<div id="xianmapContainer" class="xianmapContainer"></div>
</div>
<div v-show="false" id="container"></div>
<div v-show="false" id="panel"></div>
<div class="map-legend">
<div v-for="(item, i) in legendList" :key="i" class="legend-item">
<div><img :src="item.img" alt="" class="legend-img" /> {{ item.text }}</div>
</div>
</div>
<!-- <div class="level">地图层级{{ level }}</div>-->
</div>
<div class="center-footer" v-if="showFooter">
<div class="count-item">
<div class="num">{{ useDetail?.alerdyreceive || '0' }}</div>
<div class="text">累计受理</div>
</div>
<div class="count-item">
<div class="num">{{ useDetail?.totalacceptance || '0' }}</div>
<div class="text">累计处置</div>
</div>
</div>
<!-- 附近医院医疗点 -->
<div class="hospital-list" v-if="showHospitalList">
<div class="hospital-item" v-for="(item, index) in hospitalList" :key="index" @click="showDrivingLine(item)">
<div>{{ item.name }}</div>
<div>相距{{ item.distance }}</div>
<div>驾车大约{{ item.driveTime }}</div>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import { nextTick, onMounted, ref } from 'vue';
import { message } from 'ant-design-vue';
import { RedoOutlined } from '@ant-design/icons-vue';
import { Map } from '/@/assets/mapUtils/map';
import { aircraft, getKmStr, getTimeStr, legendList, mapApiSwitch, tabList, TabType } from '/@/components/xianMap/xianMapHooks.ts';
import { useDetailStore } from '/@/store/modules/detailData.ts';
import RoutePanel from '/@/components/xianMap/components/routePanel.vue';
import { innerLineLight, outerLineOption } from '/@/assets/mapUtils/mapConstant.ts';
const props = defineProps({
//是否展示底部统计
showFooter: {
type: Boolean,
default: () => {
return true;
},
},
//地图是否按照接口数据的中心点定位
computedCenter: {
type: Boolean,
default: () => {
return true;
},
},
// 地图配置
mapOptions: {
type: Object,
default: () => {
return {};
},
},
//是否展示最近的三个医院
showHospitalList: {
type: Boolean,
default: () => {
return false;
},
},
hospitalList: {
type: Array,
default: () => {
return [];
},
},
});
const emits = defineEmits(['clearHospitalList']);
const useDetail = useDetailStore();
const formState = ref({
start: '',
end: '',
});
const list = ref(tabList);
const currentIndex = ref(0);
function changeTab(item, i: number) {
currentIndex.value = i; // 地方医院
Map.clearActiveHospital();
closeDrivingElement();
Map.map.off('moveend', logMapinfo);
if (TabType.diFangYiYuan == item.type) {
let { lng, lat } = Map.getMapCenter();
Map.getAddressByPoint([lng, lat]).then((text, data) => {
console.log('data', data, data.citycode);
});
Map.removeOverlayGroup();
Map.map.on('moveend', logMapinfo);
return;
}
if (TabType.zhiShengJi == item.type) {
Map.createAircraft(aircraft);
return;
} else {
getMapData(item.type, { type: item.type });
}
}
const currentCityCode = ref('');
function logMapinfo() {
Map.map.getCity(function (info) {
const { citycode } = info;
if (currentCityCode.value != citycode) {
Map.createActiveHospital(citycode);
currentCityCode.value = citycode;
}
});
}
const level = ref(0);
function setLevel() {
//获取当前地图级别
level.value = Map.map.getZoom();
}
async function getMapData(type, params = {}) {
try {
const { code, result } = await mapApiSwitch(type, params);
if (code == 200) {
if (Array.isArray(result) && result.length > 0) {
Map.createOverlay(
result,
{
content: (val) => {
return `<div style="
width: 21px;
height: 44px;
position: absolute;
left: -20px;
top: -20px;" title="${val?.name}">
</div>`;
},
},
() => {},
props.computedCenter
);
} else {
Map.removeOverlayGroup();
}
}
} catch (e) {
console.warn(e);
}
}
onMounted(() => {
const op = { el: 'xianmapContainer', option: props.mapOptions, innerLineOption: innerLineLight, outerLineOption: outerLineOption };
Map.initMap(op).then(() => {
getMapData(tabList[0].type);
Map.map && Map.map.on('zoomend', setLevel);
Map.map && Map.map.on('zoomend', setLevel);
});
});
const routeList = ref([]);
const showRoutePanel = ref(false);
const panelTitle = ref();
function outClick() {
showRoutePanel.value = false;
}
function setTitle({ time, distance }) {
let str = '全程';
str += getTimeStr(time);
str += getKmStr(distance);
panelTitle.value = str;
}
let searchFlag = ref(false);
/**
* @desc 路线规划
* @param callback
*/
function searchRoute(callback: ((this: MediaQueryList, ev: MediaQueryListEvent) => any) | null) {
console.log('search.....');
showRoutePanel.value = false;
panelTitle.value = '';
if (!formState.value.start) {
return message.warn('请输入起点');
}
if (!formState.value.end) {
return message.warn('请输入终点');
}
searchFlag.value = true;
//基本地图加载
let map = new AMap.Map('container', {
resizeEnable: true,
center: [116.397428, 39.90923], //地图中心点
zoom: 13, //地图显示的缩放级别
});
//构造路线导航类
let driving = new AMap.Driving({
map: map,
panel: 'panel',
});
// 根据起终点名称规划驾车导航路线
driving.search([{ keyword: formState.value.start }, { keyword: formState.value.end }], function (status, result) {
// result 即是对应的驾车导航信息,相关数据结构文档请参考 https://lbs.amap.com/api/javascript-api/reference/route-search#m_DrivingResult
if (status === 'complete') {
// console.log('绘制驾车路线完成');
searchFlag.value = false;
} else {
console.log('获取驾车数据失败:', result);
searchFlag.value = false;
}
});
AMap.Event.addListener(driving, 'complete', (res) => {
const data = JSON.parse(JSON.stringify(res));
searchFlag.value = false;
console.log('查询结果', data);
if (data.info == 'OK') {
const { routes } = data;
setTitle(routes[0]);
let arr = [];
arr.push(data.originName);
routes[0].steps.map((item: any) => {
arr.push(item.instruction);
});
arr.push(data.destinationName);
showRoutePanel.value = true;
routeList.value = arr;
}
});
}
function removeInput() {
formState.value.start = '';
formState.value.end = '';
}
// 驾车路线
const drivingRoute = ref([]);
const drivingTitle = ref('');
const showDrivingPanel = ref(false);
function showDrivingLine(item) {
nextTick(() => {
drivingTitle.value = '全程' + item.driveTime + item.distance;
drivingRoute.value = item.routeList?.map((item) => item?.instruction);
showDrivingPanel.value = true;
if (item.lon) {
Map.clearNaviLine();
Map.createNaviLine(item.userLocation, [item.lon, item.lat]);
}
});
}
function closeDrivingElement() {
Map.clearNavigationElements();
formState.value.start = '';
formState.value.end = '';
showDrivingPanel.value = false;
emits('clearHospitalList');
}
function resetMap() {
closeDrivingElement();
changeTab(list.value[currentIndex.value], currentIndex.value);
}
</script>
<style lang="less" scoped>
.center-map {
flex: 1;
color: #fff;
display: flex;
flex-direction: column;
align-content: space-between;
position: relative;
.xian-map-box {
flex: 1;
display: flex;
flex-direction: column;
position: relative;
}
.tab-list {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
font-size: 16px;
.tab {
width: calc(100% / 8);
height: 40px;
display: flex;
justify-content: center;
align-items: center;
color: #29f1fa;
background: url('/@/assets/img/tab-default.png') no-repeat;
background-size: 100% 100%;
cursor: pointer;
transition: all 0.3s;
&.active {
color: #fff;
background: url('/@/assets/img/tab-active.png') no-repeat;
background-size: 100% 100%;
}
}
}
.route-navigation {
margin: 12px 0;
width: 100%;
height: 46px;
display: flex;
align-items: center;
justify-content: center;
background: #002e64;
border-radius: 6px;
position: absolute;
top: 36px;
z-index: 999;
transition: all 0.3s;
:deep(.form-item-self) {
label {
color: #29f1fa;
}
.ant-input {
width: 280px;
color: #d6d9e0;
background: #2a4164;
border-radius: 2px 2px 2px 2px;
border: 1px solid #1b7ef2;
}
}
.reset-btn {
width: 64px;
height: 32px;
border-radius: 5px;
color: #45a2ff;
background: #002e64;
border: 1px solid #45a2ff;
}
.search-btn {
margin-left: 10px;
width: 100px;
height: 32px;
color: #efefef;
background: #45a2ff;
border-radius: 5px;
border-color: #45a2ff;
}
.line-container {
position: absolute;
right: 0;
top: 54px;
width: 288px;
padding: 9px 18px;
min-height: 200px;
max-height: 473px;
overflow: auto;
background: #2a4164;
border-radius: 2px;
border: 1px solid #1b7ef2;
.line-title {
margin-bottom: 9px;
font-size: 14px;
font-weight: 700;
color: rgba(255, 255, 255, 0.8);
}
.line-content {
font-size: 12px;
.start {
display: flex;
align-items: center;
&::before {
content: '起';
color: #fff;
width: 20px;
height: 20px;
margin-right: 7px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
background: #1478f5;
}
}
.end {
display: flex;
align-items: center;
&::before {
content: '终';
color: #fff;
width: 20px;
height: 20px;
margin-right: 7px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
background: #1478f5;
}
}
.line-body {
display: flex;
//max-height: 370px;
}
.line {
width: 1px;
//max-height: 370px;
background-color: #1478f5;
margin: 5px 19px 5px 8px;
}
.line-sesc {
flex: 1;
}
}
.empty-data {
margin-top: 30%;
text-align: center;
}
}
}
.reset-map {
position: absolute;
left: 0;
top: 50px;
z-index: 99;
font-size: 20px;
color: #05d5ff;
cursor: pointer;
background: #243b5d;
padding: 0px 6px;
}
//驾驶路线导航面板
.driving-route-panel {
position: absolute;
right: 0;
top: 86px;
width: 288px;
padding: 9px 18px;
min-height: 200px;
max-height: 473px;
overflow: auto;
background: #2a4164;
border-radius: 2px;
border: 1px solid #1b7ef2;
z-index: 99;
}
.xianmapContainer {
flex: 1;
height: calc(100% + 22px);
margin: 10px 0;
}
.map-legend {
position: absolute;
bottom: 20px;
left: 10px;
padding: 0 20px 0 10px;
display: flex;
border-radius: 6px;
flex-direction: column;
background-color: #fff;
box-shadow:
0 3px 6px -4px #0000001f,
0 6px 16px #00000014,
0 9px 28px 8px #0000000d;
.legend-item {
width: 100%;
font-size: 12px;
font-weight: 400;
line-height: 30px;
color: #000;
.legend-img {
width: 20px;
}
}
}
.level {
position: absolute;
top: 50px;
left: 400px;
font-size: 18px;
color: #fff;
}
.center-footer {
position: absolute;
left: 50%;
bottom: 20px;
transform: translateX(-50%);
display: flex;
justify-content: center;
margin-bottom: 10px;
gap: 20px;
.count-item {
width: 340px;
height: 80px;
display: flex;
color: #ffffff;
flex-direction: column;
align-items: center;
justify-content: center;
background: #00071b;
box-shadow: inset 0 0 40px 0 #1b7ef2;
border-radius: 4px;
.num {
font-size: 24px;
font-weight: 700;
}
.text {
font-size: 16px;
font-weight: 400;
}
}
}
.hospital-list {
position: absolute;
bottom: 200px;
width: 800px;
left: 50%;
transform: translateX(-50%);
display: flex;
.hospital-item {
position: relative;
flex: 1;
gap: 20px;
min-width: 230px;
max-width: 230px;
height: 110px;
text-align: center;
padding: 10px;
margin: 0 10px;
color: #fff;
font-size: 16px;
background-color: #00152b;
border: 1px solid #1b7ef2;
border-radius: 12px;
box-shadow: 0 1px 11px 0 rgba(194, 189, 189, 0.5);
cursor: pointer;
}
.hospital-item:hover {
background-color: #192a46;
box-shadow: inset 0px 0px 16px 3px #2562a9;
}
}
}
</style>
+11
View File
@@ -0,0 +1,11 @@
import { get } from '/@/api/request.ts';
export enum Api {
allList = '/health-emergency/emergency/tblAmbulanceGps/getAllList',
getAmbulanceList = '/health-emergency/emergency/tblAmbulanceGps/getAmbulanceList',
}
// 获取所有资源
export const getAllList = (params) => get(Api.allList, params);
//获取救护车GPS信息
export const getAmbulanceList = (params) => get(Api.getAmbulanceList, params);
+175
View File
@@ -0,0 +1,175 @@
import { getAllList, getAmbulanceList } from '/@/components/xianMap/xianMapApi.ts';
export enum TabType {
all = '', //所有资源
youTianYiYuan = '1', //油田医院
heZuoYiYuan = '2', //合作医院
yiLiaoDian = '3', //医疗点
jiuHuChe = '5', //救护车
zhiShengJi = '4', //直升机
diFangYiYuan = '6', //地方医院
}
export const tabList = [
{
name: '所有资源',
type: TabType.all,
},
{
name: '油田医院',
type: TabType.youTianYiYuan,
},
{
name: '医疗点',
type: TabType.yiLiaoDian,
},
{
name: '救护车',
type: TabType.jiuHuChe,
},
{
name: '合作医院',
type: TabType.heZuoYiYuan,
},
{
name: '地方医院',
type: TabType.diFangYiYuan,
},
// {
// name: '直升机',
// type: TabType.zhiShengJi,
// },
{
name: '急救路线',
},
];
export const helicopter = new URL('/@/assets/img/helicopter.png', import.meta.url).href;
export const mapbg = new URL('/@/assets/img/helicopter.png', import.meta.url).href;
export const alarmIcon = new URL('/@/assets/img/alarm-icon.png', import.meta.url).href;
export const male = new URL('/@/assets/img/male.png', import.meta.url).href;
export const female = new URL('/@/assets/img/female.png', import.meta.url).href;
// 直升机位置数据
export const aircraft = [
{
category: 3,
lon: '108.861377',
lat: '34.35965',
img: helicopter,
name: '直升机',
},
{
category: 3,
lon: '106.267358',
lat: '38.520079',
img: helicopter,
name: '直升机',
},
{
category: 3,
lon: '109.505282',
lat: '36.579381',
img: helicopter,
name: '直升机',
},
{
category: 3,
lon: '107.638372',
lat: '35.734218',
img: helicopter,
name: '直升机',
},
];
/**
* @desc 直升机文本
*/
export function aircraftContent() {
return `
<div style="display: flex;justify-content: center;align-items: center;">
<div>
<div style="display: flex;justify-content: center;">
<div class="helicopter"></div>
</div>
<div style="z-index:999;background-color:#0A8B18;">
<h5 style="overflow: hidden;font-size:18px;color:#fff;white-space: nowrap;padding:0 4px;">
4009-120-999
</h5>
</div>
</div>
</div>`;
}
export function mapApiSwitch(type, params: any) {
const basicParams = {
lat: 34, //纬度34
lon: 108, //经度
};
// 全部 油田 医疗点 合作医院
if ([TabType.all, TabType.youTianYiYuan, TabType.yiLiaoDian, TabType.heZuoYiYuan, TabType.jiuHuChe, TabType.jiuHuChe].includes(type)) {
return getAllList({ ...basicParams, ...params });
}
// if ([TabType.jiuHuChe].includes(type)) {
// return getAmbulanceList({});
// }
}
export const mapIcon1 = new URL('/@/assets/img/mapIcon1.png', import.meta.url).href;
export const mapIcon2 = new URL('/@/assets/img/mapIcon2.png', import.meta.url).href;
export const mapIcon3 = new URL('/@/assets/img/mapIcon3.png', import.meta.url).href;
export const mapIcon4 = new URL('/@/assets/img/mapIcon4.png', import.meta.url).href;
export const mapIcon5 = new URL('/@/assets/img/mapIcon5.png', import.meta.url).href;
export const mapIcon6 = new URL('/@/assets/img/mapIcon6.png', import.meta.url).href;
export const legend1 = new URL('/@/assets/img/legend1.png', import.meta.url).href;
export const legend2 = new URL('/@/assets/img/legend2.png', import.meta.url).href;
export const legend3 = new URL('/@/assets/img/legend3.png', import.meta.url).href;
export const legend4 = new URL('/@/assets/img/legend4.png', import.meta.url).href;
export const legend5 = new URL('/@/assets/img/legend5.png', import.meta.url).href;
export const legend6 = new URL('/@/assets/img/legend6.png', import.meta.url).href;
export const legendList = [
{ img: legend1, text: '油田医院' },
{ img: legend2, text: '医疗点' },
{ img: legend3, text: '救护车' },
{ img: legend4, text: '合作医院' },
{ img: legend5, text: '地方医院' },
// { img: legend6, text: '直升机' },
];
/**
* @description 秒转小时
* */
export function convertSeconds(seconds: number) {
let hours = Math.floor(seconds / 3600);
let minutes = Math.floor((seconds % 3600) / 60);
let remainingSeconds = seconds % 60;
return {
hours: hours,
minutes: minutes,
seconds: remainingSeconds,
};
}
export function getTimeStr(time: number): string {
let str = '';
const { hours, minutes } = convertSeconds(time);
if (hours) {
str += hours + '小时';
}
if (minutes) {
str += minutes + '分钟';
}
return str;
}
export function convertMetersToKilometers(meters: number): number {
let kilometers = meters / 1000;
return Math.round(kilometers * 100) / 100;
}
export function getKmStr(distance: number): string {
if (!distance) return '';
let d = convertMetersToKilometers(distance);
return d >= 1 ? d + '公里' : d * 100 + '米';
}