ry-vue-map 0.0.1
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.
- package/.eslintrc.js +11 -0
- package/README.MD +439 -0
- package/babel.config.js +3 -0
- package/jsconfig.json +10 -0
- package/lib/demo.html +10 -0
- package/lib/ryui.common.js +58381 -0
- package/lib/ryui.common.js.gz +0 -0
- package/lib/ryui.css +1 -0
- package/lib/ryui.umd.js +58391 -0
- package/lib/ryui.umd.js.gz +0 -0
- package/lib/ryui.umd.min.js +2 -0
- package/lib/ryui.umd.min.js.gz +0 -0
- package/package.json +73 -0
- package/prettier.config.js +20 -0
- package/src/App.vue +5 -0
- package/src/assets/fonts/index.scss +2 -0
- package/src/assets/fonts/ry-bg/iconfont.css +40 -0
- package/src/assets/fonts/ry-bg/iconfont.ttf +0 -0
- package/src/assets/fonts/ry-bg/iconfont.woff +0 -0
- package/src/assets/fonts/ry-bg/iconfont.woff2 +0 -0
- package/src/assets/fonts/ry.css +347 -0
- package/src/assets/ic-403.svg +480 -0
- package/src/assets/ic-404.svg +299 -0
- package/src/assets/ic-500.svg +191 -0
- package/src/assets/logo.svg +24 -0
- package/src/assets/upload.svg +12 -0
- package/src/components/index.js +27 -0
- package/src/components/maps/models/base/base.js +14 -0
- package/src/components/maps/models/multiPolygonGeoJsonModel.js +11 -0
- package/src/components/maps/models/ryMap/map.js +120 -0
- package/src/components/maps/models/ryMap/view.js +62 -0
- package/src/components/maps/models/ryMapTool/mapTool.js +105 -0
- package/src/components/maps/models/ryPolygon/ryPolygon.js +40 -0
- package/src/components/maps/models/ryPolygons/ryPolygons.js +122 -0
- package/src/components/maps/models/switchMap/switchMap.js +54 -0
- package/src/components/maps/ryClusters/index.js +7 -0
- package/src/components/maps/ryClusters/src/index.vue +238 -0
- package/src/components/maps/ryCrossHair/index.js +7 -0
- package/src/components/maps/ryCrossHair/src/index.vue +44 -0
- package/src/components/maps/ryMap/index.js +6 -0
- package/src/components/maps/ryMap/src/index.vue +306 -0
- package/src/components/maps/ryMapTool/index.js +7 -0
- package/src/components/maps/ryMapTool/src/index.vue +330 -0
- package/src/components/maps/ryOverlay/index.vue +22 -0
- package/src/components/maps/ryPolygon/index.js +7 -0
- package/src/components/maps/ryPolygon/src/index.vue +246 -0
- package/src/components/maps/ryPolygons/index.js +7 -0
- package/src/components/maps/ryPolygons/src/index.vue +524 -0
- package/src/components/maps/switchMap/index.js +7 -0
- package/src/components/maps/switchMap/src/index.vue +224 -0
- package/src/components/maps/switchMap/src/newIndex.vue +256 -0
- package/src/config/setting.js +40 -0
- package/src/directives/index.js +4 -0
- package/src/directives/map.js +41 -0
- package/src/layout/components/footer.vue +35 -0
- package/src/layout/components/header-right.vue +135 -0
- package/src/layout/components/notice.vue +418 -0
- package/src/layout/components/password.vue +133 -0
- package/src/layout/index.vue +252 -0
- package/src/main.js +35 -0
- package/src/router/index.js +92 -0
- package/src/store/getters.js +7 -0
- package/src/store/index.js +21 -0
- package/src/store/modules/theme.js +544 -0
- package/src/store/modules/user.js +74 -0
- package/src/styles/index.scss +9 -0
- package/src/utils/index.js +4 -0
- package/src/utils/lMapServices.js +873 -0
- package/src/utils/page-tab-util.js +106 -0
- package/src/utils/permission.js +118 -0
- package/src/utils/request.js +68 -0
- package/src/utils/token-util.js +40 -0
- package/src/views/exception/403.vue +31 -0
- package/src/views/exception/404.vue +31 -0
- package/src/views/exception/500.vue +31 -0
- package/src/views/map/index.vue +340 -0
- package/vue.config.js +28 -0
package/.eslintrc.js
ADDED
package/README.MD
ADDED
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
# ryvuemap
|
|
2
|
+

