af-mobile-client-vue3 1.3.46 → 1.3.48
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/core/XMultiSelect/index.vue +35 -26
- package/src/components/data/XFormGroup/index.vue +9 -3
- package/src/router/routes.ts +1 -1
- package/src/utils/queryFormDefaultRangePicker.ts +57 -57
- package/src/views/component/XCellListView/index.vue +6 -32
- package/src/views/component/XFormGroupView/index.vue +7 -11
- package/src/views/component/XFormView/index.vue +4 -19
- package/src/views/component/XOlMapView/XLocationPicker/index.vue +118 -118
package/package.json
CHANGED
|
@@ -110,7 +110,7 @@ const resultLabel = computed(() => {
|
|
|
110
110
|
</script>
|
|
111
111
|
|
|
112
112
|
<template>
|
|
113
|
-
<div class="
|
|
113
|
+
<div class="x-multi-select">
|
|
114
114
|
<VanField
|
|
115
115
|
v-model="resultLabel"
|
|
116
116
|
v-bind="$attrs"
|
|
@@ -131,7 +131,7 @@ const resultLabel = computed(() => {
|
|
|
131
131
|
确认
|
|
132
132
|
</button>
|
|
133
133
|
</div>
|
|
134
|
-
<div
|
|
134
|
+
<div class="x-multi-select-content">
|
|
135
135
|
<VanSearch
|
|
136
136
|
v-if="props.isSearch"
|
|
137
137
|
v-model="searchVal"
|
|
@@ -139,44 +139,53 @@ const resultLabel = computed(() => {
|
|
|
139
139
|
@update:model-value="search"
|
|
140
140
|
@cancel="search"
|
|
141
141
|
/>
|
|
142
|
-
<
|
|
143
|
-
<
|
|
144
|
-
<
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
<
|
|
149
|
-
<
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
<
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
142
|
+
<div class="x-multi-select-checkbox-group">
|
|
143
|
+
<VanCell title="全选">
|
|
144
|
+
<template #right-icon>
|
|
145
|
+
<VanCheckbox v-model="checkedAll" name="all" @click="toggleAll" />
|
|
146
|
+
</template>
|
|
147
|
+
</VanCell>
|
|
148
|
+
<VanCheckboxGroup ref="checkboxGroup" v-model="checkboxValue" @change="change">
|
|
149
|
+
<VanCellGroup>
|
|
150
|
+
<VanCell
|
|
151
|
+
v-for="(item, index) in columnsData"
|
|
152
|
+
:key="item[props.option.value]"
|
|
153
|
+
:title="item[props.option.text]"
|
|
154
|
+
clickable
|
|
155
|
+
@click="toggle(item, index)"
|
|
156
|
+
>
|
|
157
|
+
<template #right-icon>
|
|
158
|
+
<VanCheckbox ref="checkboxes" :name="item[props.option.value]" @click.stop />
|
|
159
|
+
</template>
|
|
160
|
+
</VanCell>
|
|
161
|
+
</VanCellGroup>
|
|
162
|
+
</VanCheckboxGroup>
|
|
163
|
+
</div>
|
|
162
164
|
</div>
|
|
163
165
|
</VanPopup>
|
|
164
166
|
</div>
|
|
165
167
|
</template>
|
|
166
168
|
|
|
167
169
|
<style lang="less" scoped>
|
|
168
|
-
.
|
|
170
|
+
.x-multi-select {
|
|
169
171
|
width: 100%;
|
|
170
172
|
padding: 0;
|
|
171
173
|
background: #fff;
|
|
172
174
|
.dh-cell.van-cell {
|
|
173
|
-
padding: 10px
|
|
175
|
+
padding: 10px 16px;
|
|
174
176
|
}
|
|
175
177
|
.dh-cell.van-cell--required::before {
|
|
176
178
|
left: -8px;
|
|
177
179
|
}
|
|
178
|
-
.
|
|
179
|
-
|
|
180
|
+
.x-multi-select-content {
|
|
181
|
+
max-height: 264px;
|
|
182
|
+
overflow-y: auto;
|
|
183
|
+
.x-multi-select-checkbox-group {
|
|
184
|
+
padding: 0 16px;
|
|
185
|
+
}
|
|
180
186
|
}
|
|
187
|
+
//.van-popup {
|
|
188
|
+
// border-radius: 20px 20px 0 0;
|
|
189
|
+
//}
|
|
181
190
|
}
|
|
182
191
|
</style>
|
|
@@ -94,9 +94,15 @@ function removeRef(refValue: XFormLike) {
|
|
|
94
94
|
|
|
95
95
|
async function submit() {
|
|
96
96
|
console.log(props.groupFormData)
|
|
97
|
+
await getGroupFormData()
|
|
98
|
+
emit('submit', formData.value)
|
|
99
|
+
}
|
|
100
|
+
async function getGroupFormData(isValidate = true) {
|
|
97
101
|
for (const res of xFormListRef.value) {
|
|
98
102
|
try {
|
|
99
|
-
|
|
103
|
+
if (isValidate) {
|
|
104
|
+
await res.validate()
|
|
105
|
+
}
|
|
100
106
|
if (res.formGroupName && typeof res.getFormData === 'function') {
|
|
101
107
|
formData.value[res.formGroupName] = res.getFormData()
|
|
102
108
|
}
|
|
@@ -106,7 +112,7 @@ async function submit() {
|
|
|
106
112
|
return
|
|
107
113
|
}
|
|
108
114
|
}
|
|
109
|
-
|
|
115
|
+
return formData.value
|
|
110
116
|
}
|
|
111
117
|
function emitFunc(func: any, data: any, value: any) {
|
|
112
118
|
emit(func, data, value)
|
|
@@ -120,7 +126,7 @@ onMounted(() => {
|
|
|
120
126
|
offsetTop.value = Number.parseInt(navBarHeight, 10) || 60 + 10
|
|
121
127
|
})
|
|
122
128
|
|
|
123
|
-
defineExpose({ init, removeRef, xFormListRef })
|
|
129
|
+
defineExpose({ init, removeRef, xFormListRef, getGroupFormData })
|
|
124
130
|
</script>
|
|
125
131
|
|
|
126
132
|
<template>
|
package/src/router/routes.ts
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 根据类型获取日期区间字符串
|
|
3
|
-
* @param type '当年' | 'curMonth' | '当日'
|
|
4
|
-
* @param show 区分实际值还是显示值, true为实际值, false为显示值
|
|
5
|
-
* @returns [start, end] 例:['2024-01-01 00:00:00', '2024-12-31 23:59:59']
|
|
6
|
-
*/
|
|
7
|
-
export function getRangeByType(type: string, show: boolean): [string, string] {
|
|
8
|
-
const now = new Date()
|
|
9
|
-
const year = now.getFullYear()
|
|
10
|
-
const month = (now.getMonth() + 1).toString().padStart(2, '0')
|
|
11
|
-
const day = now.getDate().toString().padStart(2, '0')
|
|
12
|
-
|
|
13
|
-
if (!show) {
|
|
14
|
-
if (type === 'curYear') {
|
|
15
|
-
return [
|
|
16
|
-
`${year}-01-01 00:00:00`,
|
|
17
|
-
`${year}-12-31 23:59:59`,
|
|
18
|
-
]
|
|
19
|
-
}
|
|
20
|
-
if (type === 'curMonth') {
|
|
21
|
-
const lastDay = new Date(year, now.getMonth() + 1, 0).getDate()
|
|
22
|
-
return [
|
|
23
|
-
`${year}-${month}-01 00:00:00`,
|
|
24
|
-
`${year}-${month}-${lastDay.toString().padStart(2, '0')} 23:59:59`,
|
|
25
|
-
]
|
|
26
|
-
}
|
|
27
|
-
if (type === 'curDay') {
|
|
28
|
-
return [
|
|
29
|
-
`${year}-${month}-${day} 00:00:00`,
|
|
30
|
-
`${year}-${month}-${day} 23:59:59`,
|
|
31
|
-
]
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
if (show) {
|
|
35
|
-
if (type === 'curYear') {
|
|
36
|
-
return [
|
|
37
|
-
`${year}-01-01`,
|
|
38
|
-
`${year}-12-31`,
|
|
39
|
-
]
|
|
40
|
-
}
|
|
41
|
-
if (type === 'curMonth') {
|
|
42
|
-
const lastDay = new Date(year, now.getMonth() + 1, 0).getDate()
|
|
43
|
-
return [
|
|
44
|
-
`${year}-${month}-01`,
|
|
45
|
-
`${year}-${month}-${lastDay.toString().padStart(2, '0')}`,
|
|
46
|
-
]
|
|
47
|
-
}
|
|
48
|
-
if (type === 'curDay') {
|
|
49
|
-
return [
|
|
50
|
-
`${year}-${month}-${day}`,
|
|
51
|
-
`${year}-${month}-${day}`,
|
|
52
|
-
]
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
// 兜底返回空字符串数组
|
|
56
|
-
return ['', '']
|
|
57
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* 根据类型获取日期区间字符串
|
|
3
|
+
* @param type '当年' | 'curMonth' | '当日'
|
|
4
|
+
* @param show 区分实际值还是显示值, true为实际值, false为显示值
|
|
5
|
+
* @returns [start, end] 例:['2024-01-01 00:00:00', '2024-12-31 23:59:59']
|
|
6
|
+
*/
|
|
7
|
+
export function getRangeByType(type: string, show: boolean): [string, string] {
|
|
8
|
+
const now = new Date()
|
|
9
|
+
const year = now.getFullYear()
|
|
10
|
+
const month = (now.getMonth() + 1).toString().padStart(2, '0')
|
|
11
|
+
const day = now.getDate().toString().padStart(2, '0')
|
|
12
|
+
|
|
13
|
+
if (!show) {
|
|
14
|
+
if (type === 'curYear') {
|
|
15
|
+
return [
|
|
16
|
+
`${year}-01-01 00:00:00`,
|
|
17
|
+
`${year}-12-31 23:59:59`,
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
if (type === 'curMonth') {
|
|
21
|
+
const lastDay = new Date(year, now.getMonth() + 1, 0).getDate()
|
|
22
|
+
return [
|
|
23
|
+
`${year}-${month}-01 00:00:00`,
|
|
24
|
+
`${year}-${month}-${lastDay.toString().padStart(2, '0')} 23:59:59`,
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
if (type === 'curDay') {
|
|
28
|
+
return [
|
|
29
|
+
`${year}-${month}-${day} 00:00:00`,
|
|
30
|
+
`${year}-${month}-${day} 23:59:59`,
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (show) {
|
|
35
|
+
if (type === 'curYear') {
|
|
36
|
+
return [
|
|
37
|
+
`${year}-01-01`,
|
|
38
|
+
`${year}-12-31`,
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
if (type === 'curMonth') {
|
|
42
|
+
const lastDay = new Date(year, now.getMonth() + 1, 0).getDate()
|
|
43
|
+
return [
|
|
44
|
+
`${year}-${month}-01`,
|
|
45
|
+
`${year}-${month}-${lastDay.toString().padStart(2, '0')}`,
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
if (type === 'curDay') {
|
|
49
|
+
return [
|
|
50
|
+
`${year}-${month}-${day}`,
|
|
51
|
+
`${year}-${month}-${day}`,
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
// 兜底返回空字符串数组
|
|
56
|
+
return ['', '']
|
|
57
|
+
}
|
|
@@ -1,19 +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 { useUserStore } from '@af-mobile-client-vue3/stores/modules/user'
|
|
5
4
|
import { defineEmits, ref } from 'vue'
|
|
6
5
|
import { useRouter } from 'vue-router'
|
|
7
6
|
|
|
8
7
|
// 定义事件
|
|
9
8
|
const emit = defineEmits(['deleteRow'])
|
|
10
|
-
|
|
11
|
-
// 多选操作配置
|
|
12
|
-
const multiSelectActions = ref([
|
|
13
|
-
{ name: '批量审核', key: 'batchAudit', color: '#000000', icon: 'passed' },
|
|
14
|
-
])
|
|
15
|
-
|
|
16
|
-
const userInfo = useUserStore().getUserInfo()
|
|
17
9
|
// 访问路由
|
|
18
10
|
const router = useRouter()
|
|
19
11
|
// 获取默认值
|
|
@@ -56,7 +48,7 @@ const serviceName = ref('af-gaslink')
|
|
|
56
48
|
// 跳转到表单——以表单组来渲染纯表单
|
|
57
49
|
function toDetail(item) {
|
|
58
50
|
router.push({
|
|
59
|
-
name: '
|
|
51
|
+
name: 'XFormGroupView',
|
|
60
52
|
query: {
|
|
61
53
|
id: item[idKey.value],
|
|
62
54
|
// id: item.rr_id,
|
|
@@ -95,36 +87,18 @@ function toDetail(item) {
|
|
|
95
87
|
function deleteRow(result) {
|
|
96
88
|
emit('deleteRow', result.o_id)
|
|
97
89
|
}
|
|
98
|
-
|
|
99
|
-
// 多选操作处理
|
|
100
|
-
function handleMultiSelectAction(action: string, selectedItems: any[], selectedItemsArray: any[]) {
|
|
101
|
-
console.log('多选操作:', action, selectedItems, selectedItemsArray)
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
// 选择变化处理
|
|
105
|
-
function handleSelectionChange(selectedItems: any[]) {
|
|
106
|
-
console.log('选择变化,当前选中:', selectedItems.length, '个项目')
|
|
107
|
-
// 可以在这里更新UI状态,比如显示选中数量等
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// 数据加载完成后处理 @after-load
|
|
111
|
-
function afterLoad(result) {
|
|
112
|
-
console.log('afterLoad:', result)
|
|
113
|
-
}
|
|
114
90
|
</script>
|
|
115
91
|
|
|
116
92
|
<template>
|
|
117
93
|
<NormalDataLayout id="XCellListView" title="工作计划">
|
|
118
94
|
<template #layout_content>
|
|
119
95
|
<XCellList
|
|
120
|
-
config-name="
|
|
121
|
-
service-name="
|
|
122
|
-
:
|
|
123
|
-
id-key="
|
|
124
|
-
:multi-select-actions="multiSelectActions"
|
|
96
|
+
:config-name="configName"
|
|
97
|
+
:service-name="serviceName"
|
|
98
|
+
:fix-query-form="{ o_f_oper_name: 'edu_test' }"
|
|
99
|
+
:id-key="idKey"
|
|
125
100
|
@to-detail="toDetail"
|
|
126
|
-
@
|
|
127
|
-
@selection-change="handleSelectionChange"
|
|
101
|
+
@delete-row="deleteRow"
|
|
128
102
|
/>
|
|
129
103
|
</template>
|
|
130
104
|
</NormalDataLayout>
|
|
@@ -5,19 +5,16 @@ 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
|
-
|
|
11
8
|
// 纯表单
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
const configName = ref('form_check_test')
|
|
10
|
+
const serviceName = ref('af-system')
|
|
14
11
|
|
|
15
12
|
// const configName = ref("计划下发Form")
|
|
16
13
|
// const serviceName = ref("af-linepatrol")
|
|
17
14
|
|
|
18
15
|
// 表单组
|
|
19
|
-
const configName = ref('lngChargeAuditMobileFormGroup')
|
|
20
|
-
const serviceName = ref('af-gaslink')
|
|
16
|
+
// const configName = ref('lngChargeAuditMobileFormGroup')
|
|
17
|
+
// const serviceName = ref('af-gaslink')
|
|
21
18
|
|
|
22
19
|
const formData = ref({})
|
|
23
20
|
const formGroup = ref(null)
|
|
@@ -25,8 +22,7 @@ const route = useRoute()
|
|
|
25
22
|
const isInit = ref(false)
|
|
26
23
|
function submit(_result) {
|
|
27
24
|
showDialog({ message: '提交成功' }).then(() => {
|
|
28
|
-
|
|
29
|
-
// history.back()
|
|
25
|
+
history.back()
|
|
30
26
|
})
|
|
31
27
|
}
|
|
32
28
|
|
|
@@ -67,8 +63,8 @@ function submit(_result) {
|
|
|
67
63
|
<!-- v-if="isInit" -->
|
|
68
64
|
<XFormGroup
|
|
69
65
|
ref="formGroup"
|
|
70
|
-
config-name="
|
|
71
|
-
service-name="
|
|
66
|
+
:config-name="configName"
|
|
67
|
+
:service-name="serviceName"
|
|
72
68
|
:group-form-data="formData"
|
|
73
69
|
mode="新增"
|
|
74
70
|
@submit="submit"
|
|
@@ -2,22 +2,11 @@
|
|
|
2
2
|
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
|
-
import {
|
|
6
|
-
Button as VanButton,
|
|
7
|
-
} from 'vant'
|
|
8
5
|
|
|
9
|
-
const configName = ref('
|
|
10
|
-
const serviceName = ref('af-
|
|
11
|
-
const formGroupAddConstruction = ref()
|
|
6
|
+
const configName = ref('AddConstructionForm')
|
|
7
|
+
const serviceName = ref('af-linepatrol')
|
|
12
8
|
|
|
13
|
-
|
|
14
|
-
function onSubmit(form) {
|
|
15
|
-
console.log('事件触发提交表单----', form)
|
|
16
|
-
}
|
|
17
|
-
async function onAsyncSubmit() {
|
|
18
|
-
const res = await formGroupAddConstruction.value.asyncSubmit()
|
|
19
|
-
console.log('异步提交表单----', res)
|
|
20
|
-
}
|
|
9
|
+
const formGroupAddConstruction = ref(null)
|
|
21
10
|
</script>
|
|
22
11
|
|
|
23
12
|
<template>
|
|
@@ -27,14 +16,10 @@ async function onAsyncSubmit() {
|
|
|
27
16
|
ref="formGroupAddConstruction"
|
|
28
17
|
mode="新增"
|
|
29
18
|
:config-name="configName"
|
|
30
|
-
:
|
|
31
|
-
service-name="af-safecheck"
|
|
32
|
-
:is-group-form="true"
|
|
33
|
-
@on-submit="onSubmit"
|
|
19
|
+
:service-name="serviceName"
|
|
34
20
|
/>
|
|
35
21
|
</template>
|
|
36
22
|
</NormalDataLayout>
|
|
37
|
-
<van-button type="primary" @click="onAsyncSubmit">提交</van-button>
|
|
38
23
|
</template>
|
|
39
24
|
|
|
40
25
|
<style scoped lang="less">
|
|
@@ -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>
|