1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
| <template>
| <div id="app">
| <router-view />
| <el-dialog title="提示" :visible.sync="mapShow" width="1020px" :before-close="handleClose">
| <el-input v-model="xyValue" placeholder="请点击地图选择2.5维坐标"></el-input>
| <xymap class="select-map-xy" @setXyValue="setXyValue"></xymap>
| <div style="text-align: right;">
| <el-button @click="setMapXy" type="primary">确认</el-button>
| </div>
| </el-dialog>
| </div>
| </template>
|
| <script>
| import { mapGetters } from "vuex"
|
| export default {
| name: "app",
| data () {
| return {
| xyValue: '',
| mapShow: false
| }
| },
| computed: {
| ...mapGetters(["selectMamShow"]),
| },
| watch: {
| mapShow: {
| immediate: true,
| handler (newVal) {
|
| if (newVal == true) {
| this.xyValue = ''
| }
|
| this.$store.commit('SET_SELECT_MAP', newVal)
| }
| },
| selectMamShow: {
| immediate: true,
| handler (newVal) {
| this.mapShow = newVal
| }
| }
| },
| created () {
|
| },
| methods: {
| setXyValue (e) {
| let str = ''
| str = str + e[0] + ',' + e[1]
| this.xyValue = str
| },
| setMapXy () {
| if (this.xyValue == '') {
| this.$message({
| message: '请点击地图选择XY',
| type: 'warning'
| })
| }
|
| this.$store.commit('SET_MAP_X_Y', this.xyValue)
|
| this.mapShow = false
| }
| }
| };
| </script>
| <style lang="scss">
| #app {
| width: 100%;
| height: 100%;
| overflow: hidden;
| }
|
| .select-map {
| position: fixed;
| top: 0;
| left: 0;
| width: 100%;
| height: 100%;
| z-index: 3000;
| background: green;
| }
|
| .select-map-xy {
| margin: 10px 0;
| cursor: pointer;
| }
| </style>
|
|