af-mobile-client-vue3 1.1.43 → 1.1.45

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.
@@ -1,24 +1,147 @@
1
1
  <script setup lang="ts">
2
2
  import XCellList from '@af-mobile-client-vue3/components/data/XCellList/index.vue'
3
- import { ref } from 'vue'
3
+ import NormalDataLayout from '@af-mobile-client-vue3/components/layout/NormalDataLayout/index.vue'
4
+ import { useUserStore } from '@af-mobile-client-vue3/stores/modules/user'
5
+ import { defineEmits, ref } from 'vue'
4
6
  import { useRouter } from 'vue-router'
5
7
 
6
- // 巡检计划
7
- defineOptions({
8
- name: 'PatrolPlan',
9
- })
10
-
8
+ // 定义事件
9
+ const emit = defineEmits(['deleteRow'])
10
+ const userInfo = useUserStore().getUserInfo()
11
+ // 访问路由
11
12
  const router = useRouter()
12
- const configName = ref('crud_patroltask_managePhoneCRUD')
13
- const xCellListRefPatrolPlan = ref()
13
+ // 获取默认值
14
+ const idKey = ref('o_id')
15
+
16
+ // 简易crud表单测试
17
+ // const configName = ref('orderCarInMobileCRUD')
18
+ // const serviceName = ref('af-gaslink')
19
+ // const configName = ref('lngPriceManageMobileCRUD')
20
+ const configName = ref('测试')
21
+ const serviceName = ref('af-gaslink')
22
+ // const configName = ref('mobile_liushuiQueryCRUD')
23
+ // const serviceName = ref('af-revenue')
24
+
25
+ // 资源权限测试
26
+ // const configName = ref('crud_sources_test')
27
+ // const serviceName = ref('af-system')
28
+
29
+ // 实际业务测试
30
+ // const configName = ref('lngChargeAuditMobileCRUD')
31
+ // const serviceName = ref('af-gaslink')
32
+
33
+ // 跳转到详情页面
34
+ // function toDetail(item) {
35
+ // router.push({
36
+ // name: 'XCellDetailView',
37
+ // params: { id: item[idKey.value] }, // 如果使用命名路由,推荐使用路由参数而不是直接构建 URL
38
+ // query: {
39
+ // operName: item[operNameKey.value],
40
+ // method:item[methodKey.value],
41
+ // requestMethod:item[requestMethodKey.value],
42
+ // operatorType:item[operatorTypeKey.value],
43
+ // operUrl:item[operUrlKey.value],
44
+ // operIp:item[operIpKey.value],
45
+ // costTime:item[costTimeKey.value],
46
+ // operTime:item[operTimeKey.value],
47
+ //
48
+ // title: item[titleKey.value],
49
+ // businessType: item[businessTypeKey.value],
50
+ // status:item[statusKey.value]
51
+ // }
52
+ // })
53
+ // }
54
+
55
+ // 跳转到表单——以表单组来渲染纯表单
56
+ function toDetail(item) {
57
+ router.push({
58
+ name: 'XFormGroupView',
59
+ // query: {
60
+ // id: item[idKey.value],
61
+ // id: item.rr_id,
62
+ // o_id: item.o_id,
63
+ // },
64
+ })
65
+ }
66
+
67
+ // 新增功能
68
+ // function addOption(totalCount) {
69
+ // router.push({
70
+ // name: 'XFormView',
71
+ // params: { id: totalCount, openid: totalCount },
72
+ // query: {
73
+ // configName: configName.value,
74
+ // serviceName: serviceName.value,
75
+ // mode: '新增',
76
+ // },
77
+ // })
78
+ // }
79
+ function addOption(callback) {
80
+ router.push({
81
+ name: 'XFormGroupView',
82
+ // params: { id: totalCount.value },
83
+ // query: {
84
+ // configName: configName.value,
85
+ // serviceName: serviceName.value,
86
+ // mode: '新增',
87
+ // },
88
+ })
89
+ // 如果存在回调函数,调用它并传递true表示已处理
90
+ if (typeof callback === 'function') {
91
+ callback(true)
92
+ }
93
+ }
94
+
95
+ // 修改功能
96
+ function updateRow(result, callback) {
97
+ console.log('用户----', userInfo)
98
+ router.push({
99
+ name: 'XFormGroupView',
100
+ // params: { id: result.o_id, openid: result.o_id },
101
+ // query: {
102
+ // configName: configName.value,
103
+ // serviceName: serviceName.value,
104
+ // mode: '修改',
105
+ // },
106
+ })
107
+
108
+ // 如果存在回调函数,调用它并传递true表示已处理
109
+ if (typeof callback === 'function') {
110
+ callback(true)
111
+ }
112
+ }
113
+
114
+ // 删除功能
115
+ function deleteRow(result) {
116
+ emit('deleteRow', result.o_id)
117
+ }
14
118
  </script>
