af-mobile-client-vue3 1.1.5 → 1.1.7

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.
Files changed (84) hide show
  1. package/.env +6 -6
  2. package/.env.development +4 -4
  3. package/.env.envoiceShow +6 -6
  4. package/.env.production +6 -6
  5. package/.husky/commit-msg +1 -1
  6. package/.husky/pre-commit +1 -1
  7. package/.vscode/settings.json +61 -61
  8. package/build/vite/index.ts +105 -91
  9. package/mock/modules/user.mock.ts +152 -152
  10. package/package.json +3 -1
  11. package/public/favicon.svg +4 -4
  12. package/public/safari-pinned-tab.svg +32 -32
  13. package/scripts/verifyCommit.js +19 -19
  14. package/src/App.vue +43 -43
  15. package/src/api/user/index.ts +40 -40
  16. package/src/bootstrap.ts +18 -18
  17. package/src/components/core/NavBar/index.vue +12 -12
  18. package/src/components/core/Tabbar/index.vue +38 -38
  19. package/src/components/core/Uploader/index.vue +2 -2
  20. package/src/components/core/XGridDropOption/index.vue +151 -151
  21. package/src/components/core/XMultiSelect/index.vue +183 -183
  22. package/src/components/data/XCellDetail/index.vue +106 -106
  23. package/src/components/data/XForm/index.vue +5 -0
  24. package/src/components/data/XFormItem/index.vue +48 -14
  25. package/src/components/data/XOlMap/README.md +0 -2
  26. package/src/components/data/XOlMap/XLocationPicker/index.vue +21 -9
  27. package/src/components/data/XOlMap/index.vue +81 -74
  28. package/src/components/data/XOlMap/types.ts +0 -4
  29. package/src/components/data/XOlMap/utils/wgs84ToGcj02.js +154 -154
  30. package/src/components/data/XReportForm/XReportFormJsonRender.vue +220 -220
  31. package/src/components/data/XReportForm/index.vue +1079 -1079
  32. package/src/components/data/XReportGrid/XAddReport/index.ts +1 -1
  33. package/src/components/data/XReportGrid/XReportDrawer/index.ts +1 -1
  34. package/src/components/data/XSignature/index.vue +285 -285
  35. package/src/components/data/XTag/index.vue +10 -10
  36. package/src/components/layout/NormalDataLayout/index.vue +70 -70
  37. package/src/components/layout/TabBarLayout/index.vue +40 -40
  38. package/src/components.d.ts +53 -53
  39. package/src/env.d.ts +16 -16
  40. package/src/font-style/font.css +3 -3
  41. package/src/hooks/useCommon.ts +9 -9
  42. package/src/locales/en-US.json +25 -25
  43. package/src/locales/zh-CN.json +25 -25
  44. package/src/plugins/AppData.ts +38 -38
  45. package/src/router/guards.ts +59 -59
  46. package/src/router/index.ts +61 -61
  47. package/src/router/invoiceRoutes.ts +33 -33
  48. package/src/router/routes.ts +6 -0
  49. package/src/services/api/common.ts +109 -109
  50. package/src/services/api/manage.ts +8 -8
  51. package/src/services/api/search.ts +16 -16
  52. package/src/services/restTools.ts +56 -56
  53. package/src/services/v3Api.ts +11 -11
  54. package/src/stores/modules/setting.ts +52 -52
  55. package/src/stores/mutation-type.ts +7 -7
  56. package/src/utils/authority-utils.ts +84 -84
  57. package/src/utils/crypto.ts +39 -39
  58. package/src/utils/i18n.ts +41 -41
  59. package/src/utils/indexedDB.ts +180 -180
  60. package/src/utils/mobileUtil.ts +26 -26
  61. package/src/utils/routerUtil.ts +271 -271
  62. package/src/utils/runEvalFunction.ts +13 -13
  63. package/src/utils/wechatUtil.ts +9 -9
  64. package/src/views/common/LoadError.vue +64 -64
  65. package/src/views/common/NotFound.vue +68 -68
  66. package/src/views/component/EvaluateRecordView/index.vue +40 -40
  67. package/src/views/component/IconifyView/index.vue +507 -0
  68. package/src/views/component/XCellDetailView/index.vue +217 -217
  69. package/src/views/component/XOlMapView/XLocationPicker/index.vue +120 -120
  70. package/src/views/component/XOlMapView/index.vue +0 -1
  71. package/src/views/component/XReportFormIframeView/index.vue +47 -47
  72. package/src/views/component/XReportFormView/index.vue +13 -13
  73. package/src/views/component/XSignatureView/index.vue +50 -50
  74. package/src/views/component/index.vue +4 -0
  75. package/src/views/component/menu.vue +117 -117
  76. package/src/views/component/notice.vue +46 -46
  77. package/src/views/component/topNav.vue +36 -36
  78. package/src/views/invoiceShow/index.vue +61 -61
  79. package/src/views/user/login/ForgetPasswordForm.vue +94 -94
  80. package/src/views/user/login/LoginTitle.vue +68 -68
  81. package/src/views/user/login/index.vue +22 -22
  82. package/src/views/user/my/index.vue +230 -230
  83. package/src/vue-router.d.ts +9 -9
  84. package/tsconfig.json +43 -43
