| | |
| | | @check-change="handleCheckChange" |
| | | :default-checked-keys="handleTreeCheck" |
| | | :expand-on-click-node="false" |
| | | :filter-node-method="filterNode" |
| | | draggable |
| | | > |
| | | <span class="slot-t-node" slot-scope="{ node, data }"> |
| | | <span |
| | | class="slot-t-node" |
| | | slot-scope="{ node, data }" |
| | | > |
| | | <span v-show="!data.isEdit"> |
| | | <span :class="[data.id >= 99 ? 'slot-t-node--label' : '']">{{ |
| | | node.label |
| | |
| | | :style="{ ...rightClickMenuStyle }" |
| | | v-show="menuVisible" |
| | | > |
| | | <div @click="addSameLevelNode()" v-show="firstLevel"> |
| | | <div |
| | | @click="addSameLevelNode()" |
| | | v-show="firstLevel" |
| | | > |
| | | <i class="el-icon-plus"></i> 添加图层组 |
| | | </div> |
| | | <div class="add" @click="addChildNode()"> |
| | | <div |
| | | class="add" |
| | | @click="addChildNode()" |
| | | > |
| | | <i class="el-icon-plus"></i> 添加图层 |
| | | </div> |
| | | <div class="delete" @click="deleteNode()"> |
| | | <div |
| | | class="delete" |
| | | @click="deleteNode()" |
| | | > |
| | | <i class="el-icon-delete"></i> 删除 |
| | | </div> |
| | | <div class="edit" @click="editNode()"> |
| | | <div |
| | | class="edit" |
| | | @click="editNode()" |
| | | > |
| | | <i class="el-icon-edit"></i> 重命名 |
| | | </div> |
| | | <div |
| | | class="edit" |
| | | @click="showLayerAttribute()" |
| | | v-if="!showlocal" |
| | | v-if="!showlocal && !shwoHistogram" |
| | | v-show="!firstLevel" |
| | | > |
| | | <i class="el-icon-tickets"></i> 属性 |
| | | </div> |
| | | <div class="edit" @click="positioning()" v-show="showlocal"> |
| | | <div |
| | | class="edit" |
| | | @click="positioning()" |
| | | v-if="showlocal" |
| | | > |
| | | <i class="el-icon-tickets"></i> 定位 |
| | | </div> |
| | | <div |
| | | class="edit" |
| | | @click="histogram()" |
| | | v-show="shwoHistogram" |
| | | > |
| | | <i class="el-icon-tickets"></i> 钻孔柱状图 |
| | | </div> |
| | | <!-- <div |
| | | class="edit" |
| | | v-show="showModelAttach" |
| | | @click="modelAttach()" |
| | | > |
| | | <i class="el-icon-tickets"></i> 模型属性 |
| | | </div> --> |
| | | <!-- <div |
| | | class="edit" |
| | | @click="menuMoveF( 'up')" |
| | |
| | | :modal="false" |
| | | :before-close="handleClose" |
| | | > |
| | | <el-form ref="form" :model="addFormServer" label-width="100px"> |
| | | <el-form |
| | | ref="form" |
| | | :model="addFormServer" |
| | | label-width="100px" |
| | | > |
| | | <el-form-item label="服务类型"> |
| | | <!-- <el-input v-model="addFormServer.type"></el-input> --> |
| | | <el-select |
| | |
| | | <el-slider v-model="addFormServer.opacity"></el-slider> |
| | | </el-form-item> |
| | | </el-form> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button type="primary" @click="setAddServer">确 定</el-button> |
| | | <span |
| | | slot="footer" |
| | | class="dialog-footer" |
| | | > |
| | | <el-button |
| | | type="primary" |
| | | @click="setAddServer" |
| | | >确 定</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | <queryinfo ref="queryinfo" /> |
| | | |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | |
| | | import View from "ol/View.js"; |
| | | import { Fill, Stroke, Style } from "ol/style.js"; |
| | | import { perms_selectLayers } from "../../api/api.js"; |
| | | import { perms_selectLayers, inquiry_selectDomains } from "../../api/api.js"; |
| | | export default { |
| | | name: "tree", |
| | | components: { queryinfo }, |
| | | data() { |
| | | return { |
| | | shwoHistogram: false, |
| | | showlocal: false, |
| | | eleId: "", |
| | | isShow: false, |
| | |
| | | rightClickMenuStyle: {}, |
| | | handleTreeCheck: [], |
| | | dialogVisible: false, |
| | | showModelAttach: false, |
| | | addFormServer: { |
| | | opacity: 100, |
| | | serveType: "WMS", |
| | |
| | | }; |
| | | }, |
| | | methods: { |
| | | |
| | | //转孔柱状图 |
| | | async histogram() { |
| | | this.menuVisible = false |
| | | var layer = this.currentData.enName.replaceAll("_", ""); |
| | | this.$store.state.mapSpaceQueryLayer = layer; |
| | | this.$store.state.mapPopBoxFlag = "2"; |
| | | this.$store.state.showPopBoxFlag = true; |
| | | }, |
| | | modelAttach() { |
| | | this.menuVisible = false; |
| | | this.$store.state.attachinfo = this.currentData; |
| | | this.$store.state.attachModel = true; |
| | | |
| | | |
| | | }, |
| | | NodeBlur(Node, data) { |
| | | if (data.label.length === 0) { |
| | | this.$message.error("菜单名不可为空!"); |
| | |
| | | }); |
| | | } |
| | | }, |
| | | // 查询 |
| | | filterNode(value, data) { |
| | | if (!value) return true; |
| | | return data.label.indexOf(value) !== -1; |
| | | }, |
| | | |
| | | |
| | | allowDrop(draggingNode, dropNode, type) { |
| | | if (dropNode.data.label === "二级 3-1") { |
| | |
| | | rightClick(event, object, Node, element) { |
| | | this.currentData = object; |
| | | this.currentNode = Node; |
| | | |
| | | this.$store.state.propertiesName = this.currentData; |
| | | if (this.currentData.serveType == "Tileset") { |
| | | this.showModelAttach = true; |
| | | } else { |
| | | this.showModelAttach = false; |
| | | } |
| | | if (this.currentData.enName == "s_explorationpoint") { |
| | | this.shwoHistogram = true; |
| | | } else { |
| | | this.shwoHistogram = false; |
| | | } |
| | | if (Node.level === 3) { |
| | | this.firstLevel = false; |
| | | } else { |
| | |
| | | }, |
| | | // 增加同级节点事件 |
| | | addSameLevelNode() { |
| | | this.menuVisible = false |
| | | this.foo(); |
| | | if (this.currentNode.level == 2) { |
| | | this.appendNodetitle = this.currentData.label; |
| | |
| | | // 增加子级节点事件 |
| | | addChildNode() { |
| | | this.foo(); |
| | | this.menuVisible = false |
| | | // if (this.currentNode.level >= 2) { |
| | | // this.$message.error("最多只支两级!"); |
| | | // return false; |
| | |
| | | // 删除节点 |
| | | deleteNode() { |
| | | this.foo(); |
| | | this.menuVisible = false |
| | | var label = this.currentNode.data.cnName; |
| | | if (this.currentNode.data.serveType == "WMS") { |
| | | for (var i in window.Viewer.imageryLayers._layers) { |
| | | if ( |
| | | window.Viewer.imageryLayers._layers[i].imageryProvider.name === |
| | | label |
| | | ) { |
| | | window.Viewer.imageryLayers.remove( |
| | | window.Viewer.imageryLayers._layers[i] |
| | | ); |
| | | } |
| | | } |
| | | var value = this.$refs.tree.getCheckedNodes(); |
| | | |
| | | this.$bus.$emit("showMenuLayer", value); |
| | | |
| | | } else if (this.currentNode.data.serveType == "WFS") { |
| | | for (var i in window.Viewer.dataSources._dataSources) { |
| | | if (window.Viewer.dataSources._dataSources[i].name == label) { |
| | |
| | | //属性显示 |
| | | showLayerAttribute(data) { |
| | | this.foo(); |
| | | this.menuVisible = false |
| | | this.currentData = data ? data : this.currentData; |
| | | var layer = this.currentData.enName.replaceAll("_", ""); |
| | | this.$store.state.mapSpaceQueryLayer = layer; |
| | | // this.$store.state.mapPopBoolean = true; |
| | | this.$store.state.showPopBoxFlag = true; |
| | | this.$store.state.mapPopBoxFlag = "2"; |
| | | this.$refs && this.$refs.queryinfo && this.$refs.queryinfo.close(); |
| | | this.$refs && |
| | | this.$refs.queryinfo && |
| | | this.$refs.queryinfo.open("属性", null, { |
| | | close: () => { |
| | | if (this.$store.state.primitLayer != null) { |
| | | sgworld.Creator.DeleteObject(this.$store.state.primitLayer); |
| | | this.$store.state.primitLayer = null; |
| | | } |
| | | |
| | | if (window.Viewer.scene.primitives.length != 0) { |
| | | window.Viewer.scene.primitives.removeAll(); |
| | | } |
| | | }, |
| | | }); |
| | | |
| | | }, |
| | | //模型定位 |
| | | positioning() { |
| | | this.menuVisible = false |
| | | for (var i in Viewer.scene.primitives._primitives) { |
| | | if ( |
| | | Viewer.scene.primitives._primitives[i].id == this.currentData.cnName |
| | |
| | | // 编辑节点 |
| | | editNode(data) { |
| | | this.foo(); |
| | | this.menuVisible = false |
| | | this.currentData = data ? data : this.currentData; |
| | | if (!this.currentData.isEdit) { |
| | | this.$set(this.currentData, "isEdit", true); |
| | |
| | | console.log("tree drop: ", dropNode.label, dropType); |
| | | }, |
| | | handleCheckChange(data, checked, indeterminate) { |
| | | |
| | | if (data.type != 2) return; |
| | | var std = []; |
| | | if (data.serveType == "WMS") { |
| | | var layers_ol = window.map.getAllLayers(); |
| | | for (var i = 0; i < window.Viewer.imageryLayers._layers.length; i++) { |
| | | var val_id = |
| | | window.Viewer.imageryLayers._layers[i].imageryProvider.name; |
| | | if (val_id == data.cnName) { |
| | | std.push(data.label); |
| | | var value = this.$refs.tree.getCheckedNodes(); |
| | | |
| | | const img_layer = window.Viewer.imageryLayers._layers[i]; |
| | | img_layer.show = checked; |
| | | } |
| | | } |
| | | this.$bus.$emit("showMenuLayer", value); |
| | | |
| | | for (var i in layers_ol) { |
| | | var layerOl = layers_ol[i]; |
| | | if (layerOl.values_.name == data.cnName) { |
| | | layerOl.setVisible(checked); //显示图层 |
| | | } |
| | | } |
| | | } else if (data.serveType == "WFS") { |
| | | |
| | | |
| | | if (data.serveType == "WFS") { |
| | | if (window.Viewer.dataSources._dataSources.length == 0) { |
| | | this.setAddLayers(data); |
| | | } else { |
| | |
| | | } |
| | | } |
| | | } else if (data.serveType == "Tileset") { |
| | | |
| | | if (Viewer.scene.primitives._primitives.length == 0) { |
| | | this.setAddLayers(data); |
| | | } else { |
| | | var std = []; |
| | | for (var i in Viewer.scene.primitives._primitives) { |
| | | Viewer.scene.primitives._primitives[i].show = checked; |
| | | if (Viewer.scene.primitives._primitives[i].id == data.cnName) { |
| | | std.push(res.id); |
| | | std.push(data.id); |
| | | Viewer.flyTo(Viewer.scene.primitives._primitives[i]); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (std.length == 0 && checked == true) { |
| | | this.setAddLayers(data); |
| | | } |
| | | var layers_ol = window.map.getAllLayers(); |
| | | for (var i in layers_ol) { |
| | | var layerOl = layers_ol[i]; |
| | | if (layerOl.values_.name == data.label) { |
| | | layerOl.setVisible(checked); //显示图层 |
| | | if (std.length == 0 && checked == true) { |
| | | this.setAddLayers(data); |
| | | } else { |
| | | window.map.getLayers().getArray().forEach(item => { |
| | | if (item.get("name") == data.cnName) { |
| | | item.setVisible(checked); |
| | | |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | // var layers_ol = window.map.getAllLayers(); |
| | | // for (var i in layers_ol) { |
| | | // var layerOl = layers_ol[i]; |
| | | // if (layerOl.values_.name == data.label) { |
| | | // layerOl.setVisible(checked); //显示图层 |
| | | // } |
| | | // } |
| | | }, |
| | | setAddLayers(res) { |
| | | if (res.serveType == "WMS") { |
| | | var resource = geoServerURl; |
| | | // var resource = "http://192.168.20.205:8088/geoserver/LF/wms"; |
| | | |
| | | if (res.resource != null && res.resource != undefined) { |
| | | resource = res.resource; |
| | | } |
| | |
| | | skipLevelOfDetail: true, // 在遍历时候跳过详情:false |
| | | }) |
| | | ); |
| | | |
| | | tileset.readyPromise.then(function (tileset) { |
| | | tileset.readyPromise.then((tileset) => { |
| | | tileset.id = res.cnName; |
| | | tileset.layerId = res.id; |
| | | this.tileSet(tileset, parseFloat(res.elev)) |
| | | Viewer.flyTo(tileset); |
| | | }); |
| | | window.model = tileset |
| | | } |
| | | }, |
| | | |
| | | |
| | | tileSet(tileset, height) { |
| | | //3dtile模型的边界球体 |
| | | var boundingSphere = tileset.boundingSphere; |
| | | //迪卡尔空间直角坐标=>地理坐标(弧度制) |
| | | var cartographic_original = Cesium.Cartographic.fromCartesian(boundingSphere.center); |
| | | //地理坐标(弧度制)=>迪卡尔空间直角坐标 |
| | | var Cartesian3_original = Cesium.Cartesian3.fromRadians(cartographic_original.longitude, cartographic_original.latitude, cartographic_original.height); |
| | | var Cartesian3_offset = Cesium.Cartesian3.fromRadians(cartographic_original.longitude, cartographic_original.latitude, height); |
| | | //获得地面和offset的转换 |
| | | var translation = Cesium.Cartesian3.subtract(Cartesian3_offset, Cartesian3_original, new Cesium.Cartesian3()); |
| | | //修改模型矩阵 |
| | | tileset.modelMatrix = Cesium.Matrix4.fromTranslation(translation); |
| | | }, |
| | | setTreeData(source) { |
| | | let cloneData = JSON.parse(JSON.stringify(source)); // 对源数据深度克隆 |
| | |
| | | var std = data.result; |
| | | var that = this; |
| | | var checkKey = []; |
| | | let checkedLayers = []; |
| | | var val = std.filter((str) => { |
| | | if (str.type == 1) { |
| | | return str; |
| | |
| | | if (str.url != null && str.type == 2) { |
| | | if (str.isShow == 1) { |
| | | checkKey.push(str.id); |
| | | that.setAddLayers(str); |
| | | // that.setAddLayers(str); |
| | | if (str.serveType == "WMS" && str.url) { |
| | | checkedLayers.push(str); |
| | | } |
| | | } |
| | | return str; |
| | | } |
| | | }); |
| | | |
| | | //存储选中图层 |
| | | sessionStorage.setItem("checkedLayers", JSON.stringify(checkedLayers)); |
| | | var res = this.setTreeData(val); |
| | | |
| | | for (var i in res) { |
| | | res[i].children = res[i].children.filter((val) => { |
| | | if (val.children != null) { |
| | | return val; |
| | | } |
| | | }); |
| | | } |
| | | // for (var i in res) { |
| | | // res[i].children = res[i].children.filter((val) => { |
| | | // if (val.children != null) { |
| | | // return val; |
| | | // } |
| | | // }); |
| | | // } |
| | | this.treeData = res; |
| | | this.$refs.tree.setCheckedKeys(checkKey); |
| | | }, |
| | |
| | | } |
| | | this.$refs.tree.setCheckedKeys(std); |
| | | }, |
| | | // 查询 |
| | | filterNode(value, data) { |
| | | |
| | | if (!value) return true; |
| | | return data.cnName.indexOf(value) !== -1; |
| | | }, |
| | | }, |
| | | watch: { |
| | | filterText(val) { |
| | |
| | | }, |
| | | }, |
| | | mounted() { |
| | | |
| | | this.$bus.$on("treeDataCopy", (res) => { |
| | | this.$store.state.treeData = this.treeData; |
| | | this.$store.state.checkedKeys = this.$refs.tree.getCheckedKeys(); |
| | |
| | | } |
| | | |
| | | .el-checkbox .el-checkbox__inner { |
| | | display: none; |
| | | //display: none; |
| | | } |
| | | } |
| | | |