无人机管理后台前端(已迁走)
罗广辉
2025-10-11 02409bfbe15f22fc3b5dccadabfd860a660a49d9
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 () {
@@ -216,40 +223,32 @@
  }, []);
  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 +293,7 @@
  background: rgba(0, 0, 0, 0.6);
  white-space: nowrap;
  border-radius: 4px;
pointer-events: none;
  &::after {
    content: '';
    position: absolute;