diff --git a/src/components/mapBoxSelectPosition/mapBoxSelectPosition.vue b/src/components/mapBoxSelectPosition/mapBoxSelectPosition.vue index 9facb6d..1e8f2b6 100644 --- a/src/components/mapBoxSelectPosition/mapBoxSelectPosition.vue +++ b/src/components/mapBoxSelectPosition/mapBoxSelectPosition.vue @@ -106,22 +106,10 @@ addWaterLabel(); props.loadCallback && props.loadCallback(); - if (props.previousPoint && props.previousPointName) { - let drewPoint = turf.featureCollection([turf.point(props.previousPoint.split(',').map(Number))]); - drewPoint.features[0].properties.name = props.previousPointName; - addPointToMap(drewPoint); - map.easeTo({ - center: props.previousPoint.split(',').map(Number), - zoom: 14, - }); - } else { - let timeout = setTimeout(() => { - let { pitch, center } = config.params.init; - pitch && mapBoxSelectPositionMap.map.setPitch(pitch); - center && mapBoxSelectPositionMap.map.setCenter(center); - clearTimeout(timeout); - }, 1000); - } + + let { pitch, center } = config.params.init; + pitch && mapBoxSelectPositionMap.map.setPitch(pitch); + center && mapBoxSelectPositionMap.map.setCenter(center); mapBoxSelectPositionMap.map.load = true; }); @@ -277,12 +265,28 @@ map.getSource('drewPoint').setData(geojson); } }; + watch( + () => [props.previousPoint, props.previousPointName], + val => { + if (!!val.length) { + let initeTimeout = setTimeout(() => { + let drewPoint = turf.featureCollection([turf.point(val[0].split(',').map(Number))]); + drewPoint.features[0].properties.name = val[1]; + addPointToMap(drewPoint); + map.easeTo({ + center: val[0].split(',').map(Number), + zoom: 14, + }); + clearTimeout(initeTimeout); + }, 1000); + } + } + ); onMounted(() => { initeMap(); nextTick(() => { allData.inputShow = props.isNeedInput; }); - console.log(props.previousPoint, props.previousPointName); }); onBeforeUnmount(() => { diff --git a/src/components/mapBoxSelectPosition/mapBoxSelectPosition.vue b/src/components/mapBoxSelectPosition/mapBoxSelectPosition.vue index 9facb6d..1e8f2b6 100644 --- a/src/components/mapBoxSelectPosition/mapBoxSelectPosition.vue +++ b/src/components/mapBoxSelectPosition/mapBoxSelectPosition.vue @@ -106,22 +106,10 @@ addWaterLabel(); props.loadCallback && props.loadCallback(); - if (props.previousPoint && props.previousPointName) { - let drewPoint = turf.featureCollection([turf.point(props.previousPoint.split(',').map(Number))]); - drewPoint.features[0].properties.name = props.previousPointName; - addPointToMap(drewPoint); - map.easeTo({ - center: props.previousPoint.split(',').map(Number), - zoom: 14, - }); - } else { - let timeout = setTimeout(() => { - let { pitch, center } = config.params.init; - pitch && mapBoxSelectPositionMap.map.setPitch(pitch); - center && mapBoxSelectPositionMap.map.setCenter(center); - clearTimeout(timeout); - }, 1000); - } + + let { pitch, center } = config.params.init; + pitch && mapBoxSelectPositionMap.map.setPitch(pitch); + center && mapBoxSelectPositionMap.map.setCenter(center); mapBoxSelectPositionMap.map.load = true; }); @@ -277,12 +265,28 @@ map.getSource('drewPoint').setData(geojson); } }; + watch( + () => [props.previousPoint, props.previousPointName], + val => { + if (!!val.length) { + let initeTimeout = setTimeout(() => { + let drewPoint = turf.featureCollection([turf.point(val[0].split(',').map(Number))]); + drewPoint.features[0].properties.name = val[1]; + addPointToMap(drewPoint); + map.easeTo({ + center: val[0].split(',').map(Number), + zoom: 14, + }); + clearTimeout(initeTimeout); + }, 1000); + } + } + ); onMounted(() => { initeMap(); nextTick(() => { allData.inputShow = props.isNeedInput; }); - console.log(props.previousPoint, props.previousPointName); }); onBeforeUnmount(() => { diff --git a/src/views/project/projectInformation/details.vue b/src/views/project/projectInformation/details.vue index b2833b6..cb90f22 100644 --- a/src/views/project/projectInformation/details.vue +++ b/src/views/project/projectInformation/details.vue @@ -502,7 +502,6 @@ form.projectTypeName = item?.projectTypeName || ''; form.time = res.data.startTime + '至' + res.data.endTime; viewMap(form.projectLocation); - projectItemDescriptionConfigList.value = res?.data?.projectItemDescriptionList || []; console.log(projectItemDescriptionConfigList); projectContentList.value = props.projectContentType.slice(0, 3).map((item, i) => {