|
@@ -6,19 +6,9 @@
|
|
|
</div>
|
|
|
<!-- <div class="sm-function-module-content-btn"> -->
|
|
|
<div class="btnList">
|
|
|
- <span
|
|
|
- v-for="(item, index) in actionOptions"
|
|
|
- :key="index"
|
|
|
- class="icon-span"
|
|
|
- :title="item.lable"
|
|
|
- :class="item.isSelect ? 'selected-icon' : ''"
|
|
|
- @click="changleQueryItem(item)"
|
|
|
- >
|
|
|
- <i
|
|
|
- class="iconfont iconSize"
|
|
|
- :class="item.iconName"
|
|
|
- style="margin-top: 0px"
|
|
|
- ></i>
|
|
|
+ <span v-for="(item, index) in actionOptions" :key="index" class="icon-span" :title="item.lable"
|
|
|
+ :class="item.isSelect ? 'selected-icon' : ''" @click="changleQueryItem(item)">
|
|
|
+ <i class="iconfont iconSize" :class="item.iconName" style="margin-top: 0px"></i>
|
|
|
</span>
|
|
|
<!-- <el-button type="primary" size="small" @click.stop="mapLayerQuery"
|
|
|
>点击</el-button
|
|
@@ -29,44 +19,22 @@
|
|
|
</div>
|
|
|
<div class="sm-function-module-content-tabs">
|
|
|
<el-tabs @tab-click="handleTabClick" v-model="activeLayerId">
|
|
|
- <el-tab-pane
|
|
|
- :label="item.label"
|
|
|
- :name="item.id"
|
|
|
- v-for="(item, index) in layerList"
|
|
|
- :key="index"
|
|
|
- ></el-tab-pane>
|
|
|
+ <el-tab-pane :label="item.label" :name="item.id" v-for="(item, index) in layerList" :key="index"></el-tab-pane>
|
|
|
</el-tabs>
|
|
|
</div>
|
|
|
<div class="sm-function-module-content-table">
|
|
|
- <el-collapse
|
|
|
- :value="activeNames"
|
|
|
- @change="handleCollapseChange"
|
|
|
- v-if="
|
|
|
- activeLayerId &&
|
|
|
- queryResults[activeLayerId] &&
|
|
|
- queryResults[activeLayerId].length > 0
|
|
|
- "
|
|
|
- >
|
|
|
- <el-collapse-item
|
|
|
- :title="'查询结果' + (index + 1)"
|
|
|
- :name="'查询结果' + (index + 1)"
|
|
|
- v-for="(item, index) in queryResults[activeLayerId]"
|
|
|
- :key="index"
|
|
|
- >
|
|
|
+ <el-collapse :value="activeNames" @change="handleCollapseChange" v-if="
|
|
|
+ activeLayerId &&
|
|
|
+ queryResults[activeLayerId] &&
|
|
|
+ queryResults[activeLayerId].length > 0
|
|
|
+ ">
|
|
|
+ <el-collapse-item :title="'查询结果' + (index + 1)" :name="'查询结果' + (index + 1)"
|
|
|
+ v-for="(item, index) in queryResults[activeLayerId]" :key="index">
|
|
|
<template slot="title">
|
|
|
查询结果{{ index + 1
|
|
|
- }}<i
|
|
|
- title="定位"
|
|
|
- class="header-icon el-icon-s-promotion flyBtn2"
|
|
|
- @click.stop="flyTo(index)"
|
|
|
- ></i>
|
|
|
+ }}<i title="定位" class="header-icon el-icon-s-promotion flyBtn2" @click.stop="flyTo(index)"></i>
|
|
|
</template>
|
|
|
- <el-table
|
|
|
- :data="item"
|
|
|
- :show-header="false"
|
|
|
- border
|
|
|
- style="width: 100%"
|
|
|
- >
|
|
|
+ <el-table :data="item" :show-header="false" border style="width: 100%">
|
|
|
<el-table-column prop="name" label="字段" width="100">
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="value" label="值" width="208">
|
|
@@ -108,6 +76,7 @@ export default {
|
|
|
activeLayerId: "",
|
|
|
queryResults: {},
|
|
|
queryResultsGeom: {},
|
|
|
+ queryResultsGeomPart: {},
|
|
|
viewer: null,
|
|
|
dataSourceLayer: null,
|
|
|
actionOptions: [
|
|
@@ -137,7 +106,7 @@ export default {
|
|
|
return store.state.toolBar[9];
|
|
|
},
|
|
|
},
|
|
|
- created() {},
|
|
|
+ created() { },
|
|
|
watch: {
|
|
|
activeLayerId(val) {
|
|
|
if (val && val != "0") {
|
|
@@ -174,66 +143,89 @@ export default {
|
|
|
this.viewer.entities.removeAll();
|
|
|
this.dataSourceLayer.entities.removeAll();
|
|
|
let geoms = this.queryResultsGeom[this.activeLayerId];
|
|
|
+ let parts = this.queryResultsGeomPart[this.activeLayerId];
|
|
|
for (let i = 0; i < geoms.length; i++) {
|
|
|
let cur = geoms[i];
|
|
|
- let points = [];
|
|
|
- for (let j = 0; j < cur.length; j++) {
|
|
|
- points.push(cur[j][0]);
|
|
|
- points.push(cur[j][1]);
|
|
|
- }
|
|
|
- if (fill) {
|
|
|
- this.viewer.entities.add({
|
|
|
- polyline: new Cesium.PolylineGraphics({
|
|
|
- positions: Cesium.Cartesian3.fromDegreesArray(points),
|
|
|
- width: 3,
|
|
|
- material: Cesium.Color.BLUE.withAlpha(0.9),
|
|
|
- clampToGround: true,
|
|
|
- }),
|
|
|
- polygon: {
|
|
|
- //高程
|
|
|
- hierarchy: new Cesium.PolygonHierarchy(
|
|
|
- Cesium.Cartesian3.fromDegreesArray(points)
|
|
|
- ),
|
|
|
- classificationType: Cesium.ClassificationType.BOTH,
|
|
|
- clampToGround: false,
|
|
|
- material: Cesium.Color.RED.withAlpha(0.3),
|
|
|
- // material: videoElement,
|
|
|
- // perPositionHeight: true
|
|
|
- },
|
|
|
- });
|
|
|
- } else {
|
|
|
- this.viewer.entities.add({
|
|
|
- polyline: new Cesium.PolylineGraphics({
|
|
|
- positions: Cesium.Cartesian3.fromDegreesArray(points),
|
|
|
- width: 3,
|
|
|
- material: Cesium.Color.BLUE.withAlpha(0.9),
|
|
|
- clampToGround: true,
|
|
|
- }),
|
|
|
- });
|
|
|
+ let part = parts[i];
|
|
|
+ let start = 0;
|
|
|
+ let end = 0;
|
|
|
+ for (let k = 0; k < part.length; k++) {
|
|
|
+ let points = [];
|
|
|
+ if (k > 0) {
|
|
|
+ start += part[k - 1];
|
|
|
+ }
|
|
|
+ end += part[k];
|
|
|
+ for (let j = start; j < end; j++) {
|
|
|
+ let cx = cur[j][0];
|
|
|
+ let cy = cur[j][1];
|
|
|
+ points.push(cx);
|
|
|
+ points.push(cy);
|
|
|
+ }
|
|
|
+ if (fill) {
|
|
|
+ this.viewer.entities.add({
|
|
|
+ polyline: new Cesium.PolylineGraphics({
|
|
|
+ positions: Cesium.Cartesian3.fromDegreesArray(points),
|
|
|
+ width: 3,
|
|
|
+ material: Cesium.Color.BLUE.withAlpha(0.9),
|
|
|
+ clampToGround: true,
|
|
|
+ }),
|
|
|
+ polygon: {
|
|
|
+ //高程
|
|
|
+ hierarchy: new Cesium.PolygonHierarchy(
|
|
|
+ Cesium.Cartesian3.fromDegreesArray(points)
|
|
|
+ ),
|
|
|
+ classificationType: Cesium.ClassificationType.BOTH,
|
|
|
+ clampToGround: false,
|
|
|
+ material: Cesium.Color.RED.withAlpha(0.3),
|
|
|
+ // material: videoElement,
|
|
|
+ // perPositionHeight: true
|
|
|
+ },
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.viewer.entities.add({
|
|
|
+ polyline: new Cesium.PolylineGraphics({
|
|
|
+ positions: Cesium.Cartesian3.fromDegreesArray(points),
|
|
|
+ width: 3,
|
|
|
+ material: Cesium.Color.BLUE.withAlpha(0.9),
|
|
|
+ clampToGround: true,
|
|
|
+ }),
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
// this.viewer.flyTo(this.viewer.entities);
|
|
|
}
|
|
|
},
|
|
|
flyTo(index) {
|
|
|
this.dataSourceLayer.entities.removeAll();
|
|
|
let geoms = this.queryResultsGeom[this.activeLayerId];
|
|
|
+ let parts = this.queryResultsGeomPart[this.activeLayerId];
|
|
|
let cur = geoms[index];
|
|
|
if (cur) {
|
|
|
- let points = [];
|
|
|
- for (let j = 0; j < cur.length; j++) {
|
|
|
- points.push(cur[j][0]);
|
|
|
- points.push(cur[j][1]);
|
|
|
+ let part = parts[index];
|
|
|
+ let start = 0;
|
|
|
+ let end = 0;
|
|
|
+ for (let k = 0; k < part.length; k++) {
|
|
|
+ let points = [];
|
|
|
+ if (k > 0) {
|
|
|
+ start += part[k - 1];
|
|
|
+ }
|
|
|
+ end += part[k];
|
|
|
+ for (let j = start; j < end; j++) {
|
|
|
+ let cx = cur[j][0];
|
|
|
+ let cy = cur[j][1];
|
|
|
+ points.push(cx);
|
|
|
+ points.push(cy);
|
|
|
+ }
|
|
|
+ let e = this.dataSourceLayer.entities.add({
|
|
|
+ polyline: new Cesium.PolylineGraphics({
|
|
|
+ positions: Cesium.Cartesian3.fromDegreesArray(points),
|
|
|
+ width: 3,
|
|
|
+ material: Cesium.Color.RED.withAlpha(0.9),
|
|
|
+ clampToGround: true,
|
|
|
+ }),
|
|
|
+ });
|
|
|
}
|
|
|
- let e = this.dataSourceLayer.entities.add({
|
|
|
- polyline: new Cesium.PolylineGraphics({
|
|
|
- positions: Cesium.Cartesian3.fromDegreesArray(points),
|
|
|
- width: 3,
|
|
|
- material: Cesium.Color.RED.withAlpha(0.9),
|
|
|
- clampToGround: true,
|
|
|
- }),
|
|
|
- });
|
|
|
- this.viewer.flyTo(e);
|
|
|
+ this.viewer.flyTo(this.dataSourceLayer);
|
|
|
} else {
|
|
|
this.$message({
|
|
|
message: "空间范围为空!",
|
|
@@ -251,6 +243,7 @@ export default {
|
|
|
this.activeLayerId = "0";
|
|
|
this.queryResults = {};
|
|
|
this.queryResultsGeom = {};
|
|
|
+ this.queryResultsGeomPart = {};
|
|
|
},
|
|
|
/**
|
|
|
* 左键点击查询图层
|
|
@@ -324,9 +317,13 @@ export default {
|
|
|
if (result != null && result.features[0].fieldNames) {
|
|
|
result.features[0].fieldNames.forEach((fieldName, i) => {
|
|
|
const Field = Fields.find((c) => c.FieldEn == fieldName);
|
|
|
+ let v = result.features[0].fieldValues[i];
|
|
|
+ if (!isNaN(parseFloat(v))) {
|
|
|
+ v = Math.round(parseFloat(v) * 100) / 100;
|
|
|
+ }
|
|
|
that.layersData.push({
|
|
|
label: Field ? Field.FieldCn : fieldName,
|
|
|
- value: result.features[0].fieldValues[i],
|
|
|
+ value: v,
|
|
|
});
|
|
|
});
|
|
|
} else {
|
|
@@ -371,6 +368,7 @@ export default {
|
|
|
queryByIDParameters
|
|
|
);
|
|
|
}
|
|
|
+ console.log(e)
|
|
|
if (e && e.totalCount > 0) {
|
|
|
that.layerList.push(store.state.vectorlayerlist[i]);
|
|
|
let queryData = [];
|
|
@@ -399,7 +397,7 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ let parts = [];
|
|
|
let legendJson = getTreeId(tempTreeData, obj.id);
|
|
|
for (let u = 0; u < e.features.length; u++) {
|
|
|
let cur = [];
|
|
@@ -427,9 +425,13 @@ export default {
|
|
|
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: e.features[u].fieldValues[i],
|
|
|
+ value: v,
|
|
|
});
|
|
|
}
|
|
|
});
|
|
@@ -463,10 +465,12 @@ export default {
|
|
|
);
|
|
|
points.push([c.x, c.y]);
|
|
|
}
|
|
|
+ parts.push(e.features[u].geometry.parts)
|
|
|
geoms.push(points);
|
|
|
queryData.push(cur);
|
|
|
}
|
|
|
|
|
|
+ that.queryResultsGeomPart[obj.id] = parts;
|
|
|
that.queryResults[obj.id] = queryData;
|
|
|
that.queryResultsGeom[obj.id] = geoms;
|
|
|
}
|
|
@@ -583,6 +587,7 @@ export default {
|
|
|
removeMapLayerQuery() {
|
|
|
this.queryResults = {};
|
|
|
this.queryResultsGeom = {};
|
|
|
+ this.queryResultsGeomPart = {};
|
|
|
this.layerList = [];
|
|
|
this.viewer.entities.removeAll();
|
|
|
this.handler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_CLICK);
|