设备不能添加问题
This commit is contained in:
		
							parent
							
								
									b4f8356eb5
								
							
						
					
					
						commit
						9cb3ad6b60
					
				| 
						 | 
					@ -601,12 +601,25 @@ export default {
 | 
				
			||||||
                return item.geometry.coordinates;
 | 
					                return item.geometry.coordinates;
 | 
				
			||||||
              });
 | 
					              });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
              geojson.coordinates = geojson.coordinates.filter(
 | 
					              // 清理 geojson.coordinates,只保留第一个有效元素
 | 
				
			||||||
 | 
					              if (
 | 
				
			||||||
 | 
					                Array.isArray(geojson.coordinates) &&
 | 
				
			||||||
 | 
					                geojson.coordinates.length > 1
 | 
				
			||||||
 | 
					              ) {
 | 
				
			||||||
 | 
					                // 寻找第一个有效元素(点、多边形或圆)
 | 
				
			||||||
 | 
					                const firstValidItem = geojson.coordinates.find(
 | 
				
			||||||
                  (item) =>
 | 
					                  (item) =>
 | 
				
			||||||
                    Array.isArray(item) &&
 | 
					                    Array.isArray(item) &&
 | 
				
			||||||
                  Array.isArray(item[0]) &&
 | 
					                    // 点坐标:[lng, lat]
 | 
				
			||||||
                  Array.isArray(item[0][0])
 | 
					                    ((item.length === 2 &&
 | 
				
			||||||
 | 
					                      typeof item[0] === "number" &&
 | 
				
			||||||
 | 
					                      typeof item[1] === "number") ||
 | 
				
			||||||
 | 
					                      // 多边形或圆坐标:三维数组
 | 
				
			||||||
 | 
					                      (Array.isArray(item[0]) && Array.isArray(item[0][0])))
 | 
				
			||||||
                );
 | 
					                );
 | 
				
			||||||
 | 
					                // 如果找到有效元素,只保留它;否则置为空数组
 | 
				
			||||||
 | 
					                geojson.coordinates = firstValidItem ? [firstValidItem] : [];
 | 
				
			||||||
 | 
					              }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            this.ruleForm.geoJson = geojson;
 | 
					            this.ruleForm.geoJson = geojson;
 | 
				
			||||||
            this.ruleForm.center = [
 | 
					            this.ruleForm.center = [
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -336,7 +336,7 @@ export default {
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    toGeoJSON() {
 | 
					    toGeoJSON() {
 | 
				
			||||||
      if (this.typeOf === "pointP") {
 | 
					      if (this.typeOf === "pointP") {
 | 
				
			||||||
        // return this.graphicLayer.toGeoJSON({ noAlt: true });
 | 
					        return this.graphicLayer.toGeoJSON({ noAlt: true });
 | 
				
			||||||
      } else {
 | 
					      } else {
 | 
				
			||||||
        this.graphicLayer._graphicList._array.forEach((item) => {
 | 
					        this.graphicLayer._graphicList._array.forEach((item) => {
 | 
				
			||||||
          if (item.type === "billboard") {
 | 
					          if (item.type === "billboard") {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue