|
@@ -363,14 +363,49 @@ export default {
|
|
|
that.layerList.push(store.state.vectorlayerlist[i]);
|
|
|
let queryData = [];
|
|
|
let geoms = [];
|
|
|
+ let tempTreeData = store.state.tempResourceTree;
|
|
|
+ //递归查询点击的图层信息
|
|
|
+ function getTreeId(list, id) {
|
|
|
+ //判断list是否是数组
|
|
|
+ if (!list instanceof Array) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ //遍历数组
|
|
|
+ for (let i in list) {
|
|
|
+ let item = list[i];
|
|
|
+ if (item.id === id) {
|
|
|
+ return item;
|
|
|
+ } else {
|
|
|
+ //查不到继续遍历
|
|
|
+ if (item.children) {
|
|
|
+ let value = getTreeId(item.children, id);
|
|
|
+ //查询到直接返回
|
|
|
+ if (value) {
|
|
|
+ return value;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ let legendJson = getTreeId(tempTreeData, obj.id);
|
|
|
for (let u = 0; u < e.features.length; u++) {
|
|
|
let cur = [];
|
|
|
e.features[u].fieldNames.forEach((fieldName, i) => {
|
|
|
if (fieldName.toLowerCase().indexOf("shape") < 0) {
|
|
|
- cur.push({
|
|
|
- name: fieldName,
|
|
|
- value: e.features[u].fieldValues[i],
|
|
|
- });
|
|
|
+ if (legendJson.legend == "") {
|
|
|
+ cur.push({
|
|
|
+ name: fieldName,
|
|
|
+ value: e.features[u].fieldValues[i],
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ //如果配置过字典信息
|
|
|
+ let parseJson = JSON.parse(legendJson.legend);
|
|
|
+ cur.push({
|
|
|
+ name: parseJson[i].fieldaliasname,
|
|
|
+ value: e.features[u].fieldValues[i],
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
let points = [];
|
|
@@ -384,12 +419,6 @@ export default {
|
|
|
geoms.push(points);
|
|
|
queryData.push(cur);
|
|
|
}
|
|
|
- console.log(
|
|
|
- that.queryResults,
|
|
|
- "that.queryResults,",
|
|
|
- obj.id,
|
|
|
- that.queryResults[obj.id]
|
|
|
- );
|
|
|
that.queryResults[obj.id] = queryData;
|
|
|
that.queryResultsGeom[obj.id] = geoms;
|
|
|
}
|