diff --git a/.env b/.env index b7e00bf..03edcf3 100644 --- a/.env +++ b/.env @@ -8,4 +8,10 @@ VITE_GLOB_APP_TITLE = 卓景出行 VITE_IMG_BASE_URL = '' # 本地mock数据 true开启 false关闭 -VITE_APP_OPEN_MOCK = false \ No newline at end of file +VITE_APP_OPEN_MOCK = false + +#高德securityJsCode +VITE_GLOB_AMAP_SECURITY_JS_CODE = 'b85d17b7e0fa98864d495a9a52f162e4' + +# 高德密钥 +VITE_GLOB_AMAP_KEY = '0e6910fae6848722b0e57f0c01597499' \ No newline at end of file diff --git a/.env.development b/.env.development index a6bf975..c9e3f3f 100644 --- a/.env.development +++ b/.env.development @@ -9,4 +9,4 @@ VITE_ROUTER_MODE = hash VITE_PUBLIC_PATH = './' # 请求路径 管理系统/开发环境 -VITE_APP_BASE_URL = 'http://192.168.2.200:10010' +VITE_APP_BASE_URL = 'http://192.168.101.20:10010' diff --git a/package.json b/package.json index 0446e20..178b8fe 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "preinstall": "npx only-allow pnpm" }, "dependencies": { + "@amap/amap-jsapi-loader": "^1.0.1", "@arco-design/color": "^0.4.0", "@codemirror/lang-javascript": "^6.2.2", "@codemirror/lang-json": "^6.0.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 16e3c50..673b842 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,6 +8,9 @@ importers: .: dependencies: + '@amap/amap-jsapi-loader': + specifier: ^1.0.1 + version: 1.0.1 '@arco-design/color': specifier: ^0.4.0 version: 0.4.0 @@ -237,6 +240,9 @@ importers: packages: + '@amap/amap-jsapi-loader@1.0.1': + resolution: {integrity: sha512-nPyLKt7Ow/ThHLkSvn2etQlUzqxmTVgK7bIgwdBRTg2HK5668oN7xVxkaiRe3YZEzGzfV2XgH5Jmu2T73ljejw==} + '@antfu/utils@0.7.10': resolution: {integrity: sha512-+562v9k4aI80m1+VuMHehNJWLOFjBnXn3tdOitzD0il5b7smkSBal4+a3oKiQTbrwMmN/TBUMDvbdoWDehgOww==} @@ -4941,6 +4947,8 @@ packages: snapshots: + '@amap/amap-jsapi-loader@1.0.1': {} + '@antfu/utils@0.7.10': {} '@arco-design/color@0.4.0': @@ -9270,6 +9278,7 @@ snapshots: print-js: 1.6.0 qrcode: 1.5.4 recorder-core: 1.3.25011100 + sm-crypto: 0.3.13 sortablejs: 1.15.6 uuid: 11.1.0 vue: 3.5.15(typescript@5.8.3) diff --git a/src/api/modules/region/index.ts b/src/api/modules/region/index.ts new file mode 100644 index 0000000..d194ced --- /dev/null +++ b/src/api/modules/region/index.ts @@ -0,0 +1,56 @@ +import axios from "@/api"; +import { RegionPageParams, AddRegion } from "./types"; + +// 分页查询运营区域表 +export const getRegionByPageAPI = (params: RegionPageParams) => { + return axios({ + url: "/operations/ebikeRegion/page", + method: "get", + params + }); +}; + +// 添加运营区域 +export const addRegionAPI = (data: AddRegion) => { + return axios({ + url: "/operations/ebikeRegion/save", + method: "post", + data + }); +}; + +// 删除运营区域表 +export const deleteRegionAPI = (regionId: string) => { + return axios({ + url: `/operations/ebikeRegion/remove`, + method: "get", + params: { regionId } + }); +}; + +// 更新运营区域表 +export const updateRegionAPI = (data: AddRegion) => { + return axios({ + url: "/operations/ebikeRegion/update", + method: "post", + data + }); +}; + +// 开始运营 +export const startRegionAPI = (regionId: string) => { + return axios({ + url: `/operations/ebikeRegion/commenceOperation`, + method: "get", + params: { regionId } + }); +}; + +// 停止运营 +export const stopRegionAPI = (regionId: string) => { + return axios({ + url: `/operations/ebikeRegion/stopOperation`, + method: "get", + params: { regionId } + }); +}; diff --git a/src/api/modules/region/types.ts b/src/api/modules/region/types.ts new file mode 100644 index 0000000..c360bda --- /dev/null +++ b/src/api/modules/region/types.ts @@ -0,0 +1,25 @@ +interface ListType { + pageNum: number; + pageSize: number; +} + +// 分页查询运营区域表参数 +export interface RegionPageParams extends ListType { + regionName?: string; // 运营区名称 + regionSimpleName?: string; //运营区简称 +} + +// 添加运营区域 +type Coordinate = [number, number]; +interface RegionPolygon { + type: "polygon" | "point"; + coordinates: Coordinate[]; +} +export interface AddRegion { + regionId?: string; + regionName: string; + regionPolygon: RegionPolygon; + regionSimpleName?: string | null; + status?: number; + operatorId: string; +} diff --git a/src/auto-import.d.ts b/src/auto-import.d.ts index 1f3bbc4..fd7ba7c 100644 --- a/src/auto-import.d.ts +++ b/src/auto-import.d.ts @@ -5,6 +5,8 @@ // Generated by unplugin-auto-import export {} declare global { + const AMap: typeof import('@arco-design/web-vue')['Map'] + const AMaps: typeof import('@arco-design/web-vue')['Maps'] const EffectScope: typeof import('vue')['EffectScope'] const Message: (typeof import("./globals/index"))["Message"] const arcoMessage: typeof import('./globals/index')['arcoMessage'] diff --git a/src/router/route.ts b/src/router/route.ts index 164707d..5bbb383 100644 --- a/src/router/route.ts +++ b/src/router/route.ts @@ -25,6 +25,8 @@ import Layout from "@/layout/index.vue"; * @description 前端控制路由 直接改 mock/_data/system_menu 中的路由,后端控制则不需要 * @returns 返回路由菜单数据 */ + +// @/views/login/login.vue export const staticRoutes = [ { path: "/", diff --git a/src/utils/map-tools.ts b/src/utils/map-tools.ts new file mode 100644 index 0000000..aa68df7 --- /dev/null +++ b/src/utils/map-tools.ts @@ -0,0 +1,42 @@ +/** + * 表示一个二维地理坐标点 + */ +type Point = [number, number]; + +/** + * 点位数据处理工具 + */ +export const PointDataHandler = { + /** + * 准备上传:在点位数组末尾添加第一个点位,用于闭合路径(如多边形)。 + * @param points - 点位数组,每个点为 [经度, 纬度] 格式。 + * @returns 处理后的点位数组。 + */ + prepareForUpload(points: Point[]): Point[] { + if (!Array.isArray(points) || points.length < 2) { + return points; + } + return [...points, points[0]]; + }, + + /** + * 恢复显示:移除为闭合路径而添加的最后一个点位(仅当其与第一个点相同时)。 + * @param points - 从服务端返回的点位数组。 + * @returns 去除重复闭合点后的点位数组。 + */ + restoreForDisplay(points: Point[]): Point[] { + if (!Array.isArray(points) || points.length <= 1) { + return points; + } + + const first = points[0]; + const last = points[points.length - 1]; + + // 仅当最后一个点与第一个点完全相同时才移除 + if (first[0] === last[0] && first[1] === last[1]) { + return points.slice(0, -1); + } + + return points; + } +}; diff --git a/src/views/component/RegionalMap/RegionalMap.vue b/src/views/component/RegionalMap/RegionalMap.vue new file mode 100644 index 0000000..0d18b64 --- /dev/null +++ b/src/views/component/RegionalMap/RegionalMap.vue @@ -0,0 +1,219 @@ + + + + + diff --git a/src/views/urban/operateRegion/component/addForm.vue b/src/views/urban/operateRegion/component/addForm.vue new file mode 100644 index 0000000..15f4a2a --- /dev/null +++ b/src/views/urban/operateRegion/component/addForm.vue @@ -0,0 +1,116 @@ + + + + + diff --git a/src/views/urban/operateRegion/operateRegion.vue b/src/views/urban/operateRegion/operateRegion.vue new file mode 100644 index 0000000..5350e57 --- /dev/null +++ b/src/views/urban/operateRegion/operateRegion.vue @@ -0,0 +1,377 @@ + + + + +