Parcourir la source

fix: 对接列表

lxf il y a 1 semaine
Parent
commit
cefdc838fd

+ 3 - 0
src/api/config.js

@@ -3,9 +3,11 @@ let serverMock = "https://mock.apipark.cn/m1/4662471-4313509-default/"
 let pythonServe = VE_ENV.PYSERVER
 // let djiCloudBase = "http://127.0.0.1/";
 let djiCloudBase = "https://djiapi.sysuimars.com/";
+let oneMapServer = "https://one-map-api.feiniaotech.com/";
 
 export const base_url = server + "site/";
 export const base_dev_url = server + "mini/";
+export const one_map_url = oneMapServer + "site/";
 export const base_url_python = pythonServe;
 export const server_mock = serverMock + "site/";
 export const dji_cloud_base = djiCloudBase;
@@ -50,6 +52,7 @@ export const igSuccessUrl = [
 export default {
     base_url,
     base_dev_url,
+    one_map_url,
     base_url_python,
     server_mock,
     dji_cloud_base,

+ 8 - 0
src/api/modules/species.js

@@ -0,0 +1,8 @@
+import config from "../config"
+
+export default {
+    speciesList: {
+        url: config.one_map_url + "species/botany_type/list",
+        type: "get",
+    },
+}

+ 9 - 2
src/views/warningHome/index.vue

@@ -172,8 +172,8 @@ const mapRef = ref(null);
 const showDetail = ref(false);
 const treeRef = ref(null);
 const defaultProps = {
-    children: "children",
-    label: "label",
+    children: "items",
+    label: "name",
 };
 
 import lz from "@/assets/images/map/type/荔枝.png";
@@ -504,6 +504,7 @@ onMounted(() => {
     staticMapLayers = new StaticMapLayers(warningMap.kmap);
     staticMapPointLayers = new StaticMapPointLayers(warningMap.kmap);
     distributionLayer = new DistributionLayer(warningMap.kmap);
+    getSpeciesListData();
     // 作物分布默认选中
     handleDistributionTreeDefault()
     handleDistributionLayer();
@@ -739,6 +740,12 @@ const handleTabClick = (item) => {
     }
 };
 
+const getSpeciesListData = () => {
+    VE_API.species.speciesList().then((res) => {
+        treeActionData.value = res.data;
+    });
+};
+
 const props1 = {
     checkStrictly: true,
 };

+ 9 - 9
src/views/warningHome/map/distributionLayer.js

@@ -19,7 +19,7 @@ class DistributionLayer {
                 return [style2]
             }
         });
-        this.kmap.addLayer(this.distributionLayer.layer)
+        // this.kmap.addLayer(this.distributionLayer.layer)
 
         this.distributionPointLayer = new KMap.VectorLayer("distributionPointLayer", 99, {
             source: new VectorSource({}),
@@ -174,14 +174,14 @@ class DistributionLayer {
 
     for (let item of data) {
       // 面数据(区域多边形)
-      if (item.geom) {
-        const f = new Feature({
-          geometry: new WKT().readGeometry(item.geom),
-        });
-        f.set("color", item.color);
-        f.set("fillColor", item.fillColor);
-        this.distributionLayer.source.addFeature(f);
-      }
+    //   if (item.geom) {
+    //     const f = new Feature({
+    //       geometry: new WKT().readGeometry(item.geom),
+    //     });
+    //     f.set("color", item.color);
+    //     f.set("fillColor", item.fillColor);
+    //     this.distributionLayer.source.addFeature(f);
+    //   }
 
       // 点数据:根据是否有 children / wktArr 递归查找
       addPointFeaturesFromNode(item);