Bladeren bron

打点并同步修改信息

李富豪 1 jaar geleden
bovenliggende
commit
4358c74315

+ 10 - 1
Web/src/components/GMap.vue

@@ -569,7 +569,7 @@ import {
   ThunderboltOutlined, SignalFilled, GlobalOutlined, HistoryOutlined, CloudUploadOutlined, RocketOutlined,
   FieldTimeOutlined, CloudOutlined, CloudFilled, FolderOpenOutlined, RobotFilled, ArrowUpOutlined, CarryOutOutlined
 } from '@ant-design/icons-vue'
-import { EDeviceTypeName } from '../types'
+import { EDeviceTypeName, ELocalStorageKey } from '../types'
 import DockControlPanel from './g-map/DockControlPanel.vue'
 import { useDockControl } from './g-map/use-dock-control'
 import DroneControlPanel from './g-map/DroneControlPanel.vue'
@@ -840,6 +840,9 @@ export default defineComponent({
     }
     async function postPinPositionResource(obj: any) {
       const req: any = getPinPositionResource(obj)
+      const userName = localStorage.getItem(ELocalStorageKey.Username) || ''
+      req.element_from = 1
+      req.resource.user_name = userName
       setLayers(req)
       const coordinates = req.resource.content.geometry.coordinates
       updateCoordinates('gcj02-wgs84', req);
@@ -869,6 +872,9 @@ export default defineComponent({
     }
     async function postPolylineResource(obj: any) {
       const req: any = getPolylineResource(obj)
+      const userName = localStorage.getItem(ELocalStorageKey.Username) || ''
+      req.element_from = 1
+      req.resource.user_name = userName
       setLayers(req)
       const coordinatesList = req.resource.content.geometry.coordinates
       updateCoordinates('gcj02-wgs84', req)
@@ -901,6 +907,9 @@ export default defineComponent({
     }
     async function postPolygonResource(obj: any) {
       const req: any = getPoygonResource(obj)
+      const userName = localStorage.getItem(ELocalStorageKey.Username) || ''
+      req.element_from = 1
+      req.resource.user_name = userName
       setLayers(req)
       const coordinatesList = req.resource.content.geometry.coordinates[0]
       updateCoordinates('gcj02-wgs84', req)

+ 0 - 1
Web/src/components/LayersTree.vue

@@ -85,7 +85,6 @@ async function onDrop({ node, dragNode, dropPosition, dropToGap }: DropEvent) {
       if (item.id === key) {
         return callback(item, index, arr)
       }
-
       if (item.elements) {
         return loop(item.elements, key, callback)
       }

+ 4 - 24
Web/src/pages/page-web/projects/layer/index.vue

@@ -21,7 +21,7 @@
           <span class="mr30">纬度:</span>
           {{ layerState.latitude || '--' }}
         </div>
-        <div class="latitude element-item" v-if="layerState.currentType === geoType.Point">
+        <div class="latitude element-item" v-if="layerState.element_from === 2">
           <span class="mr30">高度:</span>
           {{ layerState.height || '--' }}
         </div>
@@ -305,29 +305,9 @@ async function getElementGroups(type?: string) {
 
 async function updateElements() {
   let content = null
-  if (layerState.currentType === GeoType.Point) {
-    const position = {
-      height: 0,
-      latitude: Number(layerState.latitude || 0),
-      longitude: Number(layerState.longitude || 0)
-    }
-    const cxt = generatePoint(position, {
-      color: layerState.color || MapDoodleColor.PinColor,
-      clampToGround: true
-    })
-    content = {
-      type: MapElementEnum.PIN,
-      geometry: cxt.geometry,
-      properties: cxt.properties
-    }
-    const currentLayer = selectedLayer.value
-    currentLayer.resource.content = content
-    selectedLayer.value = currentLayer
-  } else {
-    const currentLayer = selectedLayer.value
-    content = currentLayer.resource.content
-    content.properties.color = layerState.color
-  }
+  const currentLayer = selectedLayer.value
+  content = currentLayer.resource.content
+  content.properties.color = layerState.color
   updateMapElement(selectedLayer.value, layerState.layerName, layerState.color)
   const result = await updateElementsReq(layerState.layerId, {
     name: layerState.layerName,

+ 4 - 4
Web/vite.config.ts

@@ -60,10 +60,10 @@ export default defineConfig(({ mode, command }) => {
     plugins: [
       vue(),
       viteVConsole({
-        entry: path.resolve(__dirname, './src/main.ts'), // 入口文件
-        localEnabled: command === 'serve', // serve开发环境下
-        enabled: command === 'serve', // 本地运行开启
-        config: { // vconsole 配置
+        entry: path.resolve(__dirname, './src/main.ts'),// 入口文件
+        localEnabled: command === 'serve',// serve开发环境下
+        enabled: command === 'serve',// 本地运行开启
+        config: {// 配置
           maxLogNumber: 1000,
           theme: 'light'
         }