vue2-client 1.2.109 → 1.2.112

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 (54) hide show
  1. package/.env +15 -15
  2. package/.eslintrc.js +82 -82
  3. package/CHANGELOG.md +6 -0
  4. package/package.json +13 -32
  5. package/src/base-client/all.js +0 -4
  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 +547 -547
  11. package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +777 -777
  12. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +310 -310
  13. package/src/base-client/components/common/PersonSetting/PersonSetting.vue +210 -210
  14. package/src/base-client/components/common/PersonSetting/index.js +3 -3
  15. package/src/base-client/components/common/Upload/index.js +3 -3
  16. package/src/base-client/components/common/XAddForm/XAddForm.vue +349 -349
  17. package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +322 -322
  18. package/src/base-client/components/common/XCard/XCard.vue +64 -64
  19. package/src/base-client/components/common/XForm/XForm.vue +268 -268
  20. package/src/base-client/components/common/XFormTable/XFormTable.vue +514 -514
  21. package/src/base-client/components/common/XFormTable/index.md +96 -96
  22. package/src/base-client/components/iot/DeviceDetailsView/DeviceDetailsView.vue +232 -232
  23. package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsCount.vue +678 -678
  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 +960 -960
  28. package/src/base-client/components/ticket/TicketSubmitSuccessView/TicketSubmitSuccessView.vue +532 -532
  29. package/src/base-client/plugins/AppData.js +71 -79
  30. package/src/base-client/plugins/compatible/LoginServiceOA.js +20 -20
  31. package/src/config/CreateQueryConfig.js +307 -307
  32. package/src/layouts/header/HeaderNotice.vue +199 -199
  33. package/src/layouts/header/InstitutionDetail.vue +182 -182
  34. package/src/pages/resourceManage/orgListManage.vue +98 -98
  35. package/src/pages/system/ticket/index.vue +111 -130
  36. package/src/pages/system/ticket/submitTicketSuccess.vue +11 -76
  37. package/src/router/async/config.async.js +26 -26
  38. package/src/router/async/router.map.js +60 -60
  39. package/src/router/index.js +27 -27
  40. package/src/services/api/TicketDetailsViewApi.js +3 -1
  41. package/src/services/api/WebmeterAnalysisViewApi.js +24 -24
  42. package/src/services/api/index.js +39 -39
  43. package/src/services/api/iot/DeviceDetailsView/DeviceDetailsCountApi.js +18 -18
  44. package/src/services/api/manage.js +16 -16
  45. package/src/services/api/restTools.js +24 -24
  46. package/src/theme/default/style.less +47 -47
  47. package/src/utils/request.js +7 -3
  48. package/src/utils/util.js +230 -230
  49. package/vue.config.js +163 -163
  50. package/src/base-client/components/common/ScrollList/SrcollList.vue +0 -113
  51. package/src/base-client/components/common/ScrollList/index.js +0 -3
  52. package/src/base-client/components/iot/DataAnalysisView/DataAnalysisView.vue +0 -244
  53. package/src/base-client/components/iot/DataAnalysisView/index.js +0 -3
  54. package/src/components/dataAnalysisView/UserData.vue +0 -61
