业务名称:
{{ businessInfo.businessName }}
@@ -221,7 +221,8 @@ import {
getbusinessById,
getEnterpriseTree,
} from "@/api/mapApi";
-import { ref, reactive, onMounted, onUnmounted } from "vue";
+import { ref, reactive, onMounted, onUnmounted, nextTick } from "vue";
+
const baseUrl = import.meta.env.VITE_APP_BASE_API;
let options = reactive({
scene: {
@@ -253,10 +254,10 @@ let options = reactive({
enableCollisionDetection: false, // 允许进入地下
},
},
- control:{
- toolbar:false,
- homeButton:false,
- zoom:false
+ control: {
+ toolbar: false,
+ homeButton: false,
+ zoom: false,
},
terrain: {
show: false,
@@ -281,6 +282,8 @@ let options = reactive({
},
],
});
+const infoDialog = ref(null);
+const businessDialog = ref(null);
//地图图层
const mapModel = reactive(["二维地图", "三维地图"]);
//图标类型图层
@@ -360,6 +363,10 @@ const handleInfoByyewu = async (id) => {
businessInfo = res.data;
innerVisible.value = true;
+
+ nextTick(() => {
+ scrollToTop(businessDialog.value);
+ });
};
/**
@@ -478,6 +485,10 @@ const initMarker = (item, flyTo = false, markerLength = 0) => {
info = await getInfo(infoItem.id, infoItem.lonLat);
queryParams.name = info.pointName;
dialogVisible.value = true;
+
+ nextTick(() => {
+ scrollToTop(infoDialog.value);
+ });
});
if (markerLength > 0) {
@@ -625,14 +636,11 @@ const changeModel = (index) => {
}
};
-
-
/**
* 地图初始化完毕
* @param mapInstance
*/
const mapLoad = (mapInstance) => {
-
map = mapInstance;
//创建marker图层
mapLayer.markerLayer = new mars3d.layer.GraphicLayer({
@@ -661,6 +669,18 @@ const getdictList = async () => {
let res = await getdicts();
dictList = res.result;
};
+
+/**
+ * 平滑滚动顶部
+ */
+const scrollToTop = (elementItem) => {
+ if (elementItem) {
+ elementItem.scrollTo({
+ top: 0,
+ behavior: "smooth",
+ });
+ }
+};