Skip to content

Commit 7b7f026

Browse files
committed
【bug】1) webMap 数据上图上传一份数据,包含2个字段同名字段的处理。第二个字段名增加_1。并且如果包含一列空字段,不报错。
(reviewed by chengl)
1 parent 2b0ca55 commit 7b7f026

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/openlayers/mapping/WebMap.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1866,11 +1866,21 @@ export class WebMap extends Observable {
18661866
olGeom.transform(fileCode, baseLayerEpsgCode);
18671867
}
18681868
for (let j = 0, leng = rowDatas.length; j < leng; j++) {
1869-
attributes[colTitles[j]] = rowDatas[j];
1869+
let field = colTitles[j];
1870+
if (field === undefined || field === null) {continue;}
1871+
field = field.trim();
1872+
if(Object.keys(attributes).includes(field)) {
1873+
//说明前面有个一模一样的字段
1874+
const newField = field + '_1';
1875+
attributes[newField] = rowDatas[j];
1876+
} else {
1877+
attributes[field] = rowDatas[j];
1878+
}
1879+
18701880
}
18711881
let feature = new Feature({
18721882
geometry: olGeom,
1873-
attributes: attributes
1883+
attributes
18741884
});
18751885
features.push(feature);
18761886
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy