ry-vue-map 0.2.1 → 0.2.3

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 (43) hide show
  1. package/README.MD +1 -1
  2. package/lib/ryui.common.js +999 -380
  3. package/lib/ryui.common.js.gz +0 -0
  4. package/lib/ryui.css +1 -1
  5. package/lib/ryui.umd.js +999 -380
  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 +8 -3
  10. package/src/assets/map.png +0 -0
  11. package/src/assets/moveMarker.png +0 -0
  12. package/src/assets/startpoint.png +0 -0
  13. package/src/assets/stoppoint.png +0 -0
  14. package/src/components/index.js +3 -1
  15. package/src/components/maps/models/ryLines/ryLines.js +73 -0
  16. package/src/components/maps/models/ryMapTool/mapTool.js +7 -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/ryLines/index.js +7 -0
  21. package/src/components/maps/ryLines/src/index.vue +226 -0
  22. package/src/components/maps/ryMap/src/index.vue +5 -2
  23. package/src/components/maps/ryMapTool/src/index.vue +6 -6
  24. package/src/components/maps/ryPolygons/src/index.vue +67 -68
  25. package/src/components/maps/ryStaticMap/index.js +7 -0
  26. package/src/components/maps/ryStaticMap/src/index.vue +233 -0
  27. package/src/components/maps/ryUniMap/index.js +6 -0
  28. package/src/components/maps/ryUniMap/src/index.vue +351 -0
  29. package/src/components/maps/ryVectorMap/src/index.vue +1 -3
  30. package/src/components/maps/switchMap/src/newIndex.vue +39 -19
  31. package/src/router/index.js +30 -5
  32. package/src/utils/lMapServices.js +962 -918
  33. package/src/views/docx/index.vue +36 -0
  34. package/src/views/excel/index.vue +26 -0
  35. package/src/views/map/dksj.js +1103 -0
  36. package/src/views/map/index.vue +76 -205
  37. package/src/views/map/indexNew.vue +625 -0
  38. package/src/views/map/lineData.js +19592 -0
  39. package/src/views/map/lineData2.js +3449 -0
  40. package/src/views/pdf/index.vue +24 -0
  41. package/src/views/staticMap/index.vue +91 -0
  42. package/src/views/tree/index.vue +193 -0
  43. package/src/views/vectorMap/index.vue +26 -5
@@ -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,91 @@
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
+ console.log(this.polygonModel);
68
+ },
69
+ drawError(obj) {
70
+ console.log(obj);
71
+ },
72
+
73
+ },
74
+ }
75
+ </script>
76
+
77
+ <style scoped>
78
+ * {
79
+ padding: 0;
80
+ margin: 0;
81
+ box-sizing: border-box;
82
+ }
83
+
84
+ .map-panel {
85
+ height: 100vh;
86
+ }
87
+
88
+ .map-style {
89
+ height: 100%;
90
+ }
91
+ </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
+ console.log(this.polygonModel);
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>