15
119
 
16
120
  <template>
17
- <XCellList
18
- ref="xCellListRefPatrolPlan"
19
- service-name="af-linepatrol"
20
- :config-name="configName"
21
- />
121
+ <NormalDataLayout id="XCellListView" title="工作计划">
122
+ <template #layout_content>
123
+ <XCellList
124
+ :config-name="configName"
125
+ :service-name="serviceName"
126
+ :id-key="idKey"
127
+ @to-detail="toDetail"
128
+ @delete-row="deleteRow"
129
+ @update="updateRow"
130
+ @add="addOption"
131
+ />
132
+
133
+ <!-- :fix-query-form="{ u_f_price_state: ['生效', '待生效'] }" -->
134
+
135
+ <!-- <XCellList -->
136
+ <!-- :config-name="configName" -->
137
+ <!-- :service-name="serviceName" -->
138
+ <!-- :fix-query-form="{ o_f_oper_name: 'edu_test' }" -->
139
+ <!-- :id-key="idKey" -->
140
+ <!-- @to-detail="toDetail" -->
141
+ <!-- @delete-row="deleteRow" -->
142
+ <!-- /> -->
143
+ </template>
144
+ </NormalDataLayout>
22
145
  </template>
23
146
 
24
147
  <style scoped lang="less">
@@ -5,9 +5,19 @@ import { showDialog } from 'vant'
5
5
  import { ref } from 'vue'
6
6
  import { useRoute } from 'vue-router'
7
7
 
8
+ // const configName = ref('reviewFormGroup')
9
+ // const serviceName = ref('af-revenue')
10
+
8
11
  // 纯表单
9
- const configName = ref('AddConstructionForm')
10
- const serviceName = ref('af-linepatrol')
12
+ // const configName = ref('form_check_test')
13
+ // const serviceName = ref('af-system')
14
+
15
+ // const configName = ref("计划下发Form")
16
+ // const serviceName = ref("af-linepatrol")
17
+
18
+ // 表单组
19
+ const configName = ref('lngChargeAuditMobileFormGroup')
20
+ const serviceName = ref('af-gaslink')
11
21
 
12
22
  const formData = ref({})
13
23
  const formGroup = ref(null)
@@ -18,6 +28,36 @@ function submit(_result) {
18
28
  history.back()
19
29
  })
20
30
  }
31
+
32
+ // 表单组——数据
33
+ // function initComponents () {
34
+ // runLogic('getlngChargeAuditMobileFormGroupData', {id: 29}, 'af-gaslink').then((res) => {
35
+ // formData.value = {...res}
36
+ // })
37
+ // }
38
+
39
+ // 纯表单——数据
40
+ // function initComponents() {
41
+ // formData.value = { plan_name: 'af-llllll', plan_point: '1号点位', plan_single: '1号点位', plan_range: '2024-12-12' }
42
+ // }
43
+
44
+ // function initComponents() {
45
+ // runLogic('getlngChargeAuditMobileFormGroupData', { id: route.query?.id, o_id: route.query?.o_id }, 'af-gaslink').then((res) => {
46
+ // console.log('res------', res)
47
+ // formData.value = { ...res }
48
+ // formGroup.value.init({
49
+ // configName: configName.value,
50
+ // serviceName: serviceName.value,
51
+ // groupFormData: { ...res },
52
+ // mode: "新增"
53
+ // })
54
+ // isInit.value = true
55
+ // })
56
+ // }
57
+
58
+ // onBeforeMount(() => {
59
+ // initComponents()
60
+ // })
21
61
  </script>
