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
+1 -1
View File
@@ -12,4 +12,4 @@
const locle = zhCN;
</script>
<style lang="less" src="./assets/less/index.less"></style>
<style lang="less" scoped></style>
<style src="./assets/theme/theme.css"></style>
+72 -72
View File
@@ -1,159 +1,159 @@
@import "./amap-item";
@import "./themeType";
.type-time {
padding-right: 4%;
padding-top: 3%;
font-size: 16px;
display: flex;
justify-content: right;
padding-right: 4%;
padding-top: 3%;
font-size: 16px;
display: flex;
justify-content: right;
span {
padding: 0 2%;
cursor: pointer;
span {
padding: 0 2%;
cursor: pointer;
}
.select {
color: var(--typeTimeSelectColor);
position: relative;
&:after {
content: '';
position: absolute;
display: block;
width: 72%;
left: 6px;
bottom: -12px;
height: 6px;
background: url('/@/assets/images/light.png') no-repeat;
background-size: 100% 100%;
}
}
.select {
color: #45a2ff;
position: relative;
&:after {
content: '';
position: absolute;
display: block;
width: 72%;
left: 6px;
bottom: -12px;
height: 6px;
background: url('/@/assets/images/light.png') no-repeat;
background-size: 100% 100%;
}
}
.unSelect {
color: #a3a4a4;
}
.unSelect {
color: var(--typeTimeUnSelectColor);
}
}
*::-webkit-scrollbar {
width: 12px;
height: 12px;
width: 12px;
height: 12px;
}
*::-webkit-scrollbar-button {
width: 0;
height: 0;
display: none;
width: 0;
height: 0;
display: none;
}
*::-webkit-scrollbar-corner {
background-color: transparent;
background-color: transparent;
}
*::-webkit-scrollbar-thumb {
border: 4px solid rgba(0, 0, 0, 0);
height: 6px;
border-radius: 25px;
background-clip: padding-box;
background-color: rgba(0, 0, 0, 0.3);
border: 4px solid rgba(0, 0, 0, 0);
height: 6px;
border-radius: 25px;
background-clip: padding-box;
background-color: rgba(0, 0, 0, 0.3);
}
.nowrap {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.ant-modal-mask {
background-color: rgba(0, 0, 0, 0.65) !important;
background-color: rgba(0, 0, 0, 0.65) !important;
}
// 下拉框样式-start
.ant-select.bg-000 {
color: #fff !important;
background-color: #000;
color: #fff !important;
background-color: #000;
}
.ant-select-dropdown {
background-color: #00152b !important;
border-right: 1px solid #1b7ef2;
border-left: 1px solid #1b7ef2;
border-bottom: 1px solid #1b7ef2;
background-color: var(--antSelectDropdownBg) !important;
border: 1px solid var(----antSelectDropdownBorderColor);
border-top: none;
}
.ant-select-item {
color: #1b7ef2 !important;
color: #1b7ef2 !important;
}
//框背景色
.ant-select:not(.ant-select-customize-input) .ant-select-selector {
color: #1b7ef2 !important;
background-color: transparent !important;
border: 1px solid #1b7ef2 !important;
color: #1b7ef2 !important;
background-color: transparent !important;
border: 1px solid #1b7ef2 !important;
}
.ant-select-item-option-selected {
color: #ffffff !important;
color: #ffffff !important;
}
// 选中字体颜色
.ant-select-selection-item {
//color: #1b7ef2 !important;
color: #fff;
//color: #1b7ef2 !important;
color: #fff;
}
.ant-select-item-option-active {
background-color: transparent !important;
background-color: transparent !important;
}
.ant-select-item-option-active:hover {
background-color: #002e64 !important;
background-color: #002e64 !important;
}
// 箭头颜色
.ant-select-arrow {
color: #1b7ef2 !important;
color: #1b7ef2 !important;
}
.ant-select-item-option-selected:not(.ant-select-item-option-disabled) {
background-color: #002e64 !important;
background-color: #002e64 !important;
}
// 下拉框样式-end
// 级联选择器样式-start
.ant-cascader-menu-item {
color: #1b7ef2 !important;
color: #1b7ef2 !important;
}
.ant-cascader-menu-item:hover {
background-color: #002e64 !important;
background-color: #002e64 !important;
}
.ant-cascader-menu-item-active {
color: #fff !important;
background-color: #002e64 !important;
color: #fff !important;
background-color: #002e64 !important;
}
.ant-cascader-menu-item-expand .ant-cascader-menu-item-expand-icon, .ant-cascader-menu-item-loading-icon {
color: #1b7ef2 !important;
color: #1b7ef2 !important;
}
// 级联选择器样式-end
.ant-empty-description {
color: #fff;
color: #fff;
}
//空表格hover白色
.ant-table-tbody > tr.ant-table-placeholder:hover > td {
background: transparent !important;
background: transparent !important;
}
//直升机
.helicopter {
width: 60px;
height: 37px;
background: url("/@/assets/img/helicopter.png") no-repeat;
background-size: 100% 100%;
margin-bottom: 4px;
width: 60px;
height: 37px;
background: url("/@/assets/img/helicopter.png") no-repeat;
background-size: 100% 100%;
margin-bottom: 4px;
}
+10
View File
@@ -0,0 +1,10 @@
/*弹窗背景色*/
.police-con.light {
color: #000;
background-color: #fff;
}
.police-con.dark {
color: #ffffff;
background-color: #00152b;
}
+40 -28
View File
@@ -23,8 +23,10 @@ export const Map = {
* @desc 地图舒适化
* @param el dom元素 id选择器
* @param option 地图配置
* @param innerLineOption 内轨迹线配置
* @param outlineOption 外轨迹线配置
*/
initMap({ el, option }: InitMap) {
initMap({ el, option, innerLineOption, outerLineOption }: InitMap) {
return new Promise((resolve) => {
AMapLoader.load({
key: mapKey, // 申请好的Web端开发者Key,首次调用 load 时必填
@@ -43,27 +45,41 @@ export const Map = {
});
// 异步同时加载多个插件
new AMap.plugin(mapPlugin, () => {
this.drawInnerLine();
this.drawOutLine();
if (outerLineOption) {
this.drawInnerLine(innerLineOption);
this.drawOutLine(outerLineOption);
} else {
this.drawInnerLine();
this.drawOutLine();
}
});
resolve();
});
});
} /**
},
/**
*#desc 获取地图中心点
*/
getMapCenter() {
return this.map.getCenter();
},
/**
* @desc 中国外层边界线
*/,
drawOutLine() {
*/
drawOutLine(outerLineOption = {}) {
let line = {
strokeColor: '#2384dd',
strokeWeight: 3,
isOutline: false,
};
let geoJson = new AMap.GeoJSON({
geoJSON: china,
getPolygon: function (geoJson: string, lngLats: any) {
return new AMap.Polyline({
path: lngLats[0],
strokeColor: '#2384dd',
strokeWeight: 3,
// lineJoin: 'round', //折线拐点的绘制样式
isOutline: false,
// borderWeight: 2,
// outlineColor: '#6ccffe',
...line,
...outerLineOption,
});
},
});
@@ -71,24 +87,19 @@ export const Map = {
} /**
* @desc 中国内层边界线
*/,
drawInnerLine() {
drawInnerLine(innerLineOption = {}) {
let line = {
isOutline: true,
outlineColor: '#2692fc',
borderWeight: 1,
strokeColor: '#88b9f8',
strokeWeight: 1,
strokeOpacity: 0.8,
};
let geoJson = new AMap.GeoJSON({
geoJSON: chinaInner,
getPolygon: function (geoJson: string, lngLats: any) {
return new AMap.Polyline({
path: lngLats[0],
// strokeColor: '#57b2f8',
// strokeColor: '#2BA5FF',
// strokeColor: '#3d6eff',
// strokeWeight: 2,
// zIndex: 10,
isOutline: true,
outlineColor: '#2692fc',
borderWeight: 1,
strokeColor: '#88b9f8',
strokeWeight: 1,
strokeOpacity: 0.8,
});
return new AMap.Polyline({ path: lngLats[0], ...line, ...innerLineOption });
},
});
this.map.add(geoJson);
@@ -448,7 +459,8 @@ export const Map = {
return new Promise((resolve, reject) => {
geocoder.getAddress(lnglat, (status, result) => {
if (status === 'complete' && result.regeocode) {
return resolve(result.regeocode.formattedAddress);
console.log('xx', result);
return resolve(result.regeocode.formattedAddress, result.regeocode);
}
return reject(result);
});
+11 -1
View File
@@ -9,7 +9,17 @@ export const YinChuanOption = {
zoom: 8, //地图显示的缩放级别
mapStyle: 'darkblue', //地图样式
};
//浅色地图样式
export const lightMapOption = {
mapStyle: 'normal', //地图样式
};
export const outerLineOption = {
strokeColor: '#768ddb',
};
export const innerLineLight = {
outlineColor: '#88a2f9',
strokeColor: '#93aaf8',
};
// 地图key
export const mapKey = '4bbcb216b889f2d612cbed05ae6979c8';
// 地图插件
+3 -1
View File
@@ -1,6 +1,8 @@
export interface InitMap {
el: string;
option: any;
innerLineOption?: any;
outerLineOption?: any;
}
export type Callback = (result?: any) => void;
@@ -24,4 +26,4 @@ export interface MarkerOption {
zoom?: number;
[k: string]: any;
}
}
+7
View File
@@ -0,0 +1,7 @@
:root {
--antSelectDropdownBg: #00152b;
--antSelectDropdownBorderColor: #1b7ef2;
/*服务详情数据*/
}
+23
View File
@@ -0,0 +1,23 @@
export const themeList = {
dark: {
/*下拉框*/
antSelectDropdownBg: '#00152b',
antSelectDropdownBorderColor: '#1b7ef2',
/*服务详情数据*/
typeTimeSelectColor: '#45a2ff',
typeTimeUnSelectColor: '#a3a4a4',
},
light: {
antSelectDropdownBg: '#fff',
antSelectDropdownBorderColor: '#1b7ef2',
typeTimeSelectColor: '#45a2ff',
typeTimeUnSelectColor: '#a3a4a4',
},
};
export function setTheme(theme: string) {
const themeStyle = themeList[theme];
for (const key in themeStyle) {
document.documentElement.style.setProperty(`--${key}`, themeStyle[key]);
}
}
+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 + '米';
}
+15
View File
@@ -0,0 +1,15 @@
import { nextTick, onMounted, ref } from 'vue';
import { useUserStore } from '/@/store/modules/user.ts';
export function useTheme() {
const themeType = ref('light');
onMounted(() => {
const store = useUserStore();
nextTick(() => {
themeType.value = store.getThemeType;
});
});
return {
themeType,
};
}
+8
View File
@@ -14,6 +14,7 @@ export const useUserStore = defineStore({
userInfo: null,
//登录返回信息
loginInfo: null,
themeType: '', // dark 1, light 2
}),
getters: {
getUserInfo(): UserInfo {
@@ -25,6 +26,9 @@ export const useUserStore = defineStore({
getToken(): string {
return this.token || getAuthCache(TOKEN_KEY);
},
getThemeType(): string {
return this.themeType || getAuthCache('themeType');
},
},
actions: {
setToken(info: string | undefined) {
@@ -38,6 +42,10 @@ export const useUserStore = defineStore({
setLoginInfo(info: LoginInfo | null) {
this.loginInfo = info;
},
setThemeType(info: string | undefined) {
this.themeType = info ? info : '';
setAuthCache('themeType', info);
},
/**
* 登录事件
*/
+5
View File
@@ -7,6 +7,11 @@ export enum DataType {
yinChuan = '2',
}
export enum ThemeType {
dark = 'dark',
light = 'light',
}
export enum SexType {
male = '2', //男
female = '1', //女
+3 -4
View File
@@ -2,7 +2,7 @@
<template>
<Dialog :openVis="visible" width="30%" :title="title" @close="closeDialog" :maskClosable="false">
<template #container>
<div class="police-con">
<div class="police-con" :class="[themeType]">
<div class="sub-text"> 有一个员工刚刚发起应急求助,请马上处理</div>
<div class="con-item">
<span>姓名</span>
@@ -31,11 +31,13 @@
import Dialog from '/@/components/dialog/Dialog.vue';
import { useDialog } from '/@/views/components/dialogHooks.ts';
import { watch, ref, Ref } from 'vue';
import { useTheme } from '/@/hooks/theme/useTheme.ts';
const props = defineProps({
record: Object,
});
const emit = defineEmits(['confirmHelp']);
const { themeType } = useTheme();
interface UserInfo {
realName?: string;
@@ -65,9 +67,6 @@
</script>
<style scoped lang="less">
.police-con {
color: #ffffff;
background-color: #00152b;
//border: 1px solid #129bff;
padding: 2% 0 2% 5%;
.sub-text {
+3 -1
View File
@@ -2,7 +2,7 @@
<template>
<Dialog :openVis="visible" width="30%" :title="title" @close="closeDialog" :maskClosable="false">
<template #container>
<div class="police-con">
<div class="police-con" :class="[themeType]">
<div class="sub-text">有一个员工健康监测发生异常</div>
<div class="con-item">
<span>异常事件</span>
@@ -36,11 +36,13 @@
import Dialog from '/@/components/dialog/Dialog.vue';
import { useDialog } from '/@/views/components/dialogHooks.ts';
import { watch, ref } from 'vue';
import { useTheme } from '/@/hooks/theme/useTheme.ts';
const props = defineProps({
record: Object,
});
const userInfo = ref({});
const { themeType } = useTheme();
watch(
() => props.record,
(nVal) => {
+16 -6
View File
@@ -4,17 +4,22 @@
<div class="title-d-left">
{{ dayTimeO }}
</div>
<div class="title-d-middle"> 应急就医服务中心</div>
<div class="title-d-middle" @click="employeeDialogOpen"> 应急就医服务中心</div>
<div class="title-d-right"> 累计运行时间{{ dayTimeT }}</div>
</div>
<div class="body-d">
<div class="body-d-left">
<one-l :setting="setting" :refreshState="refreshState" @handleClick="handlePhoneDialog" />
<two-l :key="tabState" :refreshState="refreshState" />
<one-l theme="light" :setting="setting" :refreshState="refreshState" @handleClick="handlePhoneDialog" />
<two-l theme="light" :key="tabState" :refreshState="refreshState" />
<three-l :key="tabState" :setting="setting" :refreshState="refreshState" />
</div>
<div class="body-d-middle">
<china-map :showHospitalList="showHospitalList" :hospitalList="hospitalList" @clearHospitalList="clearHospitalList"></china-map>
<xian-map
:showHospitalList="showHospitalList"
:hospitalList="hospitalList"
@clearHospitalList="clearHospitalList"
:mapOptions="lightMapOption"
/>
</div>
<div class="body-d-right">
<one-r :setting="setting" :refreshState="refreshState" />
@@ -36,17 +41,19 @@
import OneR from '/@/components/body-d-right/oneR.vue';
import TwoR from '/@/components/body-d-right/twoR.vue';
import ThreeR from '/@/components/body-d-right/threeR.vue';
import ChinaMap from '/@/components/chinaMap/chinaMap.vue';
import xianMap from '/@/components/xianMap/xianMap.vue';
import EmployeeDialog from '/@/views/components/employeeDialog.vue';
import EmergencyDialog from '/@/views/components/emergencyDialog.vue';
import { useTopTime } from '/@/utils/utils.ts';
import { basicPath, emergencyPath, useSocket } from '/@/utils/socket.ts';
import { useRefresh } from '/@/hooks/autoRefresh';
import { DEFAULT_TIME } from '/@/hooks/autoRefresh/pageRefreshTime.ts';
import { DataType, getSettings } from '/@/utils/settings.ts';
import { DataType, getSettings, ThemeType } from '/@/utils/settings.ts';
import { ServerDetailType } from '/@/components/body-d-left/bodyLeftHooks.ts';
import PhoneDialog from '/@/views/components/phoneDialog/phoneDialog.vue';
import { Map } from '/@/assets/mapUtils/map.ts';
import { useUserStore } from '/@/store/modules/user.ts';
import { lightMapOption } from '/@/assets/mapUtils/mapConstant.ts';
const { refreshState } = useRefresh(DEFAULT_TIME);
const dayTimeO = ref();
@@ -67,9 +74,12 @@
dayTimeT.value = timeRight;
}
const store = useUserStore();
onMounted(() => {
init();
document.addEventListener('visibilitychange', checkTabState);
//设置主题
store.setThemeType(ThemeType.light);
});
onUnmounted(() => {
clearInterval(interval.value);
+66 -2
View File
@@ -13,7 +13,13 @@
<div class="body-d">
<div class="yichuan-body-left">
<!--服务详情数据-->
<ServiceDetails :refreshState="refreshState" :setting="setting" class="service-details" @handleClick="handlePhoneDialog" />
<ServiceDetails
theme="dark"
:refreshState="refreshState"
:setting="setting"
class="service-details"
@handleClick="handlePhoneDialog"
/>
<!--一线医疗点每日工作动态-->
<DailyWorkTrends :refreshState="refreshState" class="daily-work-trends" />
</div>
@@ -53,9 +59,10 @@
import { useRefresh } from '/@/hooks/autoRefresh';
import { DEFAULT_TIME } from '/@/hooks/autoRefresh/pageRefreshTime.ts';
import { useRoute } from 'vue-router';
import { DataType, getSettings } from '/@/utils/settings.ts';
import { DataType, getSettings, ThemeType } from '/@/utils/settings.ts';
import { ServerDetailType } from '/@/components/body-d-left/bodyLeftHooks.ts';
import { YinChuanOption } from '/@/assets/mapUtils/mapConstant.ts';
import { useUserStore } from '/@/store/modules/user.ts';
const title = ref('银川片应急就医服务中心');
const phone = '(0951-6805199)';
@@ -65,7 +72,11 @@
init();
document.title = title.value;
document.addEventListener('visibilitychange', checkTabState);
//设置主题
store.setThemeType(ThemeType.dark);
});
const store = useUserStore();
onUnmounted(() => {
clearInterval(interval.value);
document.removeEventListener('visibilitychange', checkTabState);
@@ -107,6 +118,59 @@
}
});
//模拟开启
function employeeDialogOpen() {
setEmergencyData({
userId: '001a9878fdaf401c844a03e2fc7c370b',
realName: '曹燕',
lon: 108.872442,
lat: 34.189956,
sex: 2,
age: 40,
orgCode: 'A01A33A05',
orgName: '地质研究所',
hospitalList: [
{
id: null,
name: '交大一附院',
lat: 34.22,
lon: 108.94,
type: null,
ambulance: null,
docNum: null,
nurseNum: null,
expertNum: null,
distance: null,
},
{
id: null,
name: '高新医院',
lat: 34.23,
lon: 108.88,
type: null,
ambulance: null,
docNum: null,
nurseNum: null,
expertNum: null,
distance: null,
},
{
id: null,
name: '人民医院',
lat: 34.24,
lon: 108.93,
type: null,
ambulance: null,
docNum: null,
nurseNum: null,
expertNum: null,
distance: null,
},
],
});
emergencyDialogRef.value.openDialog();
}
//应急求助
const {
socketData: emergencyData,