From 6fe940335b9ca7f4640983929b070c00e401dc61 Mon Sep 17 00:00:00 2001 From: Surpriseplus <845948745@qq.com> Date: 星期四, 09 三月 2023 09:48:14 +0800 Subject: [PATCH] 综合展示点击模型显示详细信息 --- src/views/Synthesis/LeftMenu.vue | 494 ++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 458 insertions(+), 36 deletions(-) diff --git a/src/views/Synthesis/LeftMenu.vue b/src/views/Synthesis/LeftMenu.vue index 50c31de..648cb1e 100644 --- a/src/views/Synthesis/LeftMenu.vue +++ b/src/views/Synthesis/LeftMenu.vue @@ -16,6 +16,7 @@ <maplayer ref="maplayer" /> <queryinfo ref="queryinfo" /> <terrainDig ref="terrainDig" /> + <modelAttach ref="modelAttach" /> <input type="file" accept=".kml" @@ -32,6 +33,197 @@ multiple="multiple" @change="handleOpenShp()" /> + + <el-dialog + :title="formInline.title" + :visible.sync="dialogVisible" + :modal="false" + :modal-append-to-body="false" + :close-on-click-modal="false" + :before-close="handleClose" + width="30%" + > + <el-dialog + title="棰勮" + :append-to-body="false" + :visible.sync="dialog.dialogVisible" + width="70%" + :modal="false" + :close-on-click-modal="false" + > + <div + v-if="dialog.isPdf" + class="pdfClass" + > + <iframe + :src="dialog.src" + type="application/x-google-chrome-pdf" + width="100%" + height="100%" + > + </iframe> + </div> + <div + v-if="dialog.isJpg" + class="pdfClass" + > + <img + style="width:100%; height:100%" + :src="dialog.src" + alt="" + /> + </div> + </el-dialog> + <div style="height:63vh"> + <el-tabs + v-model="activeName" + @tab-click="handleClick" + > + <el-tab-pane + label="灞炴��" + name="first" + > + <el-form + ref="form" + :model="formInline" + label-width="80px" + > + + <el-form-item :label="$t('common.name')"> + <el-input v-model="formInline.name"></el-input> + </el-form-item> + <el-form-item :label="$t('common.type')"> + <el-input v-model="formInline.type"></el-input> + </el-form-item> + <!-- <el-form-item :label="$t('common.info')"> + <el-input v-model="formInline.info"></el-input> + </el-form-item> + <el-form-item label="URL"> + <el-input v-model="formInline.url"></el-input> + </el-form-item> + <el-form-item label="Icon"> + <el-input v-model="formInline.icon"></el-input> + </el-form-item> --> + <el-form-item :label="$t('common.bak')"> + <el-input v-model="formInline.bak"></el-input> + </el-form-item> + <el-form-item> + <el-button + v-show="isShowModel" + type="success" + plain + size="small" + @click="InsertData" + >{{$t('common.increase')}}</el-button> + <el-button + v-show="!isShowModel" + type="info" + plain + size="small" + @click="EditData" + >{{$t('common.update')}}</el-button> + </el-form-item> + </el-form-item> + </el-form> + + </el-tab-pane> + <el-tab-pane + label="闄勪欢" + name="second" + > + <el-table + :data="tableData" + ref="filterTable" + height="calc(100% - 130px)" + border + style="width: 100%" + @selection-change="handleAttatchChange" + > + <el-table-column + type="selection" + width="70" + /> + <el-table-column + width="60" + type="index" + :label="$t('common.index')" + /> + <el-table-column + prop="name" + :label="$t('common.name')" + /> + + <el-table-column + prop="sizes" + :label="$t('common.size')" + :formatter="statSizeChange" + /> + <el-table-column + align="center" + :label="$t('common.operate')" + min-width="100" + > + <template slot-scope="scope"> + <el-link + v-if="matchState(scope, /[]/)" + @click="setAttatchDetail(scope.$index, scope.row)" + class="elLink" + >{{ $t('common.see') }}</el-link> + + </template> + </el-table-column> + </el-table> + + </el-tab-pane> + + </el-tabs> + <!-- <el-form :model="formInline"> + <el-form-item> + <el-row :gutter="20"> + <el-col :span="20"> + <el-input + size="small" + disabled + v-model="formInline.file" + ></el-input> + + <input + name="file1" + type="file" + id="insertFile" + multiple="multiple" + style="display: none" + @change="insertFile( )" + /> + </el-col> + <el-col :span="4"> + <el-link + @click="getInsertFile( )" + :underline="false" + icon="el-icon-folder" + > </el-link> + </el-col> + </el-row> + </el-form-item> + <el-form-item> + <el-button + @click="setAttachInsert" + size="mini" + type="primary" + plain + >娣诲姞</el-button> + <el-button + type="danger" + plain + size="mini" + @click="setAttachDel" + >鍒犻櫎</el-button> + </el-form-item> + </el-form> --> + <!-- @selection-change="handleAttatchChange" --> + + </div> + </el-dialog> </div> </template> @@ -41,6 +233,7 @@ import maplayer from "../Tools/maplayer.vue"; import queryinfo from "../Tools/queryinfo.vue"; import terrainDig from "../Tools/terrainDig.vue"; +import modelAttach from "../Tools/ModelAttach.vue"; import $ from "jquery"; import { getToken } from "@/utils/auth"; import ImageWMS from "ol/source/ImageWMS"; @@ -48,7 +241,14 @@ import GeoJSON from "ol/format/GeoJSON.js"; import { Vector as VectorSource } from "ol/source"; import { Vector as VectorLayer } from "ol/layer"; -import { perms_selectLayers } from '../../api/api.js' +import { + perms_selectLayers, + comprehensive_selectModelByGuid, + comprehensive_selectFiles, + comprehensive_deletes, + comprehensive_selectModelByPageAndCount, + comprehensive_insertModel +} from "../../api/api.js"; import { OverviewMap, defaults as defaultControls, @@ -60,7 +260,7 @@ import { geometry } from "@turf/turf"; export default { - components: { mapinfo, maplayer, queryinfo, terrainDig }, + components: { mapinfo, maplayer, queryinfo, terrainDig, modelAttach }, data() { return { showTwoMenuFlag: false, @@ -424,6 +624,25 @@ isRouter: false, //璺緞鍒嗘瀽 isPiple: false, //绠¢亾鍒嗘瀽 DXZPState: null, //鍦板舰鏁村钩 + dialogVisible: false, + formInline: { + title: '', + file: '', + name: '', + type: '', + info: '', + icon: '', + bak: '' + }, + tableData: [], + dialog: { + dialogVisible: false, + isPdf: false, + isJpg: false, + src: '' + }, + activeName: "first", + isShowModel: false, }; }, methods: { @@ -440,7 +659,7 @@ } if (this.isMenuFlag != val) { - if (res.id != 'b9') { + if (res.id != "b9") { this.$store.state.mapMenuBoolean = false; this.$store.state.mapMenuBoxFlag = null; this.$store.state.mapPopBoolean = false; @@ -463,7 +682,6 @@ this.$store.state.primitLayer = null; } } - } this.showTwoMenuFlag = res.id; @@ -1179,7 +1397,7 @@ var val = { name: "Lengend", id: res, - vshow: that.isslopeFlag + vshow: that.isslopeFlag, }; this.$bus.$emit("mapChangeBox", val); window.PDelevationTool = new SmartEarth.ElevationTool(sgworld); //鍏ㄥ眬鍙橀噺 @@ -1193,20 +1411,19 @@ break; case "d3": //璺緞鍒嗘瀽 - this.isRouter = !this.isRouter; let value; if (this.isRouter) { value = { name: "Analysis", id: 3, - show: true + show: true, }; } else { value = { name: "Analysis", id: 3, - show: false + show: false, }; } this.$bus.$emit("mapChangeBox", value); @@ -1266,7 +1483,7 @@ var that = this; window.model = sgworld.Creator.create3DTilesets( "", - modelUrl + '/tileset/m/SN/tileset.json', + modelUrl + "/tileset/m/SN/tileset.json", {}, {}, "0", @@ -1288,7 +1505,9 @@ close: () => { if (this.$store.state.pipelineEntity.length != 0) { for (var i in this.$store.state.pipelineEntity) { - sgworld.Viewer.entities.remove(this.$store.state.pipelineEntity[i]); + sgworld.Viewer.entities.remove( + this.$store.state.pipelineEntity[i] + ); } } }, @@ -1347,27 +1566,27 @@ break; case "d11": //鍦板舰寮�鎸� - this.$refs && - this.$refs.terrainDig && - this.$refs.terrainDig.open("绠¢亾绌洪棿鍒嗘瀽", null, { - close: () => { + // this.$refs && + // this.$refs.terrainDig && + // this.$refs.terrainDig.open("绠¢亾绌洪棿鍒嗘瀽", null, { + // close: () => { - }, - }); - // if (window.Excavation) { - // window.Excavation.drawHandler && - // window.Excavation.drawHandler.destroy(); - // Viewer._container.style.cursor = "default"; - // window.Excavation.tooltip && window.Excavation.tooltip.show(false); - // window.Excavation.clear(); - // window.Excavation = null; - // } else { - // window.Excavation = sgworld.Analysis.TerrainExcavation( - // 10, - // {}, - // function () { } - // ); - // } + // }, + // }); + if (window.Excavation) { + window.Excavation.drawHandler && + window.Excavation.drawHandler.destroy(); + Viewer._container.style.cursor = "default"; + window.Excavation.tooltip && window.Excavation.tooltip.show(false); + window.Excavation.clear(); + window.Excavation = null; + } else { + window.Excavation = sgworld.Analysis.TerrainExcavation( + 10, + {}, + function () { } + ); + } break; case "d12": //閫氳鍒嗘瀽 @@ -1505,9 +1724,7 @@ ); }, setWander(res) { - ; switch (res) { - case "c1": if (window.PointMY != null) { window.PointMY.drawHandler && window.PointMY.drawHandler.destroy(); @@ -1677,7 +1894,7 @@ } this.$store.state.treeData = res; // this.$refs.tree.setCheckedKeys(checkKey); - this.$store.state.checkedKeys = checkKey + this.$store.state.checkedKeys = checkKey; }, setTreeData(source) { let cloneData = JSON.parse(JSON.stringify(source)); // 瀵规簮鏁版嵁娣卞害鍏嬮殕 @@ -1768,7 +1985,6 @@ }); window.map.addLayer(vectorLayer); } else if (res.serveType == "Tileset") { - var tileset = Viewer.scene.primitives.add( new Cesium.Cesium3DTileset({ name: res.cnName, @@ -1782,9 +1998,196 @@ tileset.readyPromise.then(function (tileset) { tileset.id = res.cnName; + tileset.layerId = res.id; Viewer.flyTo(tileset); }); } + }, + showModelAttach() { + if (this.$store.state.attachModel) { + var name = this.$store.state.attachinfo.cnName; + this.$refs && + this.$refs.modelAttach && + this.$refs.modelAttach.open(name, null, { + close: () => { }, + }); + } else { + } + }, + async showModelCatch() { + if (this.$store.state.catModel) { + + this.startModelData(); + this.formInline.title = this.$store.state.catModelInfo.name; + + this.formInline.Id = this.$store.state.catModelInfo.id; + this.formInline.LayerName = this.$store.state.catModelInfo.layerName; + + this.activeName = "first" + this.getAttacthFlieList(); + this.dialogVisible = true; + } else { + this.dialogVisible = false; + window.pickedFeature.color = window.pickedColor; + } + }, + async startModelData() { + var obj = { + layerid: this.$store.state.catModelInfo.layerId, + pageIndex: 1, + pageSize: 10, + } + const data = await comprehensive_selectModelByPageAndCount(obj); + if (data.code != 200) { + return; + } + if (data.count == 0) { + this.isShowModel = true; + this.formInline.name = this.formInline.title; + } else { + this.formInline = data.result; + + this.isShowModel = false; + } + }, + async InsertData() { + const data = await comprehensive_insertModel(this.formInline) + debugger + this.startModelData(); + + }, + handleClose() { + this.$store.state.catModel = false; + }, + + //闄勪欢鍒楄〃鏂板 + setAttachInsert() { + var token = getToken(); + var fs = document.getElementById("insertFile"); + if (fs.files.length == 0) { + + this.$message({ + message: '璇烽�夋嫨瑕佷笂浼犵殑鏂囦欢锛�', + type: 'warning' + }); + return; + } + const formData = new FormData() + for (var i = 0, c = fs.files.length; i < c; i++) { + + formData.append('file', fs.files[i]); // fs.files[i].name,file + } + + $.ajax(BASE_URL + "/comprehensive/uploadFiles?token=" + token + "&tabName=lf.sys_style&eventid=" + this.$store.state.catModelInfo.id, { + type: "post", + data: formData, + async: true, + cache: false, + processData: false, + contentType: false, + success: (rs) => { + this.$message({ + message: '闄勪欢娣诲姞鎴愬姛', + type: 'success' + }); + document.getElementById("insertFile").value = ""; + this.formInline.file = ""; + this.getAttacthFlieList(); + }, + error: (e) => { + document.getElementById("insertFile").value = ""; + this.formInline.file = ""; + this.$message.error('闄勪欢娣诲姞澶辫触'); + } + }); + }, + //闄勪欢鍒楄〃鏌ヨ + async getAttacthFlieList() { + var obj = { + eventid: this.$store.state.catModelInfo.id, + tabName: "lf.sys_style" + }; + const res = await comprehensive_selectFiles(obj); + if (res.code != 200) { + this.$message.error('鍒楄〃璋冪敤澶辫触'); + return + } + this.tableData = res.result; + }, + + + //闄勪欢=>鏂囦欢閫夋嫨 + getInsertFile() { + $('#insertFile').click(); + }, + insertFile() { + var val = document.getElementById('insertFile').files; + if (!val || !val.length) return; + this.formInline.file = val[0].name; + }, + statSizeChange(row, column) { + return this.stateFormatSizes(row.sizes) + }, + stateFormatSizes(res) { + if (res >= 1024) { + const val = parseFloat(res / 1024).toFixed(3); + return val + ' GB'; + } else { + return res + ' MB'; + } + }, + matchState(state = "", reg) { + var row = state.row; + var name = row.name; + if (name.indexOf('.pdf') != -1 || name.indexOf('.jpg') != -1 || name.indexOf('.gif') != -1 || name.indexOf('.png') != -1 || name.indexOf('.jpeg') != -1) { + return true; + } + + return false; + }, + refreshAttatchDetail() { + this.dialog.src = ""; + this.dialog.dialogVisible = false; + this.dialog.isPdf = false; + this.dialog.isJpg = false; + }, + //闄勪欢鏌ョ湅 + setAttatchDetail(index, row) { + this.refreshAttatchDetail() + var name = row.name; + if (name.indexOf('.pdf') != -1) { + this.dialog.dialogVisible = true; + this.dialog.isPdf = true; + var url = BASE_URL + "/comprehensive/downloadForView?guid=" + row.guid + "&token=" + getToken(); + this.dialog.src = url + } else if (name.indexOf('.jpg') != -1 || name.indexOf('.gif') != -1 || name.indexOf('.png') != -1 || name.indexOf('.jpeg') != -1) { + this.dialog.dialogVisible = true; + this.dialog.isJpg = true; + var url = BASE_URL + "/comprehensive/downloadForView?guid=" + row.guid + "&token=" + getToken(); + this.dialog.src = url + } + }, + handleClick(tab, event) { + if (tab.name == "second") { + this.getAttacthFlieList(); + } + }, + //闄勪欢鍒櫎 + async setAttachDel() { + var std = []; + for (var i in this.attacgSelection) { + std.push(this.attacgSelection[i].id); + } + + const res = await comprehensive_deletes({ ids: std.toString() }); + if (res.code != 200) { + this.$message.error('鏂囦欢鍒犻櫎澶辫触'); + } + this.getAttacthFlieList(); + }, + // 闄勪欢=>琛ㄦ牸閫夋嫨 + handleAttatchChange(val) { + this.attacgSelection = val; }, }, mounted() { @@ -1808,8 +2211,23 @@ this.$store.state.treeData = null; this.$store.state.checkedKeys = []; // this.setCoverage("a1"); - this.layersStart() - + this.layersStart(); + }, + watch: { + Obj(newVal, oldVal) { + this.showModelAttach(); + }, + catch(newVal, oldVal) { + this.showModelCatch(); + }, + }, + computed: { + Obj() { + return this.$store.state.attachModel; + }, + catch() { + return this.$store.state.catModel; + }, }, }; </script> @@ -1857,5 +2275,9 @@ height: 30px; display: inline-block; } + .pdfClass { + height: 63vh; + width: 100%; + } } </style> -- Gitblit v1.9.3