ry-vue-map 0.2.2 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/README.MD +1 -1
  2. package/lib/ryui.common.js +81115 -75690
  3. package/lib/ryui.common.js.gz +0 -0
  4. package/lib/ryui.css +1 -1
  5. package/lib/ryui.umd.js +81115 -75690
  6. package/lib/ryui.umd.js.gz +0 -0
  7. package/lib/ryui.umd.min.js +5 -5
  8. package/lib/ryui.umd.min.js.gz +0 -0
  9. package/package.json +7 -3
  10. package/src/assets/map.png +0 -0
  11. package/src/components/index.js +5 -1
  12. package/src/components/maps/models/ryKML/index.js +29 -0
  13. package/src/components/maps/models/ryKMLs/index.js +41 -0
  14. package/src/components/maps/models/ryMapTool/mapTool.js +7 -0
  15. package/src/components/maps/models/ryOfflineMap/map.js +140 -0
  16. package/src/components/maps/models/ryOfflineMap/view.js +62 -0
  17. package/src/components/maps/models/ryStaticMap/map.js +36 -0
  18. package/src/components/maps/models/ryStaticMap/view.js +66 -0
  19. package/src/components/maps/ryClusters/src/index.vue +4 -2
  20. package/src/components/maps/ryKML/index.js +7 -0
  21. package/src/components/maps/ryKML/src/index.vue +174 -0
  22. package/src/components/maps/ryKMLs/index.js +7 -0
  23. package/src/components/maps/ryKMLs/src/index.vue +217 -0
  24. package/src/components/maps/ryMap/src/index.vue +4 -2
  25. package/src/components/maps/ryMapTool/src/index.vue +6 -6
  26. package/src/components/maps/ryOfflineMap/index.js +6 -0
  27. package/src/components/maps/ryOfflineMap/src/index.vue +329 -0
  28. package/src/components/maps/ryPolygons/src/index.vue +0 -1
  29. package/src/components/maps/ryStaticMap/index.js +7 -0
  30. package/src/components/maps/ryStaticMap/src/index.vue +233 -0
  31. package/src/components/maps/ryVectorMap/src/index.vue +1 -3
  32. package/src/components/maps/switchMap/src/newIndex.vue +39 -19
  33. package/src/main.js +10 -8
  34. package/src/router/index.js +28 -3
  35. package/src/utils/lMapServices.js +50 -5
  36. package/src/views/docx/index.vue +36 -0
  37. package/src/views/excel/index.vue +26 -0
  38. package/src/views/map/330112.js +220 -0
  39. package/src/views/map/dksj.js +1103 -0
  40. package/src/views/map/index.vue +69 -429
  41. package/src/views/map/index3.vue +207 -0
  42. package/src/views/map/index4.vue +207 -0
  43. package/src/views/map/indexNew.vue +625 -0
  44. package/src/views/map/indexStatic.vue +205 -0
  45. package/src/views/pdf/index.vue +24 -0
  46. package/src/views/staticMap/index.vue +90 -0
  47. package/src/views/tree/index.vue +193 -0
  48. package/src/views/vectorMap/index.vue +26 -5
@@ -0,0 +1,205 @@
1
+ <template>
2
+ <div class="map-style">
3
+
4
+ <ry-map projection="EPSG:4326" :zoom="10" :minZoom="1" :maxZoom="maxZoom" :center="center" @load="load($event)"
5
+ :isCrossHair="isRyMapTool" :isRight="true" :isRyMapTool="true" @drawSuccess="drawSuccess"
6
+ @drawError="drawError" :isShowRangingTool="true" :isShowDrawTool="isRyMapTool" :bindMapClick="true"
7
+ @mapClick="mapClick($event)" @crossHairClick="crossHairClick($event)" :bindMapMoveend="true"
8
+ @mapMoveend="mapMoveend($event)"
9
+ v-if="dto"
10
+ :boundaryModel="dto"
11
+ :urls="urls"
12
+ :bbox="bbox"
13
+ >
14
+ </ry-map>
15
+
16
+ <button @click="onClick()">测试</button>
17
+ <button @click="onClick2()">测试2</button>
18
+ <button @click="onClick3()">测试3</button>
19
+
20
+ <aside class="aside-style">
21
+ <el-button
22
+ class="ele-text-primary" v-show="isShowPaly" style="padding:10px;" @click.stop="onShowPaly(false)">
23
+ 轨迹回放 </el-button>
24
+
25
+ <el-button
26
+ class="ele-text-primary" v-show="!isShowPaly" style="padding:10px; color: red;" @click.stop="onShowPaly(true)">
27
+ 结束轨迹回放 </el-button>
28
+ </aside>
29
+ </div>
30
+ </template>
31
+
32
+ <script>
33
+ import dayjs from 'dayjs'
34
+ import RyMap from '@/components/maps/ryOfflineMap/src/index.vue';
35
+ import RyMapTool from '@/components/maps/ryMapTool/src/index.vue';
36
+ import RyPolygon from '@/components/maps/ryPolygon/src/index.vue';
37
+ import RyPolygons from '@/components/maps/ryPolygons/src/index.vue';
38
+ import RyClustersMarker from '@/components/maps/ryClustersMarker/src/index.vue';
39
+ import RyPolygonGeo from '@/components/maps/ryPolygonGeo/src/index.vue';
40
+ import geoJson from "./330112";
41
+
42
+
43
+
44
+ export default {
45
+ components: {
46
+ RyMap,
47
+ RyMapTool,
48
+ RyPolygon,
49
+ RyPolygons,
50
+ RyClustersMarker,
51
+ RyPolygonGeo,
52
+ },
53
+ data() {
54
+ return {
55
+ map: null,
56
+ lMap: null,
57
+ polygonColorObj: null,
58
+ // const bbox = [ 118.84072600000002, 29.937127000000032, 119.86315600000012, 30.445895000000064 ];
59
+ // const center = [119.34667114000006, 30.198078622500038];
60
+
61
+
62
+ bbox: [118.84072600000002, 29.937127000000032, 119.86315600000012, 30.445895000000064],
63
+ isClear: false,
64
+ colors: [],
65
+ modelArr2: [
66
+ {id:'ceshi1', x:120.15535003220648,y:30.179378795342608},
67
+ {id:'ceshi2',x:120.16369976775891,y:30.1967116895034},
68
+ {id:'ceshi3',x:120.156817,y:30.1753985} ,
69
+ {id:'ceshi4',x:120.1538245,y:30.183076} ,
70
+ ],
71
+ center: [119.34667114000006, 30.198078622500038],
72
+ polygonColors: [],
73
+ remove: 'ceshi1',
74
+ removes: [],
75
+ ranges: [],
76
+ restFit: true,
77
+ range: 'ceshi2',
78
+ isFit: false,
79
+ insert: null,
80
+ showPolygon: null,
81
+ showPolygons: [{
82
+ id: 'ceshi2',
83
+ isShow: false
84
+ }],
85
+ inserts: [],
86
+ isShowAll: false,
87
+ polygonModel: null,
88
+ mapTool: null,
89
+ isCheckPoint: null,
90
+ gpsType: 0,
91
+ isRyMapTool: true,
92
+ maxZoom: 18,
93
+ lineData1:null,
94
+ lineData2:null,
95
+ clearLiens:false,
96
+ // startMarkerDto:null,
97
+ // endMarkerDto:null,
98
+ startMarkerDto: {
99
+ url:require('@/assets/startpoint.png'),
100
+ height:23,
101
+ offset:[8, -11],
102
+ width:28
103
+ },
104
+ endMarkerDto:{
105
+ url:require('@/assets/stoppoint.png'),
106
+ height:16,
107
+ offset:[0, -8],
108
+ width:16
109
+ },
110
+ lineAppend:[],
111
+ isShowPaly:true,
112
+ layerArr:[2,2],
113
+ urls:[
114
+ `http://127.0.0.1:10006/${330112}/satellite/{z}/{x}/{y}.jpg`,
115
+ `http://127.0.0.1:10006/${330112}/overlay/{z}/{x}/{y}.png`
116
+ ],
117
+ dto:null,
118
+ };
119
+ },
120
+ created() {
121
+ this.dto={
122
+ geo:geoJson,
123
+ width:4,
124
+ color:'#000'
125
+ };
126
+ console.log(this.dto);
127
+ },
128
+ methods: {
129
+ onShowPaly(b) {
130
+ this.isShowPaly = b;
131
+
132
+ },
133
+ load(obj) {
134
+ this.lMap = obj.mapServices;
135
+ this.map = obj.map;
136
+ console.log(this.lMap);
137
+
138
+ },
139
+ drawSuccess(obj) {
140
+ this.polygonModel = {
141
+ fillColor: '#000',
142
+ stroke: '#fff',
143
+ width: 4,
144
+ text: '',
145
+ geo: obj.geoJson,
146
+ id: 'ceshi',
147
+ };
148
+ },
149
+ drawError(obj) {},
150
+ mapClick(e) {
151
+ // alert(e);
152
+ },
153
+ onLoad(e) {},
154
+ crossHairClick(e) {
155
+ // console.log(e);
156
+ },
157
+ mapMoveend(e) {
158
+ // alert(1);
159
+ // console.log(e);
160
+ },
161
+ loadDrawPolygonEvent(e) {
162
+ this.mapTool = e;
163
+ },
164
+ clusterCallback({
165
+ id,
166
+ isShow
167
+ }) {
168
+ setTimeout(r => {
169
+ this.showPolygon = {
170
+ id,
171
+ isShow
172
+ };
173
+ this.isCheckPoint = {
174
+ id,
175
+ isShow
176
+ };
177
+ }, 50);
178
+ },
179
+ changeSwitchMap(obj) {
180
+ if (obj.mapType == 2) {
181
+ this.gpsType = 0;
182
+ return;
183
+ }
184
+ this.gpsType = obj.mapType;
185
+ },
186
+ onClick() {
187
+ this.isRyMapTool = !this.isRyMapTool;
188
+ },
189
+ onClick2() {
190
+ this.maxZoom = 28;
191
+ },
192
+ onClick3() {
193
+ this.maxZoom = 10;
194
+ },
195
+
196
+ }
197
+ };
198
+ </script>
199
+
200
+ <style lang="scss" scoped>
201
+ .map-style {
202
+ height: 100vh;
203
+ position: relative;
204
+ }
205
+ </style>
@@ -0,0 +1,24 @@
1
+ <template>
2
+ <vue-office-pdf :src="pdf" @rendered="rendered"/>
3
+ </template>
4
+
5
+ <script>
6
+ //引入VueOfficePdf组件
7
+ import VueOfficePdf from '@vue-office/pdf'
8
+
9
+ export default {
10
+ components:{
11
+ VueOfficePdf
12
+ },
13
+ data(){
14
+ return {
15
+ pdf: 'http://static.shanhuxueyuan.com/test.pdf' //设置文档地址
16
+ }
17
+ },
18
+ methods:{
19
+ rendered(){
20
+ console.log("渲染完成")
21
+ }
22
+ }
23
+ }
24
+ </script>
@@ -0,0 +1,90 @@
1
+ <template>
2
+ <div class="map-panel">
3
+ <RyStaticMap
4
+ :url="url"
5
+ :isRyMapTool="true"
6
+ :zoom="16"
7
+ :minZoom="14"
8
+ :isCrossHair="true"
9
+ :isShowDrawTool="true"
10
+ :isDrag="true"
11
+ :bindMapClick="true"
12
+ class="map-style"
13
+ :isHideAreaAndKM="true"
14
+ :isShowRangingTool="false"
15
+ @drawSuccess="drawSuccess"
16
+ @drawError="drawError"
17
+ @load="load"
18
+ @initLayersEvent="initLayersEvent"
19
+ @mapClick="mapClick">
20
+ <template #polygon="{mapDto}">
21
+ <ry-polygon :map="mapDto.map" :isShow="true" :isFit="false" :model="polygonModel" ></ry-polygon>
22
+ </template>
23
+ </RyStaticMap>
24
+ </div>
25
+ </template>
26
+
27
+ <script>
28
+ import RyStaticMap from '@/components/maps/ryStaticMap/src/index.vue';
29
+
30
+ export default {
31
+ components: {
32
+ RyStaticMap,
33
+ },
34
+ data() {
35
+ return {
36
+ map: null,
37
+ url:require('@/assets/map.png'),
38
+ polygonModel:null,
39
+ };
40
+ },
41
+ created() {
42
+
43
+ },
44
+ mounted() {},
45
+ methods: {
46
+ load(obj) {
47
+ },
48
+ initLayersEvent(obj) {
49
+ // console.log(obj);
50
+ },
51
+ mapClick(e) {
52
+ console.log(e);
53
+ },
54
+ drawSuccess({
55
+ delete: del,
56
+ geoJson
57
+ }) {
58
+ this.polygonModel = {
59
+ fillColor: 'rgba(244,20,20,0.4)',
60
+ stroke: 'rgba(244,20,20,0.4)',
61
+ width: 4,
62
+ text: '',
63
+ geo: geoJson,
64
+ id: 'ceshi',
65
+ };
66
+ del();
67
+ },
68
+ drawError(obj) {
69
+ console.log(obj);
70
+ },
71
+
72
+ },
73
+ }
74
+ </script>
75
+
76
+ <style scoped>
77
+ * {
78
+ padding: 0;
79
+ margin: 0;
80
+ box-sizing: border-box;
81
+ }
82
+
83
+ .map-panel {
84
+ height: 100vh;
85
+ }
86
+
87
+ .map-style {
88
+ height: 100%;
89
+ }
90
+ </style>
@@ -0,0 +1,193 @@
1
+
2
+ <template>
3
+ <div class="tree-style">
4
+ <el-tree
5
+ :data="data"
6
+ show-checkbox
7
+ default-expand-all
8
+ node-key="id"
9
+ ref="tree"
10
+ highlight-current
11
+ :props="defaultProps"
12
+ @check="onCheck"
13
+ check-strictly
14
+ >
15
+ </el-tree>
16
+
17
+ <div class="buttons">
18
+ <el-button @click="getCheckedNodes">通过 node 获取</el-button>
19
+ <el-button @click="getCheckedKeys">通过 key 获取</el-button>
20
+ <el-button @click="setCheckedNodes">通过 node 设置</el-button>
21
+ <el-button @click="setCheckedKeys">通过 key 设置</el-button>
22
+ <el-button @click="resetChecked">清空</el-button>
23
+ </div>
24
+
25
+
26
+ </div>
27
+ </template>
28
+
29
+
30
+ <script>
31
+ export default {
32
+ methods: {
33
+ searchParent (map, id) {
34
+ let t = []
35
+ for (let i = 0; i < map.length; i++) {
36
+ const e = map[i]
37
+ if (e.id == id) {
38
+ //若查询到对应的节点,则直接返回
39
+ t.push(e)
40
+ break
41
+ } else if (e.children && e.children.length != 0) {
42
+ //判断是否还有子节点,若有对子节点进行循环调用
43
+ let p = this.searchParent(e.children, id)
44
+ //若p的长度不为0,则说明子节点在该节点的children内,记录此节点,并终止循环
45
+ if (p.length !== 0) {
46
+ p.unshift(e)
47
+ t = p
48
+ break
49
+ }
50
+ }
51
+ }
52
+ return t;
53
+ },
54
+
55
+ treeToArray(tree) {
56
+ if (!Array.isArray(tree) || !tree.length) return [];
57
+ let res = []
58
+ tree.forEach(v => {
59
+ res.push(v)
60
+ if (v.children) {
61
+ res.push(...this.treeToArray(v.children))
62
+ }
63
+ })
64
+ return res;
65
+ },
66
+
67
+ convertTreeToArray(arr, parentId = null){
68
+ const res = [];
69
+ let i=1;
70
+
71
+ arr.forEach(item => {
72
+ if (item.parentId === parentId) {
73
+ const children = this.convertTreeToArray(arr.filter(v => v.parentId !== parentId), item.id);
74
+ const {id,label,parentId} = item;
75
+ res.push({ id,label,parentId,l:i});
76
+ }
77
+ });
78
+ console.log('执行了')
79
+ i++;
80
+ return res;
81
+ },
82
+
83
+ getCheckedNodes() {
84
+ console.log(this.$refs.tree.getCheckedNodes());
85
+ },
86
+ getCheckedKeys() {
87
+ console.log(this.$refs.tree.getCheckedKeys());
88
+ },
89
+ setCheckedNodes() {
90
+ this.$refs.tree.setCheckedNodes([{
91
+ id: 5,
92
+ label: '二级 2-1'
93
+ }, {
94
+ id: 9,
95
+ label: '三级 1-1-1'
96
+ },
97
+ {
98
+ id: 3,
99
+ label: '一级 3',
100
+ }
101
+ ]);
102
+ },
103
+ setCheckedKeys() {
104
+ this.$refs.tree.setCheckedKeys([3]);
105
+ },
106
+ resetChecked() {
107
+ this.$refs.tree.setCheckedKeys([]);
108
+ },
109
+ onCheck(node,checkedKeys){
110
+ // console.log(node);
111
+ console.log(this.searchParent(this.data,node.id));
112
+ const arr= this.searchParent(this.data,node.id);
113
+ if(arr.length){
114
+ this.$refs.tree.setCheckedKeys(arr.map(r=> r.id));
115
+ }
116
+ // if(checkedNodes.children && checkedNodes.children.length){
117
+ // const ids = checkedNodes.children.map(r=> r.id);
118
+ // console.log(checkedNodes);
119
+ // }
120
+ }
121
+ },
122
+
123
+ data() {
124
+ return {
125
+ data: [{
126
+ id: 1,
127
+ label: '一级 1',
128
+ parentId:0,
129
+ children: [{
130
+ id: 4,
131
+ label: '二级 1-1',
132
+ parentId:1,
133
+ children: [{
134
+ id: 9,
135
+ parentId:4,
136
+ label: '三级 1-1-1'
137
+ }, {
138
+ id: 10,
139
+ parentId:4,
140
+ label: '三级 1-1-2'
141
+ }]
142
+ }]
143
+ }, {
144
+ id: 2,
145
+ label: '一级 2',
146
+ parentId:0,
147
+ children: [{
148
+ id: 5,
149
+ label: '二级 2-1',
150
+ parentId:2,
151
+ }, {
152
+ id: 6,
153
+ label: '二级 2-2',
154
+ parentId:2,
155
+ }]
156
+ }, {
157
+ id: 3,
158
+ label: '一级 3',
159
+ parentId:0,
160
+ children: [{
161
+ id: 7,
162
+ label: '二级 3-1',
163
+ parentId:3,
164
+ }, {
165
+ id: 8,
166
+ label: '二级 3-2',
167
+ parentId:3,
168
+ }]
169
+ }],
170
+ defaultProps: {
171
+ children: 'children',
172
+ label: 'label'
173
+ },
174
+ arr:[],
175
+ };
176
+ },
177
+ created(){
178
+ // this.setArr(this.data);
179
+
180
+ this.arr= this.treeToArray(this.data)?.map(r=> {return{
181
+ id:r.id,
182
+ label:r.label,
183
+ parentId:r.parentId,
184
+ }});
185
+
186
+ console.log(this.searchParent(this.data,10));
187
+ console.log(this.arr);
188
+
189
+
190
+ }
191
+ };
192
+ </script>
193
+
@@ -1,6 +1,16 @@
1
1
  <template>
2
2
  <div class="map-panel" >
3
- <RyVectorMap :isDrag="true" :bindMapClick="true" :modelArr="modelArr" class="map-style" @load="load" @initLayersEvent="initLayersEvent" @mapClick="mapClick"></RyVectorMap>
3
+ <RyVectorMap
4
+ :isDrag="true"
5
+ :bindMapClick="true"
6
+ :modelArr="modelArr"
7
+ class="map-style"
8
+ @load="load"
9
+ @initLayersEvent="initLayersEvent"
10
+ @mapClick="mapClick"
11
+ @drawSuccess="drawSuccess($event)"
12
+ @drawError="drawError($event)"
13
+ ></RyVectorMap>
4
14
  </div>
5
15
  </template>
6
16
 
@@ -21,7 +31,7 @@
21
31
  map: null,
22
32
  vmap: null,
23
33
  modelArr:[],
24
-
34
+ polygonModel:null,
25
35
  };
26
36
  },
27
37
  created() {
@@ -29,7 +39,6 @@
29
39
  mounted(){},
30
40
  methods: {
31
41
  load(obj) {
32
- console.log(obj.map,obj.vmap);
33
42
  this.initData();
34
43
  },
35
44
  initData(){
@@ -58,7 +67,19 @@
58
67
  },
59
68
  mapClick(e){
60
69
  console.log(e);
61
- }
70
+ },
71
+ drawSuccess(obj) {
72
+ this.polygonModel = {
73
+ fillColor: '#000',
74
+ stroke: '#fff',
75
+ width: 4,
76
+ text: '',
77
+ geo: obj.geoJson,
78
+ id: 'ceshi',
79
+ };
80
+
81
+ },
82
+ drawError(obj) {},
62
83
 
63
84
  },
64
85
  }
@@ -78,4 +99,4 @@
78
99
  .map-style{
79
100
  height: 100%;
80
101
  }
81
- </style>
102
+ </style>