22
62
 
23
63
  <template>
@@ -12,19 +12,16 @@ const formGroupAddConstruction = ref(null)
12
12
  <template>
13
13
  <NormalDataLayout id="XFormGroupView" title="纯表单">
14
14
  <template #layout_content>
15
- <div class="form"> <XForm
15
+ <XForm
16
16
  ref="formGroupAddConstruction"
17
17
  mode="新增"
18
18
  :config-name="configName"
19
19
  :service-name="serviceName"
20
- /></div>
21
-
20
+ />
22
21
  </template>
23
22
  </NormalDataLayout>
24
23
  </template>
25
24
 
26
25
  <style scoped lang="less">
27
- .form {
28
- margin-top: 2px;
29
- }
26
+
30
27
  </style>
@@ -1,118 +1,118 @@
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
- :default-center="[108.948024, 34.263161]"
48
- :default-zoom="12"
49
- @confirm="handleLocationConfirm"
50
- />
51
- </div>
52
- </div>
53
- </template>
54
- </NormalDataLayout>
55
- </template>
56
-
57
- <style scoped lang="less">
58
- .location-picker-demo {
59
- width: 100%;
60
- height: 100%;
61
- position: relative;
62
- display: flex;
63
- flex-direction: column;
64
- background-color: #f7f8fa;
65
- }
66
-
67
- .page-header {
68
- height: 44px;
69
- display: flex;
70
- align-items: center;
71
- justify-content: center;
72
- background: white;
73
- box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
74
- position: relative;
75
- z-index: 1;
76
-
77
- .title {
78
- font-size: 16px;
79
- color: #333;
80
- font-weight: 500;
81
- }
82
- }
83
-
84
- .location-result {
85
- background: white;
86
- padding: 12px 16px;
87
- margin: 10px;
88
- border-radius: 8px;
89
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
90
-
91
- .label {
92
- font-size: 14px;
93
- color: #666;
94
- margin-bottom: 4px;
95
- }
96
-
97
- .value {
98
- font-size: 16px;
99
- color: #333;
100
- margin-bottom: 8px;
101
- word-break: break-all;
102
- }
103
-
104
- .coordinates {
105
- font-size: 12px;
106
- color: #999;
107
- }
108
- }
109
-
110
- .map-container {
111
- flex: 1;
112
- position: relative;
113
- margin: 0 10px 10px 10px;
114
- border-radius: 8px;
115
- overflow: hidden;
116
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
117
- }
118
- </style>
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
+ :default-center="[108.948024, 34.263161]"
48
+ :default-zoom="12"
49
+ @confirm="handleLocationConfirm"
50
+ />
51
+ </div>
52
+ </div>
53
+ </template>
54
+ </NormalDataLayout>
55
+ </template>
56
+
57
+ <style scoped lang="less">
58
+ .location-picker-demo {
59
+ width: 100%;
60
+ height: 100%;
61
+ position: relative;
62
+ display: flex;
63
+ flex-direction: column;
64
+ background-color: #f7f8fa;
65
+ }
66
+
67
+ .page-header {
68
+ height: 44px;
69
+ display: flex;
70
+ align-items: center;
71
+ justify-content: center;
72
+ background: white;
73
+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
74
+ position: relative;
75
+ z-index: 1;
76
+
77
+ .title {
78
+ font-size: 16px;
79
+ color: #333;
80
+ font-weight: 500;
81
+ }
82
+ }
83
+
84
+ .location-result {
85
+ background: white;
86
+ padding: 12px 16px;
87
+ margin: 10px;
88
+ border-radius: 8px;
89
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
90
+
91
+ .label {
92
+ font-size: 14px;
93
+ color: #666;
94
+ margin-bottom: 4px;
95
+ }
96
+
97
+ .value {
98
+ font-size: 16px;
99
+ color: #333;
100
+ margin-bottom: 8px;
101
+ word-break: break-all;
102
+ }
103
+
104
+ .coordinates {
105
+ font-size: 12px;
106
+ color: #999;
107
+ }
108
+ }
109
+
110
+ .map-container {
111
+ flex: 1;
112
+ position: relative;
113
+ margin: 0 10px 10px 10px;
114
+ border-radius: 8px;
115
+ overflow: hidden;
116
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
117
+ }
118
+ </style>
@@ -3,6 +3,7 @@ import NormalDataLayout from '@af-mobile-client-vue3/components/layout/NormalDat
3
3
  import { showNotify } from 'vant'