package/.env CHANGED
@@ -1,15 +1,15 @@
1
- VUE_APP_PUBLIC_PATH=/
2
- VUE_APP_NAME=Admin
3
- VUE_APP_ROUTES_KEY=admin.routes
4
- VUE_APP_PERMISSIONS_KEY=admin.permissions
5
- VUE_APP_ROLES_KEY=admin.roles
6
- VUE_APP_USER_KEY=admin.user
7
- VUE_APP_LOGIN_KEY=admin.login
8
- VUE_APP_SETTING_KEY=admin.setting
9
- VUE_APP_TBAS_KEY=admin.tabs
10
- VUE_APP_TBAS_TITLES_KEY=admin.tabs.titles
11
- VUE_APP_DICTIONARY_KEY=admin.dictionary
12
- VUE_APP_BADGE_KEY=admin.badge
13
- VUE_APP_SINGLEVALUE_KEY=admin.singlevalue
14
- VUE_APP_DIVISIONSOHCHINA=admin.divisionsohchina
15
- VUE_APP_API_BASE_URL=http://123.60.214.109:8405
1
+ VUE_APP_PUBLIC_PATH=/
2
+ VUE_APP_NAME=Admin
3
+ VUE_APP_ROUTES_KEY=admin.routes
4
+ VUE_APP_PERMISSIONS_KEY=admin.permissions
5
+ VUE_APP_ROLES_KEY=admin.roles
6
+ VUE_APP_USER_KEY=admin.user
7
+ VUE_APP_LOGIN_KEY=admin.login
8
+ VUE_APP_SETTING_KEY=admin.setting
9
+ VUE_APP_TBAS_KEY=admin.tabs
10
+ VUE_APP_TBAS_TITLES_KEY=admin.tabs.titles
11
+ VUE_APP_DICTIONARY_KEY=admin.dictionary
12
+ VUE_APP_BADGE_KEY=admin.badge
13
+ VUE_APP_SINGLEVALUE_KEY=admin.singlevalue
14
+ VUE_APP_DIVISIONSOHCHINA=admin.divisionsohchina
15
+ VUE_APP_API_BASE_URL=http://123.60.214.109:8405
package/.eslintrc.js CHANGED
@@ -1,82 +1,82 @@
1
- module.exports = {
2
- root: true,
3
- env: {
4
- node: true
5
- },
6
- 'extends': [
7
- 'plugin:vue/essential',
8
- 'plugin:vue/strongly-recommended',
9
- '@vue/standard'
10
- ],
11
- rules: {
12
- 'comma-dangle': 'off',
13
- 'no-console': 'off',
14
- 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
15
- 'generator-star-spacing': 'off',
16
- 'no-mixed-operators': 0,
17
- 'vue/max-attributes-per-line': [
18
- 2,
19
- {
20
- 'singleline': 5,
21
- 'multiline': {
22
- 'max': 1,
23
- 'allowFirstLine': false
24
- }
25
- }
26
- ],
27
- 'vue/attribute-hyphenation': 0,
28
- 'vue/html-self-closing': 0,
29
- 'vue/component-name-in-template-casing': 0,
30
- 'vue/html-closing-bracket-spacing': 0,
31
- 'vue/singleline-html-element-content-newline': 0,
32
- 'vue/no-unused-components': 0,
33
- 'vue/multiline-html-element-content-newline': 0,
34
- 'vue/no-use-v-if-with-v-for': 0,
35
- 'vue/html-closing-bracket-newline': 0,
36
- 'vue/no-parsing-error': 0,
37
- 'vue/name-property-casing': 0,
38
- 'no-tabs': 0,
39
- 'quotes': [
40
- 2,
41
- 'single',
42
- {
43
- 'avoidEscape': true,
44
- 'allowTemplateLiterals': true
45
- }
46
- ],
47
- 'semi': [
48
- 2,
49
- 'never',
50
- {
51
- 'beforeStatementContinuationChars': 'never'
52
- }
53
- ],
54
- 'no-delete-var': 2,
55
- 'prefer-const': [
56
- 2,
57
- {
58
- 'ignoreReadBeforeAssign': false
59
- }
60
- ],
61
- 'template-curly-spacing': 'off',
62
- 'indent': 'off',
63
- // 必须使用全等: false
64
- 'eqeqeq': 0,
65
- // 可以使用!! 双重否定
66
- 'no-extra-boolean-cast': 'off'
67
- },
68
- parserOptions: {
69
- parser: 'babel-eslint'
70
- },
71
- overrides: [
72
- {
73
- files: [
74
- '**/__tests__/*.{j,t}s?(x)',
75
- '**/tests/unit/**/*.spec.{j,t}s?(x)'
76
- ],
77
- env: {
78
- jest: true
79
- }
80
- }
81
- ]
82
- }
1
+ module.exports = {
2
+ root: true,
3
+ env: {
4
+ node: true
5
+ },
6
+ 'extends': [
7
+ 'plugin:vue/essential',
8
+ 'plugin:vue/strongly-recommended',
9
+ '@vue/standard'
10
+ ],
11
+ rules: {
12
+ 'comma-dangle': 'off',
13
+ 'no-console': 'off',
14
+ 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
15
+ 'generator-star-spacing': 'off',
16
+ 'no-mixed-operators': 0,
17
+ 'vue/max-attributes-per-line': [
18
+ 2,
19
+ {
20
+ 'singleline': 5,
21
+ 'multiline': {
22
+ 'max': 1,
23
+ 'allowFirstLine': false
24
+ }
25
+ }
26
+ ],
27
+ 'vue/attribute-hyphenation': 0,
28
+ 'vue/html-self-closing': 0,
29
+ 'vue/component-name-in-template-casing': 0,
30
+ 'vue/html-closing-bracket-spacing': 0,
31
+ 'vue/singleline-html-element-content-newline': 0,
32
+ 'vue/no-unused-components': 0,
33
+ 'vue/multiline-html-element-content-newline': 0,
34
+ 'vue/no-use-v-if-with-v-for': 0,
35
+ 'vue/html-closing-bracket-newline': 0,
36
+ 'vue/no-parsing-error': 0,
37
+ 'vue/name-property-casing': 0,
38
+ 'no-tabs': 0,
39
+ 'quotes': [
40
+ 2,
41
+ 'single',
42
+ {
43
+ 'avoidEscape': true,
44
+ 'allowTemplateLiterals': true
45
+ }
46
+ ],
47
+ 'semi': [
48
+ 2,
49
+ 'never',
50
+ {
51
+ 'beforeStatementContinuationChars': 'never'
52
+ }
53
+ ],
54
+ 'no-delete-var': 2,
55
+ 'prefer-const': [
56
+ 2,
57
+ {
58
+ 'ignoreReadBeforeAssign': false
59
+ }
60
+ ],
61
+ 'template-curly-spacing': 'off',
62
+ 'indent': 'off',
63
+ // 必须使用全等: false
64
+ 'eqeqeq': 0,
65
+ // 可以使用!! 双重否定
66
+ 'no-extra-boolean-cast': 'off'
67
+ },
68
+ parserOptions: {
69
+ parser: 'babel-eslint'
70
+ },
71
+ overrides: [
72
+ {
73
+ files: [
74
+ '**/__tests__/*.{j,t}s?(x)',
75
+ '**/tests/unit/**/*.spec.{j,t}s?(x)'
76
+ ],
77
+ env: {
78
+ jest: true
79
+ }
80
+ }
81
+ ]
82
+ }
package/CHANGELOG.md CHANGED
@@ -1,6 +1,12 @@
1
1
  # Change Log
