| | |
| | | <template> |
| | | <div class="menuBox"> |
| | | <el-form :inline="true" :model="menuTopFrom" class="demo-form-inline"> |
| | | <el-form |
| | | :inline="true" |
| | | :model="menuTopFrom" |
| | | class="demo-form-inline" |
| | | > |
| | | <el-form-item> |
| | | <el-select |
| | | v-model="menuTopFrom.queryLayer" |
| | |
| | | placeholder="请选择..." |
| | | :popper-append-to-body="false" |
| | | > |
| | | <el-option :value="menuTopFrom.queryLayer" style="height: 100%"> |
| | | <el-option |
| | | :value="menuTopFrom.queryLayer" |
| | | style="height: 100%" |
| | | > |
| | | <div style="height: 200px; overflow: auto"> |
| | | <el-tree |
| | | :data="layerData" |
| | | show-checkbox |
| | | node-key="id" |
| | | ref="tree" |
| | | accordion |
| | | highlight-current |
| | | :props="defaultProps" |
| | | > |
| | | </el-tree> |
| | | </div> |
| | | <div style="margin-top: 5px"> |
| | | <el-button size="small" plain @click="getCheckedNodes" |
| | | >确认</el-button |
| | | > |
| | | <el-button |
| | | size="small" |
| | | plain |
| | | @click="getCheckedNodes" |
| | | >确认</el-button> |
| | | <el-button |
| | | size="small" |
| | | type="info" |
| | | plain |
| | | @click="resetCheckedNodes" |
| | | >重置</el-button |
| | | > |
| | | >重置</el-button> |
| | | </div> |
| | | </el-option> |
| | | </el-select> |
| | |
| | | </el-form-item> |
| | | |
| | | <el-form-item> |
| | | <el-button plain size="small" @click="getAttributeQuery" |
| | | >查询</el-button |
| | | > |
| | | <el-button type="info" size="small" @click="clearQuery" plain |
| | | >重置</el-button |
| | | > |
| | | <el-button |
| | | plain |
| | | size="small" |
| | | @click="getAttributeQuery" |
| | | >查询</el-button> |
| | | <el-button |
| | | type="info" |
| | | size="small" |
| | | @click="clearQuery" |
| | | plain |
| | | >重置</el-button> |
| | | </el-form-item> |
| | | <!-- <el-form-item> |
| | | <el-button |
| | |
| | | <queryinfo ref="queryinfo" /> |
| | | <!-- <div class="buffer-container" ></div> --> |
| | | <el-dialog |
| | | v-dialogDrag |
| | | custom-class="buffer-dialog" |
| | | top="40vh" |
| | | title="管道中心线查询" |
| | | :visible.sync="dialogFormVisible" |
| | | :modal="false" |
| | | :lock-scroll="false" |
| | | :close-on-click-modal="false" |
| | | width="25%" |
| | | @opened="dialogOpend" |
| | | > |
| | | <el-form :model="menuTopFrom" label-width="150px"> |
| | | <el-form |
| | | :model="menuTopFrom" |
| | | label-width="150px" |
| | | > |
| | | <el-form-item label="管道中心线"> |
| | | <el-select |
| | | @change="changeSelect2" |
| | |
| | | <el-input-number |
| | | v-model="menuTopFrom.bufferSize" |
| | | placeholder="" |
| | | @change="handleBufferChange" |
| | | :step="500" |
| | | ></el-input-number> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <div |
| | | slot="footer" |
| | | class="dialog-footer" |
| | | > |
| | | <el-button @click="dialogFormVisible = false">取 消</el-button> |
| | | <el-button type="primary" @click="genBuffer">确 定</el-button> |
| | | <el-button |
| | | type="primary" |
| | | @click="changeBufferData" |
| | | >确 定</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | import { |
| | | inquiry_SelectTabs, |
| | | inquiry_uploadShp, |
| | | decr, |
| | | encr, |
| | | dataLib_selectTabs, |
| | | pipelines_selectSegNames, |
| | | dataLib_selectTabed |
| | | } from "../../api/api.js" |
| | | import { selectPipelines } from "@/api/screen.js" |
| | | import { getToken } from "@/utils/auth" |
| | | import * as turf from "@turf/turf" |
| | | import { wktToGeoJSON } from "@terraformer/wkt" |
| | | |
| | | export default { |
| | | components: { queryinfo }, |
| | | data() { |
| | | return { |
| | | selectTree: "", |
| | | menuTopFrom: { |
| | | queryType: "", |
| | | pipeline: "", |
| | | segName: "", |
| | | bufferSize: 10, |
| | | bufferSize: 5000, |
| | | }, |
| | | treeChange: [], |
| | | layerData: [ |
| | | { |
| | | id: 1, |
| | | label: "基础数据", |
| | | tabDesc: "基础数据", |
| | | value: "BD", |
| | | children: [], |
| | | }, |
| | | { |
| | | id: 2, |
| | | label: "业务数据", |
| | | tabDesc: "业务数据", |
| | | value: "BS", |
| | | children: [], |
| | | }, |
| | | // { |
| | | // id: 1, |
| | | // label: "基础数据", |
| | | // tabDesc: "基础数据", |
| | | // value: "BD", |
| | | // children: [], |
| | | // }, |
| | | // { |
| | | // id: 2, |
| | | // label: "业务数据", |
| | | // tabDesc: "业务数据", |
| | | // value: "BS", |
| | | // children: [], |
| | | // }, |
| | | ], |
| | | |
| | | queryOption: [ |
| | |
| | | featureLayer: [], |
| | | analyGid: null, |
| | | dialogFormVisible: false, |
| | | bufferLinePosition: [], |
| | | dialogExtentVisible: false, |
| | | setExtent: 10, |
| | | wktExtent: null, |
| | | } |
| | | }, |
| | | |
| | |
| | | this.menuTopFrom.queryType = "rectangle" |
| | | this.getAllTable() |
| | | this.getPipelineData() |
| | | this.$bus.$on("setExtentBUff", res => { |
| | | this.setExtentBuffer(res); |
| | | }) |
| | | }, |
| | | watch: { |
| | | analyGid(newVal, oldVal) { |
| | | if (newVal !== oldVal && this.dialogFormVisible) { |
| | | this.genBuffer() |
| | | } |
| | | }, |
| | | }, |
| | | methods: { |
| | | setExtentBuffer(res) { |
| | | // var wkt = this.$wkt.parse(this.wktExtent) |
| | | // var wkt = encr(this.wktExtent) |
| | | var wkt1 = decr(this.wktExtent) |
| | | |
| | | var wkt = this.$wkt.parse(wkt1) |
| | | |
| | | var restVal = turf.buffer(wkt, res, { units: "meters", steps: 64 }) |
| | | |
| | | var options = { precision: 6, coordinates: 2 }; |
| | | |
| | | var truncated = turf.truncate(restVal, options); |
| | | |
| | | var options1 = { tolerance: 0.01, highQuality: false }; |
| | | var simplified = turf.simplify(truncated, options1); |
| | | |
| | | var wkt2 = this.$wkt.convert(simplified.geometry) |
| | | var wkt3 = encr(wkt2) |
| | | |
| | | this.$store.state.mapMenuShpFile = wkt3 |
| | | |
| | | var points = simplified.geometry.coordinates[0] |
| | | var degreesArray = this.pointsToDegreesArray(points) |
| | | let array = Cesium.Cartesian3.fromDegreesArray(degreesArray) |
| | | const hierarchy = new Cesium.PolygonHierarchy(array) |
| | | const bufferPolygon = sgworld.Viewer.entities.add({ |
| | | polygon: { |
| | | hierarchy: hierarchy, |
| | | material: Cesium.Color.RED.withAlpha(0.5), |
| | | classificationType: Cesium.ClassificationType.BOTH, |
| | | }, |
| | | }) |
| | | this.bufferEntities.push(bufferPolygon) |
| | | sgworld.Navigate.flyToObj(bufferPolygon) |
| | | |
| | | this.showMapMenuPop() |
| | | |
| | | }, |
| | | getDownLoadExtent(res) { |
| | | this.wktExtent = res.result.wkt |
| | | |
| | | this.$bus.$emit('showExtentLayer', true); |
| | | |
| | | |
| | | // this.dialogExtentVisible = true |
| | | // this.$store.state.mapMenuShpFile = rs.result.wkt |
| | | // |
| | | }, |
| | | |
| | | changeValue(value) { |
| | | var obj = {} |
| | | obj = this.queryOption.find(function (item) { |
| | |
| | | if (obj.value == "inputFile") { |
| | | this.getMenuTopFile() |
| | | } else if (obj.value == "buffer") { |
| | | this.handleBuffer() |
| | | this.dialogFormVisible = true |
| | | } |
| | | }, |
| | | async getAllTable() { |
| | | const data = await dataLib_selectTabs({ |
| | | pageIndex: 1, |
| | | pageSize: 500, |
| | | const data = await dataLib_selectTabed({ |
| | | hasGeom: "true", |
| | | name: null, |
| | | }) |
| | | if (data.code != 200) { |
| | | this.$message.error("列表调用失败") |
| | | } |
| | | var option = data.result.filter(res => { |
| | | if (res.rows != 0) { |
| | | return res |
| | | |
| | | |
| | | var val = data.result |
| | | var std = []; |
| | | val.filter((item) => { |
| | | if (std.indexOf(item.bak) == -1) { |
| | | std.push(item.bak); |
| | | this.layerData.push( |
| | | { |
| | | val: item.bak, |
| | | label: item.bak, |
| | | children: [], |
| | | } |
| | | ) |
| | | } |
| | | }) |
| | | for (var i in option) { |
| | | var val_Data = option[i] |
| | | val_Data.id = "1" + i |
| | | val_Data.label = val_Data.tabDesc |
| | | if (option[i].ns == "bd") { |
| | | this.layerData[0].children.push(val_Data) |
| | | } else { |
| | | this.layerData[1].children.push(val_Data) |
| | | }); |
| | | for (var i in this.layerData) { |
| | | var item = this.layerData[i]; |
| | | for (var j in val) { |
| | | var res = val[j]; |
| | | |
| | | if (item.val === res.bak) { |
| | | |
| | | res.label = res.tabDesc |
| | | this.layerData[i].children.push(res) |
| | | } |
| | | } |
| | | } |
| | | |
| | | }, |
| | | //获取选择树的节点 |
| | | getCheckedNodes() { |
| | | |
| | | var valTree = this.$refs.tree.getCheckedNodes() |
| | | if (valTree.length == 0) return |
| | | |
| | | this.menuTopFrom.queryLayer = valTree[0].tabDesc |
| | | this.menuTopFrom.queryLayer = null; |
| | | |
| | | this.$store.state.propertiesName = valTree[0]; |
| | | this.treeChange = []; |
| | | for (var i = 0; i < valTree.length; i++) { |
| | | if (valTree[i].entity) { |
| | | if (!this.menuTopFrom.queryLayer) { |
| | | this.menuTopFrom.queryLayer = valTree[i].tabDesc; |
| | | } |
| | | this.treeChange.push(valTree[i]) |
| | | } |
| | | |
| | | } |
| | | }, |
| | | //清空树选中的节点 |
| | | resetCheckedNodes() { |
| | | this.layerData = [] |
| | | this.getAllTable() |
| | | this.$refs.tree.setCheckedKeys([]); |
| | | this.treeChange = [] |
| | | this.menuTopFrom.queryLayer = null |
| | | this.$refs.tree.setCheckedKeys([]) |
| | | |
| | | }, |
| | | //导入shp文件 |
| | | async setMenuTopFile() { |
| | |
| | | }) |
| | | return |
| | | } |
| | | var that = this; |
| | | $.ajax(BASE_URL + "/inquiry/uploadShp?token=" + getToken(), { |
| | | type: "post", |
| | | data: formData, |
| | |
| | | contentType: false, |
| | | success: rs => { |
| | | if (rs.code !== 200) { |
| | | return this.$message.error("用户角色请求错误") |
| | | return this.$message.error("数据解析失败") |
| | | } |
| | | |
| | | this.$store.state.mapMenuShpFile = rs.result.wkt |
| | | this.showMapMenuPop() |
| | | that.getDownLoadExtent(rs); |
| | | |
| | | }, |
| | | error: e => { |
| | | console.log(e) |
| | |
| | | sgworld.Creator.DeleteObject(this.$store.state.primitLayer) |
| | | this.$store.state.primitLayer = null |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | if (this.treeChange.length == 0) { |
| | | this.$message.error("请选择要查询的数据") |
| | | return |
| | |
| | | }, |
| | | clearQuery() { |
| | | // 清楚buffer |
| | | this.layerData = []; |
| | | this.getAllTable(); |
| | | this.clearBufferEntities() |
| | | this.$refs.pathClear.value = "" |
| | | this.treeChange = [] |
| | |
| | | std.alt = cartographic.height |
| | | return std |
| | | }, |
| | | handleBuffer() {}, |
| | | async getPipelineData() { |
| | | const data = await pipelines_selectSegNames() |
| | | if (data.code != 200) { |
| | |
| | | |
| | | if (item && wkt) { |
| | | const line = wktToGeoJSON(wkt) |
| | | // const line2 = wktToGeoJSON(wkt2) |
| | | |
| | | const position = line.coordinates |
| | | // const position2 = line2.coordinates |
| | | let position = line.coordinates |
| | | if (wkt.includes("MULTILINESTRING")) { |
| | | this.createBuffer(position.flat()) |
| | | } else { |
| | | this.createBuffer(position) |
| | | position = line.coordinates.flat() |
| | | } |
| | | this.bufferLinePosition = position |
| | | if (this.dialogFormVisible) { |
| | | this.createBuffer() |
| | | } |
| | | } |
| | | } |
| | | this.dialogFormVisible = false |
| | | let wkt = |
| | | "LINESTRING(114.82181424692999 33.697046488105,115.06065563205186 32.2808276171009,114.69405780892077 31.527280108790023)" |
| | | let wkt2 = |
| | | "MULTILINESTRING((115.35696516720873 33.51877172773311,117.76217256980829 32.44801812803422,118.69492094774364 32.31899881794112))" |
| | | |
| | | // console.log("line1", position) |
| | | // console.log("line2", position2) |
| | | }, |
| | | createBuffer(position) { |
| | | createBuffer() { |
| | | this.clearBufferEntities() |
| | | const position = this.bufferLinePosition |
| | | const buffRadius = this.menuTopFrom.bufferSize |
| | | var polylineF = turf.lineString(position) |
| | | var bufferd = turf.buffer(polylineF, buffRadius, { units: "meters" }) |
| | |
| | | }) |
| | | this.bufferEntities.push(bufferPolygon) |
| | | let res = hierarchy.positions |
| | | sgworld.Navigate.flyToObj(bufferPolygon) |
| | | this.flyEntity = res |
| | | }, |
| | | changeBufferData() { |
| | | this.dialogFormVisible = false |
| | | let res = this.flyEntity |
| | | let restVal, |
| | | std = [] |
| | | for (let i in res) { |
| | |
| | | } |
| | | restVal = turf.polygon([std], { name: "polygon" }) |
| | | |
| | | this.flyEntity = res |
| | | sgworld.Navigate.flyToObj(bufferPolygon) |
| | | console.log("bufferPolygon", res) |
| | | |
| | | console.log("bufferPolygon", restVal) |
| | | this.setJonToWKT(restVal) |
| | | }, |
| | | |
| | | pointsToDegreesArray(points) { |
| | | let degreesArray = [] |
| | | points.forEach(item => { |
| | |
| | | this.bufferEntities.forEach(entity => { |
| | | sgworld.Viewer.entities.remove(entity) |
| | | }) |
| | | this.flyEntity = null |
| | | }, |
| | | changeSelect2(res) { |
| | | var value = this.featureLayer |
| | |
| | | } |
| | | } |
| | | this.segNameOption = option |
| | | this.menuTopFrom.segName = option[0].segName || '<空>' |
| | | this.menuTopFrom.segName = option[0].segName || "<空>" |
| | | this.analyGid = option[0].gid |
| | | this.genBuffer() |
| | | }, |
| | | selectChangeGid(res) { |
| | | this.analyGid = res |
| | |
| | | }) |
| | | return restVal |
| | | }, |
| | | handleBufferChange(val, oldVal) { |
| | | this.createBuffer() |
| | | }, |
| | | dialogOpend() { |
| | | this.createBuffer() |
| | | } |
| | | }, |
| | | } |
| | | </script> |
| | |
| | | |
| | | <style lang="less"> |
| | | .menuBox { |
| | | .buffer-dialog { |
| | | background-color: rgba(244, 248, 255, 0.85) !important; |
| | | border: 1px solid rgba(32, 160, 255, 0.6); |
| | | color: #202020; |
| | | .el-dialog__header { |
| | | padding: 10px 20px; |
| | | border-bottom: 1px solid rgba(32, 160, 255, 0.6); |
| | | .el-dialog__wrapper { |
| | | pointer-events: none; |
| | | .buffer-dialog { |
| | | top: 355px; |
| | | background-color: rgba(244, 248, 255, 0.85) !important; |
| | | border: 1px solid rgba(32, 160, 255, 0.6); |
| | | color: #202020; |
| | | .el-dialog__body, |
| | | .el-dialog__header, |
| | | .el-dialog__footer { |
| | | pointer-events: auto; |
| | | } |
| | | .el-dialog__header { |
| | | padding: 10px 20px; |
| | | border-bottom: 1px solid rgba(32, 160, 255, 0.6); |
| | | |
| | | .el-dialog__headerbtn { |
| | | top: 10px; |
| | | font-size: 18px; |
| | | .el-dialog__headerbtn { |
| | | top: 10px; |
| | | font-size: 18px; |
| | | } |
| | | } |
| | | .el-form-item { |
| | | .el-input-number { |
| | | width: 202px; |
| | | } |
| | | } |
| | | } |
| | | .el-form-item { |
| | | .el-input-number { |
| | | width: 202px; |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | </style> |