4
4
  import { onMounted, ref } from 'vue'
5
5
  import XOlMap from '../../../components/data/XOlMap/index.vue'
6
+ import { trackTestData } from './testData'
6
7
  import 'vant/lib/index.css'
7
8
 
8
9
  const mapRef = ref()
@@ -265,6 +266,13 @@ function handleAddMassPoints() {
265
266
  })
266
267
  }
267
268
 
269
+ // 添加轨迹测试
270
+ function handleAddTrack() {
271
+ trackTestData.forEach((track) => {
272
+ mapRef.value.addTrackLayer(track)
273
+ })
274
+ }
275
+
268
276
  // 导航模式相关
269
277
  const isNavigationMode = ref(false)
270
278
 
@@ -322,6 +330,15 @@ function stopNavigation() {
322
330
  </van-button>
323
331
  </div>
324
332
 
333
+ <div class="control-group">
334
+ <div class="group-title">
335
+ 轨迹示例
336
+ </div>
337
+ <van-button type="primary" size="small" @click="handleAddTrack">
338
+ 添加测试轨迹
339
+ </van-button>
340
+ </div>
341
+
325
342
  <div class="control-group">
326
343
  <div class="group-title">
327
344
  导航模式测试
@@ -0,0 +1,64 @@
1
+ /**
2
+ * 轨迹测试数据
3
+ */
4
+
5
+ // 轨迹数据类型定义
6
+ export interface TrackData {
7
+ id: number
8
+ name: string
9
+ trackData: [number, number][] // 经纬度数组
10
+ color: string
11
+ show?: boolean // 是否显示
12
+ }
13
+
14
+ /**
15
+ * 生成随机轨迹点
16
+ * @param startPoint - 起始点 [经度, 纬度]
17
+ * @param pointCount - 点的数量
18
+ * @param maxOffset - 最大偏移量(经纬度)
19
+ * @returns 轨迹点数组
20
+ */
21
+ function generateRandomTrack(
22
+ startPoint: [number, number],
23
+ pointCount: number,
24
+ maxOffset: number = 0.01,
25
+ ): [number, number][] {
26
+ const points: [number, number][] = [startPoint]
27
+ let currentPoint = startPoint
28
+
29
+ for (let i = 1; i < pointCount; i++) {
30
+ // 生成随机偏移量,使用正态分布使轨迹更自然
31
+ const offsetLng = (Math.random() - 0.5) * maxOffset * (1 + Math.random() * 0.5)
32
+ const offsetLat = (Math.random() - 0.5) * maxOffset * (1 + Math.random() * 0.5)
33
+
34
+ // 添加一些随机性,使轨迹更自然
35
+ const randomFactor = Math.random() > 0.8 ? 2 : 1 // 偶尔会有较大的偏移
36
+ const newPoint: [number, number] = [
37
+ currentPoint[0] + offsetLng * randomFactor,
38
+ currentPoint[1] + offsetLat * randomFactor,
39
+ ]
40
+
41
+ points.push(newPoint)
42
+ currentPoint = newPoint
43
+ }
44
+
45
+ return points
46
+ }
47
+
48
+ // 测试数据
49
+ export const trackTestData: TrackData[] = [
50
+ {
51
+ id: 1,
52
+ name: '张三的轨迹',
53
+ trackData: generateRandomTrack([108.948024, 34.263161], 1000, 0.005),
54
+ color: '#FF0000',
55
+ show: true,
56
+ },
57
+ {
58
+ id: 2,
59
+ name: '李四的轨迹',
60
+ trackData: generateRandomTrack([108.948024, 34.263161], 500, 0.003),
61
+ color: '#00FF00',
62
+ show: true,
63
+ },
64
+ ]
package/vite.config.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import type { ConfigEnv, UserConfig } from 'vite'
2
2
  import path from 'node:path'
3
3
  import process from 'node:process'
4
- import autoprefixer from 'autoprefixer'
5
- import viewport from 'postcss-mobile-forever'
4
+ // import autoprefixer from 'autoprefixer'
5
+ // import viewport from 'postcss-mobile-forever'
6
6
  import { loadEnv } from 'vite'
7
7
  import { createVitePlugins } from './build/vite'
8
8
 
@@ -95,15 +95,15 @@ export default ({ mode }: ConfigEnv): UserConfig => {
95
95
  postcss: {
96
96
  plugins: [
97
97
  // 自动获取浏览器的流行度和能够支持的属性,并为 CSS 规则添加前缀
98
- autoprefixer(),
99
- viewport({
100
- appSelector: '#system-app',
101
- viewportWidth: 375,
102
- maxDisplayWidth: 800,
103
- appContainingBlock: 'auto',
104
- necessarySelectorWhenAuto: '.app-wrapper',
105
- rootContainingBlockSelectorList: ['van-tabbar', 'van-popup'],
106
- }),
98
+ // autoprefixer(),
99
+ // viewport({
100
+ // appSelector: '#system-app',
101
+ // viewportWidth: 375,
102
+ // maxDisplayWidth: 800,
103
+ // appContainingBlock: 'auto',
104
+ // necessarySelectorWhenAuto: '.app-wrapper',
105
+ // rootContainingBlockSelectorList: ['van-tabbar', 'van-popup'],
106
+ // }),
107
107
  ],
108
108
  },
109
109
  },
@@ -1,70 +0,0 @@
1
- <script setup lang="ts">
2
- import XForm from '@af-mobile-client-vue3/components/data/XForm/index.vue'
3
- import NormalDataLayout from '@af-mobile-client-vue3/components/layout/NormalDataLayout/index.vue'
4
- import { getConfigByName } from '@af-mobile-client-vue3/services/api/common'
5
- import { onBeforeMount, ref, toRaw } from 'vue'
6
-
7
- const configName = ref('AddConstructionForm')
8
- const serviceName = ref('af-linepatrol')
9
- const formGroup = ref(null)
10
- const formConfig = ref(null)
11
- const submitSimple = ref(null)
12
- const isLoading = ref(true)
13
-
14
- function safeStringify(obj) {
15
- const seen = new WeakSet()
16
- return JSON.stringify(toRaw(obj), (key, val) => {
17
- if (typeof val === 'object' && val !== null) {
18
- if (seen.has(val))
19
- return
20
- seen.add(val)
21
- }
22
- return val
23
- }, 2)
24
- }
25
-
26
- function submit(result) {
27
- console.log('>>>> result: ', safeStringify(result))
28
- }
29
-
30
- function loadConfig() {
31
- return new Promise((resolve) => {
32
- getConfigByName(configName.value, (result) => {
33
- submitSimple.value = result.showSubmitBtn
34
- formConfig.value = result
35
- resolve(result)
36
- }, serviceName.value)
37
- })
38
- }
39
-
40
- onBeforeMount(async () => {
41
- try {
42
- await loadConfig()
43
- }
44
- finally {
45
- isLoading.value = false
46
- }
47
- })
48
- </script>
49
-
50
- <template>
51
- <NormalDataLayout id="XFormGroupView" title="纯表单">
52
- <template #layout_content>
53
- <van-loading v-if="isLoading" />
54
- <XForm
55
- v-else
56
- ref="formGroup"
57
- mode="查询"
58
- :service-name="serviceName"
59
- :group-form-items="formConfig"
60
- :form-data="{}"
61
- :form-name="formConfig?.groupName || '11111'"
62
- :submit-button="submitSimple"
63
- @on-submit="submit"
64
- />
65
- </template>
66
- </NormalDataLayout>
67
- </template>
68
-
69
- <style scoped lang="less">
70
- </style>