Ver código fonte

生态修复山水工程上图改用服务

maxiaoxiao 11 meses atrás
pai
commit
d650d9337c

+ 8 - 2
src/views/cockpit/common/VectorSpace/BoxCommonVector.vue

@@ -36,7 +36,7 @@
 </template>
   
 <script>
-import { QueryList } from '@/api/cockpitNew'
+import { QueryOne, QueryList } from '@/api/cockpitNew'
 import * as tdsy from "@/views/cockpit/js/tdsy";
 
 import * as wellknown from "wellknown";
@@ -54,6 +54,10 @@ export default {
         };
     },
     methods: {
+        async draw_vector_server(jscType){
+            let res = await QueryOne({ jscType, id: "4602" });
+            tdsy.addLayer({ ...res.data, title: this.title });
+        },
         multiPolygonToPolygons(multiPolygon) {
             const polygons = [];
             multiPolygon.coordinates.forEach(polygonCoordinates => {
@@ -428,6 +432,7 @@ export default {
             this.state = ''
             if (newVal.tableData && newVal.tableData.length > 0) {
 
+                this.active_dableData = []//防止重复点击tableData不刷新
                 this.active_dableData = newVal.tableData
                 this.tableData = newVal.tableData
                 // this.init_vector()
@@ -440,7 +445,8 @@ export default {
             }
         },
         active_dableData(newVal, oldVal) {
-            this.draw_vector_tdgy_gy_jd(newVal);
+            if(this.cockpit_vector.mapType) this.draw_vector_server(this.cockpit_vector.mapType)
+            else this.draw_vector_tdgy_gy_jd(newVal);
         }
     },
     mounted() {

+ 19 - 3
src/views/cockpit/js/tdsy.js

@@ -18,7 +18,6 @@ export const add = (res, oneDArray) => {
     gy_jd_entity.entities.add({
         // position: Cesium.Cartesian3.fromDegrees(res_coordinates[0], res_coordinates[1], 0),
         properties: res,
-        
         polygon: {
             zIndex: 1,
             hierarchy: {
@@ -35,9 +34,25 @@ export const add = (res, oneDArray) => {
         }
     })
 }
+let layer = null
+export function addLayer(obj) {
+    // this.bus.$emit("checkedChange", {...obj,checked:true });
+    layer = viewer.imageryLayers.addImageryProvider(
+        new Cesium.SuperMapImageryProvider({
+            url: obj.url,
+            name: obj.title,
+        })
+    );
+}
 export const remove = () => {
-    viewer.dataSources.remove(gy_jd_entity);
-    gy_jd_entity = null
+    if (gy_jd_entity) {
+        viewer.dataSources.remove(gy_jd_entity);
+        gy_jd_entity = null
+    }
+    if (layer) {
+        viewer.imageryLayers.remove(layer);
+        layer = null
+    }
     store.setCockpit_vector({
         title: "",
         tableData: [],
@@ -52,6 +67,7 @@ export const remove = () => {
     // }
 
 }
+
 export const hidden = (flag) => {
     gy_jd_entity.show = flag;
 

+ 1 - 1
src/views/cockpit/stxf.vue

@@ -238,7 +238,7 @@ export default {
         store.setCockpit_vector({
           title: "山水工程项目",
           word: "项目名称",
-
+          mapType:'jsc_stxf_ssxf_layer',
           tableData: store.state.cockpit_stxf.ssgc.list,
           tablejscType: `jsc_stxf_ywlx_ssxfmx`,
           columns: ['项目名称', '治理面积(公顷)','投资金额(万元)', '区县编码', '区县编码名称', '治理时间', '治理进度',  '备注'],