vue2-client 1.2.74 → 1.2.75

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 (46) hide show
  1. package/.env +15 -15
  2. package/.eslintrc.js +82 -82
  3. package/CHANGELOG.md +5 -0
  4. package/package.json +46 -46
  5. package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +225 -225
  6. package/src/base-client/components/common/AmapMarker/AmapPointRendering.vue +113 -113
  7. package/src/base-client/components/common/CitySelect/CitySelect.vue +244 -244
  8. package/src/base-client/components/common/CitySelect/index.js +3 -3
  9. package/src/base-client/components/common/CitySelect/index.md +109 -109
  10. package/src/base-client/components/common/CreateQuery/CreateQuery.vue +539 -539
  11. package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +773 -773
  12. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +310 -310
  13. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQueryItem.vue +553 -553
  14. package/src/base-client/components/common/Upload/Upload.vue +151 -151
  15. package/src/base-client/components/common/Upload/index.js +3 -3
  16. package/src/base-client/components/common/XAddForm/XAddForm.vue +345 -345
  17. package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +322 -322
  18. package/src/base-client/components/common/XForm/XForm.vue +268 -268
  19. package/src/base-client/components/common/XForm/XFormItem.vue +358 -358
  20. package/src/base-client/components/common/XFormTable/XFormTable.vue +491 -491
  21. package/src/base-client/components/common/XTable/XTable.vue +269 -269
  22. package/src/base-client/components/iot/DeviceDetailsView/DeviceDetailsView.vue +232 -230
  23. package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsCount.vue +623 -330
  24. package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsException.vue +57 -57
  25. package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsRead.vue +131 -131
  26. package/src/base-client/components/iot/DeviceTypeDetailsView/DeviceTypeDetailsView.vue +300 -300
  27. package/src/base-client/components/iot/WebmeterAnalysisView/WebmeterAnalysisView.vue +647 -647
  28. package/src/base-client/components/ticket/TicketSubmitSuccessView/TicketSubmitSuccessView.vue +532 -532
  29. package/src/base-client/plugins/AppData.js +70 -70
  30. package/src/base-client/plugins/compatible/LoginServiceOA.js +20 -20
  31. package/src/components/Charts/ChartCard.vue +14 -0
  32. package/src/config/CreateQueryConfig.js +301 -301
  33. package/src/pages/resourceManage/orgListManage.vue +98 -98
  34. package/src/router/async/config.async.js +26 -26
  35. package/src/router/async/router.map.js +60 -60
  36. package/src/router/index.js +27 -27
  37. package/src/services/api/common.js +56 -56
  38. package/src/services/api/index.js +39 -39
  39. package/src/services/api/iot/DeviceDetailsView/DeviceDetailsCountApi.js +14 -0
  40. package/src/services/api/manage.js +16 -16
  41. package/src/services/api/restTools.js +24 -24
  42. package/src/theme/default/style.less +47 -47
  43. package/src/utils/map-utils.js +28 -28
  44. package/src/utils/request.js +198 -198
  45. package/src/utils/util.js +222 -222
  46. package/vue.config.js +153 -153
