af-mobile-client-vue3 1.1.2 → 1.1.4

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.
@@ -0,0 +1,138 @@
1
+ /** 地址选择结果接口 */
2
+ export interface LocationResult {
3
+ /** 经度 */
4
+ longitude: number
5
+ /** 纬度 */
6
+ latitude: number
7
+ /** 地址描述 */
8
+ address: string
9
+ }
10
+
11
+ /** 手机状态接口 */
12
+ export interface PhoneLocationStatus {
13
+ /** 纬度 */
14
+ f_latitude: number
15
+ /** 经度 */
16
+ f_longitude: number
17
+ /** 其他可能的状态属性 */
18
+ [key: string]: unknown
19
+ }
20
+
21
+ /** 初始化参数接口 */
22
+ export interface InitParams {
23
+ /** 地图中心点坐标 [经度, 纬度] */
24
+ center?: [number, number]
25
+ /** 地图缩放级别 */
26
+ zoom?: number
27
+ /** 最大缩放级别 */
28
+ maxZoom?: number
29
+ /** 最小缩放级别 */
30
+ minZoom?: number
31
+ /** 天地图密钥 */
32
+ tianDiTuKey?: string
33
+ /** 是否开启地址选择模式 */
34
+ enableLocationPicker?: boolean
35
+ /** 高德地图 API key */
36
+ amapKey?: string
37
+ }
38
+
39
+ /** 点位数据接口 */
40
+ export interface PointData {
41
+ /** 经度 */
42
+ longitude: number
43
+ /** 纬度 */
44
+ latitude: number
45
+ /** 点标题 */
46
+ title?: string
47
+ /** 自定义数据 */
48
+ extData?: Record<string, any>
49
+ }
50
+
51
+ /** 点位数据提供者函数类型 */
52
+ export type PointDataProvider = () => PointData[] | Promise<PointData[]>
53
+
54
+ /** 点位图层配置接口 */
55
+ export interface PointLayerConfig {
56
+ /** 图层ID */
57
+ id: number
58
+ /** 图层名称 */
59
+ value: string
60
+ /** 是否显示 */
61
+ show: boolean
62
+ /** 是否在控制面板显示 */
63
+ showInControl?: boolean
64
+ /** 图标URL */
65
+ icon: string
66
+ /** 图标锚点 */
67
+ iconAnchor?: [number, number]
68
+ /** 点击事件处理函数 */
69
+ onClick?: (point: PointData, event: any) => void
70
+ /** 点位数据提供者 */
71
+ dataProvider?: () => PointData[] | Promise<PointData[]>
72
+ }
73
+
74
+ /** WebGL渲染配置接口 */
75
+ export interface WebGLPointOptions extends PointLayerConfig {
76
+ /** 图标大小 */
77
+ iconSize?: [number, number]
78
+ /** 是否开启聚合 */
79
+ enableCluster?: boolean
80
+ /** 聚合距离,单位像素 */
81
+ clusterDistance?: number
82
+ /** 聚合样式配置 */
83
+ clusterStyle?: {
84
+ /** 填充颜色 */
85
+ fillColor?: string
86
+ /** 边框颜色 */
87
+ strokeColor?: string
88
+ /** 文字颜色 */
89
+ textColor?: string
90
+ }
91
+ /** 渲染性能配置 */
92
+ performance?: {
93
+ /** 是否开启分块加载 */
94
+ enableChunk?: boolean
95
+ /** 每块数据量 */
96
+ chunkSize?: number
97
+ /** 是否开启节流 */
98
+ enableThrottle?: boolean
99
+ /** 节流时间间隔(ms) */
100
+ throttleWait?: number
101
+ }
102
+ }
103
+
104
+ /** WMS 图层配置接口 */
105
+ export interface WMSLayerConfig {
106
+ /** 图层名称 */
107
+ layerName: string
108
+ /** 图层显示名称 */
109
+ value: string
110
+ /** 是否显示 */
111
+ show: boolean
112
+ /** 手机端是否显示 */
113
+ phoneShow: boolean
114
+ /** 图层 ID */
115
+ id: number
116
+ }
117
+
118
+ /** WMS 服务配置接口 */
119
+ export interface WMSConfig {
120
+ /** 工作空间 */
121
+ workspace: string
122
+ /** 坐标系 */
123
+ srs: string
124
+ /** 图片格式 */
125
+ format: string
126
+ /** WMS 版本 */
127
+ version: string
128
+ /** WMS 服务地址 */
129
+ url: string
130
+ }
131
+
132
+ /** WMS 完整配置接口 */
133
+ export interface WMSOptions {
134
+ /** WMS 图层列表 */
135
+ layers: WMSLayerConfig[]
136
+ /** WMS 服务配置 */
137
+ wms: WMSConfig
138
+ }
@@ -1,6 +1,5 @@
1
1
  import type { RouteRecordRaw } from 'vue-router'