@@ -1,9 +1,12 @@
1
1
  <script setup lang="ts">
2
+ import type { FieldType } from 'vant'
2
3
  import type { Numeric } from 'vant/es/utils'
4
+ import type { LocationResult } from '../XOlMap/types'
3
5
  import Uploader from '@af-mobile-client-vue3/components/core/Uploader/index.vue'
4
6
  import XGridDropOption from '@af-mobile-client-vue3/components/core/XGridDropOption/index.vue'
5
7
  import XMultiSelect from '@af-mobile-client-vue3/components/core/XMultiSelect/index.vue'
6
8
  import XSelect from '@af-mobile-client-vue3/components/core/XSelect/index.vue'
9
+ import XLocationPicker from '@af-mobile-client-vue3/components/data/XOlMap/XLocationPicker/index.vue'
7
10
  import { runLogic } from '@af-mobile-client-vue3/services/api/common'
8
11
  import { searchToListOption, searchToOption } from '@af-mobile-client-vue3/services/v3Api'
9
12
  import { useUserStore } from '@af-mobile-client-vue3/stores/modules/user'
@@ -85,7 +88,7 @@ const props = defineProps({
85
88
 
86
89
  })
87
90
 
88
- const emits = defineEmits(['update:modelValue'])
91
+ const emits = defineEmits(['update:modelValue', 'set-form'])
89
92
  // 判断并初始化防抖函数
90
93
  let debouncedUserLinkFunc: (() => void) | null = null
91
94
  let debouncedDepLinkFunc: (() => void) | null = null
@@ -124,7 +127,8 @@ const currInst = getCurrentInstance()
124
127
  // 配置中心->表单项变更触发函数
125
128
  const dataChangeFunc = debounce(async () => {
126
129
  if (attr.dataChangeFunc)
127
- await executeStrFunctionByContext(currInst, attr.dataChangeFunc, [form, attr, null, mode])
130
+ // eslint-disable-next-line vue/custom-event-name-casing
131
+ await executeStrFunctionByContext(currInst, attr.dataChangeFunc, [form, val => emits('set-form', val), attr, null, mode])
128
132
  }, 500)
129
133
 
130
134
  // 配置中心->表单项展示函数