@@ -1,225 +1,225 @@
1
- <template>
2
- <div class="certain-category-search-wrapper">
3
- <a-auto-complete
4
- :disabled="!mapAutocomplete"
5
- :dropdown-match-select-width="false"
6
- :dropdown-style="{ width: '400px' }"
7
- class="certain-category-search"
8
- dropdown-class-name="certain-category-search-dropdown"
9
- option-label-prop="value"
10
- placeholder="输入地址关键字搜索"
11
- @search="fetchFunction"
12
- @select="onSelect"
13
- >
14
- <a-spin v-if="searching" slot="notFoundContent" size="small" />
15
- <template slot="dataSource">
16
- <a-select-opt-group v-for="group in option" :key="group.title">
17
- <span
18
- slot="label">
19
- <a-icon type="bank" /> {{ group.title }}
20
- </span>
21
- <a-select-option v-for="address in group.children" :key="address.label + ' (' + address.value + ')'">
22
- <p class="addressName"><a-icon type="environment" /> <span v-html="highLight(address.label, address.word)">{{ address.label }}</span></p>
23
- <p v-if="address.address !== '[]'" class="addressRemark">
24
- {{ address.address }}
25
- </p>
26
- </a-select-option>
27
- </a-select-opt-group>
28
- </template>
29
- <a-input>
30
- <a-icon slot="suffix" class="certain-category-icon" type="search"/>
31
- </a-input>
32
- </a-auto-complete>
33
- </div>
34
- </template>
35
- <script>
36
-
37
- import { post } from '@vue2-client/services/api'
38
- import { GetGDMap } from '@vue2-client/utils/map-utils'
39
- import { debounce } from 'ant-design-vue/lib/vc-table/src/utils'
40
-
41
- export default {
42
- name: 'AddressSearchCombobox',
43
- data () {
44
- // 检索去抖
45
- this.fetchFunction = debounce(this.fetchFunction, 300)
46
- return {
47
- // 地址搜索联想
48
- mapAutocomplete: undefined,
49
- // 检索结果
50
- option: [],
51
- // 最后检索版本
52
- lastFetchId: 0,
53
- // 检索中
54
- searching: false
55
- }
56
- },
57
- model: {
58
- prop: 'searchResult',
59
- event: 'onSelect'
60
- },
61
- props: {
62
- searchResult: {
63
- type: String,
64
- default: undefined
65
- },
66
- // 返回数据格式
67
- searchResultType: {
68
- type: String,
69
- default: 'Default'
70
- // default: 'Array'
71
- // default: 'Object'
72
- },
73
- // Object 返回格式时 可以自定义key
74
- resultKeys: {
75
- type: Object,
76
- default: () => { return { address: 'address', coords: 'coords' } }
77
- }
78
- },
79
- created () {
80
- },
81
- mounted () {
82
- GetGDMap().then(aMap => {
83
- this.mapAutocomplete = new (aMap).Autocomplete({})
84
- })
85
- },
86
- methods: {
87
- onSelect (value) {
88
- let result
89
- if (this.searchResultType !== 'Default') {
90
- const _arr = value.replace(')', '').split('(')
91
- if (this.searchResultType === 'Array') {
92
- result = _arr
93
- } else {
94
- result = {}
95
- result[this.resultKeys.address] = _arr[0]
96
- result[this.resultKeys.coords] = _arr[1]
97
- }
98
- }
99
- this.$emit('onSelect', JSON.stringify(result) || value)
100
- // this.$emit('onClick', result || value)
101
- },
102
- // 懒加载检索方法
103
- fetchFunction (value) {
104
- if (value && this.mapAutocomplete) {
105
- this.searching = true
106
- this.lastFetchId += 1
107
- const fetchId = this.lastFetchId
108
- this.mapAutocomplete.search(value, (status, result) => {
109
- if (fetchId !== this.lastFetchId) {
110
- return
111
- }
112
- if (status === 'complete') {
113
- this.option = []
114
- const addressMap = {}
115
- result.tips.forEach((res) => {
116
- if (res.location) {
117
- if (!addressMap.hasOwnProperty(res.district)) {
118
- addressMap[res.district] = []
119
- }
120
- addressMap[res.district].push({
121
- label: res.name,
122
- value: res.location.lng + ',' + res.location.lat + ',',
123
- address: res.address + '',
124
- word: value
125
- })
126
- }
127
- })
128
- for (const key of Object.keys(addressMap)) {
129
- this.option.push({
130
- title: key,
131
- children: addressMap[key]
132
- })
133
- }
134
- }
135
- this.searching = false
136
- })
137
- }
138
- },
139
- // 获取数据
140
- getData (value, callback) {
141
- if (value !== '') {
142
- const logicName = this.attr.keyName
143
- const logic = logicName.substring(6)
144
- post('/webmeterapi/' + logic, value).then(res => {
145
- callback(res)
146
- })
147
- }
148
- },
149
- // 关键字高亮
150
- highLight (value, word) {
151
- // 如果标题中包含,关键字就替换一下
152
- if (value.includes(word)) {
153
- value = value.replace(word,
154
- // 这里是替换成html格式的数据,最好再加一个样式权重,保险一点
155
- '<span style="color:red!important;">' + word + '</span>'
156
- )
157
- return value
158
- // eslint-disable-next-line brace-style
159
- }
160
- // 不包含的话还用这个
161
- else {
162
- return value
163
- }
164
- }
165
- }
166
- }
167
- </script>
168
-
169
- <style>
170
- .certain-category-search-dropdown .ant-select-dropdown-menu-item-group-title {
171
- color: #666;
172
- font-weight: bold;
173
- font-size: 14px;
174
- }
175
-
176
- .certain-category-search-dropdown .ant-select-dropdown-menu-item-group {
177
- border-bottom: 1px solid #f6f6f6;
178
- }
179
-
180
- .certain-category-search-dropdown .ant-select-dropdown-menu-item {
181
- padding-left: 16px;
182
- }
183
-
184
- .certain-category-search-dropdown .ant-select-dropdown-menu-item.show-all {
185
- text-align: center;
186
- cursor: default;
187
- }
188
-
189
- .certain-category-search-dropdown .ant-select-dropdown-menu {
190
- max-height: 300px;
191
- }
192
- </style>
193
- <style scoped>
194
- .certain-category-search-wrapper
195
- >>> .certain-category-search.ant-select-auto-complete
196
- .ant-input-affix-wrapper
197
- .ant-input-suffix {
198
- right: 12px;
199
- }
200
- .certain-category-search-wrapper >>> .certain-search-item-count {
201
- position: absolute;
202
- color: #999;
203
- right: 16px;
204
- }
205
- .certain-category-search-wrapper >>> .certain-category-search.ant-select-focused,
206
- .certain-category-icon {
207
- color: #108ee9;
208
- }
209
- .certain-category-search-wrapper >>> .certain-category-icon {
210
- color: #6e6e6e;
211
- transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
212
- font-size: 16px;
213
- }
214
-
215
- .addressName {
216
- margin-bottom: 0;
217
- font-size: 14px;
218
- font-weight: bold;
219
- }
220
-
221
- .addressRemark {
222
- margin-bottom: 0;
223
- font-size: 12px;
224
- }
225
- </style>
1
+ <template>
2
+ <div class="certain-category-search-wrapper">
3
+ <a-auto-complete
4
+ :disabled="!mapAutocomplete"
5
+ :dropdown-match-select-width="false"
6
+ :dropdown-style="{ width: '400px' }"
7
+ class="certain-category-search"
8
+ dropdown-class-name="certain-category-search-dropdown"
9
+ option-label-prop="value"
10
+ placeholder="输入地址关键字搜索"
11
+ @search="fetchFunction"
12
+ @select="onSelect"
13
+ >
14
+ <a-spin v-if="searching" slot="notFoundContent" size="small" />
15
+ <template slot="dataSource">
16
+ <a-select-opt-group v-for="group in option" :key="group.title">
17
+ <span
18
+ slot="label">
19
+ <a-icon type="bank" /> {{ group.title }}
20
+ </span>
21
+ <a-select-option v-for="address in group.children" :key="address.label + ' (' + address.value + ')'">
22
+ <p class="addressName"><a-icon type="environment" /> <span v-html="highLight(address.label, address.word)">{{ address.label }}</span></p>
23
+ <p v-if="address.address !== '[]'" class="addressRemark">
24
+ {{ address.address }}
25
+ </p>
26
+ </a-select-option>
27
+ </a-select-opt-group>
28
+ </template>
29
+ <a-input>
30
+ <a-icon slot="suffix" class="certain-category-icon" type="search"/>
31
+ </a-input>
32
+ </a-auto-complete>
33
+ </div>
34
+ </template>
35
+ <script>
36
+
37
+ import { post } from '@vue2-client/services/api'
38
+ import { GetGDMap } from '@vue2-client/utils/map-utils'
39
+ import { debounce } from 'ant-design-vue/lib/vc-table/src/utils'
40
+
41
+ export default {
42
+ name: 'AddressSearchCombobox',
43
+ data () {
44
+ // 检索去抖
45
+ this.fetchFunction = debounce(this.fetchFunction, 300)
46
+ return {
47
+ // 地址搜索联想
48
+ mapAutocomplete: undefined,
49
+ // 检索结果
50
+ option: [],
51
+ // 最后检索版本
52
+ lastFetchId: 0,
53
+ // 检索中
54
+ searching: false
55
+ }
56
+ },
57
+ model: {
58
+ prop: 'searchResult',
59
+ event: 'onSelect'
60
+ },
61
+ props: {
62
+ searchResult: {
63
+ type: String,
64
+ default: undefined
65
+ },
66
+ // 返回数据格式
67
+ searchResultType: {
68
+ type: String,
69
+ default: 'Default'
70
+ // default: 'Array'
71
+ // default: 'Object'
72
+ },
73
+ // Object 返回格式时 可以自定义key
74
+ resultKeys: {
75
+ type: Object,
76
+ default: () => { return { address: 'address', coords: 'coords' } }
77
+ }
78
+ },
79
+ created () {
80
+ },
81
+ mounted () {
82
+ GetGDMap().then(aMap => {
83
+ this.mapAutocomplete = new (aMap).Autocomplete({})
84
+ })
85
+ },
86
+ methods: {
87
+ onSelect (value) {
88
+ let result
89
+ if (this.searchResultType !== 'Default') {
90
+ const _arr = value.replace(')', '').split('(')
91
+ if (this.searchResultType === 'Array') {
92
+ result = _arr
93
+ } else {
94
+ result = {}
95
+ result[this.resultKeys.address] = _arr[0]
96
+ result[this.resultKeys.coords] = _arr[1]
97
+ }
98
+ }
99
+ this.$emit('onSelect', JSON.stringify(result) || value)
100
+ // this.$emit('onClick', result || value)
101
+ },
102
+ // 懒加载检索方法
103
+ fetchFunction (value) {
104
+ if (value && this.mapAutocomplete) {
105
+ this.searching = true
106
+ this.lastFetchId += 1
107
+ const fetchId = this.lastFetchId
108
+ this.mapAutocomplete.search(value, (status, result) => {
109
+ if (fetchId !== this.lastFetchId) {
110
+ return
111
+ }
112
+ if (status === 'complete') {
113
+ this.option = []
114
+ const addressMap = {}
115
+ result.tips.forEach((res) => {
116
+ if (res.location) {
117
+ if (!addressMap.hasOwnProperty(res.district)) {
118
+ addressMap[res.district] = []
119
+ }
120
+ addressMap[res.district].push({
121
+ label: res.name,
122
+ value: res.location.lng + ',' + res.location.lat + ',',
123
+ address: res.address + '',
124
+ word: value
125
+ })
126
+ }
127
+ })
128
+ for (const key of Object.keys(addressMap)) {
129
+ this.option.push({
130
+ title: key,
131
+ children: addressMap[key]
132
+ })
133
+ }
134
+ }
135
+ this.searching = false
136
+ })
137
+ }
138
+ },
139
+ // 获取数据
140
+ getData (value, callback) {
141
+ if (value !== '') {
142
+ const logicName = this.attr.keyName
143
+ const logic = logicName.substring(6)
144
+ post('/webmeterapi/' + logic, value).then(res => {
145
+ callback(res)
146
+ })
147
+ }
148
+ },
149
+ // 关键字高亮
150
+ highLight (value, word) {
151
+ // 如果标题中包含,关键字就替换一下
152
+ if (value.includes(word)) {
153
+ value = value.replace(word,
154
+ // 这里是替换成html格式的数据,最好再加一个样式权重,保险一点
155
+ '<span style="color:red!important;">' + word + '</span>'
156
+ )
157
+ return value
158
+ // eslint-disable-next-line brace-style
159
+ }
160
+ // 不包含的话还用这个
161
+ else {
162
+ return value
163
+ }
164
+ }
165
+ }
166
+ }
167
+ </script>
168
+
169
+ <style>
170
+ .certain-category-search-dropdown .ant-select-dropdown-menu-item-group-title {
171
+ color: #666;
172
+ font-weight: bold;
173
+ font-size: 14px;
174
+ }
175
+
176
+ .certain-category-search-dropdown .ant-select-dropdown-menu-item-group {
177
+ border-bottom: 1px solid #f6f6f6;
178
+ }
179
+
180
+ .certain-category-search-dropdown .ant-select-dropdown-menu-item {
181
+ padding-left: 16px;
182
+ }
183
+
184
+ .certain-category-search-dropdown .ant-select-dropdown-menu-item.show-all {
185
+ text-align: center;
186
+ cursor: default;
187
+ }
188
+
189
+ .certain-category-search-dropdown .ant-select-dropdown-menu {
190
+ max-height: 300px;
191
+ }
192
+ </style>
193
+ <style scoped>
194
+ .certain-category-search-wrapper
195
+ >>> .certain-category-search.ant-select-auto-complete
196
+ .ant-input-affix-wrapper
197
+ .ant-input-suffix {
198
+ right: 12px;
199
+ }
200
+ .certain-category-search-wrapper >>> .certain-search-item-count {
201
+ position: absolute;
202
+ color: #999;
203
+ right: 16px;
204
+ }
205
+ .certain-category-search-wrapper >>> .certain-category-search.ant-select-focused,
206
+ .certain-category-icon {
207
+ color: #108ee9;
208
+ }
209
+ .certain-category-search-wrapper >>> .certain-category-icon {
210
+ color: #6e6e6e;
211
+ transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
212
+ font-size: 16px;
213
+ }
214
+
215
+ .addressName {
216
+ margin-bottom: 0;
217
+ font-size: 14px;
218
+ font-weight: bold;
219
+ }
220
+
221
+ .addressRemark {
222
+ margin-bottom: 0;
223
+ font-size: 12px;
224
+ }
225
+ </style>
@@ -1,113 +1,113 @@
1
- <template >
2
- <div id="amap_point_rendering_map" :style="mapStyle">
3
- <div v-show="false">
4
- <div id="amap_point_rendering_template">
5
- <a-descriptions :column="1">
6
- <a-descriptions-item v-for="(des, index) in describeList" :key="index" :label="des.describe" >{{ markers[des.field] }}</a-descriptions-item>
7
- </a-descriptions>
8
- </div>
9
- </div>
10
- </div>
11
- </template>
12
- <script>
13
- import { GetGDMap } from '@vue2-client/utils/map-utils'
14
- export default {
15
- name: 'AmapPointRendering',
16
- props: {
17
- // 选中点位后需要展示的信息描述
18
- describeList: {
19
- type: Array,
20
- // eslint-disable-next-line vue/require-valid-default-prop
21
- default: () => { return [ ] } // lng:描述信息 lat:描述信息对应的值的字段名 { describe: '用户名称', field: 'name' }
22
- },
23
- // 需要渲染的点位数据
24
- markers: {
25
- type: String,
26
- default: null // lng:经度值 lat:纬度值
27
- },
28
- // 渲染点位的图片
29
- imgurl: {
30
- type: String,
31
- default: '/image/success1.png'
32
- },
33
- mapStyle: {
34
- type: Object,
35
- default: () => {
36
- return {
37
- width: '100%',
38
- height: '85vh',
39
- border: '2px solid lightgray',
40
- 'border-radius': '5px'
41
- }
42
- }
43
- }
44
- },
45
- data () {
46
- return {
47
- map: null,
48
- geocoder: null, // 逆地理编码
49
- infoWindow: null,
50
- selectrow: {}
51
- }
52
- },
53
- created () {
54
- },
55
- mounted () {
56
- GetGDMap().then(aMap => {
57
- this.initMap(aMap)
58
- this.initData(aMap)
59
- })
60
- },
61
- methods: {
62
- initMap (aMap) {
63
- this.map = new (aMap).Map('amap_point_rendering_map', { // 设置地图容器id
64
- resizeEnable: true, // 是否监控地图容器尺寸变化
65
- zoom: 17, // 初始化地图层级
66
- center: [108.943784, 34.265] // 初始化地图中心点
67
- })
68
- this.geocoder = new (aMap).Geocoder({
69
- radius: 500 // 范围,默认:500
70
- })
71
- this.map.addControl(new (aMap).ToolBar()) // 初始化工具插件
72
- // 初始化窗体
73
- this.infoWindow = new (aMap).InfoWindow({
74
- anchor: 'bottom-center',
75
- isCustom: false, // 使用自定义窗体
76
- autoMove: true,
77
- content: '',
78
- showShadow: true,
79
- offset: new (aMap).Pixel(0, -25)
80
- })
81
- },
82
- initData (aMap) {
83
- // 创建一个 Marker 实例:
84
- if (this.markers) {
85
- const lngLat = this.markers.split(',')
86
- const lng = lngLat[0]
87
- const lat = lngLat[1]
88
- const marker = new (aMap).Marker({
89
- // 经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9]
90
- position: new (aMap).LngLat(lng, lat),
91
- title: '北京',
92
- icon: new (aMap).Icon({
93
- // 图标大小
94
- size: new (aMap).Size(26, 28),
95
- // 报警图标URL
96
- url: this.imgurl,
97
- // 图标偏移位置
98
- anchor: new (aMap).Pixel(0, 0),
99
- }),
100
- extData: this.markers
101
- })
102
- marker.on('click', function (e) {
103
- this.infoWindow.setContent(document.getElementById('amap_point_rendering_template'))
104
- this.infoWindow.open(this.map, [e.target.getExtData().lng, e.target.getExtData().lat])
105
- })
106
- // 将创建的点标记添加到已有的地图实例:
107
- this.map.add(marker)
108
- this.map.setFitView()
109
- }
110
- }
111
- }
112
- }
113
- </script>
1
+ <template >
2
+ <div id="amap_point_rendering_map" :style="mapStyle">
3
+ <div v-show="false">
4
+ <div id="amap_point_rendering_template">
5
+ <a-descriptions :column="1">
6
+ <a-descriptions-item v-for="(des, index) in describeList" :key="index" :label="des.describe" >{{ markers[des.field] }}</a-descriptions-item>
7
+ </a-descriptions>
8
+ </div>
9
+ </div>
10
+ </div>
11
+ </template>
12
+ <script>
13
+ import { GetGDMap } from '@vue2-client/utils/map-utils'
14
+ export default {
15
+ name: 'AmapPointRendering',
16
+ props: {
17
+ // 选中点位后需要展示的信息描述
18
+ describeList: {
19
+ type: Array,
20
+ // eslint-disable-next-line vue/require-valid-default-prop
21
+ default: () => { return [ ] } // lng:描述信息 lat:描述信息对应的值的字段名 { describe: '用户名称', field: 'name' }
22
+ },
23
+ // 需要渲染的点位数据
24
+ markers: {
25
+ type: String,
26
+ default: null // lng:经度值 lat:纬度值
27
+ },
28
+ // 渲染点位的图片
29
+ imgurl: {
30
+ type: String,
31
+ default: '/image/success1.png'
32
+ },
33
+ mapStyle: {
34
+ type: Object,
35
+ default: () => {
36
+ return {
37
+ width: '100%',
38
+ height: '85vh',
39
+ border: '2px solid lightgray',
40
+ 'border-radius': '5px'
41
+ }
42
+ }
43
+ }
44
+ },
45
+ data () {
46
+ return {
47
+ map: null,
48
+ geocoder: null, // 逆地理编码
49
+ infoWindow: null,
50
+ selectrow: {}
51
+ }
52
+ },
53
+ created () {
54
+ },
55
+ mounted () {
56
+ GetGDMap().then(aMap => {
57
+ this.initMap(aMap)
58
+ this.initData(aMap)
59
+ })
60
+ },
61
+ methods: {
62
+ initMap (aMap) {
63
+ this.map = new (aMap).Map('amap_point_rendering_map', { // 设置地图容器id
64
+ resizeEnable: true, // 是否监控地图容器尺寸变化
65
+ zoom: 17, // 初始化地图层级
66
+ center: [108.943784, 34.265] // 初始化地图中心点
67
+ })
68
+ this.geocoder = new (aMap).Geocoder({
69
+ radius: 500 // 范围,默认:500
70
+ })
71
+ this.map.addControl(new (aMap).ToolBar()) // 初始化工具插件
72
+ // 初始化窗体
73
+ this.infoWindow = new (aMap).InfoWindow({
74
+ anchor: 'bottom-center',
75
+ isCustom: false, // 使用自定义窗体
76
+ autoMove: true,
77
+ content: '',
78
+ showShadow: true,
79
+ offset: new (aMap).Pixel(0, -25)
80
+ })
81
+ },
82
+ initData (aMap) {
83
+ // 创建一个 Marker 实例:
84
+ if (this.markers) {
85
+ const lngLat = this.markers.split(',')
86
+ const lng = lngLat[0]
87
+ const lat = lngLat[1]
88
+ const marker = new (aMap).Marker({
89
+ // 经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9]
90
+ position: new (aMap).LngLat(lng, lat),
91
+ title: '北京',
92
+ icon: new (aMap).Icon({
93
+ // 图标大小
94
+ size: new (aMap).Size(26, 28),
95
+ // 报警图标URL
96
+ url: this.imgurl,
97
+ // 图标偏移位置
98
+ anchor: new (aMap).Pixel(0, 0),
99
+ }),
100
+ extData: this.markers
101
+ })
102
+ marker.on('click', function (e) {
103
+ this.infoWindow.setContent(document.getElementById('amap_point_rendering_template'))
104
+ this.infoWindow.open(this.map, [e.target.getExtData().lng, e.target.getExtData().lat])
105
+ })
106
+ // 将创建的点标记添加到已有的地图实例:
107
+ this.map.add(marker)
108
+ this.map.setFitView()
109
+ }
110
+ }
111
+ }
112
+ }
113
+ </script>