af-mobile-client-vue3 1.1.17 → 1.1.19
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/ImageUploader/index.vue +163 -163
- package/src/components/data/XCellList/index.vue +1 -0
- package/src/components/data/XCellListFilter/index.vue +1 -1
- package/src/components/data/XFormItem/index.vue +1 -1
- package/src/components/data/XOlMap/XLocationPicker/index.vue +8 -5
- package/src/components/data/XOlMap/index.vue +12 -9
- package/src/components/data/XOlMap/types.ts +6 -6
- package/src/components/data/XOlMap/utils/wgs84ToGcj02.js +154 -154
- package/src/components/data/XReportGrid/XReportDemo.vue +33 -33
- package/src/components/data/XReportGrid/print.js +184 -184
- package/src/views/component/XCellListView/index.vue +9 -4
- package/src/views/component/XFormGroupView/index.vue +37 -0
- package/src/views/component/XFormView/index.vue +120 -27
- package/src/views/component/XOlMapView/XLocationPicker/index.vue +118 -118
- package/src/views/component/XReportGridView/index.vue +41 -2
- package/src/views/component/test/index.vue +52 -0
- package/tsconfig.json +43 -43
- package/vite.config.ts +10 -10
- package/src/views/component/XFormView/oldindex.vue +0 -133
package/package.json
CHANGED
|
@@ -1,163 +1,163 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { deleteFile } from '@af-mobile-client-vue3/services/api/common'
|
|
3
|
-
import { mobileUtil } from '@af-mobile-client-vue3/utils/mobileUtil'
|
|
4
|
-
import {
|
|
5
|
-
Button as vanButton,
|
|
6
|
-
Uploader as vanUploader,
|
|
7
|
-
} from 'vant'
|
|
8
|
-
import { ref, watch } from 'vue'
|
|
9
|
-
|
|
10
|
-
const props = defineProps({
|
|
11
|
-
imageList: Array<any>,
|
|
12
|
-
outerIndex: { default: undefined },
|
|
13
|
-
authority: { default: 'user' },
|
|
14
|
-
uploadMode: { default: 'server' },
|
|
15
|
-
attr: { type: Object as () => { addOrEdit?: string }, default: () => ({}) },
|
|
16
|
-
})
|
|
17
|
-
const emit = defineEmits(['updateFileList'])
|
|
18
|
-
|
|
19
|
-
const imageList = ref<Array<any>>(props.imageList ?? [])
|
|
20
|
-
|
|
21
|
-
// 同步 props.imageList 到内部 imageList,保证每次变化都响应
|
|
22
|
-
watch(() => props.imageList, (newVal) => {
|
|
23
|
-
imageList.value = Array.isArray(newVal) ? [...newVal] : []
|
|
24
|
-
}, { immediate: true })
|
|
25
|
-
|
|
26
|
-
// 触发拍照
|
|
27
|
-
function triggerCamera() {
|
|
28
|
-
console.log('>>>> uploader 上传111')
|
|
29
|
-
mobileUtil.execute({
|
|
30
|
-
funcName: 'takePicture',
|
|
31
|
-
param: {},
|
|
32
|
-
callbackFunc: (result: any) => {
|
|
33
|
-
console.log('>>>> 拍照 后 上传', result)
|
|
34
|
-
if (result.status === 'success') {
|
|
35
|
-
handlePhotoUpload(result.data)
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
})
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// 处理拍照后的上传
|
|
42
|
-
function handlePhotoUpload(photoData: any) {
|
|
43
|
-
const formData = new FormData()
|
|
44
|
-
formData.append('resUploadMode', props.uploadMode)
|
|
45
|
-
formData.append('pathKey', 'Default')
|
|
46
|
-
formData.append('formType', 'image')
|
|
47
|
-
formData.append('useType', 'Default')
|
|
48
|
-
formData.append('resUploadStock', '1')
|
|
49
|
-
formData.append('filename', photoData.name)
|
|
50
|
-
formData.append('filesize', (photoData.size / 1024 / 1024).toFixed(4))
|
|
51
|
-
formData.append('f_operator', 'server')
|
|
52
|
-
formData.append('imgPath', photoData.filePath)
|
|
53
|
-
formData.append('urlPath', '/api/af-revenue/resource/upload')
|
|
54
|
-
|
|
55
|
-
// 添加临时预览
|
|
56
|
-
const tempFile = {
|
|
57
|
-
uid: Date.now() + Math.random().toString(36).substr(2, 5),
|
|
58
|
-
name: photoData.name,
|
|
59
|
-
status: 'uploading',
|
|
60
|
-
message: '上传中...',
|
|
61
|
-
url: `data:image/png;base64,${photoData.content}`,
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
if (!imageList.value) {
|
|
65
|
-
imageList.value = [tempFile]
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
imageList.value.push(tempFile)
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
const param = {
|
|
72
|
-
resUploadMode: props.uploadMode,
|
|
73
|
-
pathKey: 'Default',
|
|
74
|
-
formType: 'image',
|
|
75
|
-
useType: 'Default',
|
|
76
|
-
resUploadStock: '1',
|
|
77
|
-
filename: photoData.name,
|
|
78
|
-
filesize: photoData.size,
|
|
79
|
-
f_operator: 'server',
|
|
80
|
-
imgPath: photoData.filePath,
|
|
81
|
-
urlPath: '/api/af-revenue/resource/upload',
|
|
82
|
-
}
|
|
83
|
-
console.log('>>>> 上传 param: ', JSON.stringify(param))
|
|
84
|
-
// 上传到服务器
|
|
85
|
-
mobileUtil.execute({
|
|
86
|
-
funcName: 'uploadResource',
|
|
87
|
-
param,
|
|
88
|
-
callbackFunc: (result: any) => {
|
|
89
|
-
console.log('>>>> 上传结果: ', result)
|
|
90
|
-
if (result.status === 'success') {
|
|
91
|
-
const index = imageList.value.findIndex(item => item.uid === tempFile.uid)
|
|
92
|
-
if (index !== -1) {
|
|
93
|
-
imageList.value[index].uid = result.data.id
|
|
94
|
-
imageList.value[index].id = result.data.id
|
|
95
|
-
delete imageList.value[index].message
|
|
96
|
-
imageList.value[index].status = 'done'
|
|
97
|
-
imageList.value[index].url = result.data.f_downloadpath
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
const index = imageList.value.findIndex(item => item.uid === tempFile.uid)
|
|
102
|
-
if (index !== -1) {
|
|
103
|
-
imageList.value[index].status = 'failed'
|
|
104
|
-
imageList.value[index].message = '上传失败'
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
if (props.outerIndex !== undefined)
|
|
109
|
-
emit('updateFileList', imageList.value.filter(item => item.status === 'done'), props.outerIndex)
|
|
110
|
-
else
|
|
111
|
-
emit('updateFileList', imageList.value.filter(item => item.status === 'done'))
|
|
112
|
-
},
|
|
113
|
-
})
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
// 删除图片
|
|
117
|
-
function deleteFileFunction(file: any) {
|
|
118
|
-
if (file.id) {
|
|
119
|
-
deleteFile({ ids: [file.id], f_state: '删除' }).then((res: any) => {
|
|
120
|
-
if (res.msg !== undefined) {
|
|
121
|
-
const targetIndex = imageList.value.findIndex(item => item.id === file.id)
|
|
122
|
-
if (targetIndex !== -1) {
|
|
123
|
-
imageList.value.splice(targetIndex, 1)
|
|
124
|
-
if (props.outerIndex !== undefined)
|
|
125
|
-
emit('updateFileList', imageList.value.filter(item => item.status === 'done'), props.outerIndex)
|
|
126
|
-
else
|
|
127
|
-
emit('updateFileList', imageList.value.filter(item => item.status === 'done'))
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
})
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
</script>
|
|
134
|
-
|
|
135
|
-
<template>
|
|
136
|
-
<div class="uploader-container">
|
|
137
|
-
<van-button
|
|
138
|
-
v-if="props.attr?.addOrEdit !== 'readonly'"
|
|
139
|
-
icon="photograph"
|
|
140
|
-
type="primary"
|
|
141
|
-
@click="triggerCamera"
|
|
142
|
-
>
|
|
143
|
-
拍照
|
|
144
|
-
</van-button>
|
|
145
|
-
|
|
146
|
-
<van-uploader
|
|
147
|
-
v-model="imageList"
|
|
148
|
-
:show-upload="false"
|
|
149
|
-
:deletable="props.attr?.addOrEdit !== 'readonly' && props.authority === 'admin'"
|
|
150
|
-
:multiple="props.authority === 'admin'"
|
|
151
|
-
:preview-image="true"
|
|
152
|
-
:before-delete="props.attr?.addOrEdit !== 'readonly' && props.authority === 'admin' ? deleteFileFunction : undefined"
|
|
153
|
-
/>
|
|
154
|
-
</div>
|
|
155
|
-
</template>
|
|
156
|
-
|
|
157
|
-
<style scoped lang="less">
|
|
158
|
-
.uploader-container {
|
|
159
|
-
display: flex;
|
|
160
|
-
flex-direction: column;
|
|
161
|
-
gap: 16px;
|
|
162
|
-
}
|
|
163
|
-
</style>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { deleteFile } from '@af-mobile-client-vue3/services/api/common'
|
|
3
|
+
import { mobileUtil } from '@af-mobile-client-vue3/utils/mobileUtil'
|
|
4
|
+
import {
|
|
5
|
+
Button as vanButton,
|
|
6
|
+
Uploader as vanUploader,
|
|
7
|
+
} from 'vant'
|
|
8
|
+
import { ref, watch } from 'vue'
|
|
9
|
+
|
|
10
|
+
const props = defineProps({
|
|
11
|
+
imageList: Array<any>,
|
|
12
|
+
outerIndex: { default: undefined },
|
|
13
|
+
authority: { default: 'user' },
|
|
14
|
+
uploadMode: { default: 'server' },
|
|
15
|
+
attr: { type: Object as () => { addOrEdit?: string }, default: () => ({}) },
|
|
16
|
+
})
|
|
17
|
+
const emit = defineEmits(['updateFileList'])
|
|
18
|
+
|
|
19
|
+
const imageList = ref<Array<any>>(props.imageList ?? [])
|
|
20
|
+
|
|
21
|
+
// 同步 props.imageList 到内部 imageList,保证每次变化都响应
|
|
22
|
+
watch(() => props.imageList, (newVal) => {
|
|
23
|
+
imageList.value = Array.isArray(newVal) ? [...newVal] : []
|
|
24
|
+
}, { immediate: true })
|
|
25
|
+
|
|
26
|
+
// 触发拍照
|
|
27
|
+
function triggerCamera() {
|
|
28
|
+
console.log('>>>> uploader 上传111')
|
|
29
|
+
mobileUtil.execute({
|
|
30
|
+
funcName: 'takePicture',
|
|
31
|
+
param: {},
|
|
32
|
+
callbackFunc: (result: any) => {
|
|
33
|
+
console.log('>>>> 拍照 后 上传', result)
|
|
34
|
+
if (result.status === 'success') {
|
|
35
|
+
handlePhotoUpload(result.data)
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// 处理拍照后的上传
|
|
42
|
+
function handlePhotoUpload(photoData: any) {
|
|
43
|
+
const formData = new FormData()
|
|
44
|
+
formData.append('resUploadMode', props.uploadMode)
|
|
45
|
+
formData.append('pathKey', 'Default')
|
|
46
|
+
formData.append('formType', 'image')
|
|
47
|
+
formData.append('useType', 'Default')
|
|
48
|
+
formData.append('resUploadStock', '1')
|
|
49
|
+
formData.append('filename', photoData.name)
|
|
50
|
+
formData.append('filesize', (photoData.size / 1024 / 1024).toFixed(4))
|
|
51
|
+
formData.append('f_operator', 'server')
|
|
52
|
+
formData.append('imgPath', photoData.filePath)
|
|
53
|
+
formData.append('urlPath', '/api/af-revenue/resource/upload')
|
|
54
|
+
|
|
55
|
+
// 添加临时预览
|
|
56
|
+
const tempFile = {
|
|
57
|
+
uid: Date.now() + Math.random().toString(36).substr(2, 5),
|
|
58
|
+
name: photoData.name,
|
|
59
|
+
status: 'uploading',
|
|
60
|
+
message: '上传中...',
|
|
61
|
+
url: `data:image/png;base64,${photoData.content}`,
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (!imageList.value) {
|
|
65
|
+
imageList.value = [tempFile]
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
imageList.value.push(tempFile)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const param = {
|
|
72
|
+
resUploadMode: props.uploadMode,
|
|
73
|
+
pathKey: 'Default',
|
|
74
|
+
formType: 'image',
|
|
75
|
+
useType: 'Default',
|
|
76
|
+
resUploadStock: '1',
|
|
77
|
+
filename: photoData.name,
|
|
78
|
+
filesize: photoData.size,
|
|
79
|
+
f_operator: 'server',
|
|
80
|
+
imgPath: photoData.filePath,
|
|
81
|
+
urlPath: '/api/af-revenue/resource/upload',
|
|
82
|
+
}
|
|
83
|
+
console.log('>>>> 上传 param: ', JSON.stringify(param))
|
|
84
|
+
// 上传到服务器
|
|
85
|
+
mobileUtil.execute({
|
|
86
|
+
funcName: 'uploadResource',
|
|
87
|
+
param,
|
|
88
|
+
callbackFunc: (result: any) => {
|
|
89
|
+
console.log('>>>> 上传结果: ', result)
|
|
90
|
+
if (result.status === 'success') {
|
|
91
|
+
const index = imageList.value.findIndex(item => item.uid === tempFile.uid)
|
|
92
|
+
if (index !== -1) {
|
|
93
|
+
imageList.value[index].uid = result.data.id
|
|
94
|
+
imageList.value[index].id = result.data.id
|
|
95
|
+
delete imageList.value[index].message
|
|
96
|
+
imageList.value[index].status = 'done'
|
|
97
|
+
imageList.value[index].url = result.data.f_downloadpath
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
const index = imageList.value.findIndex(item => item.uid === tempFile.uid)
|
|
102
|
+
if (index !== -1) {
|
|
103
|
+
imageList.value[index].status = 'failed'
|
|
104
|
+
imageList.value[index].message = '上传失败'
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (props.outerIndex !== undefined)
|
|
109
|
+
emit('updateFileList', imageList.value.filter(item => item.status === 'done'), props.outerIndex)
|
|
110
|
+
else
|
|
111
|
+
emit('updateFileList', imageList.value.filter(item => item.status === 'done'))
|
|
112
|
+
},
|
|
113
|
+
})
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// 删除图片
|
|
117
|
+
function deleteFileFunction(file: any) {
|
|
118
|
+
if (file.id) {
|
|
119
|
+
deleteFile({ ids: [file.id], f_state: '删除' }).then((res: any) => {
|
|
120
|
+
if (res.msg !== undefined) {
|
|
121
|
+
const targetIndex = imageList.value.findIndex(item => item.id === file.id)
|
|
122
|
+
if (targetIndex !== -1) {
|
|
123
|
+
imageList.value.splice(targetIndex, 1)
|
|
124
|
+
if (props.outerIndex !== undefined)
|
|
125
|
+
emit('updateFileList', imageList.value.filter(item => item.status === 'done'), props.outerIndex)
|
|
126
|
+
else
|
|
127
|
+
emit('updateFileList', imageList.value.filter(item => item.status === 'done'))
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
})
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
</script>
|
|
134
|
+
|
|
135
|
+
<template>
|
|
136
|
+
<div class="uploader-container">
|
|
137
|
+
<van-button
|
|
138
|
+
v-if="props.attr?.addOrEdit !== 'readonly'"
|
|
139
|
+
icon="photograph"
|
|
140
|
+
type="primary"
|
|
141
|
+
@click="triggerCamera"
|
|
142
|
+
>
|
|
143
|
+
拍照
|
|
144
|
+
</van-button>
|
|
145
|
+
|
|
146
|
+
<van-uploader
|
|
147
|
+
v-model="imageList"
|
|
148
|
+
:show-upload="false"
|
|
149
|
+
:deletable="props.attr?.addOrEdit !== 'readonly' && props.authority === 'admin'"
|
|
150
|
+
:multiple="props.authority === 'admin'"
|
|
151
|
+
:preview-image="true"
|
|
152
|
+
:before-delete="props.attr?.addOrEdit !== 'readonly' && props.authority === 'admin' ? deleteFileFunction : undefined"
|
|
153
|
+
/>
|
|
154
|
+
</div>
|
|
155
|
+
</template>
|
|
156
|
+
|
|
157
|
+
<style scoped lang="less">
|
|
158
|
+
.uploader-container {
|
|
159
|
+
display: flex;
|
|
160
|
+
flex-direction: column;
|
|
161
|
+
gap: 16px;
|
|
162
|
+
}
|
|
163
|
+
</style>
|
|
@@ -578,6 +578,7 @@ function evaluateCustomFunction(funcString: string | undefined, record: any, ind
|
|
|
578
578
|
height: calc(94vh - var(--van-nav-bar-height) - 5px);
|
|
579
579
|
--van-search-padding:5px;
|
|
580
580
|
--van-dropdown-menu-title-padding: 5px;
|
|
581
|
+
--van-cell-vertical-padding: 0px;
|
|
581
582
|
.main {
|
|
582
583
|
overflow-y: auto;
|
|
583
584
|
height: 100%;
|
|
@@ -372,7 +372,7 @@ const labelData = computed(() => {
|
|
|
372
372
|
})
|
|
373
373
|
// 是否展示表单左侧label文字
|
|
374
374
|
const labelAlign = computed(() => {
|
|
375
|
-
return attr.labelAlign ? attr.labelAlign : '
|
|
375
|
+
return attr.labelAlign ? attr.labelAlign : 'left'
|
|
376
376
|
})
|
|
377
377
|
// 是否只读
|
|
378
378
|
const readonly = computed(() => {
|
|
@@ -15,12 +15,15 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
15
15
|
defaultCenter: () => {
|
|
16
16
|
try {
|
|
17
17
|
mobileUtil.execute({
|
|
18
|
-
param:
|
|
19
|
-
funcName: '
|
|
18
|
+
param: {},
|
|
19
|
+
funcName: 'getLocationResult',
|
|
20
20
|
callbackFunc: (result) => {
|
|
21
|
-
const
|
|
22
|
-
if (
|
|
23
|
-
|
|
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
|
+
}
|
|
24
27
|
}
|
|
25
28
|
},
|
|
26
29
|
})
|
|
@@ -818,16 +818,19 @@ async function handleLocation() {
|
|
|
818
818
|
|
|
819
819
|
try {
|
|
820
820
|
mobileUtil.execute({
|
|
821
|
-
param:
|
|
822
|
-
funcName: '
|
|
821
|
+
param: {},
|
|
822
|
+
funcName: 'getLocationResult',
|
|
823
823
|
callbackFunc: (result) => {
|
|
824
|
-
const
|
|
825
|
-
if (
|
|
826
|
-
const
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
824
|
+
const res = result as PhoneLocationStatus
|
|
825
|
+
if (res.status === 'success') {
|
|
826
|
+
const locationResult = JSON.parse(res.data.location)
|
|
827
|
+
if (locationResult.longitude && locationResult.latitude) {
|
|
828
|
+
const center: [number, number] = [locationResult.longitude, locationResult.latitude]
|
|
829
|
+
setCenterAndZoom(center, getZoom())
|
|
830
|
+
// 更新位置图标
|
|
831
|
+
if (isFollowingLocation.value) {
|
|
832
|
+
updateLocationMarker(center)
|
|
833
|
+
}
|
|
831
834
|
}
|
|
832
835
|
}
|
|
833
836
|
},
|
|
@@ -10,12 +10,12 @@ export interface LocationResult {
|
|
|
10
10
|
|
|
11
11
|
/** 手机状态接口 */
|
|
12
12
|
export interface PhoneLocationStatus {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
|
|
14
|
+
status: string
|
|
15
|
+
|
|
16
|
+
data: {
|
|
17
|
+
location: string;
|
|
18
|
+
}
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
/** 初始化参数接口 */
|