@@ -144,13 +148,9 @@ const showFormItemFunc = debounce(async () => {
144
148
 
145
149
  const localValue = computed({
146
150
  get() {
147
- // if (props.modelValue !== undefined) {
148
- // return props.modelValue
149
- // }
150
151
  switch (attr.type) {
151
152
  case 'uploader':
152
153
  if (mode === '查询') {
153
- // console.log(querySelectDefaultValue.value)
154
154
  return props.modelValue !== undefined ? props.modelValue : querySelectDefaultValue.value
155
155
  }
156
156
  else {
@@ -510,7 +510,7 @@ function onPickerConfirm({ selectedOptions }) {
510
510
  // 日期时间选择数据
511
511
  const dateTimePickerValue = ref(undefined)
512
512
  function showDataTimePicker() {
513
- if (props.modelValue !== undefined && props.modelValue !== '' && props.modelValue !== null) {
513
+ if (props.modelValue !== undefined && props.modelValue !== '' && props.modelValue !== null && typeof props.modelValue === 'string') {
514
514
  // 拆分日期和时间
515
515
  const [dateStr, timeStr] = props.modelValue.split(' ')
516
516
  // 拆分日期部分
@@ -587,6 +587,14 @@ function onDateTimePickerConfirm() {
587
587
  function onPickerCancel() {
588
588
  showDatePicker.value = false
589
589
  }
590
+
591
+ const showAddressPicker = ref(false)
592
+ const addressValue = ref('')
593
+ // 处理地址选择器确认
594
+ function handleAddressConfirm(location) {
595
+ addressValue.value = location.address
596
+ showAddressPicker.value = false
597
+ }
590
598
  </script>
591
599
 
592
600
  <template>
@@ -843,11 +851,11 @@ function onPickerCancel() {
843
851
  >
844
852
  <VanDatePicker
845
853
  v-model="dateTimePickerValue.date"
846
- :columns-type="attr.columnsType ? attr.columnsType : ['year', 'month', 'day']"
854
+ :columns-type="attr.dateColumnsType || ['year', 'month', 'day']"
847
855
  />
848
856
  <VanTimePicker
849
857
  v-model="dateTimePickerValue.time"
850
- :columns-type="['hour', 'minute', 'second']"
858
+ :columns-type="attr.timeColumnsType || ['hour', 'minute', 'second']"
851
859
  :min-time="attr.minTime ? attr.minTime : '00:00:00'"
852
860
  :max-time="attr.maxTime ? attr.maxTime : '23:59:59'"
853
861
  />
@@ -880,15 +888,13 @@ function onPickerCancel() {
880
888
  >
881
889
  <VanDatePicker
882
890
  v-model="dateTimePickerValue.date"
883
- :columns-type="attr.columnsType ? attr.columnsType : ['year', 'month', 'day']"
884
- :readonly="attr.readonly ? attr.readonly : false"
891
+ :columns-type="attr.dateColumnsType || ['year', 'month', 'day']"
885
892
  />
886
893
  <VanTimePicker
887
894
  v-model="dateTimePickerValue.time"
888
- :columns-type="['hour', 'minute', 'second']"
895
+ :columns-type="attr.timeColumnsType || ['hour', 'minute', 'second']"
889
896
  :min-time="attr.minTime ? attr.minTime : '00:00:00'"
890
897
  :max-time="attr.maxTime ? attr.maxTime : '23:59:59'"
891
- :readonly="attr.readonly ? attr.readonly : false"
892
898
  />
893
899
  </VanPickerGroup>
894
900
  </VanPopup>
@@ -979,7 +985,7 @@ function onPickerCancel() {
979
985
  :label="labelData"
980
986
  :label-align="labelAlign"
981
987
  :input-align="attr.inputAlign ? attr.inputAlign : 'left'"
982
- :type="attr.type"
988
+ :type="attr.type as FieldType"
983
989
  :readonly="readonly"
984
990
  :disabled="attr.disabled"
985
991
  :placeholder="placeholder"
@@ -988,6 +994,34 @@ function onPickerCancel() {
988
994
  :rules="[{ required: attr.rule.required === 'true', message: `请填写${attr.name}` }]"
989
995
  @blur="() => formTypeCheck(attr, localValue as string)"
990
996
  />
997
+
998
+ <!-- 地址选择器 -->
999
+ <VanField
1000
+ v-if="attr.type === 'addressSearch' && showItem"
1001
+ v-model="addressValue"
1002
+ name="addressSearch"
1003
+ :label="labelData"
1004
+ :label-align="labelAlign"
1005
+ :input-align="attr.inputAlign ? attr.inputAlign : 'left'"
1006
+ readonly
1007
+ is-link
1008
+ :placeholder="placeholder"
1009
+ :rules="[{ required: attr.rule.required === 'true', message: '请选择地址' }]"
1010
+ @click="readonly ? null : showAddressPicker = true"
1011
+ />
1012
+ <VanPopup
1013
+ v-model:show="showAddressPicker"
1014
+ position="bottom"
1015
+ :style="{ height: '80vh' }"
1016
+ teleport="body"
1017
+ >
1018
+ <XLocationPicker
1019
+ v-model="localValue as LocationResult"
1020
+ tian-di-tu-key="c16876b28898637c0a1a68b3fa410504"
1021
+ amap-key="5ebabc4536d4b42e0dd1e20175cca8ab"
1022
+ @confirm="handleAddressConfirm"
1023
+ />
1024
+ </VanPopup>
991
1025
  </div>
992
1026
  </template>
993
1027
 
@@ -52,8 +52,6 @@ const initParams: InitParams = {
52
52
  zoom: 12, // 初始缩放级别
53
53
  maxZoom: 18, // 最大缩放级别
54
54
  minZoom: 4, // 最小缩放级别
55
- tianDiTuKey: 'your_key', // 天地图密钥
56
- amapKey: 'your_key', // 高德地图密钥
57
55
  }
58
56
 
59
57
  // 中心点变化回调
@@ -1,22 +1,36 @@
1
1
  <script setup lang="ts">
2
- import type { LocationResult } from '../types'
2
+ import type { LocationResult, PhoneLocationStatus } from '../types'
3
+ import { mobileUtil } from '@af-mobile-client-vue3/utils/mobileUtil'
3
4
  import { Button } from 'vant'
4
5
  import { nextTick, onMounted, ref, watch } from 'vue'
5
6
  import XOlMap from '../index.vue'
6
7
 
7
8
  interface Props {
8
9
  modelValue?: LocationResult
9
- tianDiTuKey: string
10
- amapKey: string
11
10
  defaultCenter?: [number, number]
12
11
  defaultZoom?: number
13
12
  }
14
13
 
15
14
  const props = withDefaults(defineProps<Props>(), {
16
- defaultCenter: () => [116.404, 39.915],
17
- defaultZoom: 10,
18
- tianDiTuKey: '',
19
- amapKey: '',
15
+ defaultCenter: () => {
16
+ try {
17
+ mobileUtil.execute({
18
+ param: undefined,
19
+ funcName: 'getPhoneStatus',
20
+ callbackFunc: (result) => {
21
+ const locationResult = result as PhoneLocationStatus
22
+ if (locationResult.f_latitude && locationResult.f_longitude) {
23
+ return [locationResult.f_longitude, locationResult.f_latitude]
24
+ }
25
+ },
26
+ })
27
+ }
28
+ catch (error) {
29
+ console.error('获取位置信息失败:', error)
30
+ }
31
+ return [108.948024, 34.263161] // 北京天安门坐标
32
+ },
33
+ defaultZoom: 16,
20
34
  })
21
35
 
22
36
  const emit = defineEmits<{
@@ -55,8 +69,6 @@ onMounted(() => {
55
69
  mapRef.value.init({
56
70
  center: props.defaultCenter,
57
71
  zoom: props.defaultZoom,
58
- tianDiTuKey: props.tianDiTuKey,
59
- amapKey: props.amapKey,
60
72
  })
61
73
 
62
74
  // 初始化后尝试获取地址信息
@@ -17,6 +17,7 @@ import type {
17
17
  WMSOptions,
18
18
  } from './types'
19
19
  import locationIcon from '@af-mobile-client-vue3/assets/img/component/positioning.png'
20
+ import { getConfigByName } from '@af-mobile-client-vue3/services/api/common'
20
21
  import { mobileUtil } from '@af-mobile-client-vue3/utils/mobileUtil'
21
22
  import { Map, View } from 'ol'
22
23
  import { defaults as defaultControls, ScaleLine } from 'ol/control'
@@ -73,6 +74,8 @@ const wmsLayerStatus = ref<WMSLayerConfig[]>([])
73
74
  const vectorLayers: Record<number, VectorLayer<VectorSource>> = {}
74
75
  const pointLayerStatus = ref<PointLayerConfig[]>([])
75
76
 
77
+ const tiandityKey = ref()
78
+ const gaodeKey = ref()
76
79
  /** 导航模式 是否正在跟随定位 */
77
80
  const isFollowingLocation = ref(false)
78
81
  /** 定位定时器 */
@@ -85,11 +88,10 @@ let locationLayer: VectorLayer<VectorSource> | null = null
85
88
  */
86
89
  function createLocationLayer(): VectorLayer<VectorSource> {
87
90
  const source = new VectorSource()
88
- const layer = new VectorLayer({
91
+ return new VectorLayer({
89
92
  source,
90
93
  zIndex: 10, // 确保位置图标在最上层
91
94
  })
92
- return layer
93
95
  }
94
96
 
95
97
  /**
@@ -252,7 +254,7 @@ function initializeLayers(tianDiTuKey = ''): void {
252
254
  */
253
255
  async function getAddressInfo(location: [number, number]): Promise<string> {
254
256
  try {
255
- const key = mapParams.value.amapKey
257
+ const key = gaodeKey.value
256
258
 
257
259
  if (!key) {
258
260
  return '获取地址失败: 未配置密钥'
@@ -320,86 +322,91 @@ function init(params: InitParams = {}): void {
320
322
  zoom = 10,
321
323
  maxZoom = 18,
322
324
  minZoom = 4,
323
- tianDiTuKey = '',
324
- amapKey = '',
325
325
  } = params
326
326
 
327
327
  try {
328
- // 初始化所有底图图层
329
- initializeLayers(tianDiTuKey)
330
-
331
- // 创建地图实例 - 加载所有底图图层,但默认只显示高德地图
332
- map = new Map({
333
- target: mapRef.value,
334
- layers: Object.values(baseMaps), // 加载所有底图图层
335
- view: new View({
336
- center: fromLonLat(center),
337
- zoom,
338
- projection: 'EPSG:3857',
339
- maxZoom,
340
- minZoom,
341
- }),
342
- controls: defaultControls({
343
- zoom: false,
344
- rotate: false,
345
- attribution: false,
346
- }).extend([
347
- new ScaleLine({
348
- units: 'metric',
349
- className: 'ol-scale-line',
328
+ getConfigByName('webConfig', (res) => {
329
+ const tianDiTuKey = res.tianDiTuKey || 'c16876b28898637c0a1a68b3fa410504'
330
+ const amapKey = res.amapKey || '5ebabc4536d4b42e0dd1e20175cca8ab'
331
+
332
+ tiandityKey.value = tianDiTuKey
333
+ gaodeKey.value = amapKey
334
+ // 初始化所有底图图层
335
+ initializeLayers(tianDiTuKey)
336
+
337
+ // 创建地图实例 - 加载所有底图图层,但默认只显示高德地图
338
+ map = new Map({
339
+ target: mapRef.value,
340
+ layers: Object.values(baseMaps), // 加载所有底图图层
341
+ view: new View({
342
+ center: fromLonLat(center),
343
+ zoom,
344
+ projection: 'EPSG:3857',
345
+ maxZoom,
346
+ minZoom,
347
+ }),
348
+ controls: defaultControls({
349
+ zoom: false,
350
+ rotate: false,
351
+ attribution: false,
352
+ }).extend([
353
+ new ScaleLine({
354
+ units: 'metric',
355
+ className: 'ol-scale-line',
356
+ }),
357
+ ]),
358
+ interactions: defaultInteractions({
359
+ altShiftDragRotate: false,
360
+ pinchRotate: false,
350
361
  }),
351
- ]),
352
- interactions: defaultInteractions({
353
- altShiftDragRotate: false,
354
- pinchRotate: false,
355
- }),
356
- })
357
-
358
- // 更新地图大小,确保地图正确渲染
359
- setTimeout(() => {
360
- if (map) {
361
- map.updateSize()
362
- // 确保默认图层正确显示
363
- handleMapChange('tianditu')
364
- }
365
- }, 200)
366
-
367
- // 监听地图移动结束事件
368
- map.on('moveend', handleMoveEnd)
369
-
370
- // 设置鼠标样式
371
- if (mapRef.value) {
372
- mapRef.value.style.cursor = 'grab'
373
- // 监听地图事件
374
- const mapElement = mapRef.value
375
-
376
- // 鼠标按下时
377
- mapElement.addEventListener('mousedown', () => {
378
- mapElement.style.cursor = 'grabbing'
379
- // 用户开始拖动地图,取消跟随定位
380
- if (locationTimer) {
381
- isFollowingLocation.value = false
382
- }
383
362
  })
384
363
 
385
- // 触摸开始时
386
- mapElement.addEventListener('touchstart', () => {
387
- // 用户开始拖动地图,取消跟随定位
388
- if (locationTimer) {
389
- isFollowingLocation.value = false
364
+ // 更新地图大小,确保地图正确渲染
365
+ setTimeout(() => {
366
+ if (map) {
367
+ map.updateSize()
368
+ // 确保默认图层正确显示
369
+ handleMapChange('tianditu')
390
370
  }
391
- })
371
+ }, 200)
372
+
373
+ // 监听地图移动结束事件
374
+ map.on('moveend', handleMoveEnd)
375
+
376
+ // 设置鼠标样式
377
+ if (mapRef.value) {
378
+ mapRef.value.style.cursor = 'grab'
379
+ // 监听地图事件
380
+ const mapElement = mapRef.value
381
+
382
+ // 鼠标按下时
383
+ mapElement.addEventListener('mousedown', () => {
384
+ mapElement.style.cursor = 'grabbing'
385
+ // 用户开始拖动地图,取消跟随定位
386
+ if (locationTimer) {
387
+ isFollowingLocation.value = false
388
+ }
389
+ })
392
390
 
393
- // 鼠标释放时
394
- mapElement.addEventListener('mouseup', () => {
395
- mapElement.style.cursor = 'grab'
396
- })
391
+ // 触摸开始时
392
+ mapElement.addEventListener('touchstart', () => {
393
+ // 用户开始拖动地图,取消跟随定位
394
+ if (locationTimer) {
395
+ isFollowingLocation.value = false
396
+ }
397
+ })
397
398
 
398
- // 鼠标离开地图时
399
- mapElement.addEventListener('mouseleave', () => {
400
- mapElement.style.cursor = 'grab'
401
- })
402
- }
399
+ // 鼠标释放时
400
+ mapElement.addEventListener('mouseup', () => {
401
+ mapElement.style.cursor = 'grab'
402
+ })
403
+
404
+ // 鼠标离开地图时
405
+ mapElement.addEventListener('mouseleave', () => {
406
+ mapElement.style.cursor = 'grab'
407
+ })
408
+ }
409
+ })
403
410
  }
404
411
  catch (error) {
405
412
  console.error('地图初始化失败:', error)
@@ -28,12 +28,8 @@ export interface InitParams {
28
28
  maxZoom?: number
29
29
  /** 最小缩放级别 */
30
30
  minZoom?: number
31
- /** 天地图密钥 */
32
- tianDiTuKey?: string
33
31
  /** 是否开启地址选择模式 */
34
32
  enableLocationPicker?: boolean
35
- /** 高德地图 API key */
36
- amapKey?: string
37
33
  }
38
34
 
39
35
  /** 点位数据接口 */