|
|
3
|
+
> ry公共组件库
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## 更新日志
|
|
7
|
+
|
|
8
|
+
## 安装
|
|
9
|
+
```bash
|
|
10
|
+
npm i ry-vue-map
|
|
11
|
+
yarn add ry-vue-map
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## 快速开始
|
|
16
|
+
`main.js`
|
|
17
|
+
|
|
18
|
+
```js
|
|
19
|
+
import Vue from 'vue'
|
|
20
|
+
import RyUI from 'ry-vue-map';
|
|
21
|
+
|
|
22
|
+
Vue.use(RyUI)
|
|
23
|
+
```
|
|
24
|
+
## 组件
|
|
25
|
+
|
|
26
|
+
#### 表格
|
|
27
|
+
- `index.vue`
|
|
28
|
+
|
|
29
|
+
```html
|
|
30
|
+
<template>
|
|
31
|
+
<div class="ele-body">
|
|
32
|
+
<el-card>
|
|
33
|
+
<ry-query
|
|
34
|
+
:queryArgs="queryArgs"
|
|
35
|
+
@load="load"
|
|
36
|
+
@submit="query"
|
|
37
|
+
@reset="
|
|
38
|
+
() => {
|
|
39
|
+
where = {};
|
|
40
|
+
}
|
|
41
|
+
"
|
|
42
|
+
>
|
|
43
|
+
</ry-query>
|
|
44
|
+
</el-card>
|
|
45
|
+
<el-card>
|
|
46
|
+
<ry-table :url="url" :columns="columns" :where="where" @loadingSuccessCallback="loadingSuccessCallback($event)" >
|
|
47
|
+
<template #status="{ row }">
|
|
48
|
+
{{ row.status ? '在线' : '离线' }}
|
|
49
|
+
</template>
|
|
50
|
+
</ry-table>
|
|
51
|
+
</el-card>
|
|
52
|
+
</div>
|
|
53
|
+
</template>
|
|
54
|
+
|
|
55
|
+
<script>
|
|
56
|
+
import { columnFactory } from 'ry-form-create';
|
|
57
|
+
import { QueryArgs, Column } from './model';
|
|
58
|
+
export default {
|
|
59
|
+
name: 'Table',
|
|
60
|
+
data() {
|
|
61
|
+
return {
|
|
62
|
+
queryArgs: new QueryArgs(),
|
|
63
|
+
where: {},
|
|
64
|
+
columns: columnFactory(new Column()),
|
|
65
|
+
url: [
|
|
66
|
+
{ no: 1, name: '1', status: true },
|
|
67
|
+
{ no: 2, name: '2', status: true }
|
|
68
|
+
]
|
|
69
|
+
};
|
|
70
|
+
},
|
|
71
|
+
methods: {
|
|
72
|
+
load(ruleMap) {
|
|
73
|
+
ruleMap.get('projectTaskId').setOptinos = tasks;
|
|
74
|
+
ruleMap.get('areaCode').setOptinos = districts;
|
|
75
|
+
},
|
|
76
|
+
query(form) {
|
|
77
|
+
this.where = { ...form };
|
|
78
|
+
},
|
|
79
|
+
// 数据加载成功后回调
|
|
80
|
+
loadingSuccessCallback(datas){
|
|
81
|
+
console.log(datas);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
</script>
|
|
86
|
+
```
|
|
87
|
+
- `model.js`
|
|
88
|
+
|
|
89
|
+
```js
|
|
90
|
+
import { formType, column } from 'ry-form-create';
|
|
91
|
+
|
|
92
|
+
const col = {
|
|
93
|
+
xs: 12,
|
|
94
|
+
sm: 12,
|
|
95
|
+
md: 8,
|
|
96
|
+
lg: 8,
|
|
97
|
+
xl: 8
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const wrap = {
|
|
101
|
+
labelWidth: '80px'
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const style = {
|
|
105
|
+
width: '100%'
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const options = [
|
|
109
|
+
{
|
|
110
|
+
value: 1,
|
|
111
|
+
label: '小鸟有限公司'
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
value: 2,
|
|
115
|
+
label: '大地有限公司'
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
value: 3,
|
|
119
|
+
label: '东方有限公司'
|
|
120
|
+
}
|
|
121
|
+
];
|
|
122
|
+
|
|
123
|
+
export class QueryArgs {
|
|
124
|
+
@formType({ title: '关键字', prefix: '前缀', suffix: '后缀', col, wrap, style: { width: '70%', margin: '0 5px' } })
|
|
125
|
+
keywords = '';
|
|
126
|
+
@formType({ type: 'daterange', title: '创建日期', col, wrap, style })
|
|
127
|
+
date = '';
|
|
128
|
+
@formType({ type: 'select', title: '主体', options, col, wrap, style })
|
|
129
|
+
name = '';
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
export class Column {
|
|
134
|
+
@column({ label: '编号' })
|
|
135
|
+
no;
|
|
136
|
+
@column({ label: '名称' })
|
|
137
|
+
name;
|
|
138
|
+
@column({ label: '在线状态', minWidth: 160, slot: 'status' })
|
|
139
|
+
status;
|
|
140
|
+
@column({ label: '操作', minWidth: 200, slot: 'action', fixed: 'right' })
|
|
141
|
+
action;
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
#### 图片上传
|
|
146
|
+
|
|
147
|
+
- `upload/index.vue`
|
|
148
|
+
```html
|
|
149
|
+
<template>
|
|
150
|
+
<div class="ele-body">
|
|
151
|
+
<ry-upload
|
|
152
|
+
multiple
|
|
153
|
+
:file-list="[
|
|
154
|
+
{
|
|
155
|
+
id:1,
|
|
156
|
+
url:'https://fuss10.elemecdn.com/d/e6/c4d93a3805b3ce3f323f7974e6f78jpeg.jpeg'
|
|
157
|
+
}
|
|
158
|
+
]"
|
|
159
|
+
@handlerSuccess="handlerSuccess"
|
|
160
|
+
@afterRemove="afterRemove"
|
|
161
|
+
:limit="3"
|
|
162
|
+
themeColor="pink"
|
|
163
|
+
gap="20px"
|
|
164
|
+
text="上传图片">
|
|
165
|
+
</ry-upload>
|
|
166
|
+
</div>
|
|
167
|
+
</template>
|
|
168
|
+
|
|
169
|
+
<script>
|
|
170
|
+
import RyUpload from '@/components/upload';
|
|
171
|
+
export default {
|
|
172
|
+
name: 'upload',
|
|
173
|
+
components: {
|
|
174
|
+
RyUpload
|
|
175
|
+
},
|
|
176
|
+
methods: {
|
|
177
|
+
handlerSuccess(file) {
|
|
178
|
+
console.log(file)
|
|
179
|
+
},
|
|
180
|
+
afterRemove({afterList, current}) {
|
|
181
|
+
console.log(afterList, current)
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
</script>
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
- 属性列表
|
|
189
|
+
|
|
190
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
191
|
+
| ---- | ---- | ---- | ---- |
|
|
192
|
+
| fileList | 图片列表,数组格式 [{id:string,url:string}] | Array | [ ] |
|
|
193
|
+
| gap | 上传图片列表之间的间距 | String | '10px' |
|
|
194
|
+
| multiple | 是否支持多选文件, 同 el-upload 的属性 |Boolean|false|
|
|
195
|
+
|fileSize|单个上传文件大小限制|Number|5|
|
|
196
|
+
|limit|限制传入个数|Number|9|
|
|
197
|
+
|fileType|上传类型|Array|['jpg', 'png', 'gif', 'jpeg']|
|
|
198
|
+
|url|上传路径|[Boolean, String]|false|
|
|
199
|
+
|isCustomText|是否自定义文本|Boolean|false|
|
|
200
|
+
|unit|上传单位(支持KB,MB,GB),大小写不敏感|String|MB|
|
|
201
|
+
|isTip|是否显示提示|Boolean|false|
|
|
202
|
+
|width|宽度|Number|200|
|
|
203
|
+
|height|高度|Number|200|
|
|
204
|
+
|themeColor|主题颜色|String|rgba(102, 151, 77,.8)|
|
|
205
|
+
|text|显示的上传文字|String|' '|
|
|
206
|
+
|type|上传格式可选file|String|image|
|
|
207
|
+
|@handlerSuccess|验证成功钩子函数,(file)=>{}|Function||
|
|
208
|
+
|@afterRemove|删除后的回调({afterList, current})=>{afterList是删除后的列表,current是当前删除数据}|Function|
|
|
209
|
+
|
|
210
|
+
#### RyMap
|
|
211
|
+
`map/index.vue`
|
|
212
|
+
```html
|
|
213
|
+
<template>
|
|
214
|
+
<ry-map
|
|
215
|
+
projection="EPSG:4326" // 投影方式 (可不传)
|
|
216
|
+
:mapType="1" // 地图类型 1为天地图 不填为bing地图
|
|
217
|
+
:zoom="15" // 地图缩放率 默认为10(可不传)
|
|
218
|
+
:minZoom="1" // 地图最下缩放率 默认为1(可不传)
|
|
219
|
+
:maxZoom="28" // 地图最大缩放率 默认为18(可不传)
|
|
220
|
+
:bbox="bbox" // 自适应范围 [[x,y],[x,y]] 组件内部以有 watch 监听
|
|
221
|
+
:center="center" // 设置地图中心点 [x,y] 组件内部以有 watch 监听
|
|
222
|
+
@load="load($event)" // 地图加载成功后回调函数
|
|
223
|
+
:isCrossHair="false" // 是否显示十字点 默认fasle 不显示
|
|
224
|
+
:isRight="true" // 地图工具 显示方向 顶部 左 右 默认右上方(可不传)
|
|
225
|
+
:isRyMapTool="true" // 是否创建地图工具
|
|
226
|
+
@drawSuccess="drawSuccess" // 绘制多边形成功后回调函数 {geoJson,delelte} delelte为回调函数用来清空绘制的多边形实例相当于工具栏中的删除功能
|
|
227
|
+
@drawError="drawError" // 绘制多边形出错后回调函数
|
|
228
|
+
:isShowRangingTool="true" // 是否显示侧面、测距工具 默认显示(可不传)
|
|
229
|
+
:isShowDrawTool="true" // 是显示绘制多边形工具 默认不显示
|
|
230
|
+
:bindMapClick="true" //是否注册地图点击事件 true 注册 false 注销注册watch 监听
|
|
231
|
+
@mapClick="mapClick($event)" // 点击地图回调事件 注意:这里为了其回调函数代码少 只返回有有Id图层
|
|
232
|
+
:initModifyPolygon="geoJson" // 初始化需要编辑的多边形 传入 geoJson或 字符串geoJson 用于地图编辑界面 isShowDrawTool=true时 才生效
|
|
233
|
+
:m="3000" // 地图中心点计算中心点距离 默认 单位m 默认3000m
|
|
234
|
+
:bindMapMoveend="true" 绑定地图移动事件会根据zoom 缩放 以及地图移动时触发
|
|
235
|
+
@mapMoveend="mapMoveend($event)" // 绑定地图移动事件后回调函数 会根据zoom 缩放 以及地图移动时触发 根据m参数设定的值返回 当前中心点与移动后的 中心点距离 {m,oversteSetValue}
|
|
236
|
+
oversteSetValue 当前中心点 是否 大于等于 m 设定值 如果 超过 返回 true
|
|
237
|
+
:hideAdd="true" // 隐藏添加功能
|
|
238
|
+
:hidePoint="true" // 隐藏打点功能
|
|
239
|
+
:hideCancel="true" // 隐藏取消功能
|
|
240
|
+
:hideDelete="true" // 隐藏删除功能
|
|
241
|
+
:hideSave="true" // 隐藏报错 功能
|
|
242
|
+
:hideLine="true" // 隐藏绘 隐藏测量线功能
|
|
243
|
+
:hideArea="true" // 隐藏测量面积功能
|
|
244
|
+
// 点击绘制多边形或初始化编辑多边形触发返回 ryMapTool实例
|
|
245
|
+
// 常用函数 $event onCreatePolygon()// 创建多边形 onPointEvent() 打点功能 onCancel()撤销当前绘制 onDelete()删除多边形 onSave() 保存图形功能
|
|
246
|
+
@loadDrawPolygonEvent="loadDrawPolygonEvent($event)"
|
|
247
|
+
// 聚合控件
|
|
248
|
+
<ry-clusters
|
|
249
|
+
@callback="clusterCallback($event)" // 返回值 {id,isShow} id 多边形Id isShow true显示多边形
|
|
250
|
+
:map="mapDto.map" // 地图实例
|
|
251
|
+
:modelArr="modelArr" // 与多边形组件数据结构相同即可
|
|
252
|
+
:clusterPolygonModel // 集合多边形样式 {fillColor: 'rgba(184, 233, 134, 0.56)',stroke: 'rgba(23, 168, 162, 0.56)',width: 3, id:3,text:'块'}
|
|
253
|
+
:
|
|
254
|
+
>
|
|
255
|
+
</ry-clusters>
|
|
256
|
+
>
|
|
257
|
+
<template slot="maptool"> // 工具栏 插槽
|
|
258
|
+
<button>ry</button>
|
|
259
|
+
</template>
|
|
260
|
+
// 多边形插槽
|
|
261
|
+
<template #polygon="{mapDto}" >
|
|
262
|
+
<ry-polygon
|
|
263
|
+
:isFit="true" // 是根据多边形bbox 进行定位 true开启定位 false关闭
|
|
264
|
+
:map="mapDto.map" //地图实例
|
|
265
|
+
:isShow="true" // 是否显示多边形 true 显示
|
|
266
|
+
:model="polygonModel" // 数据模型 参考 data中的 polygonModel
|
|
267
|
+
:text="123" // 设置marker文本 注意 在model 添加text属性后才会创建文本标记 否则不创建
|
|
268
|
+
:polygonColor="'red'" 动态设置多边形颜色
|
|
269
|
+
:isCheckPointHide="true" // 是否显示多边形 true 隐藏
|
|
270
|
+
:clear="true" // 释放多边形 和 text标记 释放后不能在进行其他操作、在次给:model赋值可从新使用该组件
|
|
271
|
+
@onLoad="onLoad($event)" // 回调函数返回 多边形对象和标记对象 每次在释放或 model赋值才会触发
|
|
272
|
+
>
|
|
273
|
+
</ry-polygon>
|
|
274
|
+
<ry-polygons
|
|
275
|
+
:map="map" //地图实例
|
|
276
|
+
:modelArr="modelArr" //数据模型 在数据发生变化时会从新生成多边形
|
|
277
|
+
:insert="insert" // 插入单个多边形 参照 polygonModel 数据结构
|
|
278
|
+
:inserts="inserts" // 插入多个多边形 参照ModelArr 数据结构
|
|
279
|
+
:isShowAl="true" // 显示或者隐藏所有多边形 true,显示 默认为 false 注意此处不会隐藏marker标记
|
|
280
|
+
:isShowPolygon="isShowPolygon"// 隐藏或显示多个多边形 true显示 // 此处不会隐藏maker标记 数据结构 {id:'ceshis',isShow:false}
|
|
281
|
+
:isShowPolygons="isShowPolygons" // 批量显示和隐藏多边形 [{id:'ceshis',isShow:false}]
|
|
282
|
+
:restFit="false" 显示隐藏多边形后是否需要从新定位 true从新定位 默认为false
|
|
283
|
+
:clear="true" // true 为释放资源、默认为false 需要释放资源设置为true即可 或 modelArr 赋值为null [] 都可以
|
|
284
|
+
:isCheckPointHideAll="isCheckPointHideAll" // 是否隐藏所有标记 true 为隐藏 注意隐藏标记 不会触发 restFit从新定位
|
|
285
|
+
:isCheckPointHide="isCheckPointHide" // 是否显示隐藏单个标记 数据结构 {id:'ceshis',isShow:true} isShow true 为隐藏 注意隐藏标记 不会触发 restFit从新定位
|
|
286
|
+
:isCheckPointHides="isCheckPointHides" // 批量 是否显示标记 [{id:'ceshis',isShow:true} ] isShow true 为隐藏 注意隐藏标记 不会触发 restFit从新定位
|
|
287
|
+
:polygonColor="polygonColor" // 设置多边形颜色 {id:'ceshi1',colorArr['red','#000'] } 数组中0为填充演示 1为边框演示
|
|
288
|
+
:polygonColors="polygonColors" // 批量设置多边形颜色 [{id:'ceshi1', colorArr:['red','#000'] }]
|
|
289
|
+
:text="text" // 设置标记文本 {id:'ceshi1',text:'ceshiabc'}
|
|
290
|
+
:isFit="true"// 是否根据bbox 设为中心点 默认为true,false则不在定位
|
|
291
|
+
:remove="'ceshi1'" // 根据Id 释放多边形 和 标记
|
|
292
|
+
:removes="['ceshi1']" // 根据Id数组 移除多边形 和标记
|
|
293
|
+
:range="range" 根据传入的 Id 去进行定位
|
|
294
|
+
:ranges="ranges" // 根据传入的Id数组进行定位
|
|
295
|
+
@onLoad="onLoad($event)" // 回调函数 在插入、批量插入、modelArr发生变化时触发 返回{bboxMap, polygonMap,checkPointMap }
|
|
296
|
+
@crossHairClick="crossHairClick($event)" // 点击中心点或打点功能触发回调
|
|
297
|
+
></ry-polygons>
|
|
298
|
+
</template>
|
|
299
|
+
</ry-map>
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
<div>
|
|
303
|
+
<h1>插槽外部使用方式</h1>
|
|
304
|
+
<ry-polygon
|
|
305
|
+
v-if="map"
|
|
306
|
+
:isFit="true"
|
|
307
|
+
:map="map"
|
|
308
|
+
......省略与上方多边形示例相同
|
|
309
|
+
>
|
|
310
|
+
</ry-polygon>
|
|
311
|
+
<ry-polygons
|
|
312
|
+
v-if="map"
|
|
313
|
+
:isFit="true"
|
|
314
|
+
:map="map"
|
|
315
|
+
......省略与上方多边形示例相同
|
|
316
|
+
>
|
|
317
|
+
</ry-polygons>
|
|
318
|
+
|
|
319
|
+
</div>
|
|
320
|
+
|
|
321
|
+
<h1>
|
|
322
|
+
|
|
323
|
+
<RyMapTool
|
|
324
|
+
@crossHairClick="crossHairClick($event)" // 点击中心点或打点功能触发回调
|
|
325
|
+
:isCrossHair="false" // 是否显示十字点 默认fasle 不显示
|
|
326
|
+
:initModifyPolygon="geoJson" // 初始化需要编辑的多边形 传入 geoJson或 字符串geoJson 用于地图编辑界面
|
|
327
|
+
:isRight="true" // 地图工具 显示方向 顶部 左 右 默认右上方(可不传)
|
|
328
|
+
:isRyMapTool="true" // 是否创建地图工具
|
|
329
|
+
@drawSuccess="drawSuccess" // 绘制多边形成功后回调函数 {geoJson,delelte} delelte为回调函数用来清空绘制的多边形实例相当于工具栏中的删除功能
|
|
330
|
+
@drawError="drawError" // 绘制多边形出错后回调函数
|
|
331
|
+
:isShowRangingTool="true" // 是否显示侧面、测距工具 默认显示(可不传)
|
|
332
|
+
:isShowDrawTool="true" // 是显示绘制多边形工具 默认不显示
|
|
333
|
+
@drawSuccess="drawSuccess" // 绘制多边形成功后回调函数 {geoJson,delelte} delelte为回调函数用来清空绘制的多边形实例相当于工具栏中的删除功能 getGeoJson() 获取GeoJson
|
|
334
|
+
@drawError="drawError" // 绘制多边形出错后回调函数
|
|
335
|
+
:hideAdd="true" // 隐藏添加功能
|
|
336
|
+
:hidePoint="true" // 隐藏打点功能
|
|
337
|
+
:hideCancel="true" // 隐藏取消功能
|
|
338
|
+
:hideDelete="true" // 隐藏删除功能
|
|
339
|
+
:hideSave="true" // 隐藏报错 功能
|
|
340
|
+
:hideLine="true" // 隐藏绘 隐藏测量线功能
|
|
341
|
+
:hideArea="true" // 隐藏测量面积功能
|
|
342
|
+
// 点击绘制多边形或初始化编辑多边形触发返回 ryMapTool实例
|
|
343
|
+
// 常用函数 $event onCreatePolygon()// 创建多边形 onPointEvent() 打点功能 onCancel()撤销当前绘制 onDelete()删除多边形 onSave() 保存图形功能
|
|
344
|
+
@loadDrawPolygonEvent="loadDrawPolygonEvent($event)"
|
|
345
|
+
|
|
346
|
+
>
|
|
347
|
+
<template>
|
|
348
|
+
// 插槽
|
|
349
|
+
</template>
|
|
350
|
+
</RyMapTool>
|
|
351
|
+
</h1>
|
|
352
|
+
|
|
353
|
+
</template>
|
|
354
|
+
|
|
355
|
+
<script>
|
|
356
|
+
import RyMap from '@/components/maps/ryMap/src/customTable.vue';
|
|
357
|
+
import RyMapTool from '@/components/maps/ryMapTool/src/customTable.vue'
|
|
358
|
+
|
|
359
|
+
export default {
|
|
360
|
+
components: {
|
|
361
|
+
RyMap,
|
|
362
|
+
RyMapTool
|
|
363
|
+
},
|
|
364
|
+
data() {
|
|
365
|
+
return {
|
|
366
|
+
map: null,
|
|
367
|
+
lMap: null,
|
|
368
|
+
bbox:[],
|
|
369
|
+
center: [116.40769, 39.89945],
|
|
370
|
+
polygonModel: {
|
|
371
|
+
// 填充颜色
|
|
372
|
+
fillColor: '#000',
|
|
373
|
+
// 边框颜色
|
|
374
|
+
stroke: 'red',
|
|
375
|
+
// 边框宽度
|
|
376
|
+
width: 1,
|
|
377
|
+
// 注意在此处 添加text属性后才会创建文本标记 否则不创建
|
|
378
|
+
text:'测试',
|
|
379
|
+
geo:g1, // geoJson 可为字符串或对象 注意 传入geoJson后不需要在传送 coordinates 三维数组
|
|
380
|
+
// coordinates: [
|
|
381
|
+
// [
|
|
382
|
+
// [121.03623185250073, 29.247091764239528],
|
|
383
|
+
// [121.03525048300928, 29.24522364753245],
|
|
384
|
+
// [121.03576144393304, 29.244964111834967],
|
|
385
|
+
// [121.03598042717134, 29.245156060100488],
|
|
386
|
+
// ]
|
|
387
|
+
// ],
|
|
388
|
+
// id 为必穿且不能重复
|
|
389
|
+
id: 'ceshi',
|
|
390
|
+
},
|
|
391
|
+
modelArr:[this.polygonModel]
|
|
392
|
+
};
|
|
393
|
+
},
|
|
394
|
+
created(){
|
|
395
|
+
// setTimeout(r=> this.center=[116.407693, 39.899456],5000);
|
|
396
|
+
},
|
|
397
|
+
methods: {
|
|
398
|
+
load(obj) {
|
|
399
|
+
console.log(obj);
|
|
400
|
+
// mapServices 地图服务
|
|
401
|
+
// Map 实例对象
|
|
402
|
+
const {mapServices, map} = obj;
|
|
403
|
+
this.lMap = mapServices;
|
|
404
|
+
|
|
405
|
+
},
|
|
406
|
+
drawSuccess(geo){
|
|
407
|
+
// geo 绘制多边形成功后 返回 geojson 非字符串
|
|
408
|
+
console.log(geo);
|
|
409
|
+
},
|
|
410
|
+
drawError(obj){
|
|
411
|
+
const {type,geoJson}= obj;
|
|
412
|
+
// type 错误类型
|
|
413
|
+
// geoJson 非字符串
|
|
414
|
+
// 绘制多边形失败后
|
|
415
|
+
// type =0 请绘制地块后在进行保存操作
|
|
416
|
+
// 1 多边形不合法
|
|
417
|
+
console.log(obj);
|
|
418
|
+
},
|
|
419
|
+
mapClick(e){
|
|
420
|
+
// e 返回的是图层Id
|
|
421
|
+
},
|
|
422
|
+
}
|
|
423
|
+
};
|
|
424
|
+
</script>
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
## 指令
|
|
430
|
+
`main.js`
|
|
431
|
+
|
|
432
|
+
```js
|
|
433
|
+
import Vue from 'vue'
|
|
434
|
+
import * as directives from 'ry-vue-map/src/directives';
|
|
435
|
+
|
|
436
|
+
Object.keys(directives).forEach((key) => {
|
|
437
|
+
Vue.use(directives[key]);
|
|
438
|
+
});
|
|
439
|
+
```
|
package/babel.config.js
ADDED
package/jsconfig.json
ADDED