From b5546c748f4a713992f18aa180a12ce4133943b1 Mon Sep 17 00:00:00 2001 From: SjS Date: Wed, 23 Apr 2025 10:51:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BA=97=E9=93=BA=E7=9B=B8=E5=85=B3=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + src/api/bst/floor.js | 44 +++ src/components/AreaTextSelect/index.vue | 107 ++++++ .../Map/PlaceSearch/PlaceSearchDialog.vue | 108 ++++++ .../Map/PlaceSearch/PlaceSearchMap.vue | 297 +++++++++++++++ src/main.js | 6 + src/utils/map.js | 59 +++ src/views/bst/floor/index.vue | 344 ++++++++++++++++++ src/views/bst/store/index.vue | 8 +- 9 files changed, 970 insertions(+), 4 deletions(-) create mode 100644 src/api/bst/floor.js create mode 100644 src/components/AreaTextSelect/index.vue create mode 100644 src/components/Map/PlaceSearch/PlaceSearchDialog.vue create mode 100644 src/components/Map/PlaceSearch/PlaceSearchMap.vue create mode 100644 src/utils/map.js create mode 100644 src/views/bst/floor/index.vue diff --git a/package.json b/package.json index 1832293..fa7b6b1 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,7 @@ "@pansy/watermark": "^2.3.0", "@riophae/vue-treeselect": "0.4.0", "axios": "0.28.1", + "element-china-area-data": "^6.1.0", "clipboard": "2.0.8", "core-js": "3.37.1", "decimal.js": "^10.4.3", diff --git a/src/api/bst/floor.js b/src/api/bst/floor.js new file mode 100644 index 0000000..89c4d5a --- /dev/null +++ b/src/api/bst/floor.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询楼层列表列表 +export function listFloor(query) { + return request({ + url: '/bst/floor/list', + method: 'get', + params: query + }) +} + +// 查询楼层列表详细 +export function getFloor(floorId) { + return request({ + url: '/bst/floor/' + floorId, + method: 'get' + }) +} + +// 新增楼层列表 +export function addFloor(data) { + return request({ + url: '/bst/floor', + method: 'post', + data: data + }) +} + +// 修改楼层列表 +export function updateFloor(data) { + return request({ + url: '/bst/floor', + method: 'put', + data: data + }) +} + +// 删除楼层列表 +export function delFloor(floorId) { + return request({ + url: '/bst/floor/' + floorId, + method: 'delete' + }) +} diff --git a/src/components/AreaTextSelect/index.vue b/src/components/AreaTextSelect/index.vue new file mode 100644 index 0000000..33c4f7f --- /dev/null +++ b/src/components/AreaTextSelect/index.vue @@ -0,0 +1,107 @@ + + + + + diff --git a/src/components/Map/PlaceSearch/PlaceSearchDialog.vue b/src/components/Map/PlaceSearch/PlaceSearchDialog.vue new file mode 100644 index 0000000..cf64e98 --- /dev/null +++ b/src/components/Map/PlaceSearch/PlaceSearchDialog.vue @@ -0,0 +1,108 @@ + + + + + diff --git a/src/components/Map/PlaceSearch/PlaceSearchMap.vue b/src/components/Map/PlaceSearch/PlaceSearchMap.vue new file mode 100644 index 0000000..cbcbcf2 --- /dev/null +++ b/src/components/Map/PlaceSearch/PlaceSearchMap.vue @@ -0,0 +1,297 @@ + + + diff --git a/src/main.js b/src/main.js index ee24aed..f2f9815 100644 --- a/src/main.js +++ b/src/main.js @@ -43,6 +43,7 @@ import DictData from '@/components/DictData'; import filter from '@/utils/filter'; // 行内表单组件 import FormCol from '@/components/FormCol'; +import globalConfig from "@/utils/config/globalConfig"; filter(Vue); @@ -214,3 +215,8 @@ Vue.directive('tableMove', { } } }) + +// 高德地图 +window._AMapSecurityConfig = { + securityJsCode: globalConfig.aMap.secret, +}; diff --git a/src/utils/map.js b/src/utils/map.js new file mode 100644 index 0000000..538435e --- /dev/null +++ b/src/utils/map.js @@ -0,0 +1,59 @@ + + +/** + * 创建并获取一个点标记 + * @param lng 经度 + * @param lat 纬度 + * @param icon 图片路径 + * @param offset 偏移量 + */ +export function createMaker(lng, lat, icon = null, offset = null, size = null) { + let option = { + position: [lng, lat], + } + if (icon != null) { + option.icon = icon; + } + if (offset != null) { + option.offset = new AMap.Pixel(offset[0], offset[1]); + } + if (size != null) { + option.size = new AMap.Size(size[0], size[1]); + } + return new AMap.Marker(option); +} + + +export function createIcon(image, size, imageSize, offset) { + // 创建一个 icon + return new AMap.Icon({ + size: new AMap.Size(size[0], size[1]), + image: '//a.amap.com/jsapi_demos/static/demo-center/icons/dir-marker.png', + imageSize: new AMap.Size(imageSize[0], imageSize[1]), + imageOffset: new AMap.Pixel(offset[0], offset[1]) + }); +} + +/** + * 点标记工厂 + * 用于创造各种类型的点标记 + */ +export const makerFactory = { + /// 创建指定类型点标记 + createMaker(lng, lat, type) { + switch(type) { + case 'store': return this.createStoreMaker(lng, lat); + default: return createMaker(lng, lat); + } + }, + // 创建店铺点标记 + createStoreMaker(lng, lat) { + let icon = new AMap.Icon({ + size: new AMap.Size(36, 43), + image: 'https://api.ccttiot.com/Fofy3sTm5cYkYGcQDCFsMzcxkcF8', + imageSize: new AMap.Size(36, 43), + imageOffset: new AMap.Pixel(0, 0) + }); + return createMaker(lng, lat, icon, [-18, -43]); + } +} diff --git a/src/views/bst/floor/index.vue b/src/views/bst/floor/index.vue new file mode 100644 index 0000000..06cf7bc --- /dev/null +++ b/src/views/bst/floor/index.vue @@ -0,0 +1,344 @@ + + + diff --git a/src/views/bst/store/index.vue b/src/views/bst/store/index.vue index e74c954..4fb36bb 100644 --- a/src/views/bst/store/index.vue +++ b/src/views/bst/store/index.vue @@ -224,8 +224,8 @@ @@ -343,8 +343,8 @@ export default { methods: { onSubmitAddress(addr) { this.form.address = addr.name; - this.form.lat = addr.lat; - this.form.lng = addr.lng; + this.form.latitude = addr.lat; + this.form.longitude = addr.lng; this.form.province = addr.province; this.form.city = addr.city; this.form.county = addr.county;