|
@@ -531,62 +531,38 @@ 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 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);
|
|
|
+ // let parseJson =
|
|
|
+ // legendJson.legend != "" ? JSON.parse(legendJson.legend) : [];
|
|
|
let parts = [];
|
|
|
- let legendJson = getTreeId(tempTreeData, obj.id);
|
|
|
+ let parseJson = JSON.parse(obj.legend);
|
|
|
for (let u = 0; u < e.features.length; u++) {
|
|
|
let cur = [];
|
|
|
- // if (legendJson.legend != "") {
|
|
|
- // //将数据转为json
|
|
|
- // let parseJson = JSON.parse(legendJson.legend);
|
|
|
- // //初始化下标
|
|
|
- // let index = -1;
|
|
|
- // var linSAr = JSON.parse(JSON.stringify(e.features[u]));
|
|
|
- // parseJson.forEach((p) => {
|
|
|
- // //将数据改为大写
|
|
|
- // p.fieldname = p.fieldname.toUpperCase();
|
|
|
- // let index1 = linSAr.fieldNames.indexOf(p.fieldname);
|
|
|
- // if (index1 > -1 && !condition(p)) {
|
|
|
- // this.$delete(linSAr.fieldNames, index1);
|
|
|
- // this.$delete(linSAr.fieldValues, index1);
|
|
|
- // }
|
|
|
-
|
|
|
- // //判断数据是否存在
|
|
|
- // index = linSAr.fieldNames.indexOf(p.fieldname);
|
|
|
- // if (index > -1 && p.fieldaliasname != p.fieldname) {
|
|
|
- // //如果数据存在数组中并且进行了修改,找到它对应的下标对数据进行替换
|
|
|
- // linSAr.fieldNames[index] = p.fieldaliasname;
|
|
|
- // }
|
|
|
- // });
|
|
|
- // } else {
|
|
|
- // var linSAr = JSON.parse(JSON.stringify(e.features[u]));
|
|
|
- // }
|
|
|
var linSAr = JSON.parse(JSON.stringify(e.features[u]));
|
|
|
- let parseJson =
|
|
|
- legendJson.legend != "" ? JSON.parse(legendJson.legend) : [];
|
|
|
function condition(ci) {
|
|
|
return ci.status != undefined && ci.status;
|
|
|
}
|
|
@@ -609,22 +585,6 @@ export default {
|
|
|
cur.push({ name: fieldName, value: v, order });
|
|
|
}
|
|
|
});
|
|
|
- // e.features[u].fieldNames.forEach((fieldName, i) => {
|
|
|
- // if (
|
|
|
- // fieldName.toLowerCase().indexOf("shape") < 0 &&
|
|
|
- // fieldName.toLowerCase().indexOf("sm") &&
|
|
|
- // e.features[u].fieldValues[i] != ""
|
|
|
- // ) {
|
|
|
- // let v = e.features[u].fieldValues[i];
|
|
|
- // if (!isNaN(parseFloat(v))) {
|
|
|
- // v = Math.round(parseFloat(v) * 100) / 100;
|
|
|
- // }
|
|
|
- // cur.push({
|
|
|
- // name: fieldName,
|
|
|
- // value: v,
|
|
|
- // });
|
|
|
- // }
|
|
|
- // });
|
|
|
} else {
|
|
|
that.$message({
|
|
|
message: "查询结果为空!",
|
|
@@ -635,31 +595,19 @@ export default {
|
|
|
|
|
|
//排序
|
|
|
cur.sort((a, b) => a.order - b.order);
|
|
|
- // cur.sort((a, b) => {
|
|
|
- // if (a === b) {
|
|
|
- // return 0;
|
|
|
- // } else if (a.value == null || a.value == "") {
|
|
|
- // return 1;
|
|
|
- // } else if (b.value == null || b.value == "") {
|
|
|
- // return -1;
|
|
|
- // } else {
|
|
|
- // // 降序
|
|
|
- // return a.value < b.value ? 1 : -1;
|
|
|
- // }
|
|
|
- // });
|
|
|
let urlNew = obj.url + ".json";
|
|
|
let resNew = await axios.get(urlNew);
|
|
|
let serCode = resNew.data.prjCoordSys.epsgCode;
|
|
|
let points = [];
|
|
|
for (let y = 0; y < e.features[u].geometry.points.length; y++) {
|
|
|
- let c = {}
|
|
|
+ let c = {};
|
|
|
if (serCode == 3857) {
|
|
|
c = that.cartesianToCartographic84(
|
|
|
e.features[u].geometry.points[y].x,
|
|
|
e.features[u].geometry.points[y].y
|
|
|
);
|
|
|
} else {
|
|
|
- c = e.features[u].geometry.points[y];
|
|
|
+ c = e.features[u].geometry.points[y];
|
|
|
}
|
|
|
points.push([c.x, c.y]);
|
|
|
}
|