From e0a68e0426c7d883f720831ebfeb843c70df697c Mon Sep 17 00:00:00 2001 From: Surpriseplus <845948745@qq.com> Date: 星期一, 03 四月 2023 09:05:13 +0800 Subject: [PATCH] 1 --- src/views/Tools/LayerTree.vue | 114 +++++++++- src/store/index.js | 2 src/components/MapView/mapMenuTop.vue | 69 ++++++ src/views/Synthesis/LeftMenu.vue | 351 ++++++++++++++++++++++++++++++++++ src/components/MapView/mapMenuPop.vue | 9 src/views/datamanage/styleManage.vue | 18 + 6 files changed, 528 insertions(+), 35 deletions(-) diff --git a/src/components/MapView/mapMenuPop.vue b/src/components/MapView/mapMenuPop.vue index f6754e1..36f4d0e 100644 --- a/src/components/MapView/mapMenuPop.vue +++ b/src/components/MapView/mapMenuPop.vue @@ -1,10 +1,8 @@ <template> <div class="menuPop"> <div class="leftBox"> - <div - class="leftDown" - v-if="$store.state.download" - > + <!-- v-if="$store.state.download" --> + <div class="leftDown"> <div @click="getDownloadDep"> <el-link icon="el-icon-download"> </el-link> </div> @@ -331,6 +329,7 @@ if (res.code != 200) { return } + this.selectDownloadFile(res.result, obj.pwd) }, }) @@ -368,10 +367,12 @@ pwd: encodeURIComponent(rspwd), } const data = await dataLib_selectDownloadFile(downObj) + if (data.code != 200) { this.$message.error("涓嬭浇璇锋眰澶辫触") return } + this.closeDown() var token = getToken() var url = diff --git a/src/components/MapView/mapMenuTop.vue b/src/components/MapView/mapMenuTop.vue index 57d4a24..945beab 100644 --- a/src/components/MapView/mapMenuTop.vue +++ b/src/components/MapView/mapMenuTop.vue @@ -170,6 +170,7 @@ >纭� 瀹�</el-button> </div> </el-dialog> + </div> </template> @@ -179,6 +180,7 @@ import { inquiry_SelectTabs, inquiry_uploadShp, + decr, encr, dataLib_selectTabs, pipelines_selectSegNames, @@ -260,6 +262,9 @@ analyGid: null, dialogFormVisible: false, bufferLinePosition: [], + dialogExtentVisible: false, + setExtent: 10, + wktExtent: null, } }, @@ -267,6 +272,9 @@ this.menuTopFrom.queryType = "rectangle" this.getAllTable() this.getPipelineData() + this.$bus.$on("setExtentBUff", res => { + this.setExtentBuffer(res); + }) }, watch: { analyGid(newVal, oldVal) { @@ -276,6 +284,55 @@ }, }, 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) { @@ -346,7 +403,8 @@ }, //娓呯┖鏍戦�変腑鐨勮妭鐐� resetCheckedNodes() { - + this.layerData = [] + this.getAllTable() this.$refs.tree.setCheckedKeys([]); this.treeChange = [] this.menuTopFrom.queryLayer = null @@ -375,6 +433,7 @@ }) return } + var that = this; $.ajax(BASE_URL + "/inquiry/uploadShp?token=" + getToken(), { type: "post", data: formData, @@ -384,11 +443,11 @@ contentType: false, success: rs => { if (rs.code !== 200) { - return this.$message.error("鐢ㄦ埛瑙掕壊璇锋眰閿欒") + return this.$message.error("鏁版嵁瑙f瀽澶辫触") } - this.$store.state.mapMenuShpFile = rs.result.wkt - this.showMapMenuPop() + that.getDownLoadExtent(rs); + }, error: e => { console.log(e) @@ -548,6 +607,8 @@ }, clearQuery() { // 娓呮buffer + this.layerData = []; + this.getAllTable(); this.clearBufferEntities() this.$refs.pathClear.value = "" this.treeChange = [] diff --git a/src/store/index.js b/src/store/index.js index 30f8663..4917f99 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -74,6 +74,8 @@ histLenged: false, setAlphaDity: null, setAlphaList: [], + isProjectLayer: [], + pigCode: null, }, mutations: { //鑾峰彇鏉冮檺鍚堥泦 diff --git a/src/views/Synthesis/LeftMenu.vue b/src/views/Synthesis/LeftMenu.vue index ce5f276..f5a922c 100644 --- a/src/views/Synthesis/LeftMenu.vue +++ b/src/views/Synthesis/LeftMenu.vue @@ -192,6 +192,156 @@ </div> </el-dialog> + <el-dialog + title="鏁版嵁鐢宠" + :visible.sync="dialogInsertVisible" + width="30%" + top="35vh" + :modal="false" + :before-close="handleInsertClose" + > + <div style="width: 100%; max-height: 450px; overflow-y: auto"> + <el-form + ref="form" + :model="ruleForm" + label-width="100px" + > + <el-form-item label="瀹℃牳鍗曚綅"> + <div> + <ul> + <li v-for="item in ruleForm.depid"> + {{ item.name }} + </li> + </ul> + </div> + </el-form-item> + <el-form-item label="琛ㄥ悕"> + <div> + <ul> + <li v-for="item in ruleForm.tabs"> + {{ item.tabDesc }} + </li> + </ul> + </div> + </el-form-item> + <el-form-item label="鏉′欢"> + <el-input + :title="ruleForm.wkt" + v-model="ruleForm.wkt" + disabled + ></el-input> + </el-form-item> + <el-form-item label="鎻忚堪"> + <el-input + type="textarea" + placeholder="璇疯緭鍏ュ唴瀹�" + v-model="ruleForm.descr" + maxlength="50" + show-word-limit + > + </el-input> + </el-form-item> + <el-form-item> + <el-button + class="primary" + size="small" + @click="getInsertDown" + >{{ + $t("common.confirm") + }}</el-button> + <el-button + type="info" + size="small" + @click="closeInsertDown" + >{{ + $t("common.cancel") + }}</el-button> + </el-form-item> + </el-form> + </div> + </el-dialog> + <el-dialog + :title="$t('common.passworld')" + :visible.sync="dialogVisible1" + width="30%" + top="35vh" + :modal="false" + :before-close="handleCloseDown1" + > + <el-form + :model="codeForm" + :rules="rules" + ref="codeForm" + label-width="100px" + class="codeForm" + > + <el-form-item + :label="$t('common.passworld')" + prop="password" + > + <el-input + type="password" + v-model="codeForm.password" + show-password + ></el-input> + </el-form-item> + <el-form-item + :label="$t('common.SPassword')" + prop="repassword" + > + <el-input + type="password" + v-model="codeForm.repassword" + show-password + ></el-input> + </el-form-item> + <el-form-item> + <el-button + class="primary" + size="small" + @click="downloadx('codeForm')" + >{{ $t("common.confirm") }}</el-button> + <el-button + type="info" + size="small" + @click="closeDownx('codeForm')" + >{{ + $t("common.cancel") + }}</el-button> + </el-form-item> + </el-form> + </el-dialog> + <el-dialog + title="鑼冨洿" + :visible.sync="dialogExtentVisible" + width="30%" + :before-close="handleExtentClose" + :modal="false" + :lock-scroll="false" + :close-on-click-modal="false" + > + + <el-row :gutter="20"> + <el-col :span="16"> + <el-input v-model="setExtent"></el-input> + </el-col> + <el-col :span="6"> + <div> + 鍗曚綅锛氾紙m锛� + </div> + </el-col> + </el-row> + <span + slot="footer" + class="dialog-footer" + > + <el-button @click="handleExtentClose">鍙� 娑�</el-button> + <el-button + @click="handleExtentinsert" + type="primary" + >纭� 瀹�</el-button> + </span> + </el-dialog> </div> </template> @@ -237,7 +387,38 @@ export default { components: { mapinfo, maplayer, queryinfo, terrainDig, modelAttach, undergroundModel, setPellucidity }, data() { + var repasswordValidator = (rule, value, callback) => { + if (value === '') { + callback(new Error('璇峰啀娆¤緭鍏ュ瘑鐮�')); + } else if (value !== this.codeForm.password) { + callback(new Error('涓ゆ杈撳叆瀵嗙爜涓嶄竴鑷�!')); + } else { + callback(); + } + }; + var passwordValidator = (rule, value, callback) => { + var passwordreg = + /^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\W!@#$%^&*`~()\\-_+=,.?;<>]+$)(?![a-z0-9]+$)(?![a-z\W!@#$%^&*`~()\\-_+=,.?;<>]+$)(?![0-9\W!@#$%^&*`~()\\-_+=,.?;<>]+$)[a-zA-Z0-9\W!@#$%^&*`~()\\-_+=,.?;<>]{12,20}$/; + if (!passwordreg.test(value)) { + callback( + new Error('瀵嗙爜蹇呴』鐢辨暟瀛椼�佸瓧姣嶃�佺壒娈婂瓧绗︾粍鍚�,璇疯緭鍏�13-20浣�') + ); + } else { + callback(); + } + }; return { + rules: { + password: [{ required: true, message: '璇疯緭鍏ュ瘑鐮�', trigger: 'blur' }, { validator: passwordValidator, trigger: 'blur' }], + repassword: [ + { required: true, message: '璇疯緭鍏ョ‘璁ゅ瘑鐮�', trigger: 'blur' }, + { validator: repasswordValidator, trigger: 'blur' }, + ], + }, + codeForm: { + password: '', + repassword: '', + }, showTwoMenuFlag: false, setListTwoMenu: [], setListTwoMenuAll: [ @@ -641,6 +822,18 @@ }], modelClip: false, showPickUp: false, + dialogInsertVisible: false, + dialogVisible1: false, + ruleForm: { + depname: [], + tabs: [], + pwd: null, + repwd: null, + wkt: null, + descr: null, + }, + dialogExtentVisible: false, + setExtent: 10, }; }, methods: { @@ -1835,10 +2028,10 @@ // } // } window.model.clippingPlanes = clippingPlanes; - if (window.modelHeight && window.modelHeight != 0){ + if (window.modelHeight && window.modelHeight != 0) { // console.log("window.modelHeight---",window.modelHeight) window.model.clippingPlanes.modelMatrix = Cesium.Matrix4.fromTranslation( - new Cesium.Cartesian3(0.0, 0.0, window.modelHeight) + new Cesium.Cartesian3(0.0, 0.0, window.modelHeight) ); } // 缁戝畾涓婄Щ鍔ㄤ簨浠� @@ -2241,6 +2434,8 @@ var that = this; var checkKey = []; let checkedLayers = []; + this.$store.state.isProjectLayer = []; + var val = std.filter((str) => { if (str.type == 1) { return str; @@ -2256,12 +2451,15 @@ if (str.url != null && str.type == 2 && str.isShow == 1) { return str; } + if (str.isProject == 1 && str.type == 2) { + this.$store.state.isProjectLayer.push(str); + } }) this.setAddLayers(value); var res = this.setTreeData(val); - + this.$store.state.pigCode = null; //瀛樺偍閫変腑鍥惧眰 // sessionStorage.setItem("checkedLayers", JSON.stringify(checkedLayers)); @@ -2299,9 +2497,74 @@ } } if (std[0].length != 0) { - this.setAddWmsLayer(std[0]) + if (this.$store.state.pigCode) { + this.setPrjidWmsLayer(std[0]) + } else { + + this.setAddWmsLayer(std[0]) + } + } }, + setPrjidWmsLayer(res) { + var layer = []; + var sql = []; + var dirid = this.$store.state.pigCode + + for (var i in res) { + layer.push(res[i].url) + + if (res[i].isProject == 1) { + var val = "dirid like '" + dirid + "%'" + sql.push(val) + } else { + sql.push("1 = 1") + } + } + layer = layer.reverse(); + sql = sql.reverse().join(";") + var getFeatureInfoFormat = new Cesium.GetFeatureInfoFormat("html", null, function (html) { + that.getFeatureInfo(html) + }); + window.layerWMS = new Cesium.WebMapServiceImageryProvider({ + url: geoServerURl, + layers: layer.toString(), + getFeatureInfoParameters: { info_format: 'text/html' }, + enablePickFeatures: true, + getFeatureInfoFormats: [getFeatureInfoFormat], + parameters: { + transparent: true, + format: "image/png", + srs: "EPSG:4490", + styles: "", + cql_filter: sql + }, + tileWidth: 512, + tileHeight: 512, + }); + layerWMS.name = "Wms_Layer"; + window.Viewer.scene.imageryLayers.addImageryProvider(window.layerWMS); + var layer2 = new Image({ + name: "Wms_Layer", + source: new ImageWMS({ + crossOrigin: "anonymous", + url: geoServerURl, + params: { + FORMAT: "image/png", + VERSION: "1.1.1", + LAYERS: layer.toString(), + cql_filter: sql + }, + }), + }); + if (res.opacity) { + layer2.setOpacity(parseInt(res.opacity) / 100); + } + window.map.addLayer(layer2); + }, + + + setClearWmsLayer() { for (var i = 0; i < window.Viewer.imageryLayers._layers.length; i++) { var val_id = window.Viewer.imageryLayers._layers[i].imageryProvider.name; @@ -2731,8 +2994,6 @@ if (this.$store.state.showPopBoxFlag == true) { this.$refs && this.$refs.queryinfo && this.$refs.queryinfo.close(); - - this.$refs && this.$refs.queryinfo && this.$refs.queryinfo.open("灞炴��", null, { @@ -2753,6 +3014,60 @@ setPellucidity() { this.$refs && this.$refs.setPellucidity && this.$refs.setPellucidity.open(); }, + setDialogInsertVisible(res) { + this.ruleForm = res; + this.dialogInsertVisible = true; + }, + downloadx() { + this.$bus.$emit("setInsertDown", this.codeForm) + this.closeDownx(); + }, + handleCloseDown1() { + this.$confirm("纭鍏抽棴锛�") + .then(_ => { + this.closeDownx(); + }) + .catch(_ => { }) + }, + closeDownx() { + this.dialogVisible1 = false; + this.codeForm = { + password: '', + repassword: '', + } + }, + closeInsertDown() { + this.ruleForm = { + depname: [], + tabs: [], + pwd: null, + repwd: null, + wkt: null, + descr: null, + } + this.dialogInsertVisible = false + }, + handleInsertClose() { + this.$confirm("纭鍏抽棴锛�") + .then(_ => { + this.closeInsertDown() + }) + .catch(_ => { }) + }, + getInsertDown() { + this.dialogInsertVisible = false; + this.dialogVisible1 = true; + // + }, + handleExtentClose() { + this.dialogExtentVisible = false + this.setExtent = 10; + }, + handleExtentinsert() { + this.$bus.$emit("setExtentBUff", this.setExtent) + this.handleExtentClose(); + + } }, mounted() { this.measureData = new Map(); @@ -2776,12 +3091,34 @@ this.$bus.$on("showPellucidity", res => { this.setPellucidity(); }); - this.$store.state.showAllLayers = true; + + + this.$store.state.isProjectLayer = [], + this.$store.state.pigCode = null, + this.$store.state.showAllLayers = true; this.$store.state.layerMnage = false; this.$store.state.treeData = null; this.$store.state.checkedKeys = []; // this.setCoverage("a1"); this.layersStart(); + + + this.$bus.$on("setDialogInsertVisible", (res) => { + + if (res == true) { + this.dialogVisible1 = true; + } else { + this.setDialogInsertVisible(res); + } + }) + this.$bus.$on('showExtentLayer', res => { + this.dialogExtentVisible = res; + }); + + + + + }, watch: { Obj(newVal, oldVal) { diff --git a/src/views/Tools/LayerTree.vue b/src/views/Tools/LayerTree.vue index 4909a56..f461b83 100644 --- a/src/views/Tools/LayerTree.vue +++ b/src/views/Tools/LayerTree.vue @@ -1,11 +1,35 @@ <template> <div class="lalala tree-container"> - <el-input - placeholder="杈撳叆鍏抽敭瀛楄繘琛岃繃婊�" - v-model="filterText" - class="search" - > - </el-input> + + <el-form ref="form"> + <el-form-item> + + <el-select + v-model="$store.state.pigCode" + clearable + filterable + style="width :100%" + @change="setproChange" + > + <el-option + v-for="item in optionts" + :key="item.code" + :label="item.name" + :value="item.code" + > + </el-option> + </el-select> + </el-form-item> + <el-form-item> + + <el-input + placeholder="杈撳叆鍏抽敭瀛楄繘琛岃繃婊�" + v-model="filterText" + class="search" + > + </el-input> + </el-form-item> + </el-form> <el-tree ref="tree" :data="treeData" @@ -192,7 +216,10 @@ import View from "ol/View.js"; import { Fill, Stroke, Style } from "ol/style.js"; -import { perms_selectLayers, inquiry_selectDomains, comprehensive_selectPubById } from "../../api/api.js"; +import { + perms_selectLayers, inquiry_selectDomains, comprehensive_selectPubById, + project_selectDirAll, project_selectByDirid +} from "../../api/api.js"; export default { name: "tree", components: { queryinfo }, @@ -241,6 +268,8 @@ ], childOption: [], mptLayer: [], + optionts: [], + proValue: null, }; }, methods: { @@ -878,25 +907,25 @@ // Cesium.Matrix4.equals(a,b)鍒ゆ柇涓や釜鍥涚淮鐭╅樀鏄惁鐩哥瓑 // 鏁翠釜鏍硅妭鐐规ā鍨嬬煩闃碉紝璇ileSet=>涓栫晫鍧愭爣绯� // 鍗曚綅鐭╅樀锛屽瑙掔嚎鍊间负1.0鐨�4*4鐭╅樀 - if (!Cesium.Matrix4.equals(tileset.root.transform,Cesium.Matrix4.IDENTITY)) { + if (!Cesium.Matrix4.equals(tileset.root.transform, Cesium.Matrix4.IDENTITY)) { // 鑾峰彇妯″瀷鐨勪笘鐣屽潗鏍�(绗涘崱灏�) // Cesium.Matrix4.getTranslation 閫氳繃浠垮皠鍙樻崲鐭╅樀鑾峰彇璇ileSet鐨勪笘鐣屽潗鏍� const transformCenter = Cesium.Matrix4.getTranslation( - tileset.root.transform, - new Cesium.Cartesian3() + tileset.root.transform, + new Cesium.Cartesian3() ); // 灏嗙瑳鍗″皵鍧愭爣杞崲涓篧GS84缁忕含搴﹀潗鏍囷紙妯″瀷鐨勶級 const transformCartographic = Cesium.Cartographic.fromCartesian( - transformCenter + transformCenter ); // 灏嗙瑳鍗″皵鍧愭爣杞崲涓篧GS84缁忕含搴﹀潗鏍囷紙鎴潰鐨勶級 const boundingSphereCartographic = Cesium.Cartographic.fromCartesian( - tileset.boundingSphere.center + tileset.boundingSphere.center ); const height = boundingSphereCartographic.height - transformCartographic.height; // 浠庝竴涓狢artesian3瀵硅薄鐢熸垚Matrix4鍙樻崲鐭╅樀锛堣鍒囬潰鐨勶級 window.modelHeight = height; - }else window.modelHeight = 0; + } else window.modelHeight = 0; this.getTilesetArgs(tileset, res); }); this.$store.state.setAlphaList.push({ @@ -1122,6 +1151,56 @@ if (!value) return true; return data.cnName.indexOf(value) !== -1; }, + + async setproChange(res) { + this.$store.state.pigCode = res; + if (res) { + var obj = { + dirid: res, + pageIndex: 1, + pageSize: 10, + } + + const data = await project_selectByDirid(obj); + if (data.code != 200) { + this.$message.error("鍒楄〃鑾峰彇澶辫触"); + return; + } + if (data.result[0]) { + var geom = data.result[0].geom + var wkt = this.$wkt.parse(geom) + Viewer.camera.flyTo({ + destination: Cesium.Cartesian3.fromDegrees(wkt.coordinates[0].toFixed(6), wkt.coordinates[1].toFixed(6), 5000), + }); + + } + this.setChangeProLayer(); + } else { + this.$store.state.isProjectLayer = []; + } + }, + setChangeProLayer() { + + if (value.length != 0) { + var value = this.$store.state.isProjectLayer; + var std = []; + for (var i in value) { + std.push(value[i].id) + } + this.$refs.tree.setCheckedKeys(std); + this.$bus.$emit("showMenuLayer", value); + } + + + }, + + async getMenuProject() { + const data = await project_selectDirAll(); + if (data.code != 200) { + return + } + this.optionts = data.result; + }, }, watch: { filterText(val) { @@ -1129,7 +1208,7 @@ }, }, mounted() { - + this.getMenuProject() this.$bus.$on("treeDataCopy", (res) => { this.$store.state.treeData = this.treeData; this.$store.state.checkedKeys = this.$refs.tree.getCheckedKeys(); @@ -1310,7 +1389,12 @@ } } } - +/deep/ .el-form .el-form-item { + padding-right: 0px !important; +} +/deep/ .el-form-item { + margin-bottom: 10px !important; +} /*.lalala {*/ /*position: relative;*/ /*}*/ diff --git a/src/views/datamanage/styleManage.vue b/src/views/datamanage/styleManage.vue index dd64620..bb70694 100644 --- a/src/views/datamanage/styleManage.vue +++ b/src/views/datamanage/styleManage.vue @@ -437,16 +437,16 @@ :label-width="formLabelWidth" > <el-select - v-model="upform.status" + v-model="status" style="width:85%" :placeholder="$t('common.choose')" > <el-option - value="0" + value='0' :label="$t('dataManage.styleObj.deactivate')" ></el-option> <el-option - value="1" + value='1' :label="$t('dataManage.styleObj.enable')" ></el-option> </el-select> @@ -1002,7 +1002,7 @@ dialogFormVisible: false, InsertFormdialog: false, showCata: false, - upform: {}, + upform: { status: '0' }, formLabelWidth: "130px", showinfoBox: false, itemdetail: {}, @@ -1060,6 +1060,7 @@ styleVar: { height: "calc(100% - 109px)", }, + status: 0, }; }, created() { @@ -1403,6 +1404,7 @@ if (date === undefined || date === null) { return; } + switch (date) { case 1: return "鍚敤"; @@ -1544,6 +1546,8 @@ this.upform.vname = this.upform.viewGuid; this.upform.viewGuid = this.viewFile; } + this.upform.status = this.status + const data = await updateStyle(this.upform); if (data.code == 200) { this.dialogFormVisible = false; @@ -1657,6 +1661,7 @@ // }, handleEdit(index, row) { + this.upflag = true; this.dialogFormVisible = true; this.upform = row; @@ -1664,7 +1669,10 @@ this.upform.dirValue = row.dirName; this.upform.fileGuid = row.fname; this.upform.viewGuid = row.vname; - this.upform.status = this.forMontStatus(row.status); + // this.upform.status = this.forMontStatus(row.status); + + // this.upform.status = row.status; + this.status = this.forMontStatus(row.status); }, handleDelete(index, row) { this.$confirm("纭畾鏄惁鍒犻櫎?", "鎻愮ず", { -- Gitblit v1.9.3