From b187fa62b3e02d8417d73139dcf3e2271268788d Mon Sep 17 00:00:00 2001 From: 陈泽平 <chenzeping> Date: 星期五, 21 五月 2021 09:00:42 +0800 Subject: [PATCH] 管线分析功能问题修改 --- src/components/panel/topicSearch/SewersSelect/AnalysisChoose/Flow.vue | 243 +++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 198 insertions(+), 45 deletions(-) diff --git a/src/components/panel/topicSearch/SewersSelect/AnalysisChoose/Flow.vue b/src/components/panel/topicSearch/SewersSelect/AnalysisChoose/Flow.vue index 1b10461..aead8c4 100644 --- a/src/components/panel/topicSearch/SewersSelect/AnalysisChoose/Flow.vue +++ b/src/components/panel/topicSearch/SewersSelect/AnalysisChoose/Flow.vue @@ -1,60 +1,213 @@ <template> - <div class="connectivity"> - <el-row> - <el-button type="primary" size="mini">閫夋嫨绠℃</el-button> - </el-row> - <el-table - :data="tableData" - height="250" - border - style="width: 100%"> - <el-table-column - prop="date" - label="绠$嚎鍚嶇О" - width="180"> - </el-table-column> - <el-table-column - prop="name" - label="绠$嚎绫诲瀷" - width="180"> - </el-table-column> - <el-table-column - prop="address" - label="鎿嶄綔"> - </el-table-column> - </el-table> - </div> + <div class="connectivity"> + <el-button type="primary" @click="selectPipeLine" size="mini" highlight-current-row + title="鍦板浘涓婄偣鍑昏鏄剧ず娴佸悜鐨勭娈�">閫夋嫨绠℃ + </el-button> + <el-table max-height="200" class="tableBox" highlight-current-row :data="tableDataLiuxiang" size="mini"> + <el-table-column :show-overflow-tooltip="true" prop="pipecode" label="绠℃绫诲瀷"></el-table-column> + <el-table-column :show-overflow-tooltip="true" sortable width="100" prop="pipecode" + label="绠℃鍚嶇О"></el-table-column> + <el-table-column :show-overflow-tooltip="true" sortable width="100" prop="pipecode" + label="璧风偣缂栧彿"></el-table-column> + <el-table-column :show-overflow-tooltip="true" sortable width="100" prop="pipecode" + label="缁堢偣缂栧彿"></el-table-column> + <el-table-column class-name="fixed-table" fixed="right" label="鎿嶄綔" width="60"> + <template slot-scope="scope"> + <el-button @click="lxQuery(scope.row)" type="text" size="small">鏄剧ず娴佸悜</el-button> + </template> + </el-table-column> + </el-table> + <span class="fixed-style">鍒嗘瀽缁撴灉</span> + <el-table class="tableBox" highlight-current-row max-height="200" :data="lxTableDataResult" + @row-click="lxResultSelect" style="width: 100%" size="mini"> + <el-table-column :show-overflow-tooltip="true" prop="pipecode" label="绠℃绫诲瀷"></el-table-column> + <el-table-column :show-overflow-tooltip="true" width="100" sortable prop="pipecode" + label="绠℃鍚嶇О"></el-table-column> + <el-table-column :show-overflow-tooltip="true" sortable width="100" prop="pipecode" + label="璧风偣缂栧彿"></el-table-column> + <el-table-column :show-overflow-tooltip="true" sortable width="100" prop="pipecode" + label="缁堢偣缂栧彿"></el-table-column> + <el-table-column class-name="fixed-table" fixed="right" label="鎿嶄綔" width="40"> + <template slot-scope="scope"> + <el-button @click="linkResultSelect(scope.row)" type="text" size="small">瀹氫綅</el-button> + </template> + </el-table-column> + </el-table> + </div> </template> <script> +import mapApi from '../../../../../api/mapApi' +import { createFlowLine } from './PublicWay' +import eventBus from '../../../../../eventBus' + export default { name: 'Flow', data () { return { - tableData: [{ - date: '2016-05-02', - name: '鐜嬪皬铏�', - address: '涓婃捣甯傛櫘闄�鍖洪噾娌欐睙璺� 1518 寮�' - }, { - date: '2016-05-04', - name: '鐜嬪皬铏�', - address: '涓婃捣甯傛櫘闄�鍖洪噾娌欐睙璺� 1517 寮�' - }, { - date: '2016-05-01', - name: '鐜嬪皬铏�', - address: '涓婃捣甯傛櫘闄�鍖洪噾娌欐睙璺� 1519 寮�' - }, { - date: '2016-05-03', - name: '鐜嬪皬铏�', - address: '涓婃捣甯傛櫘闄�鍖洪噾娌欐睙璺� 1516 寮�' - }] + // 娴佸悜 閫夋嫨鐨勭娈� 鐨則able琛ㄦ牸鏁版嵁 + tableDataLiuxiang: [], + // 娴佸悜 鍒嗘瀽缁撴灉 鐨則able琛ㄦ牸鏁版嵁 + lxTableDataResult: [], + linkPipeline: [], + currentSelectResultLine: null + } + }, + mounted () { + this.$nextTick(() => { + eventBus.$on('tabData-change', (obj) => { + if (obj) { + this.handleClick() + } + }) + }) + }, + methods: { + // tab鍒囨崲 + handleClick () { + this.clearLX() + this.linkClear() + this.tableDataLiuxiang = [] + this.tableDataLinkStart = [] + this.tableDataLinkEnd = [] + this.tableDataLinkResult = [] + this.lxTableDataResult = [] + }, + linkClear () { + if (this.currentSelectStartLine != null) { + this.currentSelectStartLine.remove() + this.currentSelectStartLine = null + } + if (this.currentSelectEndLine != null) { + this.currentSelectEndLine.remove() + this.currentSelectEndLine = null + } + if (this.currentSelectResultLine != null) { + this.currentSelectResultLine.remove() + this.currentSelectResultLine = null + } + }, + // 瀹氫綅鏂规硶浜嬩欢 + linkResultSelect (e) { + // console.log('杩為�氭�у垎鏋愮粨鏋滃垪琛ㄧ偣鍑�') + console.log(e) + const geom = JSON.parse(e.geomText) + if (this.currentSelectResultLine != null) { + this.currentSelectResultLine.remove() + this.currentSelectResultLine = null + } + this.currentSelectResultLine = window.L.geoJSON(geom, { + style: function (feature) { + return { + color: 'rgba(255,0,0,.6)', + weight: 10 + } + } + }).addTo(window.map) + window.map.panInsideBounds(this.currentSelectResultLine.getBounds()) + }, + // 娓呮鍒嗘瀽缁撴灉 + clearLinkPipe () { + if (this.linkPipeline.length > 0) { + this.linkPipeline.forEach((itm, idx) => { + itm.remove() + }) + } + this.linkPipeline = [] + }, + // 鍦板浘涓婄偣鍑� + selectPipeLine () { + window.map.on('click', this.selectClick) + // // 鍏抽棴寮圭獥 + window.layerFactory.clickSwitch = false + }, + // 鍦板浘涓婄偣鍑诲洖璋� + selectClick (e) { + // console.log(e) + window.map.off('click', this.selectClick) + const point = [e.latlng.lng, e.latlng.lat] + this.getPipeLine(point) + }, + // 鐐瑰嚮鑾峰彇鍒ゆ柇鏁版嵁 + async getPipeLine (point) { + const param = { + x: point[0], + y: point[1], + radius: 3 + } + // 鏍规嵁鍙傛暟璇锋眰鎺ュ彛鏁版嵁 + const res = await mapApi.findPipelineByClickPoint(param) + console.log(res) + this.tableDataLiuxiang = res.data + }, + // 娴佸悜鍒嗘瀽缁撴灉table鍒楄〃鏁版嵁鐐瑰嚮 + lxResultSelect (e) { + // console.log('杩為�氭�у垎鏋愮粨鏋滃垪琛ㄧ偣鍑�') + // console.log(e) + + const geom = JSON.parse(e.geomText) + if (this.currentSelectResultLine != null) { + this.currentSelectResultLine.remove() + this.currentSelectResultLine = null + } + this.currentSelectResultLine = window.L.geoJSON(geom, { + style: function (feature) { + return { + weight: 10, + color: 'rgba(0,250,255,.6)' + } + } + }).addTo(window.map) + window.map.panInsideBounds(this.currentSelectResultLine.getBounds()) + }, + // 鐐瑰嚮鏄剧ず娴佸悜 table鍒楄〃涓殑鏁版嵁 => 杩涜瀹樼綉娴佸悜鐨勬樉绀� + async lxQuery (e) { + // console.log(e) + this.clearLinkPipe() + const param = { + // lineNodeID: e.startpoint + lineNodeID: e.startpointnumber + } + const res = await mapApi.findFlowDirection(param) + this.lxTableDataResult = res.data + const linkPipe = [] + res.data.forEach((itm, idx) => { + const geom = JSON.parse(itm.geomText) + const points = [] + geom.coordinates.forEach((it, id) => { + points.push(it.reverse()) + }) + linkPipe.push(points) + }) + + linkPipe.forEach((itm, idx) => { + const param1 = { + points: itm, + option: { + dashArray: '15 15', + dashSpeed: -30, + color: '#ffff00' + } + } + const line = createFlowLine(param1) + this.linkPipeline.push(line) + }) + }, + // 娓呴櫎娴佸悜 + clearLX () { + if (this.flowPipeLine != null) { + this.flowPipeLine.remove() + this.flowPipeLine = null + } + if (this.currentSelectResultLine != null) { + this.currentSelectResultLine.remove() + this.currentSelectResultLine = null + } } } } </script> <style lang="less" scoped> -/deep/ .el-table { - margin-top: 15px; -} + </style> -- Gitblit v1.8.0