2
2
  > 所有关于本项目的变化都在该文档里。
3
3
 
4
+ **1.2.111 -2022-09-01 @江超**
5
+ - 修复获取字典数据时错误的v4版本判断
6
+
7
+ **1.2.110 -2022-08-31 @杨亚文**
8
+ - 修改请求后只有当返回的token有值时才设置cookie
9
+
4
10
  **1.2.109 -2022-08-28 @张振宇**
5
11
  - 功能新增:
6
12
  - 修改确认按钮位置
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2-client",
3
- "version": "1.2.109",
3
+ "version": "1.2.112",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -10,13 +10,15 @@
10
10
  },
11
11
  "dependencies": {
12
12
  "@amap/amap-jsapi-loader": "^1.0.1",
13
- "@antv/data-set": "^0.11.8",
14
- "@antv/f2": "^3.8.11",
15
13
  "@antv/g2plot": "^2.4.20",
16
- "@logicflow/core": "^1.1.20",
17
- "@logicflow/extension": "^1.1.20",
18
- "@vue/babel-helper-vue-jsx-merge-props": "^1.2.1",
19
- "@vue/babel-preset-jsx": "^1.2.4",
14
+ "lodash.get": "^4.4.2",
15
+ "js-base64": "^3.7.2",
16
+ "jsencrypt": "^3.2.1",
17
+ "vue-json-viewer": "^2.2.22",
18
+ "xlsx": "0.18.5",
19
+ "file-saver": "^2.0.5",
20
+ "@vue/babel-preset-jsx": "^1.4.0",
21
+ "@antv/data-set": "^0.11.8",
20
22
  "animate.css": "^4.1.1",
21
23
  "ant-design-vue": "^1.7.8",
22
24
  "axios": "^0.27.2",
@@ -25,62 +27,41 @@
25
27
  "date-fns": "^2.28.0",
26
28
  "default-passive-events": "^2.0.0",
27
29
  "enquire.js": "^2.1.6",
28
- "file-saver": "^2.0.5",
29
30
  "highlight.js": "^10.7.3",
30
- "js-base64": "^3.7.2",
31
31
  "js-cookie": "^2.2.1",
32
- "jsencrypt": "^3.2.1",
33
- "lodash.get": "^4.4.2",
34
32
  "mockjs": "^1.1.0",
35
33
  "nprogress": "^0.2.0",
36
34
  "viser-vue": "^2.4.8",
37
35
  "vue": "2.6.14",
38
36
  "vue-i18n": "^8.27.2",
39
- "vue-infinite-scroll": "^2.0.2",
40
- "vue-json-viewer": "^2.2.22",
41
37
  "vue-router": "^3.5.4",
42
38
  "vuedraggable": "^2.24.3",
43
- "vuex": "^3.6.2",
44
- "xlsx": "0.18.5"
39
+ "vuex": "^3.6.2"
45
40
  },
