Browse Source

Merge branch 'master' into mock

# Conflicts:
#	src/store/modules/gis.ts
CzRger 1 year ago
parent
commit
ba14e2bfcb

+ 1 - 1
src/components/easyMap/func/base-draw.ts

@@ -33,7 +33,7 @@ const baseDrawConfig = {
     lineWidth: 1, // LineString的线段宽度,默认1
     lineType: 0, // LineString的线段类型索引,默认0,实线,取globalLineDash数组索引
     lineDash: null, // LineString的线段类型,默认null,优先级比lineType高
-    polyColor: 'rgba(20, 129, 241, 0.3)', // Polygon的填充色,默认蓝色
+    polyColor: 'rgba(20, 129, 241, 0.1)', // Polygon的填充色,默认蓝色
     polyBorderColor: '#2860F1', // Polygon的边框颜色,默认蓝色
     polyBorderWidth: 1, // Polygon的边框宽度,默认1
     polyBorderType: 0, // Polygon的边框类型索引,默认0,实线,取globalLineDash数组索引

+ 4 - 1
src/components/easyMap/func/measure.ts

@@ -14,6 +14,7 @@ import {createBox} from "ol/interaction/Draw";
 import {Circle, LineString, Polygon} from "ol/geom";
 import {locationTooltipElement} from "@/components/easyMap/func/location";
 import {v4} from "uuid";
+import store from "@/store";
 
 const layerFlag = ['layerName', 'measureLayer']
 let measureTooltipElement;
@@ -33,7 +34,8 @@ const typeMapper = new Map([
  * @param typeSelect    line线,rectangle矩形,polygon多边形,circle圆形
  */
 export default function Measure (map, typeSelect) {
-    if (!measureTooltipElement) {
+    if (!measureTooltipElement && !store.state.gis.isTooling) {
+        store.commit('gis/SET_IS_TOOLING', true)
         let _source
         const realLayer = map.getLayers().getArray().filter(v => v.get(layerFlag[0]) === layerFlag[1])
         if (realLayer[0]) {
@@ -243,6 +245,7 @@ export default function Measure (map, typeSelect) {
                 draw.un('drawend', drawendHandle);
                 map.removeInteraction(map.getInteractions().getArray().filter(v => v.get(id) === id)[0]);
                 map.un('pointermove', pointerMoveHandler)
+                store.commit('gis/SET_IS_TOOLING', false)
             }
             draw.on('drawend', drawendHandle);
         }

+ 13 - 13
src/components/easyMap/initMapInfo.ts

@@ -9,8 +9,8 @@ import WXTImg from './images/bg-wxt.png'
 // @ts-ignore
 import HYSImg from './images/bg-hys.png'
 import store from '@/store/index'
-
-const isInternet = true
+// @ts-ignore
+const isInternet = window.cusConfig?.mapInternet
 
 const baseMapView = {
   center: [109.6915958479584, 19.111636735969318],
@@ -76,14 +76,14 @@ const baseMapLayers = [
     img: LTImg,
     layersUrl: [
       {
-        url: `/${store.state.app.apiProxy.BaseMap1Api}/vec_c/wmts?tk=%E6%82%A8%E7%9A%84%E5%AF%86%E9%92%A5&service=WMTS&request=GetTile&version=1.0.0&layers=&styles=&tilematrixSet=c&format=tiles&height=256&width=256&layer=vec&style=default&opacity=1&zIndex=1&tilematrix={z}&tilerow={y}&tilecol={x}`,
+        url: `${isInternet ? `/${store.state.app.apiProxy.BaseMap1Api}` : 'http://59.255.48.160:81'}/vec_c/wmts?tk=%E6%82%A8%E7%9A%84%E5%AF%86%E9%92%A5&service=WMTS&request=GetTile&version=1.0.0&layers=&styles=&tilematrixSet=c&format=tiles&height=256&width=256&layer=vec&style=default&opacity=1&zIndex=1&tilematrix={z}&tilerow={y}&tilecol={x}`,
       },
       {
-        url: `/${store.state.app.apiProxy.BaseMap2Api}/mapserver/vmap/hn_bigdata_2018dt/getMAP?x={x}&y={y}&l={z}&styleId=hn_bigdata_2018dtys1&ratio=1&tilesize=256&clientVersion=jssdk_bate@%20leaflet%202.1.5`,
+        url: `${isInternet ? `/${store.state.app.apiProxy.BaseMap2Api}` : 'http://59.212.37.22'}/mapserver/vmap/hn_bigdata_2018dt/getMAP?x={x}&y={y}&l={z}&styleId=hn_bigdata_2018dtys1&ratio=1&tilesize=256&clientVersion=jssdk_bate@%20leaflet%202.1.5`,
         extent: [108.50508936658522, 18.127326424708514, 111.09756659719326, 20.163718157197533]
       },
       {
-        url: `/${store.state.app.apiProxy.BaseMap1Api}/cva_c/wmts?tk=%E6%82%A8%E7%9A%84%E5%AF%86%E9%92%A5&service=WMTS&request=GetTile&version=1.0.0&layers=&styles=&tilematrixSet=c&format=tiles&height=256&width=256&layer=cva&style=default&zIndex=1&tilematrix={z}&tilerow={y}&tilecol={x}`
+        url: `${isInternet ? `/${store.state.app.apiProxy.BaseMap1Api}` : 'http://59.255.48.160:81'}/cva_c/wmts?tk=%E6%82%A8%E7%9A%84%E5%AF%86%E9%92%A5&service=WMTS&request=GetTile&version=1.0.0&layers=&styles=&tilematrixSet=c&format=tiles&height=256&width=256&layer=cva&style=default&zIndex=1&tilematrix={z}&tilerow={y}&tilecol={x}`
       },
     ]
   },
@@ -97,16 +97,16 @@ const baseMapLayers = [
     img: HTImg,
     layersUrl: [
       {
-        url: `/${store.state.app.apiProxy.BaseMap1Api}/ter_c/wmts?tk=%E6%82%A8%E7%9A%84%E5%AF%86%E9%92%A5&service=WMTS&request=GetTile&version=1.0.0&layers=&styles=&tilematrixSet=c&format=tiles&height=256&width=256&layer=ter&style=default&tilematrix={z}&tilerow={y}&tilecol={x}`,
+        url: `${isInternet ? `/${store.state.app.apiProxy.BaseMap1Api}` : 'http://59.255.48.160:81'}/ter_c/wmts?tk=%E6%82%A8%E7%9A%84%E5%AF%86%E9%92%A5&service=WMTS&request=GetTile&version=1.0.0&layers=&styles=&tilematrixSet=c&format=tiles&height=256&width=256&layer=ter&style=default&tilematrix={z}&tilerow={y}&tilecol={x}`,
       },
       {
-        url: `/${store.state.app.apiProxy.BaseMap3Api}/ime-cloud/rest/hainan_dem/wmts?service=WMTS&request=GetTile&version=1.0.0&layers=&styles=&tilematrixSet=default028mm&format=image%2Fjpgpng&height=256&width=256&layer=hainan_dem&style=default&minZoom=8&maxZoom=18&zIndex=4&bounds=17.17616389817063%2C106.9017014531631%2C21.04474386095089%2C113.04819115525501&tilematrix={z}&tilerow={y}&tilecol={x}`,
+        url: `${isInternet ? `/${store.state.app.apiProxy.BaseMap3Api}` : 'http://59.212.146.170'}/ime-cloud/rest/hainan_dem/wmts?service=WMTS&request=GetTile&version=1.0.0&layers=&styles=&tilematrixSet=default028mm&format=image%2Fjpgpng&height=256&width=256&layer=hainan_dem&style=default&minZoom=8&maxZoom=18&zIndex=4&bounds=17.17616389817063%2C106.9017014531631%2C21.04474386095089%2C113.04819115525501&tilematrix={z}&tilerow={y}&tilecol={x}`,
         maxZoom: 18,
         minZoom: 8,
         extent: [106.9017014531631, 17.17616389817063, 113.04819115525501, 21.04474386095089]
       },
       {
-        url: `/${store.state.app.apiProxy.BaseMap1Api}/cta_c/wmts?tk=%E6%82%A8%E7%9A%84%E5%AF%86%E9%92%A5&service=WMTS&request=GetTile&version=1.0.0&layers=&styles=&tilematrixSet=c&format=tiles&height=256&width=256&layer=cta&style=default&tilematrix={z}&tilerow={y}&tilecol={x}`,
+        url: `${isInternet ? `/${store.state.app.apiProxy.BaseMap1Api}` : 'http://59.255.48.160:81'}/cta_c/wmts?tk=%E6%82%A8%E7%9A%84%E5%AF%86%E9%92%A5&service=WMTS&request=GetTile&version=1.0.0&layers=&styles=&tilematrixSet=c&format=tiles&height=256&width=256&layer=cta&style=default&tilematrix={z}&tilerow={y}&tilecol={x}`,
       },
     ]
   },
@@ -120,14 +120,14 @@ const baseMapLayers = [
     img: WXTImg,
     layersUrl: [
       {
-        url: `/${store.state.app.apiProxy.BaseMap1Api}/img_c/wmts?tk=%E6%82%A8%E7%9A%84%E5%AF%86%E9%92%A5&service=WMTS&request=GetTile&version=1.0.0&layers=&styles=&tilematrixSet=c&format=tiles&height=256&width=256&layer=img&style=default&opacity=0.6&zIndex=1&tilematrix={z}&tilerow={y}&tilecol={x}`,
+        url: `${isInternet ? `/${store.state.app.apiProxy.BaseMap1Api}` : 'http://59.255.48.160:81'}/img_c/wmts?tk=%E6%82%A8%E7%9A%84%E5%AF%86%E9%92%A5&service=WMTS&request=GetTile&version=1.0.0&layers=&styles=&tilematrixSet=c&format=tiles&height=256&width=256&layer=img&style=default&opacity=0.6&zIndex=1&tilematrix={z}&tilerow={y}&tilecol={x}`,
       },
       {
-        url: `/${store.state.app.apiProxy.BaseMap3Api}/ime-cloud/rest/hainan_img_2018/wmts?service=WMTS&request=GetTile&version=1.0.0&layers=&styles=&tilematrixSet=default028mm&format=image%2Fjpgpng&height=256&width=256&layer=hainan_img_2018&style=default&minZoom=8&maxZoom=18&zIndex=4&bounds=13.257020557028%2C103.34794430865948%2C23.46552385201528%2C114.30558768331025&tilematrix={z}&tilerow={y}&tilecol={x}`,
+        url: `${isInternet ? `/${store.state.app.apiProxy.BaseMap3Api}` : 'http://59.212.146.170'}/ime-cloud/rest/hainan_img_2018/wmts?service=WMTS&request=GetTile&version=1.0.0&layers=&styles=&tilematrixSet=default028mm&format=image%2Fjpgpng&height=256&width=256&layer=hainan_img_2018&style=default&minZoom=8&maxZoom=18&zIndex=4&bounds=13.257020557028%2C103.34794430865948%2C23.46552385201528%2C114.30558768331025&tilematrix={z}&tilerow={y}&tilecol={x}`,
         extent: [103.34794430865948, 13.257020557028, 114.30558768331025, 23.46552385201528]
       },
       {
-        url: `/${store.state.app.apiProxy.BaseMap1Api}/cia_c/wmts?tk=%E6%82%A8%E7%9A%84%E5%AF%86%E9%92%A5&service=WMTS&request=GetTile&version=1.0.0&layers=&styles=&tilematrixSet=c&format=tiles&height=256&width=256&layer=cia&style=default&zIndex=4&tilematrix={z}&tilerow={y}&tilecol={x}`,
+        url: `${isInternet ? `/${store.state.app.apiProxy.BaseMap1Api}` : 'http://59.255.48.160:81'}/cia_c/wmts?tk=%E6%82%A8%E7%9A%84%E5%AF%86%E9%92%A5&service=WMTS&request=GetTile&version=1.0.0&layers=&styles=&tilematrixSet=c&format=tiles&height=256&width=256&layer=cia&style=default&zIndex=4&tilematrix={z}&tilerow={y}&tilecol={x}`,
       },
     ]
   },
@@ -141,10 +141,10 @@ const baseMapLayers = [
     img: HYSImg,
     layersUrl: [
       {
-        url: `/${store.state.app.apiProxy.BaseMap2Api}/mapserver/vmap/hn_bigdata_2018dt/getMAP?x={x}&y={y}&l={z}&styleId=hn_bigdata_2018dtys2&ratio=1&tilesize=256&clientVersion=jssdk_bate@%20leaflet%202.1.5`,
+        url: `${isInternet ? `/${store.state.app.apiProxy.BaseMap2Api}` : 'http://59.212.37.22'}/mapserver/vmap/hn_bigdata_2018dt/getMAP?x={x}&y={y}&l={z}&styleId=hn_bigdata_2018dtys2&ratio=1&tilesize=256&clientVersion=jssdk_bate@%20leaflet%202.1.5`,
       },
       {
-        url: `/${store.state.app.apiProxy.BaseMap1Api}/cta_c/wmts?tk=%E6%82%A8%E7%9A%84%E5%AF%86%E9%92%A5&service=WMTS&request=GetTile&version=1.0.0&layers=&styles=&tilematrixSet=c&format=tiles&height=256&width=256&layer=cta&style=default&tilematrix={z}&tilerow={y}&tilecol={x}`,
+        url: `${isInternet ? `/${store.state.app.apiProxy.BaseMap1Api}` : 'http://59.255.48.160:81'}/cta_c/wmts?tk=%E6%82%A8%E7%9A%84%E5%AF%86%E9%92%A5&service=WMTS&request=GetTile&version=1.0.0&layers=&styles=&tilematrixSet=c&format=tiles&height=256&width=256&layer=cta&style=default&tilematrix={z}&tilerow={y}&tilecol={x}`,
       },
     ]
   },

+ 2 - 64
src/out/config.js

@@ -1,66 +1,4 @@
 window.cusConfig = {
-  portalPort: 8088, //  门户端口
-  version: 116,
-  handleClose: true,  //  万福-光电联动
-  hlxUrlArr: [  //  万福-光电联动-海兰信配置代理
-    {key: '74.10.30.38',value: '/hlx-firstly'},
-    {key: '74.10.30.39',value: '/hlx-thirdly'},
-    {key: '74.10.28.119',value: '/hlx-second'}
-  ],
-  sectorDistance:{
-   Line:1.6,  //辅佐线
-   radiusRadii:1.5, //半径
-   centerLine:1.8 //中心线
-  },
-  trackEndTimeOffset: 30000, //单位(ms),首页点船查询历史轨迹延时
-  trackInterval: 4, //单位(h),首页点船查询历史轨迹,ws返回数据时间段(12即为每查询12小时ws返回一批数据)
-  trackHistory: 4, //单位(h),首页点船查询历史轨迹,默认查询时间范围
-  maxZoomAutoOpenTrack: true,
-  116: {
-    gdld: 'fk', //  光电联动方案 ['fk', 'hlx']
-    rhWebSocketType: 'fk', // 首页融合历史轨迹参数,['fk', hlx] 后期确定了用哪一版后可删
-    rhSpeedExportType: 'FUSION', // 首页轨迹列表航速分析导出融合类型区分 116:FUSION  117:FUSION_117  118:FUSION_118
-    geoserver: {
-      countShip: true, // 使用geoserver统计:ture,不使用:false
-      rhLayers: 'redis:geo_fusion_ship',  // 融合瓦片图层: 118:redis:geo_fk_ship  117:redis:geo_fk_ship_117  116:redis:geo_fusion_ship
-      rhHotLayers: 'redis:geo_fusion_ship_hot', // 融合热力瓦片图层:118:redis:geo_fk_hot   117:redis:geo_fk_hot_117  116:redis:geo_fusion_ship_hot
-      shipWarningFilterLayers: 'MySQL:warning_ship_record_116',   // 船舶预警筛选瓦片图层:118:MySQL:warning_ship_record   117:MySQL:warning_ship_record_117  116:MySQL:warning_ship_record_116
-      personWarningHotLayers: 'MySQL:index_seat_warning_person_track_116',   // 人员预警热力瓦片图层:118:MySQL:index_seat_warning_person_track  117:MySQL:index_seat_warning_person_track_117  116:MySQL:index_seat_warning_person_track_116
-      carWarningHotLayers: 'MySQL:index_seat_warning_car_track_116',   // 车辆预警热力瓦片图层:118:MySQL:index_seat_warning_car_track   117:MySQL:index_seat_warning_car_track_117  116:MySQL:index_seat_warning_car_track_116
-      shipWarningHotLayers: 'MySQL:index_seat_warning_ship_track_116',   // 船舶预警热力瓦片图层:118:MySQL:index_seat_warning_ship_track  117:MySQL:index_seat_warning_ship_track_117   116:MySQL:index_seat_warning_ship_track_116
-    },
-  },
-  117: {
-    gdld: 'fk', //  光电联动方案 ['fk', 'hlx']
-    rhWebSocketType: 'fk', // 首页融合历史轨迹参数,['fk', hlx] 后期确定了用哪一版后可删
-    rhSpeedExportType: 'FUSION_117', // 首页轨迹列表航速分析导出融合类型区分 116:FUSION  117:FUSION_117  118:FUSION_118
-    geoserver: {
-      countShip: true, // 使用geoserver统计:ture,不使用:false
-      rhLayers: 'redis:geo_fk_ship_117',  // 融合瓦片图层: 118:redis:geo_fk_ship  117:redis:geo_fk_ship_117  116:redis:geo_fusion_ship
-      rhHotLayers: 'redis:geo_fk_hot_117', // 融合热力瓦片图层:118:redis:geo_fk_hot   117:redis:geo_fk_hot_117  116:redis:geo_fusion_ship_hot
-      shipWarningFilterLayers: 'MySQL:warning_ship_record_117',   // 船舶预警筛选瓦片图层:118:MySQL:warning_ship_record   117:MySQL:warning_ship_record_117  116:MySQL:warning_ship_record_116
-      personWarningHotLayers: 'MySQL:index_seat_warning_person_track_117',   // 人员预警热力瓦片图层:118:MySQL:index_seat_warning_person_track  117:MySQL:index_seat_warning_person_track_117  116:MySQL:index_seat_warning_person_track_116
-      carWarningHotLayers: 'MySQL:index_seat_warning_car_track_117',   // 车辆预警热力瓦片图层:118:MySQL:index_seat_warning_car_track   117:MySQL:index_seat_warning_car_track_117  116:MySQL:index_seat_warning_car_track_116
-      shipWarningHotLayers: 'MySQL:index_seat_warning_ship_track_117',   // 船舶预警热力瓦片图层:118:MySQL:index_seat_warning_ship_track  117:MySQL:index_seat_warning_ship_track_117   116:MySQL:index_seat_warning_ship_track_116
-    },
-  },
-  118: {
-    gdld: 'fk', //  光电联动方案 ['fk', 'hlx']
-    rhWebSocketType: 'fk', // 首页融合历史轨迹参数,['fk', hlx] 后期确定了用哪一版后可删
-    rhSpeedExportType: 'FUSION_118', // 首页轨迹列表航速分析导出融合类型区分 116:FUSION  117:FUSION_117  118:FUSION_118
-    geoserver: {
-      countShip: true, // 使用geoserver统计:ture,不使用:false
-      rhLayers: 'redis:geo_fk_ship',  // 融合瓦片图层: 118:redis:geo_fk_ship  117:redis:geo_fk_ship_117  116:redis:geo_fusion_ship
-      rhHotLayers: 'redis:geo_fk_hot', // 融合热力瓦片图层:118:redis:geo_fk_hot   117:redis:geo_fk_hot_117  116:redis:geo_fusion_ship_hot
-      shipWarningFilterLayers: 'MySQL:warning_ship_record',   // 船舶预警筛选瓦片图层:118:MySQL:warning_ship_record   117:MySQL:warning_ship_record_117  116:MySQL:warning_ship_record_116
-      personWarningHotLayers: 'MySQL:index_seat_warning_person_track',   // 人员预警热力瓦片图层:118:MySQL:index_seat_warning_person_track  117:MySQL:index_seat_warning_person_track_117  116:MySQL:index_seat_warning_person_track_116
-      carWarningHotLayers: 'MySQL:index_seat_warning_car_track',   // 车辆预警热力瓦片图层:118:MySQL:index_seat_warning_car_track   117:MySQL:index_seat_warning_car_track_117  116:MySQL:index_seat_warning_car_track_116
-      shipWarningHotLayers: 'MySQL:index_seat_warning_ship_track',   // 船舶预警热力瓦片图层:118:MySQL:index_seat_warning_ship_track  117:MySQL:index_seat_warning_ship_track_117   116:MySQL:index_seat_warning_ship_track_116
-    },
-  },
-  nginxApiMapper: new Map([
-    ['74.6.57.208:30030', '/kt-api'], // 科通代理
-    ['74.10.28.62:81', '/s3-api'], // 太极s3代理
-    ['74.10.28.97:443', '/hk-api'], // 海康代理
-  ])
+  mapInternet: false,
+  internetAuth: false
 }

+ 4 - 0
src/store/modules/gis.ts

@@ -8,6 +8,7 @@ import CommonStyle from "@/views/gis/map-info/style/common";
 
 const state = {
   menuRootName: '9cd5fbf9-35fd-4fb2-8c24-1f871afd67be',
+  isTooling: false,
   map: null,
   activeQyId: null,
   gisParams: {
@@ -29,6 +30,9 @@ const mutations = {
   SET_ACTIVE_QY_ID(state, id) {
     state.activeQyId = id
   },
+  SET_IS_TOOLING(state, flag) {
+    state.isTooling = flag
+  },
   SET_GIS_MAP(state, {map, defaultDom}) {
     state.map = map
     state.gisParams.default.source = new source.Vector()

+ 9 - 6
src/views/gis/business/enterprise/index.vue

@@ -63,7 +63,7 @@
           </div>
         </div>
       </div>
-      <div class="table">
+      <div class="table" v-loading="enterprise.table.loading">
         <div class="table-card">
           <template v-for="(item, index) in enterprise.table.data">
             <div class="table-card-item __hover" :class="{active: item.id === $store.state.gis.activeQyId}" @click="handleClick(item)">
@@ -140,7 +140,8 @@ export default defineComponent({
           data: <any>[],
           pageNum: 1,
           pageSize: 10,
-          total: 0
+          total: 0,
+          loading: false
         }
       },
       statistic: {
@@ -184,11 +185,13 @@ export default defineComponent({
       if (state.enterprise.form.type?.length > 0) {
         params.entType = state.enterprise.form.type.map(v => store.getters['dictionary/elementTypeMap'].get(v)).join(',')
       }
+      state.enterprise.table.loading = true
       that.$api.enterpriseQuery(params).then((res: any) => {
-        if (res.resp_code === 0 && res.datas?.length > 0) {
-          state.enterprise.table.data = res.datas
-          state.enterprise.table.total = res.recordCount
-        }
+        state.enterprise.table.data = res.datas || []
+        state.enterprise.table.total = res.recordCount || 0
+        state.enterprise.table.loading = false
+      }).catch(() => {
+        state.enterprise.table.loading = false
       })
     }
     const initStatistic = () => {

+ 14 - 12
src/views/gis/layout/index.vue

@@ -535,7 +535,7 @@ export default defineComponent({
                 lineDash: [10, 10]
               }),
               fill: new style.Fill({
-                color: 'rgba(20, 129, 241, 0.3)',
+                color: 'rgba(20, 129, 241, 0.1)',
               }),
             })
           ]
@@ -575,11 +575,11 @@ export default defineComponent({
             try {
               const feat: any = new format.WKT().readFeature(`POINT(${v.longitude} ${v.latitude})`)
               let type = ''
-              if (v.type = '公安类') {
+              if (v.type === '公安类') {
                 type = 'galsb'
-              } else if (v.type = '社会类') {
+              } else if (v.type === '社会类') {
                 type = 'shlsb'
-              } else if (v.type = '民用类') {
+              } else if (v.type === '民用类') {
                 type = 'mylsb'
               }
               feat.set('defaultStyle', SbStyle.sbStyle(type))
@@ -639,14 +639,16 @@ export default defineComponent({
       })
     }
     onMounted(() => {
-      if (!sessionStorage.getItem('auth')) {
-        if(navigator.userAgent.indexOf("Firefox") != -1 || navigator.userAgent.indexOf("Chrome") != -1){
-          window.location.href = "about:blank";
-          window.close();
-        }else{
-          window.opener = null;
-          window.open("", "_self");
-          window.close();
+      if (window.cusConfig?.internetAuth) {
+        if (!sessionStorage.getItem('auth')) {
+          if(navigator.userAgent.indexOf("Firefox") != -1 || navigator.userAgent.indexOf("Chrome") != -1){
+            window.location.href = "about:blank";
+            window.close();
+          }else{
+            window.opener = null;
+            window.open("", "_self");
+            window.close();
+          }
         }
       }
     })

+ 2 - 2
src/views/gis/layout/tools/analysis.vue

@@ -222,7 +222,7 @@ export default defineComponent({
                 lineDash: [10, 10]
               }),
               fill: new style.Fill({
-                color: 'rgba(20, 129, 241, 0.3)',
+                color: 'rgba(20, 129, 241, 0.1)',
               }),
             })
           ]
@@ -271,7 +271,7 @@ export default defineComponent({
               lineDash: [10, 10]
             }),
             fill: new style.Fill({
-              color: 'rgba(20, 129, 241, 0.3)',
+              color: 'rgba(20, 129, 241, 0.1)',
             }),
           })
         });

+ 26 - 2
src/views/gis/layout/tools/tool-draw.ts

@@ -11,6 +11,7 @@ import {isValue} from "@/utils/util";
 // @ts-ignore
 import PointIcon from "@/assets/images/gis-layout/gis-layout-tools_tool-bz_icon.png"
 import {v4} from "uuid";
+import store from "@/store";
 
 const globalLineDash = [
     [0, 0], //实线
@@ -31,7 +32,7 @@ const baseDrawConfig = {
     lineWidth: 2, // LineString的线段宽度,默认1
     lineType: 0, // LineString的线段类型索引,默认0,实线,取globalLineDash数组索引
     lineDash: null, // LineString的线段类型,默认null,优先级比lineType高
-    polyColor: 'rgba(20, 129, 241, 0.3)', // Polygon的填充色,默认蓝色
+    polyColor: 'rgba(20, 129, 241, 0.1)', // Polygon的填充色,默认蓝色
     polyBorderColor: '#2860F1', // Polygon的边框颜色,默认蓝色
     polyBorderWidth: 2, // Polygon的边框宽度,默认1
     polyBorderType: 0, // Polygon的边框类型索引,默认0,实线,取globalLineDash数组索引
@@ -164,7 +165,8 @@ export const draw = (map, obj) => {
                 map.removeInteraction(oldModify[0])
             }
         }
-        if (!toolDrawTooltipElement) {
+        if (!toolDrawTooltipElement && !store.state.gis.isTooling) {
+            store.commit('gis/SET_IS_TOOLING', true)
             // reset()
             let _source
             const realLayer = map.getLayers().getArray().filter(v => v.get(layerFlag[0]) === layerFlag[1])
@@ -184,6 +186,7 @@ export const draw = (map, obj) => {
             }
             const modifyInteraction = new Modify({
                 source: _source,
+                pixelTolerance: 1
             });
             modifyInteraction.set(modifyFlag[0], modifyFlag[1])
             map.addInteraction(modifyInteraction)
@@ -288,6 +291,7 @@ export const draw = (map, obj) => {
                         geometryFunction: obj.rectangle ? createBox() : null,
                         // geometryFunction: createRegularPolygon(6),
                         style: commonStyle(obj.featureType === 'Point' ? true : false),
+                        stopClick: true
                     });
                     draw.set('showText', obj.featureType === 'Point' ? true : false)
                     draw.set(drawFlag[0], drawFlag[1])
@@ -346,6 +350,7 @@ export const draw = (map, obj) => {
                         featEnd.set('isInit', true)
                         featEnd.set(layerFlag[0], layerFlag[1])
                         featEnd.setId(v4())
+                        store.commit('gis/SET_IS_TOOLING', false)
                     }
                     draw.on('drawend', drawendHandle);
                 }
@@ -390,4 +395,23 @@ export const draw = (map, obj) => {
             // }
         })
     }))
+}
+
+export const refreshModify = (map, _source) => {
+    const oldModify = map.getInteractions().getArray().filter(v => v.get(modifyFlag[0]) === modifyFlag[1])
+    if (oldModify) {
+        map.removeInteraction(oldModify[0])
+    }
+    const modifyInteraction = new Modify({
+        source: _source,
+        pixelTolerance: 1
+    });
+    modifyInteraction.set(modifyFlag[0], modifyFlag[1])
+    map.addInteraction(modifyInteraction)
+    modifyInteraction.on('modifyend', evt => {
+        try {
+            const feat = evt.features.item(0)
+        } catch {
+        }
+    })
 }

+ 39 - 28
src/views/gis/layout/tools/tool.vue

@@ -49,6 +49,7 @@ import {ElMessage, ElMessageBox} from "element-plus";
 import './map.scss'
 import * as ToolDraw from './tool-draw'
 import * as ol from "ol";
+import store from "@/store";
 
 export default defineComponent({
   name: '',
@@ -89,40 +90,49 @@ export default defineComponent({
         if (feat) {
           l.getSource().removeFeature(feat)
           state.tempUUID = ''
+          state.closeOverlay.getElement().style.display = 'none'
           state.closeOverlay.setPosition(undefined)
+          ToolDraw.refreshModify(props.map, l.getSource())
         }
       }
     }
     onMounted(() => {
-      state.closeOverlay = new ol.Overlay({
-        id: 'toolOverlay',
-        element: ref_close.value,
-        autoPan: false,
-        offset: [0, -10],
-        positioning: 'bottom-center',
-        stopEvent: true,
-        autoPanAnimation: {
-          duration: 250
-        }
-      })
-      props.map?.addOverlay(state.closeOverlay)
-      props.map?.on('singleclick', (e) => {
-        let flag = false
-        props.map?.forEachFeatureAtPixel(e.pixel, (f) => {
-          if (!flag && f.get('layerName') === 'toolDrawViewsLayer' && f.get('isInit')) {
-            flag = true
-            if (state.tempUUID !== f.getId()) {
-              state.tempUUID = f.getId()
-              state.closeOverlay.setPosition(e.coordinate)
-            } else {
-              state.tempUUID = ''
-              state.closeOverlay.setPosition(undefined)
-            }
+      store.commit('gis/SET_IS_TOOLING', false)
+      const id = 'toolOverlay'
+      if (props.map?.getOverlayById(id)) {
+        state.closeOverlay = props.map?.getOverlayById(id)
+      } else {
+        state.closeOverlay = new ol.Overlay({
+          id: id,
+          element: ref_close.value,
+          autoPan: false,
+          offset: [0, -10],
+          positioning: 'bottom-center',
+          stopEvent: true,
+          autoPanAnimation: {
+            duration: 250
           }
-        }, {
-          hitTolerance: 0,
-        });
-      })
+        })
+        props.map?.addOverlay(state.closeOverlay)
+        props.map?.on('singleclick', (e) => {
+          let flag = false
+          props.map?.forEachFeatureAtPixel(e.pixel, (f) => {
+            if (!flag && f.get('layerName') === 'toolDrawViewsLayer' && f.get('isInit')) {
+              flag = true
+              if (state.tempUUID !== f.getId()) {
+                state.tempUUID = f.getId()
+                state.closeOverlay.getElement().style.display = 'unset'
+                state.closeOverlay.setPosition(e.coordinate)
+              } else {
+                state.tempUUID = ''
+                state.closeOverlay.setPosition(undefined)
+              }
+            }
+          }, {
+            hitTolerance: 0,
+          });
+        })
+      }
     })
     return {
       ...toRefs(state),
@@ -157,5 +167,6 @@ export default defineComponent({
 .close-dom {
   width: 16px;
   height: 16px;
+  display: none;
 }
 </style>