From bf58722dfd03ea1513f3acc7331d4d4403fca76e Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Fri, 18 Mar 2022 11:48:37 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.105:10010/r/school-web
---
src/pcviews/tool/sign.vue | 258 +++++++++++++++++++++++++++++++++++++++------------
1 files changed, 195 insertions(+), 63 deletions(-)
diff --git a/src/pcviews/tool/sign.vue b/src/pcviews/tool/sign.vue
index 1f46892..07f42b2 100644
--- a/src/pcviews/tool/sign.vue
+++ b/src/pcviews/tool/sign.vue
@@ -1,78 +1,210 @@
<template>
- <div></div>
+ <public-box class="tool-sign">
+ <template slot="public-box-header">
+ <div class="title">
+ <img class="icon deblurring" src="/img/icon/tool-sign.png" alt />
+ <span>地图标记</span>
+ </div>
+ <img
+ class="btn-box deblurring"
+ @click.stop="addSign"
+ src="/img/navicon/add.png"
+ alt
+ />
+ <img
+ class="close deblurring"
+ src="/img/navicon/close.png"
+ alt
+ @click="closeModel"
+ />
+ </template>
+ <template slot="public-box-content">
+ <div class="list-box" v-loading="loading">
+ <ul v-show="signShow">
+ <li
+ v-for="(item, index) in signList"
+ :key="index"
+ @click="dingw(item)"
+ >
+ <img src="/img/icon/sign-list.png" alt />
+ {{ item.name }}
+ <el-button
+ type="danger"
+ size="mini"
+ icon="el-icon-delete"
+ circle
+ @click.stop="deleteIcon(item.id)"
+ ></el-button>
+ </li>
+ </ul>
+ <div v-show="!signShow" class="no-data">
+ <img src="/img/icon/no-data.png" alt />
+ <div>暂无数据</div>
+ </div>
+ </div>
+ </template>
+ </public-box>
</template>
<script>
-import { mapGetters } from 'vuex'
+import { mapGetters } from "vuex";
+import { getlabel, deletelabel } from "@/api/pc/label";
export default {
- data () {
- return {
- DC: null,
- destroyedFlag: true
+ data() {
+ return {
+ loading: true,
+ signList: [],
+ signShow: true,
+ destroyedFlag: true,
+ };
+ },
+ computed: {
+ ...mapGetters(["addSignList"]),
+ },
+ mounted() {
+ this.$store.commit("initLabelLayer", global.viewer);
+ this.getData();
+ },
+ watch: {
+ addSignList() {
+ this.getData();
+ },
+ },
+ methods: {
+ dingw(item) {
+ const that = this;
+ // console.log(item);
+ // this.$store.dispatch("mapFlyTo", {
+ // lntLat: [item.jd, item.wd, 120], //114.04020791, 27.62934732
+ // heading: 0,
+ // pitch: -90,
+ // roll: 0,
+ // noOpen: true,
+ // mviewer: that.viewer,
+ // });
+ global.viewer.camera.setView({
+ // Cesium的坐标是以地心为原点,一向指向南美洲,一向指向亚洲,一向指向北极州
+ // fromDegrees()方法,将经纬度和高程转换为世界坐标
+ destination: global.DC.Namespace.Cesium.Cartesian3.fromDegrees(
+ item.jd,
+ item.wd,
+ 400.0
+ ),
+ orientation: {
+ // 指向
+ heading: global.DC.Namespace.Cesium.Math.toRadians(0, 0),
+ // 视角
+ pitch: global.DC.Namespace.Cesium.Math.toRadians(-90),
+ roll: 0.0,
+ },
+ });
+ },
+ deleteIcon(id) {
+ const that = this;
+ deletelabel(id).then((res) => {
+ console.log(res);
+ if (res.data.code == 200) {
+ that.$message({
+ message: "删除标签成功",
+ type: "success",
+ });
+ } else {
+ that.$message({
+ message: "删除标签失败",
+ type: "warning",
+ });
}
+ that.getData();
+ });
},
- computed: {
- ...mapGetters(['viewer'])
+ getData() {
+ const that = this;
+ that.loading = true;
+ let oks = setTimeout(() => {
+ that.loading = false;
+ that.signShow = false;
+ }, 5000);
+ getlabel().then((res) => {
+ clearTimeout(oks);
+ console.log(res);
+ const data = res.data.data.records;
+ that.signList = data;
+ that.signList.length > 0
+ ? (that.signShow = true)
+ : (that.signShow = false);
+ that.loading = false;
+ // that.$store.commit("clearLabelLayerIcon");
+ that.$store.dispatch("addLabelLayerIcon", {
+ list: data,
+ clear: true,
+ });
+ });
},
- mounted () {
- var that = this
- that.DC = global.DC
-
- that.viewer.on(that.DC.MouseEventType.MOUSE_MOVE, (e) => that.moveMessage(e, '点击确认标注位置'))
-
- that.viewer.on(that.DC.MouseEventType.CLICK, (e) => {
- if (that.destroyedFlag == false) return
-
- that.viewer.on(that.DC.MouseEventType.MOUSE_MOVE, (e) => that.moveMessage(e, ''))
-
- var popup = new this.DC.DivForms(this.viewer, {
- domId: 'AddTagBox',
- position: [that.DC.Transform.transformWGS84ToCartesian(
- new that.DC.Position(
- Number(
- e.wgs84SurfacePosition.lng
- ),
- Number(
- e.wgs84SurfacePosition.lat
- ),
- Number(
- e.wgs84SurfacePosition.alt
- )
- )
- )]
- })
-
- that.$store.commit('SET_ADDTAGPOSITION', e.wgs84SurfacePosition)
- that.$store.commit('SET_ADDTAGPOPUP', true)
-
- that.$store.dispatch('delVisitedViews', this.$route)
- that.$router.push('/pcLayout/default')
- })
-
- // that.viewer.on(that.DC.MouseEventType.CLICK, (e) => {
- // alert(111)
- // })
-
- // off
+ moveMessage(e, b) {
+ if (b == "") {
+ global.viewer.tooltip.enable = false;
+ } else {
+ global.viewer.tooltip.enable = true;
+ global.viewer.tooltip.showAt(e.windowPosition, b);
+ }
},
- methods: {
- moveMessage (e, b) {
- if (b == '') {
- this.viewer.tooltip.enable = false
- } else {
- this.viewer.tooltip.enable = true
- this.viewer.tooltip.showAt(e.windowPosition, b)
- }
- }
+
+ addSign() {
+ var that = this;
+ this.$store.commit("set_closeMapClick", true);
+ // console.log("开始", "see");
+ global.viewer.on(global.DC.MouseEventType.MOUSE_MOVE, (e) =>
+ that.moveMessage(e, "点击确认标注位置")
+ );
+
+ global.viewer.once(global.DC.MouseEventType.CLICK, (e) => {
+ if (that.destroyedFlag == false) return;
+
+ global.viewer.on(global.DC.MouseEventType.MOUSE_MOVE, (e) =>
+ that.moveMessage(e, "")
+ );
+
+ // eslint-disable-next-line no-unused-vars
+ const popup = new global.DC.DivForms(global.viewer, {
+ domId: "AddTagBox",
+ position: [
+ global.DC.Transform.transformWGS84ToCartesian(
+ new global.DC.Position(
+ Number(e.wgs84SurfacePosition.lng),
+ Number(e.wgs84SurfacePosition.lat),
+ Number(e.wgs84SurfacePosition.alt)
+ )
+ ),
+ ],
+ });
+
+ that.$store.commit("SET_ADDTAGPOSITION", e.wgs84SurfacePosition);
+ that.$store.commit("SET_ADDTAGPOPUP", true);
+ });
},
- destroyed () {
- var that = this
- that.destroyedFlag = false
- that.viewer.on(that.DC.MouseEventType.MOUSE_MOVE, (e) => that.moveMessage(e, ''))
+
+ closeModel() {
+ this.$store.dispatch("delVisitedViews", this.$route);
+ this.$router.push("/pcLayout/default");
+ this.$store.commit("clearLabelLayerIcon");
+ },
+ },
+ destroyed() {
+ var that = this;
+ that.destroyedFlag = false;
+ if (global.DC) {
+ global.viewer.on(global.DC.MouseEventType.MOUSE_MOVE, (e) =>
+ that.moveMessage(e, "")
+ );
}
-}
+ this.$store.commit("clearLabelLayerIcon");
+ },
+};
</script>
-<style>
+<style lang="scss" scoped>
+.move {
+ cursor: move;
+}
</style>
--
Gitblit v1.9.3