|
@@ -3,7 +3,8 @@
|
|
* element-plus组件
|
|
* element-plus组件
|
|
*/
|
|
*/
|
|
import {
|
|
import {
|
|
- ElMessage
|
|
|
|
|
|
+ ElMessage,
|
|
|
|
+ ElLoading
|
|
} from 'element-plus';
|
|
} from 'element-plus';
|
|
|
|
|
|
import {
|
|
import {
|
|
@@ -29,6 +30,7 @@
|
|
|
|
|
|
<script>
|
|
<script>
|
|
let jt3d = undefined;
|
|
let jt3d = undefined;
|
|
|
|
+ let loading = undefined;
|
|
|
|
|
|
import {
|
|
import {
|
|
Store
|
|
Store
|
|
@@ -235,13 +237,13 @@
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+
|
|
/**
|
|
/**
|
|
- * Promise回调
|
|
|
|
* @param {Object} options
|
|
* @param {Object} options
|
|
*/
|
|
*/
|
|
initQuery(options) {
|
|
initQuery(options) {
|
|
let _self = this;
|
|
let _self = this;
|
|
- _self.treeNodes = [];
|
|
|
|
|
|
+ let treeNodes = [];
|
|
|
|
|
|
//清除高亮显示
|
|
//清除高亮显示
|
|
let list = jt3d._dataSources.getByName("单击高亮显示")
|
|
let list = jt3d._dataSources.getByName("单击高亮显示")
|
|
@@ -253,139 +255,162 @@
|
|
if (jt3d.LocateUtil._locationEntity) {
|
|
if (jt3d.LocateUtil._locationEntity) {
|
|
window["viewer"].entities.remove(jt3d.LocateUtil._locationEntity);
|
|
window["viewer"].entities.remove(jt3d.LocateUtil._locationEntity);
|
|
}
|
|
}
|
|
- store.queryMapTables.forEach((itemTable, index) => {
|
|
|
|
- this.getData(itemTable,options).then(flag => {
|
|
|
|
- if (flag === true && index === (store.queryMapTables.length - 1) && _self.treeNodes.length > 0) {
|
|
|
|
- console.log("treeNodes", _self.treeNodes);
|
|
|
|
-
|
|
|
|
- _self.$parent.$parent.$refs.refQueryResult.expandedKeys = []
|
|
|
|
- _self.$parent.$parent.$refs.refQueryResultPopup.isshow = true;
|
|
|
|
- _self.$parent.$parent.$refs.refQueryResult.treeData = deepTree(_self.treeNodes);
|
|
|
|
-
|
|
|
|
- //默认选中第一个节点并赋予选中样式
|
|
|
|
- _self.$nextTick(function() {
|
|
|
|
- let currentNode = _self.$parent.$parent.$refs.refQueryResult.treeData[0].children[0];
|
|
|
|
- let currentKey = currentNode.id;
|
|
|
|
- _self.$parent.$parent.$refs.refQueryResult.currentKey = currentKey;
|
|
|
|
- _self.$parent.$parent.$refs.refQueryResult.$refs.tree.setCurrentKey(currentKey);
|
|
|
|
- _self.$parent.$parent.$refs.refQueryResult.handleNodeClick(currentNode);
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- //expandedKeys默认展开treedata第一层,加载第一层数据
|
|
|
|
- _self.$parent.$parent.$refs.refQueryResult.expandedKeys.push(_self.$parent.$parent.$refs.refQueryResult.treeData[0].id)
|
|
|
|
-
|
|
|
|
- //清除绘制
|
|
|
|
- jt3d.CommonTools.clear();
|
|
|
|
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
|
|
+ //查询等待框
|
|
|
|
+ loading = ElLoading.service({
|
|
|
|
+ lock: true,
|
|
|
|
+ text: 'Loading',
|
|
|
|
+ background: 'rgba(0, 0, 0, 0.7)',
|
|
});
|
|
});
|
|
- },
|
|
|
|
- getData(itemTable,options) {
|
|
|
|
- let _self = this;
|
|
|
|
- return new Promise((resolve, reject) => {
|
|
|
|
- _self.$http.get('/getSpatialQuery', {
|
|
|
|
- tableName: itemTable,
|
|
|
|
- spatialType: options.spatialType,
|
|
|
|
- coordinate: options.coordinate,
|
|
|
|
- buffer: options.buffer
|
|
|
|
- }).then(res => {
|
|
|
|
-
|
|
|
|
- _self.tableName = itemTable;
|
|
|
|
- _self.field = res.table;
|
|
|
|
-
|
|
|
|
- if (res.data.features.length > 0) {
|
|
|
|
- //添加父节点
|
|
|
|
- let parentNode = {
|
|
|
|
- id: _self.tableName,
|
|
|
|
- parentid: "CIM",
|
|
|
|
- label: res.table[0].tableDescription + "(" + res.data.features.length + ")",
|
|
|
|
- };
|
|
|
|
- _self.treeNodes.push(parentNode);
|
|
|
|
-
|
|
|
|
- res.data.features.forEach((itemData, index) => {
|
|
|
|
-
|
|
|
|
- //**************高亮显示****************
|
|
|
|
-
|
|
|
|
- // /* 转换坐标 */
|
|
|
|
- // let positions = itemData.geometry.coordinates[0][0].map(point => {
|
|
|
|
- // return Cesium.Cartesian3.fromDegrees(point[0], point[1], point[2] || 0);
|
|
|
|
- // });
|
|
|
|
-
|
|
|
|
- // //先创建一个CustomDataSource源,然后把entity存入这里面
|
|
|
|
- // let Polygon = new Cesium.CustomDataSource("单击高亮显示");
|
|
|
|
- // jt3d._dataSources.add(Polygon);
|
|
|
|
- // //添加数据的方式
|
|
|
|
- // Polygon.entities.add({
|
|
|
|
- // polygon: {
|
|
|
|
- // hierarchy: new Cesium.PolygonHierarchy(positions),
|
|
|
|
- // material: Cesium.Color.fromCssColorString("rgba(255,0,255,.7)"),
|
|
|
|
- // classificationType: Cesium.ClassificationType.BOTH,
|
|
|
|
- // },
|
|
|
|
- // });
|
|
|
|
-
|
|
|
|
- //**************高亮显示****************
|
|
|
|
-
|
|
|
|
- let childNode = {
|
|
|
|
- id: itemData.properties["id"],
|
|
|
|
- parentid: _self.tableName,
|
|
|
|
- field: _self.field,
|
|
|
|
- data: itemData,
|
|
|
|
|
|
+
|
|
|
|
+ const getData = () => {
|
|
|
|
+ let data = [];
|
|
|
|
+ store.queryMapTables.forEach((itemTable, index) => {
|
|
|
|
+ let result = getAxios(itemTable, options);
|
|
|
|
+ data.push(result);
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ Promise.all(data).then(itemList => {
|
|
|
|
+
|
|
|
|
+ console.log("itemList", itemList) //itemList返回的数据是按顺序的
|
|
|
|
+ //执行自己接下来的操作
|
|
|
|
+ //doSomething
|
|
|
|
+
|
|
|
|
+ itemList.forEach((item, index) => {
|
|
|
|
+ let field = item.table;
|
|
|
|
+ let tableName = item.table[0].tableName;
|
|
|
|
+ let tableDescription = item.table[0].tableDescription;
|
|
|
|
+
|
|
|
|
+ if (item.data.features.length > 0) {
|
|
|
|
+ //添加父节点
|
|
|
|
+ let parentNode = {
|
|
|
|
+ id: tableName,
|
|
|
|
+ parentid: "CIM",
|
|
|
|
+ label: tableDescription + "(" + item.data.features.length + ")",
|
|
};
|
|
};
|
|
|
|
+ treeNodes.push(parentNode);
|
|
|
|
+
|
|
|
|
+ item.data.features.forEach((itemData, index) => {
|
|
|
|
+
|
|
|
|
+ //**************高亮显示****************
|
|
|
|
+
|
|
|
|
+ // /* 转换坐标 */
|
|
|
|
+ // let positions = itemData.geometry.coordinates[0][0].map(point => {
|
|
|
|
+ // return Cesium.Cartesian3.fromDegrees(point[0], point[1], point[2] || 0);
|
|
|
|
+ // });
|
|
|
|
+
|
|
|
|
+ // //先创建一个CustomDataSource源,然后把entity存入这里面
|
|
|
|
+ // let Polygon = new Cesium.CustomDataSource("单击高亮显示");
|
|
|
|
+ // jt3d._dataSources.add(Polygon);
|
|
|
|
+ // //添加数据的方式
|
|
|
|
+ // Polygon.entities.add({
|
|
|
|
+ // polygon: {
|
|
|
|
+ // hierarchy: new Cesium.PolygonHierarchy(positions),
|
|
|
|
+ // material: Cesium.Color.fromCssColorString("rgba(255,0,255,.7)"),
|
|
|
|
+ // classificationType: Cesium.ClassificationType.BOTH,
|
|
|
|
+ // },
|
|
|
|
+ // });
|
|
|
|
+
|
|
|
|
+ //**************高亮显示****************
|
|
|
|
+
|
|
|
|
+ let childNode = {
|
|
|
|
+ id: itemData.properties["id"],
|
|
|
|
+ parentid: tableName,
|
|
|
|
+ field: field,
|
|
|
|
+ data: itemData,
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ switch (tableName) {
|
|
|
|
+ //==============规划管理数据-重要控制线=========================
|
|
|
|
+ case "yjjbnt": //永久基本农田
|
|
|
|
+ childNode.label = itemData.properties["cfzr"] + "(" + itemData.properties["zzsxmc"] + ")"
|
|
|
|
+ break;
|
|
|
|
+ case "yjtz": //永久基本农田调整
|
|
|
|
+ childNode.label = itemData.properties["zldwmc"] + "(" + itemData.properties["dlmc"] + ")"
|
|
|
|
+ break;
|
|
|
|
+ case "bnrgdbh": //不纳入耕地保护目标
|
|
|
|
+ childNode.label = itemData.properties["zldwmc"] + "(" + itemData.properties["dlmc"] + ")"
|
|
|
|
+ break;
|
|
|
|
+ case "gdbhrw": //耕地保护任务
|
|
|
|
+ childNode.label = itemData.properties["zldwmc"] + "(" + itemData.properties["dlmc"] + ")"
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+ //==============规划管理数据-历史规划==============
|
|
|
|
+ case "tdzgh": //土地利用总体规划
|
|
|
|
+ childNode.label = itemData.properties["ghdlmc"]
|
|
|
|
+ break;
|
|
|
|
+ case "jsyd": //建设用地管制区
|
|
|
|
+ childNode.label = itemData.properties["id"]
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+ //==============现状类数据-森林资源-森林资源调查==============
|
|
|
|
+ case "slyzt": //2019年森林资源管理一张图
|
|
|
|
+ childNode.label = itemData.properties["id"]
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+ //==============现状类数据-国土调查==============
|
|
|
|
+ case "ed2009": //二调
|
|
|
|
+ childNode.label = itemData.properties["zldwmc"] + "(" + itemData.properties["dlmc"] + ")"
|
|
|
|
+ break;
|
|
|
|
+ case "ed2020": //二调2020
|
|
|
|
+ childNode.label = itemData.properties["zldwmc"] + "(" + itemData.properties["dlmc"] + ")"
|
|
|
|
+ break;
|
|
|
|
+ case "ed2021": //二调2021
|
|
|
|
+ childNode.label = itemData.properties["zldwmc"] + "(" + itemData.properties["dlmc"] + ")"
|
|
|
|
+ break;
|
|
|
|
+ case "sddltb": //三调
|
|
|
|
+ childNode.label = itemData.properties["zldwmc"] + "(" + itemData.properties["dlmc"] + ")"
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ treeNodes.push(childNode);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
|
|
- switch (_self.tableName) {
|
|
|
|
- //==============规划管理数据-重要控制线=========================
|
|
|
|
- case "yjjbnt": //永久基本农田
|
|
|
|
- childNode.label = itemData.properties["cfzr"] + "(" + itemData.properties["zzsxmc"] + ")"
|
|
|
|
- break;
|
|
|
|
- case "yjtz": //永久基本农田调整
|
|
|
|
- childNode.label = itemData.properties["zldwmc"] + "(" + itemData.properties["dlmc"] + ")"
|
|
|
|
- break;
|
|
|
|
- case "bnrgdbh": //不纳入耕地保护目标
|
|
|
|
- childNode.label = itemData.properties["zldwmc"] + "(" + itemData.properties["dlmc"] + ")"
|
|
|
|
- break;
|
|
|
|
- case "gdbhrw": //耕地保护任务
|
|
|
|
- childNode.label = itemData.properties["zldwmc"] + "(" + itemData.properties["dlmc"] + ")"
|
|
|
|
- break;
|
|
|
|
-
|
|
|
|
- //==============规划管理数据-历史规划==============
|
|
|
|
- case "tdzgh": //土地利用总体规划
|
|
|
|
- childNode.label = itemData.properties["ghdlmc"]
|
|
|
|
- break;
|
|
|
|
- case "jsyd": //建设用地管制区
|
|
|
|
- childNode.label = itemData.properties["id"]
|
|
|
|
- break;
|
|
|
|
-
|
|
|
|
- //==============现状类数据-森林资源-森林资源调查==============
|
|
|
|
- case "slyzt": //2019年森林资源管理一张图
|
|
|
|
- childNode.label = itemData.properties["id"]
|
|
|
|
- break;
|
|
|
|
-
|
|
|
|
- //==============现状类数据-国土调查==============
|
|
|
|
- case "ed2009": //二调
|
|
|
|
- childNode.label = itemData.properties["zldwmc"] + "(" + itemData.properties["dlmc"] + ")"
|
|
|
|
- break;
|
|
|
|
- case "ed2020": //二调2020
|
|
|
|
- childNode.label = itemData.properties["zldwmc"] + "(" + itemData.properties["dlmc"] + ")"
|
|
|
|
- break;
|
|
|
|
- case "ed2021": //二调2021
|
|
|
|
- childNode.label = itemData.properties["zldwmc"] + "(" + itemData.properties["dlmc"] + ")"
|
|
|
|
- break;
|
|
|
|
- case "sddltb": //三调
|
|
|
|
- childNode.label = itemData.properties["zldwmc"] + "(" + itemData.properties["dlmc"] + ")"
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- _self.treeNodes.push(childNode);
|
|
|
|
-
|
|
|
|
- if (index === (res.data.features.length - 1)) {
|
|
|
|
- resolve(true)
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
|
|
+ //处理左侧树
|
|
|
|
+ _self.$parent.$parent.$refs.refQueryResult.expandedKeys = []
|
|
|
|
+ _self.$parent.$parent.$refs.refQueryResultPopup.isshow = true;
|
|
|
|
+ _self.$parent.$parent.$refs.refQueryResult.treeData = deepTree(_self.treeNodes);
|
|
|
|
+
|
|
|
|
+ //默认选中第一个节点并赋予选中样式
|
|
|
|
+ _self.$nextTick(function() {
|
|
|
|
+ let currentNode = _self.$parent.$parent.$refs.refQueryResult.treeData[0].children[0];
|
|
|
|
+ let currentKey = currentNode.id;
|
|
|
|
+ _self.$parent.$parent.$refs.refQueryResult.currentKey = currentKey;
|
|
|
|
+ _self.$parent.$parent.$refs.refQueryResult.$refs.tree.setCurrentKey(currentKey);
|
|
|
|
+ _self.$parent.$parent.$refs.refQueryResult.handleNodeClick(currentNode);
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ //expandedKeys默认展开treedata第一层,加载第一层数据
|
|
|
|
+ _self.$parent.$parent.$refs.refQueryResult.expandedKeys.push(_self.$parent.$parent.$refs.refQueryResult.treeData[0].id)
|
|
|
|
+
|
|
|
|
+ //清除绘制
|
|
|
|
+ jt3d.CommonTools.clear();
|
|
|
|
+
|
|
|
|
+ //关闭等待框
|
|
|
|
+ loading.close()
|
|
|
|
+
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ const getAxios = (itemTable, options) => {
|
|
|
|
+ return new Promise(function(resolve, reject) {
|
|
|
|
+ _self.$http.get('/getSpatialQuery', {
|
|
|
|
+ tableName: itemTable,
|
|
|
|
+ spatialType: options.spatialType,
|
|
|
|
+ coordinate: options.coordinate,
|
|
|
|
+ buffer: options.buffer
|
|
|
|
+ }).then(res => {
|
|
|
|
+ resolve(res)
|
|
|
|
+ });
|
|
|
|
+ }).catch(err => {
|
|
|
|
+
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ getData();
|
|
|
|
+ },
|
|
},
|
|
},
|
|
|
|
|
|
mounted() {
|
|
mounted() {
|