2
2
  import XForm from '@af-mobile-client-vue3/components/data/XForm/index.vue'
3
- import XOlMapView from '@af-mobile-client-vue3/components/data/XOlMap/demo.vue'
4
3
  import XReport from '@af-mobile-client-vue3/components/data/XReportGrid/XReport.vue'
5
4
  import GridView from '@af-mobile-client-vue3/layout/GridView/index.vue'
6
5
  import PageLayout from '@af-mobile-client-vue3/layout/PageLayout.vue'
@@ -13,6 +12,8 @@ import XCellListView from '@af-mobile-client-vue3/views/component/XCellListView/
13
12
  import XFormAppraiseView from '@af-mobile-client-vue3/views/component/XFormAppraiseView/index.vue'
14
13
  import XFormGroupView from '@af-mobile-client-vue3/views/component/XFormGroupView/index.vue'
15
14
  import XFormView from '@af-mobile-client-vue3/views/component/XFormView/index.vue'
15
+ import XOlMapView from '@af-mobile-client-vue3/views/component/XOlMapView/index.vue'
16
+ import XLocationPicker from '@af-mobile-client-vue3/views/component/XOlMapView/XLocationPicker/index.vue'
16
17
  import XReportFormIframeView from '@af-mobile-client-vue3/views/component/XReportFormIframeView/index.vue'
17
18
  import XReportFormView from '@af-mobile-client-vue3/views/component/XReportFormView/index.vue'
18
19
  import XReportGridView from '@af-mobile-client-vue3/views/component/XReportGridView/index.vue'
@@ -82,6 +83,11 @@ const routes: Array<RouteRecordRaw> = [
82
83
  name: 'XOlMapView',
83
84
  component: XOlMapView,
84
85
  },
86
+ {
87
+ path: '/Component/XOlMapView/XLocationPicker',
88
+ name: 'XLocationPicker',
89
+ component: XLocationPicker,
90
+ },
85
91
  // {
86
92
  // path: '/Components/XForm',
87
93
  // name: 'XForm',
