af-mobile-client-vue3 1.1.7 → 1.1.9

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "af-mobile-client-vue3",
3
3
  "type": "module",
4
- "version": "1.1.7",
4
+ "version": "1.1.9",
5
5
  "description": "Vue + Vite component lib",
6
6
  "license": "MIT",
7
7
  "engines": {
@@ -127,7 +127,7 @@ onBeforeMount(() => {
127
127
  function initComponent() {
128
128
  getConfigByName(configName, (result) => {
129
129
  groupFormItems.value = result
130
- title.value = result.title
130
+ title.value = result?.title
131
131
  for (let i = 0; i < result.columnJson.length; i++) {
132
132
  const item = result.columnJson[i]
133
133
  item.span = item.flexSpan
@@ -436,6 +436,7 @@ function evaluateCustomFunction(funcString: string | undefined, record: any, ind
436
436
  <VanRow gutter="20" class="card_item_details" @click="emit('toDetail', item)">
437
437
  <VanCol v-for="column of detailColumns" :key="`details_${column.dataIndex}`" :span="column.span">
438
438
  <p>
439
+ {{ `${column.title}: ` }}
439
440
  <XBadge
440
441
  :style="handleFunctionStyle(column.styleFunctionForValue, item[column.dataIndex])"
441
442
  :dict-name="column.dictName" :dict-value="item[column.dataIndex]"
@@ -1,7 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import type { FieldType } from 'vant'
3
3
  import type { Numeric } from 'vant/es/utils'
4
- import type { LocationResult } from '../XOlMap/types'
5
4
  import Uploader from '@af-mobile-client-vue3/components/core/Uploader/index.vue'
6
5
  import XGridDropOption from '@af-mobile-client-vue3/components/core/XGridDropOption/index.vue'
7
6
  import XMultiSelect from '@af-mobile-client-vue3/components/core/XMultiSelect/index.vue'
@@ -216,7 +215,8 @@ const localValue = computed({
216
215
 
217
216
  else
218
217
  return props.modelValue
219
-
218
+ case 'addressSearch':
219
+ return props.modelValue
220
220
  default:
221
221
  return undefined
222
222
  }
@@ -590,9 +590,30 @@ function onPickerCancel() {
590
590
 
591
591
  const showAddressPicker = ref(false)
592
592
  const addressValue = ref('')
593
+
594
+ // XLocationPicker 默认加载的中心点
595
+ const defaultMapCenter = computed(() => {
596
+ const lonLat = form[`${attr.model}_lon_lat`]
597
+ if (lonLat && typeof lonLat === 'string' && lonLat.includes(',')) {
598
+ const [lon, lat] = lonLat.split(',').map(Number)
599
+ if (!Number.isNaN(lon) && !Number.isNaN(lat)) {
600
+ return [lon, lat] as [number, number]
601
+ }
602
+ }
603
+ return undefined
604
+ })
605
+
593
606
  // 处理地址选择器确认
594
607
  function handleAddressConfirm(location) {
595
- addressValue.value = location.address
608
+ // 构造新的数据格式
609
+ const formData = {
610
+ [`${attr.model}_lon_lat`]: `${location.longitude},${location.latitude}`,
611
+ [attr.model]: location.address,
612
+ }
613
+
614
+ // 更新表单数据
615
+ // eslint-disable-next-line vue/custom-event-name-casing
616
+ emits('set-form', formData)
596
617
  showAddressPicker.value = false
597
618
  }
598
619
  </script>
@@ -998,7 +1019,7 @@ function handleAddressConfirm(location) {
998
1019
  <!-- 地址选择器 -->
999
1020
  <VanField
1000
1021
  v-if="attr.type === 'addressSearch' && showItem"
1001
- v-model="addressValue"
1022
+ v-model="localValue as string"
1002
1023
  name="addressSearch"
1003
1024
  :label="labelData"
1004
1025
  :label-align="labelAlign"
@@ -1016,9 +1037,7 @@ function handleAddressConfirm(location) {
1016
1037
  teleport="body"
1017
1038
  >
1018
1039
  <XLocationPicker
1019
- v-model="localValue as LocationResult"
1020
- tian-di-tu-key="c16876b28898637c0a1a68b3fa410504"
1021
- amap-key="5ebabc4536d4b42e0dd1e20175cca8ab"
1040
+ :default-center="defaultMapCenter"
1022
1041
  @confirm="handleAddressConfirm"
1023
1042
  />
1024
1043
  </VanPopup>
@@ -63,17 +63,15 @@ function handleConfirm() {
63
63
  }
64
64
 
65
65
  // 组件挂载时初始化地图
66
- onMounted(() => {
66
+ onMounted(async () => {
67
67
  // 使用 nextTick 确保 DOM 已更新
68
- nextTick(() => {
69
- mapRef.value.init({
70
- center: props.defaultCenter,
71
- zoom: props.defaultZoom,
72
- })
73
-
74
- // 初始化后尝试获取地址信息
75
- handleCenterChange(props.defaultCenter)
68
+ await nextTick()
69
+ await mapRef.value.init({
70
+ center: props.defaultCenter,
71
+ zoom: props.defaultZoom,
76
72
  })
73
+ // 初始化后尝试获取地址信息
74
+ handleCenterChange(props.defaultCenter)
77
75
  })
78
76
 
79
77
  // 监听弹窗状态变化
@@ -308,109 +308,115 @@ async function handleMoveEnd() {
308
308
  * 初始化地图
309
309
  * @param params - 初始化参数
310
310
  */
311
- function init(params: InitParams = {}): void {
312
- if (!mapRef.value) {
313
- return
314
- }
315
-
316
- // 保存初始化参数
317
- mapParams.value = params
318
-
319
- // 设置默认参数
320
- const {
321
- center = [116.404, 39.915],
322
- zoom = 10,
323
- maxZoom = 18,
324
- minZoom = 4,
325
- } = params
311
+ function init(params: InitParams = {}): Promise<void> {
312
+ return new Promise((resolve) => {
313
+ if (!mapRef.value) {
314
+ resolve()
315
+ return
316
+ }
326
317
 
327
- try {
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',
318
+ // 保存初始化参数
319
+ mapParams.value = params
320
+
321
+ // 设置默认参数
322
+ const {
323
+ center = [116.404, 39.915],
324
+ zoom = 10,
325
+ maxZoom = 18,
326
+ minZoom = 4,
327
+ } = params
328
+
329
+ try {
330
+ getConfigByName('webConfig', (res) => {
331
+ const tianDiTuKey = res.tianDiTuKey || 'c16876b28898637c0a1a68b3fa410504'
332
+ const amapKey = res.amapKey || '5ebabc4536d4b42e0dd1e20175cca8ab'
333
+
334
+ tiandityKey.value = tianDiTuKey
335
+ gaodeKey.value = amapKey
336
+ // 初始化所有底图图层
337
+ initializeLayers(tianDiTuKey)
338
+
339
+ // 创建地图实例 - 加载所有底图图层,但默认只显示高德地图
340
+ map = new Map({
341
+ target: mapRef.value,
342
+ layers: Object.values(baseMaps), // 加载所有底图图层
343
+ view: new View({
344
+ center: fromLonLat(center),
345
+ zoom,
346
+ projection: 'EPSG:3857',
347
+ maxZoom,
348
+ minZoom,
349
+ }),
350
+ controls: defaultControls({
351
+ zoom: false,
352
+ rotate: false,
353
+ attribution: false,
354
+ }).extend([
355
+ new ScaleLine({
356
+ units: 'metric',
357
+ className: 'ol-scale-line',
358
+ }),
359
+ ]),
360
+ interactions: defaultInteractions({
361
+ altShiftDragRotate: false,
362
+ pinchRotate: false,
356
363
  }),
357
- ]),
358
- interactions: defaultInteractions({
359
- altShiftDragRotate: false,
360
- pinchRotate: false,
361
- }),
362
- })
363
-
364
- // 更新地图大小,确保地图正确渲染
365
- setTimeout(() => {
366
- if (map) {
367
- map.updateSize()
368
- // 确保默认图层正确显示
369
- handleMapChange('tianditu')
370
- }
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
364
  })
390
365
 
391
- // 触摸开始时
392
- mapElement.addEventListener('touchstart', () => {
393
- // 用户开始拖动地图,取消跟随定位
394
- if (locationTimer) {
395
- isFollowingLocation.value = false
366
+ // 更新地图大小,确保地图正确渲染
367
+ setTimeout(() => {
368
+ if (map) {
369
+ map.updateSize()
370
+ // 确保默认图层正确显示
371
+ handleMapChange('tianditu')
372
+ // 地图初始化完成后解析 Promise
373
+ resolve()
396
374
  }
397
- })
375
+ }, 200)
376
+
377
+ // 监听地图移动结束事件
378
+ map.on('moveend', handleMoveEnd)
379
+
380
+ // 设置鼠标样式
381
+ if (mapRef.value) {
382
+ mapRef.value.style.cursor = 'grab'
383
+ // 监听地图事件
384
+ const mapElement = mapRef.value
385
+
386
+ // 鼠标按下时
387
+ mapElement.addEventListener('mousedown', () => {
388
+ mapElement.style.cursor = 'grabbing'
389
+ // 用户开始拖动地图,取消跟随定位
390
+ if (locationTimer) {
391
+ isFollowingLocation.value = false
392
+ }
393
+ })
398
394
 
399
- // 鼠标释放时
400
- mapElement.addEventListener('mouseup', () => {
401
- mapElement.style.cursor = 'grab'
402
- })
395
+ // 触摸开始时
396
+ mapElement.addEventListener('touchstart', () => {
397
+ // 用户开始拖动地图,取消跟随定位
398
+ if (locationTimer) {
399
+ isFollowingLocation.value = false
400
+ }
401
+ })
403
402
 
404
- // 鼠标离开地图时
405
- mapElement.addEventListener('mouseleave', () => {
406
- mapElement.style.cursor = 'grab'
407
- })
408
- }
409
- })
410
- }
411
- catch (error) {
412
- console.error('地图初始化失败:', error)
413
- }
403
+ // 鼠标释放时
404
+ mapElement.addEventListener('mouseup', () => {
405
+ mapElement.style.cursor = 'grab'
406
+ })
407
+
408
+ // 鼠标离开地图时
409
+ mapElement.addEventListener('mouseleave', () => {
410
+ mapElement.style.cursor = 'grab'
411
+ })
412
+ }
413
+ })
414
+ }
415
+ catch (error) {
416
+ console.error('地图初始化失败:', error)
417
+ resolve()
418
+ }
419
+ })
414
420
  }
415
421
 
416
422
  /**
@@ -905,6 +911,7 @@ defineExpose({
905
911
  // 组件卸载时清理地图实例
906
912
  onUnmounted(() => {
907
913
  if (map) {
914
+ stopNavigation()
908
915
  map.setTarget(undefined)
909
916
  map = null
910
917
  }
@@ -1,92 +1,11 @@
1
1
  <script setup lang="ts">
2
2
  import XCellList from '@af-mobile-client-vue3/components/data/XCellList/index.vue'
3
3
  import NormalDataLayout from '@af-mobile-client-vue3/components/layout/NormalDataLayout/index.vue'
4
- import { defineEmits, ref } from 'vue'
5
- import { useRouter } from 'vue-router'
6
-
7
- // 定义事件
8
- const emit = defineEmits(['deleteRow'])
9
- // 访问路由
10
- const router = useRouter()
11
- // 获取默认值
12
- const idKey = ref('o_id')
4
+ import { ref } from 'vue'
13
5
 
14
6
  // 简易crud表单测试
15
- const configName = ref('crud_oper_log_manage')
16
- const serviceName = ref('af-system')
17
-
18
- // 资源权限测试
19
- // const configName = ref('crud_sources_test')
20
- // const serviceName = ref('af-system')
21
-
22
- // 实际业务测试
23
- // const configName = ref('lngChargeAuditMobileCRUD')
24
- // const serviceName = ref('af-gaslink')
25
-
26
- // 跳转到详情页面
27
- // function toDetail(item) {
28
- // router.push({
29
- // name: 'XCellDetailView',
30
- // params: { id: item[idKey.value] }, // 如果使用命名路由,推荐使用路由参数而不是直接构建 URL
31
- // query: {
32
- // operName: item[operNameKey.value],
33
- // method:item[methodKey.value],
34
- // requestMethod:item[requestMethodKey.value],
35
- // operatorType:item[operatorTypeKey.value],
36
- // operUrl:item[operUrlKey.value],
37
- // operIp:item[operIpKey.value],
38
- // costTime:item[costTimeKey.value],
39
- // operTime:item[operTimeKey.value],
40
- //
41
- // title: item[titleKey.value],
42
- // businessType: item[businessTypeKey.value],
43
- // status:item[statusKey.value]
44
- // }
45
- // })
46
- // }
47
-
48
- // 跳转到表单——以表单组来渲染纯表单
49
- function toDetail(item) {
50
- router.push({
51
- name: 'XFormGroupView',
52
- query: {
53
- id: item[idKey.value],
54
- // id: item.rr_id,
55
- // o_id: item.o_id,
56
- },
57
- })
58
- }
59
-
60
- // 新增功能
61
- // function addOption(totalCount) {
62
- // router.push({
63
- // name: 'XFormView',
64
- // params: { id: totalCount, openid: totalCount },
65
- // query: {
66
- // configName: configName.value,
67
- // serviceName: serviceName.value,
68
- // mode: '新增',
69
- // },
70
- // })
71
- // }
72
-
73
- // 修改功能
74
- // function updateRow(result) {
75
- // router.push({
76
- // name: 'XFormView',
77
- // params: { id: result.o_id, openid: result.o_id },
78
- // query: {
79
- // configName: configName.value,
80
- // serviceName: serviceName.value,
81
- // mode: '修改',
82
- // },
83
- // })
84
- // }
85
-
86
- // 删除功能
87
- function deleteRow(result) {
88
- emit('deleteRow', result.o_id)
89
- }
7
+ const configName = ref('defectDispatchPhoneCRUD')
8
+ const serviceName = ref('af-linepatrol')
90
9
  </script>
91
10
 
92
11
  <template>
@@ -95,10 +14,6 @@ function deleteRow(result) {
95
14
  <XCellList
96
15
  :config-name="configName"
97
16
  :service-name="serviceName"
98
- :fix-query-form="{ o_f_oper_name: 'edu_test' }"
99
- :id-key="idKey"
100
- @to-detail="toDetail"
101
- @delete-row="deleteRow"
102
17
  />
103
18
  </template>
104
19
  </NormalDataLayout>
@@ -9,13 +9,6 @@ import { useRoute } from 'vue-router'
9
9
  const configName = ref('form_check_test')
10
10
  const serviceName = ref('af-system')
11
11
 
12
- // const configName = ref("计划下发Form")
13
- // const serviceName = ref("af-linepatrol")
14
-
15
- // 表单组
16
- // const configName = ref('lngChargeAuditMobileFormGroup')
17
- // const serviceName = ref('af-gaslink')
18
-
19
12
  const formData = ref({})
20
13
  const formGroup = ref(null)
21
14
  const route = useRoute()
@@ -25,36 +18,6 @@ function submit(_result) {
25
18
  history.back()
26
19
  })
27
20
  }
28
-
29
- // 表单组——数据
30
- // function initComponents () {
31
- // runLogic('getlngChargeAuditMobileFormGroupData', {id: 29}, 'af-gaslink').then((res) => {
32
- // formData.value = {...res}
33
- // })
34
- // }
35
-
36
- // 纯表单——数据
37
- // function initComponents() {
38
- // formData.value = { plan_name: 'af-llllll', plan_point: '1号点位', plan_single: '1号点位', plan_range: '2024-12-12' }
39
- // }
40
-
41
- // function initComponents() {
42
- // runLogic('getlngChargeAuditMobileFormGroupData', { id: route.query?.id, o_id: route.query?.o_id }, 'af-gaslink').then((res) => {
43
- // console.log('res------', res)
44
- // formData.value = { ...res }
45
- // formGroup.value.init({
46
- // configName: configName.value,
47
- // serviceName: serviceName.value,
48
- // groupFormData: { ...res },
49
- // mode: "新增"
50
- // })
51
- // isInit.value = true
52
- // })
53
- // }
54
-
55
- // onBeforeMount(() => {
56
- // initComponents()
57
- // })
58
21
  </script>
59
22
 
60
23
  <template>
@@ -1,133 +1,44 @@
1
1
  <script setup lang="ts">
2
- import XForm from '@af-mobile-client-vue3/components/data/XForm/index.vue'
2
+ import XFormGroup from '@af-mobile-client-vue3/components/data/XFormGroup/index.vue'
3
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 { post } from '@af-mobile-client-vue3/services/restTools'
6
- import {
7
- showDialog,
8
- NavBar as VanNavBar,
9
- Space as VanSpace,
10
- } from 'vant'
11
- import { defineEmits, getCurrentInstance, onBeforeMount, ref } from 'vue'
12
- import { useRoute } from 'vue-router'
13
-
14
- const emit = defineEmits(['onSumbit'])
15
- const xForm = ref(null)
16
- const id = ref(-1)
17
- const openid = ref('')
18
- const instance = getCurrentInstance()
19
- const xFormInit = ref(false)
20
- const route = useRoute()
21
- const configName = route.query.configName as string
22
- const serviceName = route.query.serviceName as string
23
- const mode = route.query.mode as string
24
- const updateData = ref({})
25
- const title = ref('')
26
- const groupFormItems = ref({})
27
- const api = ref('/af-system/logic/commonQuery')
28
- const updateId = {
29
- queryParamsName: 'crud_oper_log_manage',
30
- pageNo: 1,
31
- pageSize: 20,
32
- conditionParams: { o_id: route.params.id as string },
33
- }
34
- const loadUpdate = ref(false)
35
- // const serviceName = ref('af-revenue')
36
- const _currentEvaluate = {
37
- id: null,
38
- f_business_name: '',
39
- f_evaluate_state: '',
40
- }
41
-
42
- // 组件挂载前获取数据
43
- onBeforeMount(async () => {
44
- if (instance) {
45
- id.value = route.params.id as unknown as number
46
- openid.value = route.params.openid as string
47
- formInit()
48
- }
4
+ import { ref } from 'vue'
5
+
6
+ const configName = ref('PointBindingForm')
7
+ const serviceName = ref('af-linepatrol')
8
+
9
+ const formData = ref({
10
+ t1_f_number: '点位编号>>',
11
+ t2_f_name: '所属区域>>',
12
+ t1_f_address: '地址信息>>',
13
+ t1_f_address_lon_lat: '118.842054,39.246094',
14
+ t1_f_describe: '点位描述>>',
15
+ t1_f_state: '点位状态>>',
49
16
  })
50
-
51
- // 组件初始化前的判断
52
- async function formInit() {
53
- getConfigByName(configName, (result) => {
54
- groupFormItems.value = result
55
- title.value = result.title
56
- if (mode === '修改')
57
- getUpdateData()
58
- xFormInit.value = true
59
- }, serviceName)
60
- }
61
-
62
- // 获取配置信息
63
- function queryData() {
64
-
65
- }
66
-
67
- // 提交操作
68
- function onSubmit(params) {
69
- // const data = {
70
- // id: currentEvaluate.id,
71
- // f_json: params,
72
- // f_evaluate_date: formatDate(new Date()),
73
- // f_evaluate_state: '已评价',
74
- // f_evaluate_type: '用户评价',
75
- // f_evaluate_userid: openid.value,
76
- // }
77
- // openApiLogic(data, 'saveEvaluate', formServiveName).then((_res: any) => {
78
- // showDialog({ message: '评价成功了' }).then(() => {history.back()})
79
- // }).catch(() => {
80
- // showDialog({ message: '评价失败了' })
17
+ const formGroup = ref(null)
18
+ function submit(result) {
19
+ console.log('>>>> result: ', result)
20
+ // showDialog({ message: '提交成功' }).then(() => {
21
+ // history.back()
81
22
  // })
82
- if (params) {
83
- emit('onSumbit', params)
84
- showDialog({ message: '评价成功了' }).then(() => {
85
- history.back()
86
- })
87
- }
88
- else {
89
- showDialog({ message: '评价失败了' }).then(() => {
90
- history.back()
91
- })
92
- }
93
- }
94
-
95
- // 查询需要修改的数据
96
- async function getUpdateData() {
97
- if (api.value && updateId) {
98
- const res = await post(api.value, updateId)
99
- updateData.value = res.data[0]
100
- }
101
23
  }
102
24
  </script>
103
25
 
104
26
  <template>
105
- <NormalDataLayout id="XFormView" title="XForm表单">
27
+ <NormalDataLayout id="XFormGroupView" title="纯表单">
106
28
  <template #layout_content>
107
- <VanSpace direction="vertical" fill>
108
- <VanNavBar :title="title ? mode.concat(title) : null" />
109
- <XForm
110
- v-if="xFormInit"
111
- ref="xForm"
112
- :group-form-items="JSON.parse(JSON.stringify(groupFormItems))"
113
- :service-name="serviceName"
114
- :form-data="updateData"
115
- :mode="mode"
116
- style="margin-bottom: 14px;"
117
- @on-submit="onSubmit"
118
- />
119
- </VanSpace>
29
+ <!-- v-if="isInit" -->
30
+ <XFormGroup
31
+ ref="formGroup"
32
+ :config-name="configName"
33
+ :service-name="serviceName"
34
+ :group-form-data="formData"
35
+ mode="新增"
36
+ @submit="submit"
37
+ />
120
38
  </template>
121
39
  </NormalDataLayout>
122
40
  </template>
123
41
 
124
- <style scoped>
125
- .van-doc-demo-block__title {
126
- margin: 0;
127
- padding: 32px 16px 16px;
128
- color: black;
129
- font-weight: 400;
130
- font-size: 14px;
131
- line-height: 16px;
132
- }
42
+ <style scoped lang="less">
43
+
133
44
  </style>
@@ -0,0 +1,50 @@
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 { nextTick, onMounted, ref } from 'vue'
6
+
7
+ const xForm = ref(null)
8
+ const serviceName = 'af-linepatrol'
9
+
10
+ onMounted(() => {
11
+ const modifyModelData = {
12
+ t1_f_number: '点位编号',
13
+ t2_f_name: '所属区域',
14
+ t1_f_address: '116.450355,40.057394',
15
+ t1_f_describe: '点位描述',
16
+ t1_f_state: '点位状态',
17
+ }
18
+ getConfigByName('PointBindingForm', async (res) => {
19
+ const initData = {
20
+ formItems: res, // 琉璃配置
21
+ serviceName, // 服务名称
22
+ formData: JSON.stringify(modifyModelData), // 数据
23
+ mode: '修改', // 修改
24
+ }
25
+ console.log('>>>> initData: ', JSON.stringify(initData))
26
+ await nextTick()
27
+ xForm.value.init(initData)
28
+ }, 'af-linepatrol')
29
+ })
30
+
31
+ // 提交操作
32
+ function onSubmit(params) {
33
+ console.log('>>>> params: ', JSON.stringify(params))
34
+ }
35
+ </script>
36
+
37
+ <template>
38
+ <NormalDataLayout id="XFormView" title="XForm表单">
39
+ <template #layout_content>
40
+ <XForm
41
+ ref="xForm"
42
+ service-name="af-linepatrol"
43
+ @on-submit="onSubmit"
44
+ />
45
+ </template>
46
+ </NormalDataLayout>
47
+ </template>
48
+
49
+ <style scoped>
50
+ </style>
@@ -44,8 +44,6 @@ function handleLocationConfirm(location: LocationResult) {
44
44
  <div class="map-container">
45
45
  <LocationPicker
46
46
  v-model="selectedLocation"
47
- tian-di-tu-key="c16876b28898637c0a1a68b3fa410504"
48
- amap-key="5ebabc4536d4b42e0dd1e20175cca8ab"
49
47
  :default-center="[108.948024, 34.263161]"
50
48
  :default-zoom="12"
51
49
  @confirm="handleLocationConfirm"
@@ -63,14 +63,12 @@ const wmsConfig = {
63
63
  }
64
64
 
65
65
  // 初始化地图
66
- onMounted(() => {
67
- mapRef.value.init({
66
+ onMounted(async () => {
67
+ await mapRef.value.init({
68
68
  center: [108.948024, 34.263161], // 西安坐标
69
69
  zoom: 12,
70
- maxZoom: 18,
71
- minZoom: 4,
72
70
  })
73
- mapRef.value.addWMSLayers(wmsConfig)
71
+ await mapRef.value.addWMSLayers(wmsConfig)
74
72
  })
75
73
 
76
74
  // 地图控制函数