From 233e4fc4f35bd00a36ee34a7fbf5e47b41db26db Mon Sep 17 00:00:00 2001
From: chenyao <1219716595@qq.com>
Date: Mon, 17 Nov 2025 09:54:44 +0800
Subject: [PATCH] feat:更新初始化地形
---
src/views/resource/components/DrawPolygon.vue | 62 +++++++++++++++---------------
1 files changed, 31 insertions(+), 31 deletions(-)
diff --git a/src/views/resource/components/DrawPolygon.vue b/src/views/resource/components/DrawPolygon.vue
index e4d40d0..59428dd 100644
--- a/src/views/resource/components/DrawPolygon.vue
+++ b/src/views/resource/components/DrawPolygon.vue
@@ -23,7 +23,14 @@
const viewInstance = inject('viewInstance');
const homeViewer = inject('homeViewer');
-
+watch(
+ () => selectionIds.value,
+ (newValue, oldValue) => {
+ if (newValue && oldValue && newValue !== oldValue) {
+ cancel();
+ }
+ }
+);
function preventDefault(event) {
event.preventDefault();
@@ -170,7 +177,7 @@
curPolygonEntity.polyline = {
width: 2,
material: Cesium.Color.WHITE,
- clampToGround: false,
+ clampToGround: true,
};
curPolygonEntity.polyline.positions = new Cesium.CallbackProperty(function () {
@@ -207,7 +214,7 @@
viewInstance.value.removeMouseHandler('drawCustomPolygon');
}
-const emit = defineEmits(['upDateDrawState']);
+const emit = defineEmits(['upDateDrawState',]);
function updatePolygon() {
let polygon = savePolygonPosition.reduce((pre, cur) => {
@@ -215,41 +222,34 @@
return pre;
}, []);
polygon.push(polygon[0]);
- console.log('绘制', `POLYGON((${polygon.join(',')}))`);
- ElMessage.success('重新绘制图斑成功!!');
- if (selectionIds.value) {
- emit('upDateDrawState');
- selectionIds.value = null;
- clearSelect();
- }
-getTableList()
+
// 接口
- // sdfwUpdate({
- // ids: selectionIds.value,
- // sdfw: `POLYGON((${polygon.join(',')}))`,
- // })
- // .then(res => {
- // if (selectionIds.value) {
- // emit('upDateDrawState')
- // selectionIds.value = null
- // // clearSelect()
- // }
+ sdfwUpdate({
+ ids: selectionIds.value,
+ sdfw: `POLYGON((${polygon.join(',')}))`,
+ })
+ .then(res => {
+ if (selectionIds.value) {
+ emit('upDateDrawState')
+ selectionIds.value = null
+ clearSelect()
+ }
- // if (res.data.code !== 0) return ElMessage.error(res.message)
- // ElMessage.success('重新绘制图斑成功!!')
-
- // // getTableList()
- // })
- // .catch(e => {
- // cancel()
- // })
+ if (res.data.code !== 0) return ElMessage.error(res.message)
+ ElMessage.success('重新绘制图斑成功!!')
+ getTableList()
+ })
+ .catch(e => {
+ cancel()
+ })
}
+
function cancel() {
remove();
removeMenuPanel();
clearPlanar();
-
+ removeSaveMenuPanel();
init();
}
@@ -294,7 +294,7 @@
background: rgba(0, 0, 0, 0.6);
white-space: nowrap;
border-radius: 4px;
-
+pointer-events: none;
&::after {
content: '';
position: absolute;
--
Gitblit v1.9.3