@@ -50,8 +50,8 @@ export function getConfigByNameWithoutIndexedDB(configName: string, serviceName
50
50
  /**
51
51
  * 通用执行业务逻辑
52
52
  */
53
- export function runLogic(logicName: string, parameter: object, serviceName = import.meta.env.VITE_APP_SYSTEM_NAME) {
54
- return post(`/${serviceName}/logic/${logicName}`, parameter)
53
+ export function runLogic<T>(logicName: string, parameter: object, serviceName = import.meta.env.VITE_APP_SYSTEM_NAME): Promise<T> {
54
+ return post<T>(`/${serviceName}/logic/${logicName}`, parameter)
55
55
  }
56
56
 
57
57
  /**
@@ -30,7 +30,7 @@ interface IUserState {
30
30
  token?: string
31
31
  userInfo: UserInfo
32
32
  lastUpdateTime: number
33
- permissions: [{ id: string, operation: string[] }]
33
+ permissions: string[]
34
34
  roles: [{ id: string, operation: string[] }]
35
35
  routesConfig: Array<any>
36
36
  single: Array<ExtraRouteRecordRaw>
@@ -119,13 +119,13 @@ export const useUserStore = defineStore('app-user', () => {
119
119
  userState.value.single.push(page)
120
120
  }
121
121
  }
122
- const setPermissions = (permissions: [{ id: string, operation: string[] }]) => {
122
+ const setPermissions = (permissions: []) => {
123
123
  userState.value.permissions = permissions
124
124
  Storage.set(APP_PERMISSIONS_KEY, permissions)
125
125
  }
126
126
  const setRoles = (roles: [{ id: string, operation: string[] }]) => {
127
127
  userState.value.roles = roles
128
- Storage.set(APP_PERMISSIONS_KEY, roles)
128
+ Storage.set(APP_ROLES_KEY, roles)
129
129
  }
130
130
  const setRoutesConfig = (routesConfig: Array<any>) => {
131
131
  userState.value.routesConfig = routesConfig
@@ -0,0 +1,120 @@
1
+ <script setup lang="ts">
2
+ import type { LocationResult } from '@af-mobile-client-vue3/components/data/XOlMap/types'
3
+ import LocationPicker from '@af-mobile-client-vue3/components/data/XOlMap/XLocationPicker/index.vue'
4
+ import NormalDataLayout from '@af-mobile-client-vue3/components/layout/NormalDataLayout/index.vue'
5
+ import { showNotify } from 'vant'
6
+ import { ref } from 'vue'
7
+
8
+ const selectedLocation = ref<LocationResult>()
9
+
10
+ // 处理位置选择
11
+ function handleLocationConfirm(location: LocationResult) {
12
+ console.log('选择的位置:', location)
13
+ selectedLocation.value = location
14
+ showNotify({ type: 'success', message: '位置已选择' })
15
+ }
16
+ </script>
17
+
18
+ <template>
19
+ <NormalDataLayout id="XLocationPicker" title="XOlMap地址选择器">
20
+ <template #layout_content>
21
+ <div class="location-picker-demo">
22
+ <!-- 页面标题 -->
23
+ <div class="page-header">
24
+ <div class="title">
25
+ 位置选择
26
+ </div>
27
+ </div>
28
+
29
+ <!-- 选择结果展示 -->
30
+ <div v-if="selectedLocation" class="location-result">
31
+ <div class="label">
32
+ 已选位置:
33
+ </div>
34
+ <div class="value">
35
+ {{ selectedLocation.address }}
36
+ </div>
37
+ <div class="coordinates">
38
+ 经度: {{ selectedLocation.longitude.toFixed(6) }},
39
+ 纬度: {{ selectedLocation.latitude.toFixed(6) }}
40
+ </div>
41
+ </div>
42
+
43
+ <!-- 地图组件 -->
44
+ <div class="map-container">
45
+ <LocationPicker
46
+ v-model="selectedLocation"
47
+ tian-di-tu-key="c16876b28898637c0a1a68b3fa410504"
48
+ amap-key="5ebabc4536d4b42e0dd1e20175cca8ab"
49
+ :default-center="[108.948024, 34.263161]"
50
+ :default-zoom="12"
51
+ @confirm="handleLocationConfirm"
52
+ />
53
+ </div>
54
+ </div>
55
+ </template>
56
+ </NormalDataLayout>
57
+ </template>
58
+
59
+ <style scoped lang="less">
60
+ .location-picker-demo {
61
+ width: 100%;
62
+ height: 100%;
63
+ position: relative;
64
+ display: flex;
65
+ flex-direction: column;
66
+ background-color: #f7f8fa;
67
+ }
68
+
69
+ .page-header {
70
+ height: 44px;
71
+ display: flex;
72
+ align-items: center;
73
+ justify-content: center;
74
+ background: white;
75
+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
76
+ position: relative;
77
+ z-index: 1;
78
+
79
+ .title {
80
+ font-size: 16px;
81
+ color: #333;
82
+ font-weight: 500;
83
+ }
84
+ }
85
+
86
+ .location-result {
87
+ background: white;
88
+ padding: 12px 16px;
89
+ margin: 10px;
90
+ border-radius: 8px;
91
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
92
+
93
+ .label {
94
+ font-size: 14px;
95
+ color: #666;
96
+ margin-bottom: 4px;
97
+ }
98
+
99
+ .value {
100
+ font-size: 16px;
101
+ color: #333;
102
+ margin-bottom: 8px;
103
+ word-break: break-all;
104
+ }
105
+
106
+ .coordinates {
107
+ font-size: 12px;
108
+ color: #999;
109
+ }
110
+ }
111
+
112
+ .map-container {
113
+ flex: 1;
114
+ position: relative;
115
+ margin: 0 10px 10px 10px;
116
+ border-radius: 8px;
117
+ overflow: hidden;
118
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
119
+ }
120
+ </style>