diff --git a/src/components/map/MapContainer.vue b/src/components/map/MapContainer.vue index 0275e13..4309fb8 100644 --- a/src/components/map/MapContainer.vue +++ b/src/components/map/MapContainer.vue @@ -10,6 +10,8 @@ const map = shallowRef(null); let AMap: any = null; let markerList: Array = []; let m_index: Number = 0; +let geocoder: any = null; +let autocomplete: any = null; const emits = defineEmits("changeMaps"); @@ -20,10 +22,6 @@ const resetMap = () => { emits("changeMaps", markerList); }; -defineExpose({ - resetMap, -}); - const initMap = async () => { const loader = AMapLoader.load({ key: "4f8f55618010007147aab96fc72bb408", @@ -36,37 +34,23 @@ const initMap = async () => { zoom: 13, }); + AMap.plugin("AMap.Geocoder", function () { + geocoder = new AMap.Geocoder({ + radius: 10, // 逆地理编码范围,默认值:1000,单位:米 + extensions: "all", // 返回地址描述结果时是否包含引擎内置的POI,默认值:base,可选值:base、all + }); // 经纬度数组 + }); + + // // 创建 Autocomplete 实例 + // autocomplete = new AMap.Autocomplete({ + // city: "全国", // 设置默认城市为全国 + // }); + map.value.on("click", (e: any) => { // console.log("点击", e.lnglat); if (m_index >= 3) return; // 调用函数并传入经纬度 - getDistrictName(e.lnglat.lng, e.lnglat.lat); - - // 获取地区名称 - function getDistrictName(lng, lat) { - AMap.plugin("AMap.Geocoder", function () { - var geocoder = new AMap.Geocoder({ - radius: 10, // 逆地理编码范围,默认值:1000,单位:米 - extensions: "all", // 返回地址描述结果时是否包含引擎内置的POI,默认值:base,可选值:base、all - }); // 经纬度数组 - - geocoder.getAddress([lng, lat], function (status, result) { - if (status === "complete" && result.info === "OK") { - // 解析成功,提取地区名称 - var district = result.regeocode.addressComponent.district; - // console.log(district, result.regeocode); // 输出地区名字 - markerList.push({ - lnglat: e.lnglat, - address: result.regeocode.formattedAddress, - }); - emits("changeMaps", markerList); - } else { - // 解析失败 - console.log("逆地理编码失败"); - } - }); - }); - } + getDistrictName(e.lnglat.lng, e.lnglat.lat, e); // 自定义 Marker 的图标 var customIcon = new AMap.Icon({ @@ -107,6 +91,47 @@ const initMap = async () => { }); }; +const searchMap = (address: any) => { + console.log(address); + ElMessage.error("搜索功能开发中"); + + // autocomplete.search(address, function (status: any, result: any) { + // console.log(status, result); + + // if (status === "complete" && result.info === "OK") { + // // 获取提示结果 + // var tips = result.tips; + + // // 更新搜索结果列表或下拉菜单等 + // // ... + // } + // }); +}; + +// 获取地区名称 +const getDistrictName = (lng: any, lat: any, e: any) => { + geocoder.getAddress([lng, lat], function (status: any, result: any) { + if (status === "complete" && result.info === "OK") { + // 解析成功,提取地区名称 + var district = result.regeocode.addressComponent.district; + // console.log(district, result.regeocode); // 输出地区名字 + markerList.push({ + lnglat: e.lnglat, + address: result.regeocode.formattedAddress, + }); + emits("changeMaps", markerList); + } else { + // 解析失败 + console.log("逆地理编码失败"); + } + }); +}; + +defineExpose({ + resetMap, + searchMap, +}); + onMounted(() => { initMap(); }); diff --git a/src/layout/default/components/header/user-drop-down.vue b/src/layout/default/components/header/user-drop-down.vue index 0442bc1..b1325a2 100644 --- a/src/layout/default/components/header/user-drop-down.vue +++ b/src/layout/default/components/header/user-drop-down.vue @@ -1,34 +1,37 @@ diff --git a/src/views/account/login.vue b/src/views/account/login.vue index 7def9b6..187fd3a 100644 --- a/src/views/account/login.vue +++ b/src/views/account/login.vue @@ -1,130 +1,141 @@ diff --git a/src/views/company/index.vue b/src/views/company/index.vue index baa69f5..9ce5186 100644 --- a/src/views/company/index.vue +++ b/src/views/company/index.vue @@ -1,89 +1,93 @@ diff --git a/src/views/company/subordinate.vue b/src/views/company/subordinate.vue index 756e3f9..91464b5 100644 --- a/src/views/company/subordinate.vue +++ b/src/views/company/subordinate.vue @@ -1,238 +1,320 @@ diff --git a/src/views/consumer/lists/index.vue b/src/views/consumer/lists/index.vue index 729d9a8..758ea53 100644 --- a/src/views/consumer/lists/index.vue +++ b/src/views/consumer/lists/index.vue @@ -1,203 +1,229 @@ diff --git a/src/views/contract/contractDetil.vue b/src/views/contract/contractDetil.vue index 8677155..cfae423 100644 --- a/src/views/contract/contractDetil.vue +++ b/src/views/contract/contractDetil.vue @@ -465,7 +465,7 @@ async function render() { }); compeny.value = res.party_a_info; basicdata.value = res; - if (basicdata.value.status == 1) { + if (basicdata.value.status == 1 || res.check_status == 3 || res.status == 1) { isshow.value = false; } try {