From 8d301b885c7c433300b5bbeb47a0864eb738fad4 Mon Sep 17 00:00:00 2001 From: Surpriseplus <845948745@qq.com> Date: 星期五, 23 十二月 2022 17:51:11 +0800 Subject: [PATCH] q --- src/components/MapView/mapMenuPop.vue | 230 ++++++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 186 insertions(+), 44 deletions(-) diff --git a/src/components/MapView/mapMenuPop.vue b/src/components/MapView/mapMenuPop.vue index 2f37465..cf0ce23 100644 --- a/src/components/MapView/mapMenuPop.vue +++ b/src/components/MapView/mapMenuPop.vue @@ -12,7 +12,6 @@ </ul> </div> <div class="rightBox"> - <div class="tableBox"> <el-table :data="tableData" @@ -92,10 +91,10 @@ class="primary" size="small" @click="download('codeForm')" - >{{ $t('common.confirm') }}</el-button + >{{ $t("common.confirm") }}</el-button > <el-button type="info" size="small" @click="closeDown('codeForm')">{{ - $t('common.cancel') + $t("common.cancel") }}</el-button> </el-form-item> </el-form> @@ -117,16 +116,17 @@ sign_getPublicKey, dataLib_selectDownloadFile, decr, -} from '../../api/api.js'; -import { getToken } from '@/utils/auth'; -import $ from 'jquery'; +} from "../../api/api.js"; +import { getToken } from "@/utils/auth"; +import $ from "jquery"; +import { View } from "ol"; export default { data() { var repasswordValidator = (rule, value, callback) => { - if (value === '') { - callback(new Error('璇峰啀娆¤緭鍏ュ瘑鐮�')); + if (value === "") { + callback(new Error("璇峰啀娆¤緭鍏ュ瘑鐮�")); } else if (value !== this.codeForm.password) { - callback(new Error('涓ゆ杈撳叆瀵嗙爜涓嶄竴鑷�!')); + callback(new Error("涓ゆ杈撳叆瀵嗙爜涓嶄竴鑷�!")); } else { callback(); } @@ -135,7 +135,7 @@ 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浣�')); + callback(new Error("瀵嗙爜蹇呴』鐢辨暟瀛椼�佸瓧姣嶃�佺壒娈婂瓧绗︾粍鍚�,璇疯緭鍏�13-20浣�")); } else { callback(); } @@ -143,17 +143,17 @@ return { dialogVisible: false, codeForm: { - password: '', - repassword: '', + password: "", + repassword: "", }, rules: { password: [ - { required: true, message: '璇疯緭鍏ュ瘑鐮�', trigger: 'blur' }, - { validator: passwordValidator, trigger: 'blur' }, + { required: true, message: "璇疯緭鍏ュ瘑鐮�", trigger: "blur" }, + { validator: passwordValidator, trigger: "blur" }, ], repassword: [ - { required: true, message: '璇疯緭鍏ョ‘璁ゅ瘑鐮�', trigger: 'blur' }, - { validator: repasswordValidator, trigger: 'blur' }, + { required: true, message: "璇疯緭鍏ョ‘璁ゅ瘑鐮�", trigger: "blur" }, + { validator: repasswordValidator, trigger: "blur" }, ], }, listPage: { @@ -178,6 +178,7 @@ domainsLayer: [], optionx: [], imagePoint: null, + Layerprimit: null, }; }, methods: { @@ -189,7 +190,7 @@ } }, download() { - if (this.codeForm.password == '') return; + if (this.codeForm.password == "") return; var obj = { pwd: encrypt.encrypt(this.codeForm.password), entities: [], @@ -200,8 +201,8 @@ } var token = getToken(); var that = this; - $.ajax(BASE_URL + '/dataLib/downloadDbReq?token=' + token, { - type: 'post', + $.ajax(BASE_URL + "/dataLib/downloadDbReq?token=" + token, { + type: "post", data: JSON.stringify(obj), async: true, cache: false, @@ -222,23 +223,23 @@ }; const data = await dataLib_selectDownloadFile(downObj); if (data.code != 200) { - this.$message.error('涓嬭浇璇锋眰澶辫触'); + this.$message.error("涓嬭浇璇锋眰澶辫触"); return; } this.closeDown(); var token = getToken(); var url = BASE_URL + - '/dataLib/downloadFile?token=' + + "/dataLib/downloadFile?token=" + token + - '&guid=' + + "&guid=" + rsid + - '&pwd=' + + "&pwd=" + encodeURIComponent(rspwd); - $('#Iframe1').attr('src', url).click(); + $("#Iframe1").attr("src", url).click(); }, handleCloseDown() { - this.$confirm('纭鍏抽棴锛�') + this.$confirm("纭鍏抽棴锛�") .then((_) => { this.closeDown(); }) @@ -246,8 +247,8 @@ }, closeDown() { this.dialogVisible = false; - this.codeForm.password = ''; - this.codeForm.repassword = ''; + this.codeForm.password = ""; + this.codeForm.repassword = ""; }, startTableMssage() { this.listdata.pageIndex = 1; @@ -260,7 +261,14 @@ this.startTableMssage(); this.listdata.wkt = this.$store.state.mapMenuShpFile; this.querylayer = this.$store.state.mapSpaceQueryLayer; - this.option = this.$store.state.mapSpaceQueryLayer; + // = this.$store.state.mapSpaceQueryLayer; + var arr = this.$store.state.mapSpaceQueryLayer; + var obj = {}; + arr = arr.reduce(function (item, next) { + obj[next.label] ? "" : (obj[next.label] = true && item.push(next)); + return item; + }, []); + this.option = arr; this.listdata.name = this.option[0].entity; this.getTableDateHidder(); @@ -268,11 +276,11 @@ async getTableDateHidder() { const data = await inquiry_selectFields({ name: this.listdata.name }); if (data.code != 200) { - this.$message.error('鍒楄〃璋冪敤澶辫触'); + this.$message.error("鍒楄〃璋冪敤澶辫触"); } const data1 = await inquiry_selectDomains({ name: this.listdata.name }); if (data1.code != 200) { - this.$message.error('鍒楄〃璋冪敤澶辫触'); + this.$message.error("鍒楄〃璋冪敤澶辫触"); } this.optionx = []; this.attributeData = []; @@ -304,7 +312,7 @@ }; const data = await dataQuerySelectWktById(param); if (data.code != 200) { - this.$message.error('鍒楄〃璋冪敤澶辫触'); + this.$message.error("鍒楄〃璋冪敤澶辫触"); } var val1 = decr(data.result); @@ -319,19 +327,53 @@ }, setMapLoaction(res) { var coord = res.coordinates; - if (res.type == 'Point') { - this.imagePoint = sgworld.Creator.CreateLabel( - { X: coord[0], Y: coord[1], Altitude: 2000 }, - '', - SmartEarthRootUrl + 'Workers/image/mark.png', - { - disableDepthTestDistance: Infinity, - scale: 0.8, + if (this.Layerprimit != null) { + window.Viewer.scene.primitives.remove(this.Layerprimit); + this.Layerprimit = null; + } + if (res.type == "Point") { + Viewer.camera.flyTo({ + destination: Cesium.Cartesian3.fromDegrees(coord[0], coord[1], 2000), + orientation: { + heading: Cesium.Math.toRadians(0), // 姘村钩鍋忚锛岄粯璁ゆ鍖� 0 + pitch: Cesium.Math.toRadians(-90), // 淇瑙掞紝榛樿-90锛屽瀭鐩村悜涓� + roll: 0, // 鏃嬭浆瑙� }, + }); + } else if (res.type == "MultiPolygon") { + var val = res.coordinates[0][0]; + var std = []; + + for (var i in val) { + std.push({ x: val[i][0], y: val[i][1], z: 1000 }); + } + this.$store.state.primitLayer = sgworld.Creator.createPolygon( + std, + { + fillColor: "#ffff00", + outlineColor: "#fff", + outlineWidth: 2, + }, + 1, 0, - '宸℃鐐�' + "闈�" ); - sgworld.Navigate.flyToObj(this.imagePoint.item); + sgworld.Navigate.flyToObj(this.$store.state.primitLayer.item); + } else if (res.type == "MultiLineString") { + var line = res.coordinates[0]; + var std = []; + + for (var i in line) { + std.push({ x: line[i][0], y: line[i][1], z: 1000 }); + } + this.$store.state.primitLayer = sgworld.Creator.createPolyline( + std, + "#ffff00", + 1, + 0, + "绾�" + ); + sgworld.Navigate.flyToObj(this.$store.state.primitLayer.item); } }, setTableChange(res) { @@ -354,7 +396,7 @@ const data = await dataQuery_selectByPage(this.listdata); if (data.code != 200) { - this.$message.error('鍒楄〃璋冪敤澶辫触'); + this.$message.error("鍒楄〃璋冪敤澶辫触"); } var val_Data = data.result; @@ -372,7 +414,107 @@ this.pageCount = data.count; this.tableData = data.result; this.$refs.dialogPayChannel.doLayout(); + this.showAllImage(data.result); }, + async showAllImage(res) { + if (window.Viewer.scene.primitives.length != null) { + window.Viewer.scene.primitives.removeAll(); + } + if (this.$store.state.primitLayer != null) { + sgworld.Creator.DeleteObject(this.$store.state.primitLayer); + this.$store.state.primitLayer = null; + } + for (var i in res) { + var param = { + gid: res[i].gid, + name: this.listdata.name, + }; + const data = await dataQuerySelectWktById(param); + if (data.code != 200) { + this.$message.error("鍒楄〃璋冪敤澶辫触"); + } + var val1 = decr(data.result); + if (val1) { + var wkt = this.$wkt.parse(val1); + this.getprimitiLayer(wkt); + this.primitivesAddLayer(wkt); + } + } + }, + getprimitiLayer(res) { + switch (res.type) { + case "Point": + this.$store.state.primitLayer = window.Viewer.scene.primitives.add( + new Cesium.BillboardCollection() + ); + break; + } + }, + primitivesAddLayer(res) { + switch (res.type) { + case "Point": + var val = Cesium.Cartesian3.fromDegrees( + res.coordinates[0], + res.coordinates[1], + 1000 + ); + this.$store.state.primitLayer.add({ + position: val, + image: SmartEarthRootUrl + "Workers/image/mark.png", + }); + break; + case "MultiLineString": + var line = res.coordinates[0]; + var std = []; + for (var i in line) { + std.push(line[i][0], line[i][1]); + } + var instance = new Cesium.GeometryInstance({ + geometry: new Cesium.GroundPolylineGeometry({ + positions: Cesium.Cartesian3.fromDegreesArray(std), + width: 4.0, + }), + attributes: { + color: Cesium.ColorGeometryInstanceAttribute.fromColor( + new Cesium.Color(1.0, 0.0, 0.0, 0.3) + ), + }, + }); + window.Viewer.scene.primitives.add( + new Cesium.GroundPolylinePrimitive({ + geometryInstances: instance, + appearance: new Cesium.PolylineColorAppearance(), + }) + ); + break; + case "MultiPolygon": + var val = res.coordinates[0][0]; + var std = []; + for (var i in val) { + std.push(val[i][0], val[i][1]); + } + var primitive = new Cesium.GroundPrimitive({ + //璐村湴鐨刾rimitive + geometryInstances: new Cesium.GeometryInstance({ + geometry: new Cesium.PolygonGeometry({ + //鏀寔CircleGeometry锛孋orridorGeometry锛孍llipseGeometry锛孯ectangleGeometry + polygonHierarchy: new Cesium.PolygonHierarchy( + Cesium.Cartesian3.fromDegreesArray(std) + ), + }), + attributes: { + color: Cesium.ColorGeometryInstanceAttribute.fromColor( + new Cesium.Color(1.0, 0.0, 0.0, 0.3) + ), + }, + }), + appearance: Cesium.EllipsoidSurfaceAppearance(), + }); + window.Viewer.scene.primitives.add(primitive); + break; + } + }, + closeMenuBox() { if (this.imagePoint != null) { sgworld.Creator.DeleteObject(this.imagePoint); @@ -387,8 +529,8 @@ this.setTableAll(); }, mounted() { - this.$bus.$on('changeMapMenuTop', (res) => { - if (res == 'true') { + this.$bus.$on("changeMapMenuTop", (res) => { + if (res == "true") { this.setTableAll(); } }); -- Gitblit v1.9.3