1.添加急救路线
This commit is contained in:
2025-07-09 19:38:59 +08:00
parent b52d46cd76
commit b61ca7f567
6 changed files with 115 additions and 44 deletions
+3 -1
View File
@@ -105,7 +105,7 @@
import { handleSocketUrl, startTime } from '/@/utils/utils.ts';
import { useUserStore } from '/@/store/modules/user.ts';
const { getCenterInfo } = useUserStore();
const { getCenterInfo, setCount } = useUserStore();
import {
oneLApi,
roomDetailApi,
@@ -273,6 +273,7 @@
watch(socketData, (nVal) => {
if (nVal) {
nextTick(() => {
setCount();
setSocketData(nVal);
employeeDialogRef.value.openDialog();
});
@@ -285,6 +286,7 @@
const emergencyDialogRef = ref(); //紧急求助
watch(socketData1, (nVal) => {
if (nVal) {
setCount();
setSocketData1(nVal);
emergencyDialogRef.value.openDialog();
}
+55 -36
View File
@@ -2,17 +2,17 @@
<div class="sun-center-map">
<div class="map-box">
<div class="tab-list">
<div v-for="(item, i) in list" :class="[currentIndex == i ? 'active' : '']" class="tab" @click="changeTab(item, i)">
<div v-for="(item, i) in list" :class="[currentIndex == i ? 'active' : '']" class="tab" @click="changeTab(item, i)" :key="`tab-${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-input v-model:value="formState.start" placeholder="请输入起点" id="startInput" />
</a-form-item>
<a-form-item class="form-item-self" label="终点">
<a-input v-model:value="formState.end" placeholder="请输入终点"></a-input>
<a-input v-model:value="formState.end" placeholder="请输入终点" id="endInput" />
</a-form-item>
<a-form-item>
<a-button class="reset-btn" @click="removeInput">清空</a-button>
@@ -20,7 +20,7 @@
</a-form-item>
</a-form>
</div>
<div v-show="showHospitalList || showRestB" class="reset-map" :class="[themeType]" @click="resetMap">
<div class="reset-map" :class="[themeType]" @click="resetMap">
<RedoOutlined title="重置地图" />
</div>
<div v-show="showRoutePanel" v-click-outside="outClick" class="line-container">
@@ -65,9 +65,9 @@
<div class="hospital-list" :class="[themeType]" v-if="showHospitalList">
<div class="hospital-item" v-for="(item, index) in hospitalList" :key="index" @click.stop="showDrivingLine(item)">
<div>{{ item.name }}</div>
<div>相距{{ item.distance }}</div>
<div>驾车大约{{ item.driveTime }}</div>
<div>{{ item?.name }}</div>
<div>相距{{ item?.distance }}</div>
<div>驾车大约{{ item?.driveTime }}</div>
</div>
</div>
</div>
@@ -123,7 +123,8 @@
const level = ref(0);
const routeList = ref([]);
const emits = defineEmits(['clearHospitalList', 'showRestB', 'handleDetail']);
let placeSearch = null;
let driving = null;
watch(
() => props.showHospitalList,
(v) => {
@@ -143,6 +144,17 @@
getMapData(tabList[0].type);
Map.map && Map.map.on('zoomend', setLevel);
Map.map && Map.map.on('zoomend', setLevel);
placeSearch = new Map.aMap.PlaceSearch({
extensions: 'all',
pageIndex: 1,
pageSize: 10,
showMarker: false,
});
// 确保 AutoComplete 加载完成后再使用
const startAuto = new Map.aMap.AutoComplete({ input: 'startInput' });
const endAuto = new Map.aMap.AutoComplete({ input: 'endInput' });
startAuto.on('select', startSelect);
endAuto.on('select', endSelect);
});
$bus.on(earlyWarning, (params) => {
drawMarker(params);
@@ -157,6 +169,27 @@
});
});
function startSelect(e: any) {
placeSearch.search(e.poi.name, function (status, result) {
if (status === 'complete' && result.poiList.pois.length > 0) {
const poi = result.poiList.pois[0]; // 取第一个结果
const { lat, lng } = poi.location;
formState.value.start = poi.name;
Map.createSMarker([lng, lat]);
}
});
}
function endSelect(e: any) {
placeSearch.search(e.poi.name, function (status, result) {
if (status === 'complete' && result.poiList.pois.length > 0) {
const poi = result.poiList.pois[0]; // 取第一个结果
const { lat, lng } = poi.location;
formState.value.end = poi.name;
Map.createEMarker([lng, lat]);
}
});
}
function showDrivingLine(item) {
nextTick(() => {
panelTitle.value = '全程' + item.driveTime + item.distance;
@@ -183,29 +216,13 @@
function changeTab(item: any, i: number) {
closeDrivingElement();
currentIndex.value = i;
if (item.type) {
tab(item);
}
tab(item);
}
function tab(item: any) {
Map.clearActiveHospital();
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 });
// }
getMapData(item.type, { type: item.type });
}
function watchInfoChangeTab(item: any) {
@@ -223,13 +240,13 @@
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,
// let map = new Map.aMap.Map('container', {
// resizeEnable: true,
// center: [116.397428, 39.90923], //地图中心点
// zoom: 13, //地图显示的缩放级别
// });
driving = new Map.aMap.Driving({
map: Map.map,
panel: 'panel',
});
driving.search([{ keyword: formState.value.start }, { keyword: formState.value.end }], function (status, result) {
@@ -241,7 +258,7 @@
searchFlag.value = false;
}
});
AMap.Event.addListener(driving, 'complete', (res) => {
Map.aMap.Event.addListener(driving, 'complete', (res) => {
const data = JSON.parse(JSON.stringify(res));
searchFlag.value = false;
if (data.info == 'OK') {
@@ -301,6 +318,7 @@
}
function closeDrivingElement() {
if (driving) driving.clear();
Map.clearNavigationElements();
formState.value.start = '';
formState.value.end = '';
@@ -345,6 +363,7 @@
}
function resetMap() {
Map.clearSOrE();
closeDrivingElement();
changeTab(list.value[currentIndex.value], currentIndex.value);
emits('showRestB');
@@ -404,7 +423,7 @@
border-radius: 6px;
position: absolute;
top: 36px;
z-index: 999;
z-index: 100;
transition: all 0.3s;
:deep(.form-item-self) {
@@ -679,7 +698,7 @@
position: absolute;
left: 0;
top: 50px;
z-index: 99;
z-index: 101;
font-size: 20px;
cursor: pointer;
padding: 0px 6px;
+4 -5
View File
@@ -7,10 +7,9 @@ export const legend1 = new URL('/@/assets/img/legend1.png', import.meta.url).hre
export const legend2 = new URL('/@/assets/img/legend5.png', import.meta.url).href;
export const legend3 = new URL('/@/assets/img/legend3.png', import.meta.url).href;
async function getDict(code) {
return await getDictByCode2({ dictCode: code });
}
export const checkData = await getDict('xj_check_type');
export const checkData = await (async () => {
return await getDictByCode2({ dictCode: 'xj_check_type' });
})();
export function getClassCharts(dx, dy, m) {
return {
@@ -159,7 +158,7 @@ export function infoContent1(res) {
</div>
<div class="modal-item">
<span class="item-one">地点:</span>
<span class="item-two">${res.name ? res.name : '--'}</span>
<span class="item-two">${res.orgName ? res.orgName : '--'}</span>
</div>
</div> `;
}