af-mobile-client-vue3 1.1.49 → 1.1.50
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 +1 -1
- package/src/components/data/XForm/index.vue +15 -1
- package/src/components/data/XFormItem/index.vue +0 -4
- package/src/components/data/XOlMap/XLocationPicker/index.vue +30 -21
- package/src/components/data/XOlMap/index.vue +3 -3
- package/src/views/component/XFormView/index.vue +19 -2
package/package.json
CHANGED
|
@@ -146,7 +146,21 @@ function init(params) {
|
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
function setFormProps(form, item) {
|
|
149
|
-
|
|
149
|
+
// 只有在字段未定义时,按类型赋有意义的默认值
|
|
150
|
+
if (form.value[item.model] === undefined) {
|
|
151
|
+
switch (item.rule?.type) {
|
|
152
|
+
case 'number':
|
|
153
|
+
case 'integer':
|
|
154
|
+
case 'float':
|
|
155
|
+
form.value[item.model] = 0
|
|
156
|
+
break
|
|
157
|
+
case 'string':
|
|
158
|
+
form.value[item.model] = ''
|
|
159
|
+
break
|
|
160
|
+
default:
|
|
161
|
+
form.value[item.model] = ''
|
|
162
|
+
}
|
|
163
|
+
}
|
|
150
164
|
if (item.rule) {
|
|
151
165
|
rules[item.model] = []
|
|
152
166
|
let defaultValue
|
|
@@ -277,9 +277,6 @@ watch(() => props.modelValue, (newVal) => {
|
|
|
277
277
|
pickerValue.value = newVal !== undefined ? `${newVal[0]} ~ ${newVal[1]}` : getDefaultValue()
|
|
278
278
|
}
|
|
279
279
|
else if (['datePicker', 'rangePicker', 'yearPicker', 'monthPicker', 'yearRangePicker', 'monthRangePicker'].includes(attr.type)) {
|
|
280
|
-
console.log('>>>> attr: ', JSON.stringify(attr))
|
|
281
|
-
const ss = getDateRange(attr)
|
|
282
|
-
console.log('>>>> ss: ', ss)
|
|
283
280
|
localValue.value = getDateRange(attr)
|
|
284
281
|
}
|
|
285
282
|
else {
|
|
@@ -690,7 +687,6 @@ function handleAddressConfirm(location) {
|
|
|
690
687
|
[`${attr.model}_lon_lat`]: `${location.longitude},${location.latitude}`,
|
|
691
688
|
[attr.model]: location.address,
|
|
692
689
|
}
|
|
693
|
-
|
|
694
690
|
// 更新表单数据
|
|
695
691
|
// eslint-disable-next-line vue/custom-event-name-casing
|
|
696
692
|
emits('set-form', formData)
|
|
@@ -12,27 +12,7 @@ interface Props {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
const props = withDefaults(defineProps<Props>(), {
|
|
15
|
-
defaultCenter: () =>
|
|
16
|
-
try {
|
|
17
|
-
mobileUtil.execute({
|
|
18
|
-
param: {},
|
|
19
|
-
funcName: 'getLocationResult',
|
|
20
|
-
callbackFunc: (result) => {
|
|
21
|
-
const res = result as PhoneLocationStatus
|
|
22
|
-
if (res.status === 'success') {
|
|
23
|
-
const locationResult = JSON.parse(res.data.location)
|
|
24
|
-
if (locationResult.longitude && locationResult.latitude) {
|
|
25
|
-
return [locationResult.longitude, locationResult.latitude]
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
})
|
|
30
|
-
}
|
|
31
|
-
catch (error) {
|
|
32
|
-
console.error('获取位置信息失败:', error)
|
|
33
|
-
}
|
|
34
|
-
return [108.948024, 34.263161] // 北京天安门坐标
|
|
35
|
-
},
|
|
15
|
+
defaultCenter: () => [108.948024, 34.263161],
|
|
36
16
|
defaultZoom: 16,
|
|
37
17
|
})
|
|
38
18
|
|
|
@@ -75,6 +55,32 @@ onMounted(async () => {
|
|
|
75
55
|
})
|
|
76
56
|
// 初始化后尝试获取地址信息
|
|
77
57
|
handleCenterChange(props.defaultCenter)
|
|
58
|
+
|
|
59
|
+
// 异步获取定位,获取到后更新 currentLocation 和地图中心
|
|
60
|
+
try {
|
|
61
|
+
mobileUtil.execute({
|
|
62
|
+
param: {},
|
|
63
|
+
funcName: 'getLocationResult',
|
|
64
|
+
callbackFunc: (result) => {
|
|
65
|
+
const res = result as PhoneLocationStatus
|
|
66
|
+
if (res.status === 'success') {
|
|
67
|
+
const locationResult = JSON.parse(res.data.location)
|
|
68
|
+
if (locationResult.longitude && locationResult.latitude) {
|
|
69
|
+
const newCenter: [number, number] = [locationResult.longitude, locationResult.latitude]
|
|
70
|
+
currentLocation.value = newCenter
|
|
71
|
+
// 设置地图中心
|
|
72
|
+
if (mapRef.value && mapRef.value.setCenter) {
|
|
73
|
+
mapRef.value.setCenter(newCenter)
|
|
74
|
+
}
|
|
75
|
+
handleCenterChange(newCenter)
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
})
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
console.error('获取位置信息失败:', error)
|
|
83
|
+
}
|
|
78
84
|
})
|
|
79
85
|
|
|
80
86
|
// 监听弹窗状态变化
|
|
@@ -137,6 +143,9 @@ watch(() => props.modelValue, (newVal) => {
|
|
|
137
143
|
position: relative;
|
|
138
144
|
flex: 1;
|
|
139
145
|
min-height: 0;
|
|
146
|
+
border-radius: 40px;
|
|
147
|
+
overflow: hidden;
|
|
148
|
+
padding: 10px;
|
|
140
149
|
}
|
|
141
150
|
|
|
142
151
|
.map {
|
|
@@ -12,10 +12,10 @@ import type {
|
|
|
12
12
|
PhoneLocationStatus,
|
|
13
13
|
PointData,
|
|
14
14
|
PointLayerConfig,
|
|
15
|
+
TrackData,
|
|
15
16
|
WebGLPointOptions,
|
|
16
17
|
WMSLayerConfig,
|
|
17
18
|
WMSOptions,
|
|
18
|
-
TrackData,
|
|
19
19
|
} from './types'
|
|
20
20
|
import locationIcon from '@af-mobile-client-vue3/assets/img/component/positioning.png'
|
|
21
21
|
import { getConfigByName } from '@af-mobile-client-vue3/services/api/common'
|
|
@@ -23,13 +23,13 @@ import { mobileUtil } from '@af-mobile-client-vue3/utils/mobileUtil'
|
|
|
23
23
|
import { Map, View } from 'ol'
|
|
24
24
|
import { defaults as defaultControls, ScaleLine } from 'ol/control'
|
|
25
25
|
import Feature from 'ol/Feature'
|
|
26
|
-
import Point from 'ol/geom/Point'
|
|
27
26
|
import LineString from 'ol/geom/LineString'
|
|
27
|
+
import Point from 'ol/geom/Point'
|
|
28
28
|
import { defaults as defaultInteractions } from 'ol/interaction'
|
|
29
29
|
import { Image as ImageLayer, Tile as TileLayer, Vector as VectorLayer } from 'ol/layer'
|
|
30
30
|
import { fromLonLat, toLonLat } from 'ol/proj'
|
|
31
31
|
import { ImageWMS, Vector as VectorSource, XYZ } from 'ol/source'
|
|
32
|
-
import { Fill, Icon, Stroke, Style, Text
|
|
32
|
+
import { Circle, Fill, Icon, Stroke, Style, Text } from 'ol/style'
|
|
33
33
|
import { Button } from 'vant'
|
|
34
34
|
import { getCurrentInstance, onUnmounted, ref } from 'vue'
|
|
35
35
|
import { wgs84ToGcj02Projection } from './utils/wgs84ToGcj02'
|
|
@@ -3,12 +3,27 @@ import XForm from '@af-mobile-client-vue3/components/data/XForm/index.vue'
|
|
|
3
3
|
import NormalDataLayout from '@af-mobile-client-vue3/components/layout/NormalDataLayout/index.vue'
|
|
4
4
|
import { ref } from 'vue'
|
|
5
5
|
|
|
6
|
-
const configName = ref('AddConstructionForm')
|
|
6
|
+
// const configName = ref('AddConstructionForm')
|
|
7
|
+
const configName = ref('PointBindingForm') // 点位绑定
|
|
7
8
|
const serviceName = ref('af-linepatrol')
|
|
8
9
|
|
|
9
10
|
const formGroupAddConstruction = ref(null)
|
|
10
|
-
</script>
|
|
11
11
|
|
|
12
|
+
const formData = ref({
|
|
13
|
+
t1_f_number: 'name',
|
|
14
|
+
f_region_id: '5',
|
|
15
|
+
t1_f_address: '龙首原',
|
|
16
|
+
t1_f_address_lon_lat: '108.948016,34.292333',
|
|
17
|
+
t1_f_describe: 't1_f_describe',
|
|
18
|
+
t1_f_state: 't1_f_state',
|
|
19
|
+
f_points_devices: '' as string,
|
|
20
|
+
f_brand: null as number,
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
function submit(result) {
|
|
24
|
+
console.log('>>>> form result: ', result)
|
|
25
|
+
}
|
|
26
|
+
</script>
|
|
12
27
|
<template>
|
|
13
28
|
<NormalDataLayout id="XFormGroupView" title="纯表单">
|
|
14
29
|
<template #layout_content>
|
|
@@ -16,8 +31,10 @@ const formGroupAddConstruction = ref(null)
|
|
|
16
31
|
<XForm
|
|
17
32
|
ref="formGroupAddConstruction"
|
|
18
33
|
mode="新增"
|
|
34
|
+
:form-data="formData"
|
|
19
35
|
:config-name="configName"
|
|
20
36
|
:service-name="serviceName"
|
|
37
|
+
@on-submit="submit"
|
|
21
38
|
/>
|
|
22
39
|
</div>
|
|
23
40
|
</template>
|