From d05710a997052cb89c6254f79283f8431c28fbf6 Mon Sep 17 00:00:00 2001 From: weipengfei <2187978347@qq.com> Date: Fri, 18 Aug 2023 12:03:56 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/task_template/edit.vue | 61 +++++++++++++++++++++++++------- src/views/task_template/map.vue | 23 ++++++++---- 2 files changed, 65 insertions(+), 19 deletions(-) diff --git a/src/views/task_template/edit.vue b/src/views/task_template/edit.vue index 920b74a..57aabca 100644 --- a/src/views/task_template/edit.vue +++ b/src/views/task_template/edit.vue @@ -105,25 +105,37 @@ /> - + - + - + @@ -144,7 +156,7 @@ v-if="mapShow" ref="mapRef" @success="setMap" - @close="mapShow = false" + @close="" > @@ -194,7 +206,11 @@ const formData = reactive({ money_two: 0, // 二阶段金额 money_three: 0, // 长期金额 types: "", //阶段类型 - extend: {}, + extend: { + origin: {}, //起点 + transfer: {}, //中转 + terminus: {}, //终点 + }, }); //任务类型接口 @@ -259,14 +275,35 @@ const mapRef = shallowRef>(); const changeTaskType = async (e: any) => { if (e == 32) { mapShow.value = true; //为三轮车时 - await nextTick(); - console.log(mapRef.value); - mapRef.value?.open(); + // await nextTick(); + // mapRef.value?.open(); } }; +// 当前点击的地图类型(起,转,终)点 +const mapType = ref(""); +const changeMap = async (e: Number) => { + let map_title = ""; + switch (e) { + case 0: + mapType.value = "origin"; + map_title = "起点"; + break; + case 1: + mapType.value = "transfer"; + map_title = "中转点"; + break; + case 2: + mapType.value = "terminus"; + map_title = "终点"; + break; + } + await nextTick(); + mapRef.value?.open(map_title); +}; + const setMap = (e: any) => { - formData.extend = e; + formData.extend[mapType.value] = e[0]; console.log("选择了地区", formData.extend); }; diff --git a/src/views/task_template/map.vue b/src/views/task_template/map.vue index c291855..edd26df 100644 --- a/src/views/task_template/map.vue +++ b/src/views/task_template/map.vue @@ -2,7 +2,7 @@
- 搜索 - 重置 + 搜索 + - +
@@ -72,6 +74,7 @@ const formRef = shallowRef(); const popupRef = shallowRef>(); const mode = ref("add"); const datalist = ref([]); +const title = ref(""); // 获取详情 const setFormData = async (data: Record) => { @@ -98,6 +101,12 @@ const resetMap = () => { mapRef.value.resetMap(); }; +// 搜索 +const searchText = ref(""); +const serach = () => { + mapRef.value.searchMap(searchText.value); +}; + const address = ref([]); const changeMaps = (e: any) => { address.value = JSON.parse(JSON.stringify(e)); @@ -112,8 +121,8 @@ const handleSubmit = async () => { }; //打开弹窗 -const open = (type = "add") => { - mode.value = type; +const open = (type = "地点") => { + title.value = "选择" + type; popupRef.value?.open(); }; From b21d4266d1893f7863adbe356ad698c841a2ba55 Mon Sep 17 00:00:00 2001 From: weipengfei <2187978347@qq.com> Date: Fri, 18 Aug 2023 12:04:14 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/map/MapContainer.vue | 87 +- .../components/header/user-drop-down.vue | 53 +- src/views/account/login.vue | 231 +++-- src/views/company/index.vue | 959 +++++++++--------- src/views/company/subordinate.vue | 450 ++++---- src/views/consumer/lists/index.vue | 440 ++++---- src/views/contract/contractDetil.vue | 2 +- 7 files changed, 1212 insertions(+), 1010 deletions(-) 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 { From 6f4cbcc24aa286f1e7f731a06abb2aaa9f984c21 Mon Sep 17 00:00:00 2001 From: weipengfei <2187978347@qq.com> Date: Fri, 18 Aug 2023 12:10:37 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/map/MapContainer.vue | 26 +++++++++++++------------- src/views/task/editTow.vue | 4 ++-- src/views/task/taskCalendar.vue | 8 ++------ src/views/task_template/map.vue | 11 ++++++++++- 4 files changed, 27 insertions(+), 22 deletions(-) diff --git a/src/components/map/MapContainer.vue b/src/components/map/MapContainer.vue index 4309fb8..7973e98 100644 --- a/src/components/map/MapContainer.vue +++ b/src/components/map/MapContainer.vue @@ -48,7 +48,7 @@ const initMap = async () => { map.value.on("click", (e: any) => { // console.log("点击", e.lnglat); - if (m_index >= 3) return; + if (m_index >= 1) return; // 调用函数并传入经纬度 getDistrictName(e.lnglat.lng, e.lnglat.lat, e); @@ -76,18 +76,18 @@ const initMap = async () => { m_index++; // 添加标记点击事件监听器 - // marker.on("click", (event: any) => { - // console.log("删除", event); - // markerList = markerList.filter((item: any) => { - // item[0] == marker._position.pos[0] && - // item[0] == marker._position.pos[0]; - // }); - // emits("changeMaps", markerList); - // // 在这里可以进行其他自定义逻辑操作 - // map.value.remove(marker); - // m_index--; - // marker = null; - // }); + marker.on("click", (event: any) => { + console.log("删除", event); + markerList = markerList.filter((item: any) => { + item[0] == marker._position.pos[0] && + item[0] == marker._position.pos[0]; + }); + emits("changeMaps", markerList); + // 在这里可以进行其他自定义逻辑操作 + map.value.remove(marker); + m_index--; + marker = null; + }); }); }; diff --git a/src/views/task/editTow.vue b/src/views/task/editTow.vue index b602c80..4faa146 100644 --- a/src/views/task/editTow.vue +++ b/src/views/task/editTow.vue @@ -54,10 +54,10 @@ placeholder="没有任务描述" />
- + diff --git a/src/views/task/taskCalendar.vue b/src/views/task/taskCalendar.vue index 41fc9f6..e618f3e 100644 --- a/src/views/task/taskCalendar.vue +++ b/src/views/task/taskCalendar.vue @@ -1,7 +1,7 @@