af-mobile-client-vue3 1.3.87 → 1.3.89
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/package.json +115 -115
- package/src/api/user/index.ts +45 -45
- package/src/components/data/XCellList/index.vue +1 -1
- package/src/components/data/XOlMap/index.vue +197 -0
- package/src/components/data/XOlMap/types.ts +42 -0
- package/src/router/routes.ts +1 -1
- package/src/services/api/Login.ts +6 -6
- package/src/services/v3Api.ts +170 -170
- package/src/stores/modules/user.ts +362 -362
- package/src/styles/login.less +109 -109
- package/src/types/platform.ts +194 -194
- package/src/utils/platform-auth.ts +150 -150
- package/src/utils/queryFormDefaultRangePicker.ts +57 -57
- package/src/utils/wechat.ts +297 -297
- package/src/views/component/XCellListView/index.vue +48 -21
- package/src/views/component/XFormGroupView/index.vue +82 -78
- package/src/views/component/XFormView/index.vue +42 -41
- package/src/views/component/XOlMapView/index.vue +37 -1
- package/src/views/component/XOlMapView/testData.ts +77 -0
- package/src/views/external/index.vue +158 -158
- package/src/views/user/register/index.vue +958 -958
- package/vite.config.ts +115 -115
- package/certs/127.0.0.1+2-key.pem +0 -28
- package/certs/127.0.0.1+2.pem +0 -27
- package/mock/modules/prose.mock.ts.timestamp-1758877157774.mjs +0 -53
- package/mock/modules/user.mock.ts.timestamp-1758877157774.mjs +0 -97
package/package.json
CHANGED
|
@@ -1,115 +1,115 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "af-mobile-client-vue3",
|
|
3
|
-
"type": "module",
|
|
4
|
-
"version": "1.3.
|
|
5
|
-
"packageManager": "pnpm@10.13.1",
|
|
6
|
-
"description": "Vue + Vite component lib",
|
|
7
|
-
"engines": {
|
|
8
|
-
"node": ">=20.19.0"
|
|
9
|
-
},
|
|
10
|
-
"scripts": {
|
|
11
|
-
"dev": "cross-env MOCK_SERVER_PORT=8086 vite",
|
|
12
|
-
"compress": "node ./compress.js",
|
|
13
|
-
"build:dev": "vue-tsc --noEmit && vite build --mode development && pnpm run compress",
|
|
14
|
-
"build:pro": "vue-tsc --noEmit && vite build --mode production && pnpm run compress",
|
|
15
|
-
"preview": "vite preview",
|
|
16
|
-
"lint": "eslint .",
|
|
17
|
-
"lint:fix": "eslint . --fix",
|
|
18
|
-
"release": "bumpp --commit --push --tag",
|
|
19
|
-
"typecheck": "vue-tsc --noEmit",
|
|
20
|
-
"commitlint": "commitlint --edit",
|
|
21
|
-
"prepare": "simple-git-hooks"
|
|
22
|
-
},
|
|
23
|
-
"dependencies": {
|
|
24
|
-
"@iconify/vue": "4.3.0",
|
|
25
|
-
"@micro-zoe/micro-app": "1.0.0-rc.26",
|
|
26
|
-
"@unhead/vue": "2.0.12",
|
|
27
|
-
"@vant/area-data": "^2.0.0",
|
|
28
|
-
"@vant/touch-emulator": "^1.4.0",
|
|
29
|
-
"@vant/use": "^1.6.0",
|
|
30
|
-
"@vueuse/core": "^13.5.0",
|
|
31
|
-
"axios": "^1.10.0",
|
|
32
|
-
"crypto-js": "^4.2.0",
|
|
33
|
-
"dayjs": "^1.11.13",
|
|
34
|
-
"echarts": "^5.6.0",
|
|
35
|
-
"lodash-es": "^4.17.21",
|
|
36
|
-
"nprogress": "^0.2.0",
|
|
37
|
-
"ol": "^10.5.0",
|
|
38
|
-
"pinia": "^3.0.3",
|
|
39
|
-
"pinia-plugin-persistedstate": "^4.4.1",
|
|
40
|
-
"resize-detector": "^0.3.0",
|
|
41
|
-
"vant": "^4.9.21",
|
|
42
|
-
"vconsole": "^3.15.1",
|
|
43
|
-
"vue": "^3.5.17",
|
|
44
|
-
"vue-i18n": "^11.1.10",
|
|
45
|
-
"vue-router": "^4.5.1",
|
|
46
|
-
"vue3-hash-calendar": "^1.1.3",
|
|
47
|
-
"weixin-js-sdk": "^1.6.5"
|
|
48
|
-
},
|
|
49
|
-
"devDependencies": {
|
|
50
|
-
"@antfu/eslint-config": "4.17.0",
|
|
51
|
-
"@commitlint/cli": "^19.8.1",
|
|
52
|
-
"@commitlint/config-conventional": "^19.8.1",
|
|
53
|
-
"@commitlint/types": "^19.8.1",
|
|
54
|
-
"@iconify/json": "2.2.318",
|
|
55
|
-
"@iconify/utils": "^2.3.0",
|
|
56
|
-
"@intlify/unplugin-vue-i18n": "^6.0.8",
|
|
57
|
-
"@types/crypto-js": "^4.2.2",
|
|
58
|
-
"@types/lodash-es": "^4.17.12",
|
|
59
|
-
"@types/node": "^24.0.14",
|
|
60
|
-
"@types/nprogress": "^0.2.3",
|
|
61
|
-
"@unocss/eslint-config": "66.3.3",
|
|
62
|
-
"@vitejs/plugin-legacy": "^7.0.1",
|
|
63
|
-
"@vitejs/plugin-vue": "^6.0.0",
|
|
64
|
-
"autoprefixer": "^10.4.21",
|
|
65
|
-
"bumpp": "^10.2.0",
|
|
66
|
-
"consola": "^3.4.2",
|
|
67
|
-
"cross-env": "^7.0.3",
|
|
68
|
-
"eslint": "^9.31.0",
|
|
69
|
-
"eslint-plugin-format": "^1.0.1",
|
|
70
|
-
"less": "^4.4.0",
|
|
71
|
-
"lint-staged": "^16.1.2",
|
|
72
|
-
"mockjs": "^1.1.0",
|
|
73
|
-
"postcss-mobile-forever": "^5.0.0",
|
|
74
|
-
"rollup": "^4.45.1",
|
|
75
|
-
"simple-git-hooks": "^2.13.0",
|
|
76
|
-
"tar": "^7.4.3",
|
|
77
|
-
"terser": "^5.43.1",
|
|
78
|
-
"typescript": "^5.8.3",
|
|
79
|
-
"unocss": "66.3.3",
|
|
80
|
-
"vite": "^7.0.5",
|
|
81
|
-
"vite-plugin-compression": "^0.5.1",
|
|
82
|
-
"vite-plugin-mock-dev-server": "^1.9.1",
|
|
83
|
-
"vite-plugin-pwa": "^1.0.1",
|
|
84
|
-
"vite-plugin-sitemap": "^0.8.2",
|
|
85
|
-
"vite-plugin-vconsole": "^2.1.1",
|
|
86
|
-
"vite-plugin-vue-devtools": "^7.7.7",
|
|
87
|
-
"vue-tsc": "^3.0.2"
|
|
88
|
-
},
|
|
89
|
-
"pnpm": {
|
|
90
|
-
"allowedDeprecatedVersions": {
|
|
91
|
-
"glob": "7.2.3",
|
|
92
|
-
"inflight": "1.0.6",
|
|
93
|
-
"sourcemap-codec": "1.4.8"
|
|
94
|
-
},
|
|
95
|
-
"peerDependencyRules": {
|
|
96
|
-
"allowedVersions": {}
|
|
97
|
-
},
|
|
98
|
-
"onlyBuiltDependencies": [
|
|
99
|
-
"core-js",
|
|
100
|
-
"esbuild",
|
|
101
|
-
"simple-git-hooks",
|
|
102
|
-
"unrs-resolver"
|
|
103
|
-
]
|
|
104
|
-
},
|
|
105
|
-
"resolutions": {
|
|
106
|
-
"vite": "^7.0.5"
|
|
107
|
-
},
|
|
108
|
-
"simple-git-hooks": {
|
|
109
|
-
"pre-commit": "pnpm lint-staged",
|
|
110
|
-
"commit-msg": "pnpm commitlint $1"
|
|
111
|
-
},
|
|
112
|
-
"lint-staged": {
|
|
113
|
-
"*": "eslint --fix"
|
|
114
|
-
}
|
|
115
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "af-mobile-client-vue3",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "1.3.89",
|
|
5
|
+
"packageManager": "pnpm@10.13.1",
|
|
6
|
+
"description": "Vue + Vite component lib",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=20.19.0"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"dev": "cross-env MOCK_SERVER_PORT=8086 vite",
|
|
12
|
+
"compress": "node ./compress.js",
|
|
13
|
+
"build:dev": "vue-tsc --noEmit && vite build --mode development && pnpm run compress",
|
|
14
|
+
"build:pro": "vue-tsc --noEmit && vite build --mode production && pnpm run compress",
|
|
15
|
+
"preview": "vite preview",
|
|
16
|
+
"lint": "eslint .",
|
|
17
|
+
"lint:fix": "eslint . --fix",
|
|
18
|
+
"release": "bumpp --commit --push --tag",
|
|
19
|
+
"typecheck": "vue-tsc --noEmit",
|
|
20
|
+
"commitlint": "commitlint --edit",
|
|
21
|
+
"prepare": "simple-git-hooks"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@iconify/vue": "4.3.0",
|
|
25
|
+
"@micro-zoe/micro-app": "1.0.0-rc.26",
|
|
26
|
+
"@unhead/vue": "2.0.12",
|
|
27
|
+
"@vant/area-data": "^2.0.0",
|
|
28
|
+
"@vant/touch-emulator": "^1.4.0",
|
|
29
|
+
"@vant/use": "^1.6.0",
|
|
30
|
+
"@vueuse/core": "^13.5.0",
|
|
31
|
+
"axios": "^1.10.0",
|
|
32
|
+
"crypto-js": "^4.2.0",
|
|
33
|
+
"dayjs": "^1.11.13",
|
|
34
|
+
"echarts": "^5.6.0",
|
|
35
|
+
"lodash-es": "^4.17.21",
|
|
36
|
+
"nprogress": "^0.2.0",
|
|
37
|
+
"ol": "^10.5.0",
|
|
38
|
+
"pinia": "^3.0.3",
|
|
39
|
+
"pinia-plugin-persistedstate": "^4.4.1",
|
|
40
|
+
"resize-detector": "^0.3.0",
|
|
41
|
+
"vant": "^4.9.21",
|
|
42
|
+
"vconsole": "^3.15.1",
|
|
43
|
+
"vue": "^3.5.17",
|
|
44
|
+
"vue-i18n": "^11.1.10",
|
|
45
|
+
"vue-router": "^4.5.1",
|
|
46
|
+
"vue3-hash-calendar": "^1.1.3",
|
|
47
|
+
"weixin-js-sdk": "^1.6.5"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@antfu/eslint-config": "4.17.0",
|
|
51
|
+
"@commitlint/cli": "^19.8.1",
|
|
52
|
+
"@commitlint/config-conventional": "^19.8.1",
|
|
53
|
+
"@commitlint/types": "^19.8.1",
|
|
54
|
+
"@iconify/json": "2.2.318",
|
|
55
|
+
"@iconify/utils": "^2.3.0",
|
|
56
|
+
"@intlify/unplugin-vue-i18n": "^6.0.8",
|
|
57
|
+
"@types/crypto-js": "^4.2.2",
|
|
58
|
+
"@types/lodash-es": "^4.17.12",
|
|
59
|
+
"@types/node": "^24.0.14",
|
|
60
|
+
"@types/nprogress": "^0.2.3",
|
|
61
|
+
"@unocss/eslint-config": "66.3.3",
|
|
62
|
+
"@vitejs/plugin-legacy": "^7.0.1",
|
|
63
|
+
"@vitejs/plugin-vue": "^6.0.0",
|
|
64
|
+
"autoprefixer": "^10.4.21",
|
|
65
|
+
"bumpp": "^10.2.0",
|
|
66
|
+
"consola": "^3.4.2",
|
|
67
|
+
"cross-env": "^7.0.3",
|
|
68
|
+
"eslint": "^9.31.0",
|
|
69
|
+
"eslint-plugin-format": "^1.0.1",
|
|
70
|
+
"less": "^4.4.0",
|
|
71
|
+
"lint-staged": "^16.1.2",
|
|
72
|
+
"mockjs": "^1.1.0",
|
|
73
|
+
"postcss-mobile-forever": "^5.0.0",
|
|
74
|
+
"rollup": "^4.45.1",
|
|
75
|
+
"simple-git-hooks": "^2.13.0",
|
|
76
|
+
"tar": "^7.4.3",
|
|
77
|
+
"terser": "^5.43.1",
|
|
78
|
+
"typescript": "^5.8.3",
|
|
79
|
+
"unocss": "66.3.3",
|
|
80
|
+
"vite": "^7.0.5",
|
|
81
|
+
"vite-plugin-compression": "^0.5.1",
|
|
82
|
+
"vite-plugin-mock-dev-server": "^1.9.1",
|
|
83
|
+
"vite-plugin-pwa": "^1.0.1",
|
|
84
|
+
"vite-plugin-sitemap": "^0.8.2",
|
|
85
|
+
"vite-plugin-vconsole": "^2.1.1",
|
|
86
|
+
"vite-plugin-vue-devtools": "^7.7.7",
|
|
87
|
+
"vue-tsc": "^3.0.2"
|
|
88
|
+
},
|
|
89
|
+
"pnpm": {
|
|
90
|
+
"allowedDeprecatedVersions": {
|
|
91
|
+
"glob": "7.2.3",
|
|
92
|
+
"inflight": "1.0.6",
|
|
93
|
+
"sourcemap-codec": "1.4.8"
|
|
94
|
+
},
|
|
95
|
+
"peerDependencyRules": {
|
|
96
|
+
"allowedVersions": {}
|
|
97
|
+
},
|
|
98
|
+
"onlyBuiltDependencies": [
|
|
99
|
+
"core-js",
|
|
100
|
+
"esbuild",
|
|
101
|
+
"simple-git-hooks",
|
|
102
|
+
"unrs-resolver"
|
|
103
|
+
]
|
|
104
|
+
},
|
|
105
|
+
"resolutions": {
|
|
106
|
+
"vite": "^7.0.5"
|
|
107
|
+
},
|
|
108
|
+
"simple-git-hooks": {
|
|
109
|
+
"pre-commit": "pnpm lint-staged",
|
|
110
|
+
"commit-msg": "pnpm commitlint $1"
|
|
111
|
+
},
|
|
112
|
+
"lint-staged": {
|
|
113
|
+
"*": "eslint --fix"
|
|
114
|
+
}
|
|
115
|
+
}
|
package/src/api/user/index.ts
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import { loginApi } from '@af-mobile-client-vue3/services/api/Login'
|
|
2
|
-
|
|
3
|
-
import { get, post } from '@af-mobile-client-vue3/services/restTools'
|
|
4
|
-
import { http } from '@af-mobile-client-vue3/utils/http'
|
|
5
|
-
|
|
6
|
-
export interface BasicResponseModel<T = any> {
|
|
7
|
-
code: number
|
|
8
|
-
msg: string
|
|
9
|
-
data: T
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function login(data: any) {
|
|
13
|
-
return post(
|
|
14
|
-
loginApi.Login,
|
|
15
|
-
data,
|
|
16
|
-
)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export function OALogin(data: any) {
|
|
20
|
-
return get(`/af-system/user/${data.username}/${data.password}/智慧OA`)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* @description: 获取用户信息
|
|
25
|
-
*/
|
|
26
|
-
export function getUserInfo(data: any) {
|
|
27
|
-
const params = {
|
|
28
|
-
resourceName: data.resourceName,
|
|
29
|
-
isMobile: true,
|
|
30
|
-
}
|
|
31
|
-
return get(
|
|
32
|
-
`/af-system/user/info/${data.username}`,
|
|
33
|
-
params,
|
|
34
|
-
)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* @description: 用户登出
|
|
39
|
-
*/
|
|
40
|
-
export function doLogout() {
|
|
41
|
-
return http.request({
|
|
42
|
-
url: loginApi.Logout,
|
|
43
|
-
method: 'DELETE',
|
|
44
|
-
})
|
|
45
|
-
}
|
|
1
|
+
import { loginApi } from '@af-mobile-client-vue3/services/api/Login'
|
|
2
|
+
|
|
3
|
+
import { get, post } from '@af-mobile-client-vue3/services/restTools'
|
|
4
|
+
import { http } from '@af-mobile-client-vue3/utils/http'
|
|
5
|
+
|
|
6
|
+
export interface BasicResponseModel<T = any> {
|
|
7
|
+
code: number
|
|
8
|
+
msg: string
|
|
9
|
+
data: T
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function login(data: any) {
|
|
13
|
+
return post(
|
|
14
|
+
loginApi.Login,
|
|
15
|
+
data,
|
|
16
|
+
)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function OALogin(data: any) {
|
|
20
|
+
return get(`/af-system/user/${data.username}/${data.password}/智慧OA`)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @description: 获取用户信息
|
|
25
|
+
*/
|
|
26
|
+
export function getUserInfo(data: any) {
|
|
27
|
+
const params = {
|
|
28
|
+
resourceName: data.resourceName,
|
|
29
|
+
isMobile: true,
|
|
30
|
+
}
|
|
31
|
+
return get(
|
|
32
|
+
`/af-system/user/info/${data.username}`,
|
|
33
|
+
params,
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @description: 用户登出
|
|
39
|
+
*/
|
|
40
|
+
export function doLogout() {
|
|
41
|
+
return http.request({
|
|
42
|
+
url: loginApi.Logout,
|
|
43
|
+
method: 'DELETE',
|
|
44
|
+
})
|
|
45
|
+
}
|
|
@@ -1308,7 +1308,7 @@ function handleCheckboxChange(item: any, checked: boolean) {
|
|
|
1308
1308
|
min-width: 76px;
|
|
1309
1309
|
height: 40px;
|
|
1310
1310
|
border-radius: 10px;
|
|
1311
|
-
padding: 0
|
|
1311
|
+
padding: 0 10px;
|
|
1312
1312
|
// font-size: var(--van-font-size-md);
|
|
1313
1313
|
transition: all 0.2s ease;
|
|
1314
1314
|
&:active {
|
|
@@ -12,6 +12,8 @@ import type {
|
|
|
12
12
|
PhoneLocationStatus,
|
|
13
13
|
PointData,
|
|
14
14
|
PointLayerConfig,
|
|
15
|
+
PolygonData,
|
|
16
|
+
PolygonLayerConfig,
|
|
15
17
|
TrackData,
|
|
16
18
|
WebGLPointOptions,
|
|
17
19
|
WMSLayerConfig,
|
|
@@ -25,6 +27,7 @@ import { defaults as defaultControls, ScaleLine } from 'ol/control'
|
|
|
25
27
|
import Feature from 'ol/Feature'
|
|
26
28
|
import LineString from 'ol/geom/LineString'
|
|
27
29
|
import Point from 'ol/geom/Point'
|
|
30
|
+
import Polygon from 'ol/geom/Polygon'
|
|
28
31
|
import { defaults as defaultInteractions } from 'ol/interaction'
|
|
29
32
|
import { Image as ImageLayer, Tile as TileLayer, Vector as VectorLayer } from 'ol/layer'
|
|
30
33
|
import { fromLonLat, toLonLat } from 'ol/proj'
|
|
@@ -91,6 +94,10 @@ let locationLayer: VectorLayer<VectorSource> | null = null
|
|
|
91
94
|
const trackLayers: Record<number, VectorLayer<VectorSource>> = {}
|
|
92
95
|
const trackLayerStatus = ref<TrackData[]>([])
|
|
93
96
|
|
|
97
|
+
/** 存储多边形图层 */
|
|
98
|
+
const polygonLayers: Record<number, VectorLayer<VectorSource>> = {}
|
|
99
|
+
const polygonLayerStatus = ref<PolygonLayerConfig[]>([])
|
|
100
|
+
|
|
94
101
|
/**
|
|
95
102
|
* 创建位置图标图层
|
|
96
103
|
*/
|
|
@@ -188,6 +195,7 @@ function initializeLayers(tianDiTuKey = ''): void {
|
|
|
188
195
|
url: 'https://wprd04.is.autonavi.com/appmaptile?lang=zh_cn&size=1&style=7&x={x}&y={y}&z={z}',
|
|
189
196
|
crossOrigin: 'anonymous',
|
|
190
197
|
projection: 'EPSG:3857',
|
|
198
|
+
maxZoom: 18,
|
|
191
199
|
}),
|
|
192
200
|
})
|
|
193
201
|
|
|
@@ -197,6 +205,7 @@ function initializeLayers(tianDiTuKey = ''): void {
|
|
|
197
205
|
url: 'https://webst01.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}',
|
|
198
206
|
crossOrigin: 'anonymous',
|
|
199
207
|
projection: 'EPSG:3857',
|
|
208
|
+
maxZoom: 16,
|
|
200
209
|
}),
|
|
201
210
|
visible: false,
|
|
202
211
|
})
|
|
@@ -207,6 +216,7 @@ function initializeLayers(tianDiTuKey = ''): void {
|
|
|
207
216
|
url: 'https://webst02.is.autonavi.com/appmaptile?style=8&x={x}&y={y}&z={z}',
|
|
208
217
|
crossOrigin: 'anonymous',
|
|
209
218
|
projection: 'EPSG:3857',
|
|
219
|
+
maxZoom: 18,
|
|
210
220
|
}),
|
|
211
221
|
visible: false,
|
|
212
222
|
})
|
|
@@ -218,6 +228,7 @@ function initializeLayers(tianDiTuKey = ''): void {
|
|
|
218
228
|
+ 'SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=vec&STYLE=default&TILEMATRIXSET=w&'
|
|
219
229
|
+ `FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${tianDiTuKey}`,
|
|
220
230
|
projection: wgs84ToGcj02Projection,
|
|
231
|
+
maxZoom: 18,
|
|
221
232
|
}),
|
|
222
233
|
visible: false,
|
|
223
234
|
})
|
|
@@ -229,6 +240,7 @@ function initializeLayers(tianDiTuKey = ''): void {
|
|
|
229
240
|
+ 'SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cva&STYLE=default&TILEMATRIXSET=w&'
|
|
230
241
|
+ `FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${tianDiTuKey}`,
|
|
231
242
|
projection: wgs84ToGcj02Projection,
|
|
243
|
+
maxZoom: 18,
|
|
232
244
|
}),
|
|
233
245
|
visible: false,
|
|
234
246
|
})
|
|
@@ -240,6 +252,7 @@ function initializeLayers(tianDiTuKey = ''): void {
|
|
|
240
252
|
+ 'SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&STYLE=default&TILEMATRIXSET=w&'
|
|
241
253
|
+ `FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${tianDiTuKey}`,
|
|
242
254
|
projection: wgs84ToGcj02Projection,
|
|
255
|
+
maxZoom: 18,
|
|
243
256
|
}),
|
|
244
257
|
visible: false,
|
|
245
258
|
})
|
|
@@ -251,6 +264,7 @@ function initializeLayers(tianDiTuKey = ''): void {
|
|
|
251
264
|
+ 'SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cia&STYLE=default&TILEMATRIXSET=w&'
|
|
252
265
|
+ `FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${tianDiTuKey}`,
|
|
253
266
|
projection: wgs84ToGcj02Projection,
|
|
267
|
+
maxZoom: 18,
|
|
254
268
|
}),
|
|
255
269
|
visible: false,
|
|
256
270
|
})
|
|
@@ -557,6 +571,46 @@ function createPointFeature(point: PointData, icon: string, iconAnchor: [number,
|
|
|
557
571
|
return feature
|
|
558
572
|
}
|
|
559
573
|
|
|
574
|
+
/**
|
|
575
|
+
* 创建多边形要素
|
|
576
|
+
* @param polygon - 多边形数据
|
|
577
|
+
* @returns 返回要素实例
|
|
578
|
+
*/
|
|
579
|
+
function createPolygonFeature(polygon: PolygonData): Feature {
|
|
580
|
+
// 将经纬度坐标转换为地图坐标
|
|
581
|
+
const coordinates = polygon.coordinates.map(coord => fromLonLat(coord))
|
|
582
|
+
|
|
583
|
+
const feature = new Feature({
|
|
584
|
+
geometry: new Polygon([coordinates]),
|
|
585
|
+
properties: polygon,
|
|
586
|
+
})
|
|
587
|
+
|
|
588
|
+
// 设置多边形样式
|
|
589
|
+
const style = new Style({
|
|
590
|
+
fill: new Fill({
|
|
591
|
+
color: polygon.fillColor || 'rgba(255, 0, 0, 0.3)',
|
|
592
|
+
}),
|
|
593
|
+
stroke: new Stroke({
|
|
594
|
+
color: polygon.strokeColor || '#ff0000',
|
|
595
|
+
width: polygon.strokeWidth || 2,
|
|
596
|
+
}),
|
|
597
|
+
text: new Text({
|
|
598
|
+
text: polygon.name || '',
|
|
599
|
+
font: '12px sans-serif',
|
|
600
|
+
fill: new Fill({
|
|
601
|
+
color: '#333',
|
|
602
|
+
}),
|
|
603
|
+
stroke: new Stroke({
|
|
604
|
+
color: '#fff',
|
|
605
|
+
width: 2,
|
|
606
|
+
}),
|
|
607
|
+
}),
|
|
608
|
+
})
|
|
609
|
+
|
|
610
|
+
feature.setStyle(style)
|
|
611
|
+
return feature
|
|
612
|
+
}
|
|
613
|
+
|
|
560
614
|
/**
|
|
561
615
|
* 创建点位图层
|
|
562
616
|
* @param config - 图层配置
|
|
@@ -904,6 +958,102 @@ function navigationHandleLocation() {
|
|
|
904
958
|
}
|
|
905
959
|
}
|
|
906
960
|
|
|
961
|
+
/**
|
|
962
|
+
* 创建多边形图层
|
|
963
|
+
* @param config - 图层配置
|
|
964
|
+
* @returns 返回图层实例
|
|
965
|
+
*/
|
|
966
|
+
function createPolygonLayer(config: PolygonLayerConfig): VectorLayer<VectorSource> {
|
|
967
|
+
const vectorSource = new VectorSource()
|
|
968
|
+
const vectorLayer = new VectorLayer({
|
|
969
|
+
source: vectorSource,
|
|
970
|
+
visible: config.show,
|
|
971
|
+
zIndex: config.id === undefined ? 1 : 4, // 多边形图层层级稍高
|
|
972
|
+
})
|
|
973
|
+
|
|
974
|
+
// 添加多边形要素
|
|
975
|
+
const addFeatures = (data: PolygonData[]) => {
|
|
976
|
+
// 清除现有要素
|
|
977
|
+
vectorSource.clear()
|
|
978
|
+
// 添加新的多边形要素
|
|
979
|
+
data.forEach((polygon) => {
|
|
980
|
+
const feature = createPolygonFeature(polygon)
|
|
981
|
+
vectorSource.addFeature(feature)
|
|
982
|
+
})
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
// 添加点击事件处理
|
|
986
|
+
if (config.onClick) {
|
|
987
|
+
map?.on('click', (event) => {
|
|
988
|
+
const feature = map.forEachFeatureAtPixel(event.pixel, feature => feature, {
|
|
989
|
+
layerFilter: layer => layer === vectorLayer,
|
|
990
|
+
})
|
|
991
|
+
if (feature) {
|
|
992
|
+
const properties = feature.getProperties()
|
|
993
|
+
const { geometry, ...polygonData } = properties
|
|
994
|
+
config.onClick(polygonData as PolygonData, event)
|
|
995
|
+
}
|
|
996
|
+
})
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
// 监听图层可见性变化
|
|
1000
|
+
vectorLayer.on('change:visible', async () => {
|
|
1001
|
+
if (vectorLayer.getVisible() && config.dataProvider) {
|
|
1002
|
+
try {
|
|
1003
|
+
const data = await config.dataProvider()
|
|
1004
|
+
addFeatures(data)
|
|
1005
|
+
}
|
|
1006
|
+
catch (error) {
|
|
1007
|
+
console.error('获取多边形数据失败:', error)
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
})
|
|
1011
|
+
|
|
1012
|
+
// 初始加载数据
|
|
1013
|
+
if (config.show && config.dataProvider) {
|
|
1014
|
+
const result = config.dataProvider()
|
|
1015
|
+
if (result instanceof Promise) {
|
|
1016
|
+
result.then((data) => {
|
|
1017
|
+
addFeatures(data)
|
|
1018
|
+
}).catch((error) => {
|
|
1019
|
+
console.error('获取初始多边形数据失败:', error)
|
|
1020
|
+
})
|
|
1021
|
+
}
|
|
1022
|
+
else {
|
|
1023
|
+
addFeatures(result)
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
return vectorLayer
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
/**
|
|
1031
|
+
* 添加多边形图层
|
|
1032
|
+
* @param config - 图层配置
|
|
1033
|
+
* @returns 返回图层实例
|
|
1034
|
+
*/
|
|
1035
|
+
function addPolygonLayer(config: PolygonLayerConfig): VectorLayer<VectorSource> | null {
|
|
1036
|
+
if (!map)
|
|
1037
|
+
return null
|
|
1038
|
+
|
|
1039
|
+
const vectorLayer = createPolygonLayer(config)
|
|
1040
|
+
map.addLayer(vectorLayer)
|
|
1041
|
+
polygonLayers[config.id] = vectorLayer
|
|
1042
|
+
|
|
1043
|
+
// 更新图层状态
|
|
1044
|
+
if (config.showInControl !== false) {
|
|
1045
|
+
const existingIndex = polygonLayerStatus.value.findIndex(layer => layer.id === config.id)
|
|
1046
|
+
if (existingIndex === -1) {
|
|
1047
|
+
polygonLayerStatus.value.push(config)
|
|
1048
|
+
}
|
|
1049
|
+
else {
|
|
1050
|
+
polygonLayerStatus.value[existingIndex] = config
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
return vectorLayer
|
|
1055
|
+
}
|
|
1056
|
+
|
|
907
1057
|
/**
|
|
908
1058
|
* 添加轨迹图层
|
|
909
1059
|
* @param trackData - 轨迹数据
|
|
@@ -1037,6 +1187,31 @@ function handleToggleTrackLayer(track: TrackData): void {
|
|
|
1037
1187
|
setTrackLayerVisible(track.id, track.show)
|
|
1038
1188
|
}
|
|
1039
1189
|
|
|
1190
|
+
/**
|
|
1191
|
+
* 控制多边形图层显示/隐藏
|
|
1192
|
+
* @param layerId - 图层ID
|
|
1193
|
+
* @param visible - 是否显示
|
|
1194
|
+
*/
|
|
1195
|
+
function setPolygonLayerVisible(layerId: number, visible: boolean): void {
|
|
1196
|
+
const layer = polygonLayers[layerId]
|
|
1197
|
+
if (layer) {
|
|
1198
|
+
layer.setVisible(visible)
|
|
1199
|
+
// 更新图层状态
|
|
1200
|
+
const layerIndex = polygonLayerStatus.value.findIndex(layer => layer.id === layerId)
|
|
1201
|
+
if (layerIndex !== -1) {
|
|
1202
|
+
polygonLayerStatus.value[layerIndex].show = visible
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
/**
|
|
1208
|
+
* 切换多边形图层显示状态
|
|
1209
|
+
*/
|
|
1210
|
+
function handleTogglePolygonLayer(layer: PolygonLayerConfig): void {
|
|
1211
|
+
layer.show = !layer.show
|
|
1212
|
+
setPolygonLayerVisible(layer.id, layer.show)
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1040
1215
|
// 暴露方法给父组件
|
|
1041
1216
|
defineExpose({
|
|
1042
1217
|
updateLocationMarker,
|
|
@@ -1060,6 +1235,9 @@ defineExpose({
|
|
|
1060
1235
|
addTrackLayer,
|
|
1061
1236
|
setTrackLayerVisible,
|
|
1062
1237
|
handleToggleTrackLayer,
|
|
1238
|
+
addPolygonLayer,
|
|
1239
|
+
setPolygonLayerVisible,
|
|
1240
|
+
handleTogglePolygonLayer,
|
|
1063
1241
|
})
|
|
1064
1242
|
|
|
1065
1243
|
// 组件卸载时清理地图实例
|
|
@@ -1178,6 +1356,25 @@ onUnmounted(() => {
|
|
|
1178
1356
|
</div>
|
|
1179
1357
|
</div>
|
|
1180
1358
|
</div>
|
|
1359
|
+
|
|
1360
|
+
<!-- 多边形图层 -->
|
|
1361
|
+
<div v-if="polygonLayerStatus.length > 0" class="control-panel layer-control">
|
|
1362
|
+
<div class="control-title">
|
|
1363
|
+
<i class="van-icon van-icon-map-marked" /> 多边形图层
|
|
1364
|
+
</div>
|
|
1365
|
+
<div class="layer-list">
|
|
1366
|
+
<div
|
|
1367
|
+
v-for="layer in polygonLayerStatus"
|
|
1368
|
+
:key="layer.id"
|
|
1369
|
+
class="layer-item"
|
|
1370
|
+
:class="{ active: layer.show }"
|
|
1371
|
+
@click="handleTogglePolygonLayer(layer)"
|
|
1372
|
+
>
|
|
1373
|
+
<i class="van-icon" :class="layer.show ? 'van-icon-eye' : 'van-icon-closed-eye'" />
|
|
1374
|
+
<span>{{ layer.value }}</span>
|
|
1375
|
+
</div>
|
|
1376
|
+
</div>
|
|
1377
|
+
</div>
|
|
1181
1378
|
</div>
|
|
1182
1379
|
</div>
|
|
1183
1380
|
</div>
|
|
@@ -147,3 +147,45 @@ export interface TrackData {
|
|
|
147
147
|
color: string
|
|
148
148
|
show?: boolean // 是否显示
|
|
149
149
|
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* 多边形数据接口
|
|
153
|
+
*/
|
|
154
|
+
export interface PolygonData {
|
|
155
|
+
/** 多边形ID */
|
|
156
|
+
id: number
|
|
157
|
+
/** 多边形名称 */
|
|
158
|
+
name: string
|
|
159
|
+
/** 多边形坐标点数组 [经度, 纬度][] */
|
|
160
|
+
coordinates: [number, number][]
|
|
161
|
+
/** 填充颜色 */
|
|
162
|
+
fillColor?: string
|
|
163
|
+
/** 边框颜色 */
|
|
164
|
+
strokeColor?: string
|
|
165
|
+
/** 边框宽度 */
|
|
166
|
+
strokeWidth?: number
|
|
167
|
+
/** 透明度 */
|
|
168
|
+
opacity?: number
|
|
169
|
+
/** 是否显示 */
|
|
170
|
+
show?: boolean
|
|
171
|
+
/** 自定义数据 */
|
|
172
|
+
extData?: Record<string, any>
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* 多边形图层配置接口
|
|
177
|
+
*/
|
|
178
|
+
export interface PolygonLayerConfig {
|
|
179
|
+
/** 图层ID */
|
|
180
|
+
id: number
|
|
181
|
+
/** 图层名称 */
|
|
182
|
+
value: string
|
|
183
|
+
/** 是否显示 */
|
|
184
|
+
show: boolean
|
|
185
|
+
/** 是否在控制面板显示 */
|
|
186
|
+
showInControl?: boolean
|
|
187
|
+
/** 点击事件处理函数 */
|
|
188
|
+
onClick?: (polygon: PolygonData, event: any) => void
|
|
189
|
+
/** 多边形数据提供者 */
|
|
190
|
+
dataProvider?: () => PolygonData[] | Promise<PolygonData[]>
|
|
191
|
+
}
|
package/src/router/routes.ts
CHANGED