| | |
| | | <el-button class="button-user" type="primary" icon="el-icon-upload" title="上传至服务器" |
| | | @click.stop="saveHistoryPlot"></el-button> |
| | | |
| | | <!-- <el-button class="button-user historyBtn" type="primary" icon="el-icon-s-order" title="历史记录" |
| | | @click.stop="histotyPlotting"></el-button> --> |
| | | <el-button class="button-user historyBtn" type="primary" icon="el-icon-s-order" title="获取最新数据" |
| | | @click.stop="histotyPlotting"></el-button> |
| | | </el-upload> |
| | | </div> |
| | | |
| | |
| | | import AddOnlineMap from "./AddOnlineMap.vue"; |
| | | import GetScene from "./GetScene.vue"; |
| | | import SaveScene from "./SaveScene.vue"; |
| | | import { Op_SelectByPage, Op_Insert, Op_UpdateById } from '../../../api/api.js' |
| | | import { Op_SelectByPage, Op_Insert, Op_UpdateById, Img_SelectByPage, Img_DeleteByIds } from '../../../api/api.js' |
| | | import model from "../../../assets/js/Layer/model"; |
| | | import mapOL from "../../../assets/js/Layer/mapOL"; |
| | | // 工程树工具 |
| | | let _treeTool; |
| | | function arrGroup(arr, fn) { |
| | |
| | | }; |
| | | }, |
| | | mounted() { |
| | | |
| | | Bus.$on("reastLayer", (type) => { |
| | | this.setTreeData([]); |
| | | this.initData({}); |
| | | model.deleteAll(); |
| | | setTimeout(() => { |
| | | |
| | | this.histotyPlotting(); |
| | | }, 100); |
| | | }); |
| | | // 获取本地配置文件 |
| | | if (this.$route.query.hasOwnProperty("layer")) { |
| | | axios |
| | |
| | | Bus.$emit("checkTab", "index/add/treeLayer", false); |
| | | }, |
| | | closeLayer() { |
| | | this.$parent.hideLayer(); |
| | | this.$store.state.isShowLayer = false |
| | | // this.$parent.hideLayer(); |
| | | }, |
| | | // 定义中转站事件 |
| | | initBusEvent() { |
| | | Bus.$off("addLayer"); |
| | | |
| | | |
| | | Bus.$on("addLayer", (type) => { |
| | | this.selectNode = this.$refs.tree && this.$refs.tree.getCurrentNode(); |
| | | this.openThisTypePop(type); |
| | |
| | | }, |
| | | // 加载历史标绘数据 |
| | | async histotyPlotting() { |
| | | this.setTreeData([]); |
| | | this.initData({}); |
| | | model.deleteAll(); |
| | | var finalPlotting = []; |
| | | const data = await Op_SelectByPage({ pageSize: 1000000, pageIndex: 1, name: '' }); |
| | | const data1 = await Img_SelectByPage({ pageSize: 1000000, pageIndex: 1, name: '' }); |
| | | if (data.status == 200 && data.data.length > 0) { |
| | | var val_data = data.data; |
| | | for (var i in val_data) { |
| | |
| | | let plottingArr = []; |
| | | plottingArr.push(val[0]); |
| | | const newArr = arrGroup(plottingArr, (item) => item.name); |
| | | let finalPlotting = []; |
| | | |
| | | newArr.map((a) => { |
| | | let newObj = {}; |
| | | a.map((b) => { |
| | |
| | | }); |
| | | finalPlotting.push(newObj); |
| | | }); |
| | | let json = { |
| | | name: "江苏交控智慧高速", |
| | | id: 1, |
| | | open: true, |
| | | children: finalPlotting, |
| | | }; |
| | | this.initData(json); |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (data1.status == 200) { |
| | | var img_data = data1.data; |
| | | if (img_data && img_data.length > 0) { |
| | | for (var i = 0; i < img_data.length; i++) { |
| | | var item = img_data[i] |
| | | item.sourceType = 'imgUp' |
| | | item.sid = item.id; |
| | | item.id = new Date().getTime() + i; |
| | | item.checked = true; |
| | | finalPlotting[0].children.push(item) |
| | | } |
| | | } |
| | | |
| | | } |
| | | var json = { |
| | | name: "江苏交控智慧高速", |
| | | id: 1, |
| | | open: true, |
| | | children: finalPlotting |
| | | }; |
| | | |
| | | this.initData(json); |
| | | // const downloading = this.$loading({ |
| | | // lock: true, |
| | | // text: "会议保障历史数据加载中,请稍后", |
| | |
| | | if (addData && node._children) { |
| | | node._children.forEach((item) => { |
| | | _treeTool.addData(item); |
| | | |
| | | this.setAddGLBLayer(item); |
| | | }); |
| | | } else { |
| | |
| | | model.addModelLayer(treeNode); |
| | | } else { |
| | | model.setDelGLBModel(treeNode); |
| | | } |
| | | } else if (treeNode.sourceType == "SimpleGraphic") { |
| | | if (isCheck) { |
| | | mapOL.addLayerData(treeNode); |
| | | } else { |
| | | mapOL.removeLayerD(treeNode); |
| | | } |
| | | } |
| | | // 只能同时加载一个地形 |
| | |
| | | if (res.sourceType == "GLB" && res.checked) { |
| | | |
| | | model.addModelLayer(res); |
| | | } else if (res.sourceType == "SimpleGraphic" && res.checked) { |
| | | mapOL.addLayerData(res); |
| | | } else if (res.sourceType == "imgUp" && res.checked) { |
| | | model.addImgUpLayer(res); |
| | | } |
| | | }, |
| | | // 添加演示动画 |
| | |
| | | // 右键菜单元素 |
| | | rightClick(e, data, node, comp) { |
| | | this.isClickParent = !!data.children; |
| | | if (data.sourceType == 'imgUp') { |
| | | this.isClickParent = true; |
| | | } |
| | | this.selectNode = data; |
| | | this.rightClickMenuStyle = { top: e.pageY + "px", left: e.pageX + "px" }; |
| | | this.rightClickMenuDisplay = true; |
| | |
| | | if (this.selectNode.sourceType === "GLB") { |
| | | model.setDelGLBModel(this.selectNode) |
| | | } |
| | | |
| | | if (this.selectNode.sourceType === "SimpleGraphic") { |
| | | mapOL.removeLayerData(this.selectNode) |
| | | } |
| | | if (this.selectNode.sourceType === "imgUp") { |
| | | this.removeimgUpData(this.selectNode) |
| | | } |
| | | this.remove(this.selectNode); |
| | | this.$refs.tree && this.$refs.tree.setCurrentKey(null); |
| | | this.selectNode = undefined; |
| | | |
| | | |
| | | }, |
| | | // 右键编辑按钮编辑树节点 |
| | | editTreeNode() { |
| | |
| | | } |
| | | } |
| | | }, |
| | | async removeimgUpData(res) { |
| | | const data = await Img_DeleteByIds(res.sid); |
| | | if (data.status == 200) { |
| | | |
| | | } |
| | | }, |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | // 添加目录 |
| | | addFold() { |
| | | let newChild = { |