46
41
  "devDependencies": {
42
+ "script-loader": "^0.7.2",
47
43
  "@ant-design/colors": "^4.0.5",
48
- "@babel/cli": "^7.18.10",
49
44
  "@babel/core": "^7.18.10",
50
45
  "@vue/cli-plugin-babel": "^4.5.19",
51
46
  "@vue/cli-plugin-eslint": "^4.5.19",
52
- "@vue/cli-plugin-router": "^4.5.19",
53
- "@vue/cli-plugin-unit-jest": "~4.5.19",
54
- "@vue/cli-plugin-vuex": "^4.5.19",
55
47
  "@vue/cli-service": "^4.5.19",
56
48
  "@vue/eslint-config-standard": "^4.0.0",
57
- "@vue/test-utils": "^1.3.0",
58
- "@vue/vue2-jest": "^27.0.0",
59
49
  "@vuepress/plugin-back-to-top": "^1.9.7",
60
50
  "babel-eslint": "^10.1.0",
61
- "babel-jest": "^27.1.0",
62
51
  "babel-plugin-transform-remove-console": "^6.9.4",
63
52
  "babel-polyfill": "^6.26.0",
64
53
  "compression-webpack-plugin": "^4.0.1",
65
54
  "deepmerge": "^4.2.2",
66
- "echarts": "^5.3.3",
67
55
  "eslint": "^6.8.0",
68
56
  "eslint-plugin-import": "^2.26.0",
69
57
  "eslint-plugin-node": "^11.1.0",
70
- "eslint-plugin-standard": "^5.0.0",
71
58
  "eslint-plugin-vue": "^6.2.2",
59
+ "eslint-plugin-promise": "^4.3.1",
60
+ "eslint-plugin-standard": "^4.1.0",
72
61
  "fast-deep-equal": "^3.1.3",
73
- "gh-pages": "^3.2.3",
74
- "jest": "^27.1.0",
75
62
  "less-loader": "^6.2.0",
76
- "react-bmap": "^1.0.130",
77
- "script-loader": "^0.7.2",
78
63
  "style-resources-loader": "^1.5.0",
79
- "vue-amap": "^0.5.10",
80
- "vue-baidu-map": "^0.21.22",
81
- "vue-bmap-gl": "0.0.30",
82
64
  "vue-cli-plugin-style-resources-loader": "^0.1.5",
83
- "vue-mapvgl": "0.0.34",
84
65
  "vue-template-compiler": "2.6.14",
85
66
  "vuepress": "^1.9.7",
86
67
  "webpack": "^4.46.0",
@@ -9,9 +9,7 @@ import WebmeterAnalysisView from '@vue2-client/base-client/components/iot/Webmet
9
9
  import XCard from '@vue2-client/base-client/components/common/XCard/XCard'
10
10
  import XFormCol from '@vue2-client/base-client/components/common/XFormCol'
11
11
  import XBadge from '@vue2-client/base-client/components/common/XBadge'
12
- import DataAnalysisView from '@vue2-client/base-client/components/iot/DataAnalysisView'
13
12
  import DataAnalysisUser from '@vue2-client/base-client/components/iot/DataAnalysisUser'
14
- import SrcollList from '@vue2-client/base-client/components/common/ScrollList'
15
13
  import AmapPointRendering from '@vue2-client/base-client/components/common/AmapMarker'
16
14
  import DeviceTypeDetailsView from '@vue2-client/base-client/components/iot/DeviceTypeDetailsView'
17
15
  import DeviceBrandDetailsView from '@vue2-client/base-client/components/iot/DeviceBrandDetailsView'
@@ -43,9 +41,7 @@ Vue.component('WebmeterAnalysisView', WebmeterAnalysisView)
43
41
  Vue.component('XCard', XCard)
44
42
  Vue.component('XBadge', XBadge)
45
43
  Vue.component('XFormCol', XFormCol)
46
- Vue.component('DataAnalysisView', DataAnalysisView)
47
44
  Vue.component('DataAnalysisUser', DataAnalysisUser)
48
- Vue.component('SrcollList', SrcollList)
49
45
  Vue.component('DeviceTypeDetailsView', DeviceTypeDetailsView)
50
46
  Vue.component('DeviceBrandDetailsView', DeviceBrandDetailsView)
51
47
  Vue.component('DeviceDetailsView', DeviceDetailsView)
@@ -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>