| | |
| | | <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" |
| | |
| | | </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> |
| | |
| | | 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() { |
| | |
| | | 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: [], |
| | | } |
| | | }, |
| | | |
| | |
| | | this.menuTopFrom.queryType = "rectangle" |
| | | this.getAllTable() |
| | | this.getPipelineData() |
| | | }, |
| | | watch: { |
| | | analyGid(newVal, oldVal) { |
| | | if (newVal !== oldVal && this.dialogFormVisible) { |
| | | this.genBuffer() |
| | | } |
| | | }, |
| | | }, |
| | | methods: { |
| | | changeValue(value) { |
| | |
| | | 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 = valTree[0].tabDesc; |
| | | this.$store.state.propertiesName = valTree[0]; |
| | | for (var i = 0; i < valTree.length; i++) { |
| | | if (valTree[i].entity) { |
| | | this.treeChange.push(valTree[i]) |
| | |
| | | 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> |