af-mobile-client-vue3 1.1.43 → 1.1.45
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 +115 -115
- package/src/components/core/ImageUploader/index.vue +160 -160
- package/src/components/data/XBadge/index.vue +2 -2
- package/src/components/data/XCellList/index.vue +1 -1
- package/src/components/data/XOlMap/index.vue +162 -1
- package/src/components/data/XOlMap/types.ts +11 -0
- package/src/components/data/XOlMap/utils/wgs84ToGcj02.js +154 -154
- package/src/styles/fontawesome-icons.ts +7 -7
- package/src/utils/queryFormDefaultRangePicker.ts +57 -57
- package/src/views/component/XCellListView/index.vue +136 -13
- package/src/views/component/XFormGroupView/index.vue +42 -2
- package/src/views/component/XFormView/index.vue +3 -6
- package/src/views/component/XOlMapView/XLocationPicker/index.vue +118 -118
- package/src/views/component/XOlMapView/index.vue +17 -0
- package/src/views/component/XOlMapView/testData.ts +64 -0
- package/vite.config.ts +11 -11
- package/src/views/component/XFormView/oldindex.vue +0 -70
package/package.json
CHANGED
|
@@ -1,115 +1,115 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "af-mobile-client-vue3",
|
|
3
|
-
"type": "module",
|
|
4
|
-
"version": "1.1.
|
|
5
|
-
"description": "Vue + Vite component lib",
|
|
6
|
-
"license": "MIT",
|
|
7
|
-
"engines": {
|
|
8
|
-
"node": ">=18.12.0",
|
|
9
|
-
"pnpm": ">=8.15.0"
|
|
10
|
-
},
|
|
11
|
-
"scripts": {
|
|
12
|
-
"dev": "cross-env MOCK_SERVER_PORT=8086 vite",
|
|
13
|
-
"build": "vue-tsc --noEmit && vite build",
|
|
14
|
-
"build:dev": "vue-tsc --noEmit && vite build --mode=development",
|
|
15
|
-
"preview": "vite preview",
|
|
16
|
-
"lint": "eslint . && vue-tsc --noEmit",
|
|
17
|
-
"lint:fix": "eslint . --fix",
|
|
18
|
-
"test": "vitest",
|
|
19
|
-
"release": "bumpp --commit --push --tag"
|
|
20
|
-
},
|
|
21
|
-
"dependencies": {
|
|
22
|
-
"@fortawesome/fontawesome-svg-core": "^6.7.2",
|
|
23
|
-
"@fortawesome/free-solid-svg-icons": "^6.7.2",
|
|
24
|
-
"@fortawesome/vue-fontawesome": "^3.0.8",
|
|
25
|
-
"@iconify/vue": "4.3.0",
|
|
26
|
-
"@micro-zoe/micro-app": "1.0.0-rc.24",
|
|
27
|
-
"@unhead/vue": "^2.0.5",
|
|
28
|
-
"@vant/area-data": "^2.0.0",
|
|
29
|
-
"@vant/touch-emulator": "^1.4.0",
|
|
30
|
-
"@vant/use": "^1.6.0",
|
|
31
|
-
"@vueuse/core": "^13.1.0",
|
|
32
|
-
"animate.css": "^4.1.1",
|
|
33
|
-
"axios": "^1.8.4",
|
|
34
|
-
"crypto-js": "^4.2.0",
|
|
35
|
-
"echarts": "^5.6.0",
|
|
36
|
-
"lodash-es": "^4.17.21",
|
|
37
|
-
"nprogress": "^0.2.0",
|
|
38
|
-
"ol": "^10.5.0",
|
|
39
|
-
"pinia": "^3.0.2",
|
|
40
|
-
"pinia-plugin-persistedstate": "^4.2.0",
|
|
41
|
-
"qs": "^6.14.0",
|
|
42
|
-
"resize-detector": "^0.3.0",
|
|
43
|
-
"store": "^2.0.12",
|
|
44
|
-
"vant": "^4.9.18",
|
|
45
|
-
"vconsole": "^3.15.1",
|
|
46
|
-
"vue": "^3.5.13",
|
|
47
|
-
"vue-router": "^4.5.0",
|
|
48
|
-
"vue3-hash-calendar": "^1.1.3"
|
|
49
|
-
},
|
|
50
|
-
"devDependencies": {
|
|
51
|
-
"@antfu/eslint-config": "^4.12.0",
|
|
52
|
-
"@iconify/json": "2.2.318",
|
|
53
|
-
"@types/crypto-js": "^4.2.2",
|
|
54
|
-
"@types/lodash-es": "^4.17.12",
|
|
55
|
-
"@types/node": "^22.14.1",
|
|
56
|
-
"@types/nprogress": "^0.2.3",
|
|
57
|
-
"@types/store": "^2.0.5",
|
|
58
|
-
"@unocss/eslint-plugin": "^66.1.0-beta.11",
|
|
59
|
-
"@unocss/preset-rem-to-px": "66.1.0-beta.11",
|
|
60
|
-
"@vitejs/plugin-legacy": "^6.0.2",
|
|
61
|
-
"@vitejs/plugin-vue": "^5.2.3",
|
|
62
|
-
"autoprefixer": "^10.4.21",
|
|
63
|
-
"bumpp": "^10.1.0",
|
|
64
|
-
"commitizen": "^4.3.1",
|
|
65
|
-
"consola": "^3.4.2",
|
|
66
|
-
"cross-env": "^7.0.3",
|
|
67
|
-
"cz-emoji-chinese": "^0.3.1",
|
|
68
|
-
"eslint": "^9.24.0",
|
|
69
|
-
"eslint-ts-patch": "^8.57.0-0",
|
|
70
|
-
"husky": "^9.1.7",
|
|
71
|
-
"less": "^4.3.0",
|
|
72
|
-
"mockjs": "^1.1.0",
|
|
73
|
-
"postcss-mobile-forever": "^5.0.0",
|
|
74
|
-
"rollup": "^4.40.0",
|
|
75
|
-
"terser": "^5.39.0",
|
|
76
|
-
"typescript": "^5.8.3",
|
|
77
|
-
"unocss": "^66.1.0-beta.11",
|
|
78
|
-
"unplugin-auto-import": "^19.1.2",
|
|
79
|
-
"unplugin-vue-components": "^28.4.1",
|
|
80
|
-
"unplugin-vue-router": "^0.12.0",
|
|
81
|
-
"vite": "^6.2.6",
|
|
82
|
-
"vite-plugin-compression": "^0.5.1",
|
|
83
|
-
"vite-plugin-mock-dev-server": "^1.8.5",
|
|
84
|
-
"vite-plugin-pwa": "^1.0.0",
|
|
85
|
-
"vite-plugin-sitemap": "^0.7.1",
|
|
86
|
-
"vite-plugin-svg-icons": "^2.0.1",
|
|
87
|
-
"vite-plugin-vconsole": "^2.1.1",
|
|
88
|
-
"vite-plugin-vue-devtools": "^7.7.2",
|
|
89
|
-
"vite-plugin-vue-layouts": "^0.11.0",
|
|
90
|
-
"vitest": "^3.1.1",
|
|
91
|
-
"vue-tsc": "^2.2.8"
|
|
92
|
-
},
|
|
93
|
-
"pnpm": {
|
|
94
|
-
"peerDependencyRules": {
|
|
95
|
-
"ignoreMissing": [
|
|
96
|
-
"postcss",
|
|
97
|
-
"esbuild"
|
|
98
|
-
],
|
|
99
|
-
"allowedVersions": {
|
|
100
|
-
"rollup": "^4.x"
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
"config": {
|
|
105
|
-
"commitizen": {
|
|
106
|
-
"path": "./node_modules/cz-emoji-chinese"
|
|
107
|
-
},
|
|
108
|
-
"cz-emoji-chinese": {
|
|
109
|
-
"skipQuestions": [
|
|
110
|
-
"body",
|
|
111
|
-
"scope"
|
|
112
|
-
]
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "af-mobile-client-vue3",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "1.1.45",
|
|
5
|
+
"description": "Vue + Vite component lib",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=18.12.0",
|
|
9
|
+
"pnpm": ">=8.15.0"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"dev": "cross-env MOCK_SERVER_PORT=8086 vite",
|
|
13
|
+
"build": "vue-tsc --noEmit && vite build",
|
|
14
|
+
"build:dev": "vue-tsc --noEmit && vite build --mode=development",
|
|
15
|
+
"preview": "vite preview",
|
|
16
|
+
"lint": "eslint . && vue-tsc --noEmit",
|
|
17
|
+
"lint:fix": "eslint . --fix",
|
|
18
|
+
"test": "vitest",
|
|
19
|
+
"release": "bumpp --commit --push --tag"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@fortawesome/fontawesome-svg-core": "^6.7.2",
|
|
23
|
+
"@fortawesome/free-solid-svg-icons": "^6.7.2",
|
|
24
|
+
"@fortawesome/vue-fontawesome": "^3.0.8",
|
|
25
|
+
"@iconify/vue": "4.3.0",
|
|
26
|
+
"@micro-zoe/micro-app": "1.0.0-rc.24",
|
|
27
|
+
"@unhead/vue": "^2.0.5",
|
|
28
|
+
"@vant/area-data": "^2.0.0",
|
|
29
|
+
"@vant/touch-emulator": "^1.4.0",
|
|
30
|
+
"@vant/use": "^1.6.0",
|
|
31
|
+
"@vueuse/core": "^13.1.0",
|
|
32
|
+
"animate.css": "^4.1.1",
|
|
33
|
+
"axios": "^1.8.4",
|
|
34
|
+
"crypto-js": "^4.2.0",
|
|
35
|
+
"echarts": "^5.6.0",
|
|
36
|
+
"lodash-es": "^4.17.21",
|
|
37
|
+
"nprogress": "^0.2.0",
|
|
38
|
+
"ol": "^10.5.0",
|
|
39
|
+
"pinia": "^3.0.2",
|
|
40
|
+
"pinia-plugin-persistedstate": "^4.2.0",
|
|
41
|
+
"qs": "^6.14.0",
|
|
42
|
+
"resize-detector": "^0.3.0",
|
|
43
|
+
"store": "^2.0.12",
|
|
44
|
+
"vant": "^4.9.18",
|
|
45
|
+
"vconsole": "^3.15.1",
|
|
46
|
+
"vue": "^3.5.13",
|
|
47
|
+
"vue-router": "^4.5.0",
|
|
48
|
+
"vue3-hash-calendar": "^1.1.3"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@antfu/eslint-config": "^4.12.0",
|
|
52
|
+
"@iconify/json": "2.2.318",
|
|
53
|
+
"@types/crypto-js": "^4.2.2",
|
|
54
|
+
"@types/lodash-es": "^4.17.12",
|
|
55
|
+
"@types/node": "^22.14.1",
|
|
56
|
+
"@types/nprogress": "^0.2.3",
|
|
57
|
+
"@types/store": "^2.0.5",
|
|
58
|
+
"@unocss/eslint-plugin": "^66.1.0-beta.11",
|
|
59
|
+
"@unocss/preset-rem-to-px": "66.1.0-beta.11",
|
|
60
|
+
"@vitejs/plugin-legacy": "^6.0.2",
|
|
61
|
+
"@vitejs/plugin-vue": "^5.2.3",
|
|
62
|
+
"autoprefixer": "^10.4.21",
|
|
63
|
+
"bumpp": "^10.1.0",
|
|
64
|
+
"commitizen": "^4.3.1",
|
|
65
|
+
"consola": "^3.4.2",
|
|
66
|
+
"cross-env": "^7.0.3",
|
|
67
|
+
"cz-emoji-chinese": "^0.3.1",
|
|
68
|
+
"eslint": "^9.24.0",
|
|
69
|
+
"eslint-ts-patch": "^8.57.0-0",
|
|
70
|
+
"husky": "^9.1.7",
|
|
71
|
+
"less": "^4.3.0",
|
|
72
|
+
"mockjs": "^1.1.0",
|
|
73
|
+
"postcss-mobile-forever": "^5.0.0",
|
|
74
|
+
"rollup": "^4.40.0",
|
|
75
|
+
"terser": "^5.39.0",
|
|
76
|
+
"typescript": "^5.8.3",
|
|
77
|
+
"unocss": "^66.1.0-beta.11",
|
|
78
|
+
"unplugin-auto-import": "^19.1.2",
|
|
79
|
+
"unplugin-vue-components": "^28.4.1",
|
|
80
|
+
"unplugin-vue-router": "^0.12.0",
|
|
81
|
+
"vite": "^6.2.6",
|
|
82
|
+
"vite-plugin-compression": "^0.5.1",
|
|
83
|
+
"vite-plugin-mock-dev-server": "^1.8.5",
|
|
84
|
+
"vite-plugin-pwa": "^1.0.0",
|
|
85
|
+
"vite-plugin-sitemap": "^0.7.1",
|
|
86
|
+
"vite-plugin-svg-icons": "^2.0.1",
|
|
87
|
+
"vite-plugin-vconsole": "^2.1.1",
|
|
88
|
+
"vite-plugin-vue-devtools": "^7.7.2",
|
|
89
|
+
"vite-plugin-vue-layouts": "^0.11.0",
|
|
90
|
+
"vitest": "^3.1.1",
|
|
91
|
+
"vue-tsc": "^2.2.8"
|
|
92
|
+
},
|
|
93
|
+
"pnpm": {
|
|
94
|
+
"peerDependencyRules": {
|
|
95
|
+
"ignoreMissing": [
|
|
96
|
+
"postcss",
|
|
97
|
+
"esbuild"
|
|
98
|
+
],
|
|
99
|
+
"allowedVersions": {
|
|
100
|
+
"rollup": "^4.x"
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
"config": {
|
|
105
|
+
"commitizen": {
|
|
106
|
+
"path": "./node_modules/cz-emoji-chinese"
|
|
107
|
+
},
|
|
108
|
+
"cz-emoji-chinese": {
|
|
109
|
+
"skipQuestions": [
|
|
110
|
+
"body",
|
|
111
|
+
"scope"
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
@@ -1,160 +1,160 @@
|
|
|
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
|
-
if (result.status === 'success') {
|
|
34
|
-
handlePhotoUpload(result.data)
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
})
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// 处理拍照后的上传
|
|
41
|
-
function handlePhotoUpload(photoData: any) {
|
|
42
|
-
const formData = new FormData()
|
|
43
|
-
formData.append('resUploadMode', props.uploadMode)
|
|
44
|
-
formData.append('pathKey', 'Default')
|
|
45
|
-
formData.append('formType', 'image')
|
|
46
|
-
formData.append('useType', 'Default')
|
|
47
|
-
formData.append('resUploadStock', '1')
|
|
48
|
-
formData.append('filename', photoData.name)
|
|
49
|
-
formData.append('filesize', (photoData.size / 1024 / 1024).toFixed(4))
|
|
50
|
-
formData.append('f_operator', 'server')
|
|
51
|
-
formData.append('imgPath', photoData.filePath)
|
|
52
|
-
formData.append('urlPath', `/api/${import.meta.env.VITE_APP_SYSTEM_NAME}/resource/upload`)
|
|
53
|
-
|
|
54
|
-
// 添加临时预览
|
|
55
|
-
const tempFile = {
|
|
56
|
-
uid: Date.now() + Math.random().toString(36).substr(2, 5),
|
|
57
|
-
name: photoData.name,
|
|
58
|
-
status: 'uploading',
|
|
59
|
-
message: '上传中...',
|
|
60
|
-
url: `data:image/png;base64,${photoData.content}`,
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
if (!imageList.value) {
|
|
64
|
-
imageList.value = [tempFile]
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
imageList.value.push(tempFile)
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const param = {
|
|
71
|
-
resUploadMode: props.uploadMode,
|
|
72
|
-
pathKey: 'Default',
|
|
73
|
-
formType: 'image',
|
|
74
|
-
useType: 'Default',
|
|
75
|
-
resUploadStock: '1',
|
|
76
|
-
filename: photoData.name,
|
|
77
|
-
filesize: photoData.size,
|
|
78
|
-
f_operator: 'server',
|
|
79
|
-
imgPath: photoData.filePath,
|
|
80
|
-
urlPath: `/api/${import.meta.env.VITE_APP_SYSTEM_NAME}/resource/upload`,
|
|
81
|
-
}
|
|
82
|
-
// 上传到服务器
|
|
83
|
-
mobileUtil.execute({
|
|
84
|
-
funcName: 'uploadResource',
|
|
85
|
-
param,
|
|
86
|
-
callbackFunc: (result: any) => {
|
|
87
|
-
if (result.status === 'success') {
|
|
88
|
-
const index = imageList.value.findIndex(item => item.uid === tempFile.uid)
|
|
89
|
-
if (index !== -1) {
|
|
90
|
-
imageList.value[index].uid = result.data.id
|
|
91
|
-
imageList.value[index].id = result.data.id
|
|
92
|
-
delete imageList.value[index].message
|
|
93
|
-
imageList.value[index].status = 'done'
|
|
94
|
-
imageList.value[index].url = result.data.f_downloadpath
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
const index = imageList.value.findIndex(item => item.uid === tempFile.uid)
|
|
99
|
-
if (index !== -1) {
|
|
100
|
-
imageList.value[index].status = 'failed'
|
|
101
|
-
imageList.value[index].message = '上传失败'
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
if (props.outerIndex !== undefined)
|
|
106
|
-
emit('updateFileList', imageList.value.filter(item => item.status === 'done'), props.outerIndex)
|
|
107
|
-
else
|
|
108
|
-
emit('updateFileList', imageList.value.filter(item => item.status === 'done'))
|
|
109
|
-
},
|
|
110
|
-
})
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// 删除图片
|
|
114
|
-
function deleteFileFunction(file: any) {
|
|
115
|
-
if (file.id) {
|
|
116
|
-
deleteFile({ ids: [file.id], f_state: '删除' }).then((res: any) => {
|
|
117
|
-
if (res.msg !== undefined) {
|
|
118
|
-
const targetIndex = imageList.value.findIndex(item => item.id === file.id)
|
|
119
|
-
if (targetIndex !== -1) {
|
|
120
|
-
imageList.value.splice(targetIndex, 1)
|
|
121
|
-
if (props.outerIndex !== undefined)
|
|
122
|
-
emit('updateFileList', imageList.value.filter(item => item.status === 'done'), props.outerIndex)
|
|
123
|
-
else
|
|
124
|
-
emit('updateFileList', imageList.value.filter(item => item.status === 'done'))
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
})
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
</script>
|
|
131
|
-
|
|
132
|
-
<template>
|
|
133
|
-
<div class="uploader-container">
|
|
134
|
-
<van-button
|
|
135
|
-
v-if="props.attr?.addOrEdit !== 'readonly'"
|
|
136
|
-
icon="photograph"
|
|
137
|
-
type="primary"
|
|
138
|
-
@click="triggerCamera"
|
|
139
|
-
>
|
|
140
|
-
拍照
|
|
141
|
-
</van-button>
|
|
142
|
-
|
|
143
|
-
<van-uploader
|
|
144
|
-
v-model="imageList"
|
|
145
|
-
:show-upload="false"
|
|
146
|
-
:deletable="props.attr?.addOrEdit !== 'readonly' && props.authority === 'admin'"
|
|
147
|
-
:multiple="props.authority === 'admin'"
|
|
148
|
-
:preview-image="true"
|
|
149
|
-
:before-delete="props.attr?.addOrEdit !== 'readonly' && props.authority === 'admin' ? deleteFileFunction : undefined"
|
|
150
|
-
/>
|
|
151
|
-
</div>
|
|
152
|
-
</template>
|
|
153
|
-
|
|
154
|
-
<style scoped lang="less">
|
|
155
|
-
.uploader-container {
|
|
156
|
-
display: flex;
|
|
157
|
-
flex-direction: column;
|
|
158
|
-
gap: 16px;
|
|
159
|
-
}
|
|
160
|
-
</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
|
+
if (result.status === 'success') {
|
|
34
|
+
handlePhotoUpload(result.data)
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// 处理拍照后的上传
|
|
41
|
+
function handlePhotoUpload(photoData: any) {
|
|
42
|
+
const formData = new FormData()
|
|
43
|
+
formData.append('resUploadMode', props.uploadMode)
|
|
44
|
+
formData.append('pathKey', 'Default')
|
|
45
|
+
formData.append('formType', 'image')
|
|
46
|
+
formData.append('useType', 'Default')
|
|
47
|
+
formData.append('resUploadStock', '1')
|
|
48
|
+
formData.append('filename', photoData.name)
|
|
49
|
+
formData.append('filesize', (photoData.size / 1024 / 1024).toFixed(4))
|
|
50
|
+
formData.append('f_operator', 'server')
|
|
51
|
+
formData.append('imgPath', photoData.filePath)
|
|
52
|
+
formData.append('urlPath', `/api/${import.meta.env.VITE_APP_SYSTEM_NAME}/resource/upload`)
|
|
53
|
+
|
|
54
|
+
// 添加临时预览
|
|
55
|
+
const tempFile = {
|
|
56
|
+
uid: Date.now() + Math.random().toString(36).substr(2, 5),
|
|
57
|
+
name: photoData.name,
|
|
58
|
+
status: 'uploading',
|
|
59
|
+
message: '上传中...',
|
|
60
|
+
url: `data:image/png;base64,${photoData.content}`,
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (!imageList.value) {
|
|
64
|
+
imageList.value = [tempFile]
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
imageList.value.push(tempFile)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const param = {
|
|
71
|
+
resUploadMode: props.uploadMode,
|
|
72
|
+
pathKey: 'Default',
|
|
73
|
+
formType: 'image',
|
|
74
|
+
useType: 'Default',
|
|
75
|
+
resUploadStock: '1',
|
|
76
|
+
filename: photoData.name,
|
|
77
|
+
filesize: photoData.size,
|
|
78
|
+
f_operator: 'server',
|
|
79
|
+
imgPath: photoData.filePath,
|
|
80
|
+
urlPath: `/api/${import.meta.env.VITE_APP_SYSTEM_NAME}/resource/upload`,
|
|
81
|
+
}
|
|
82
|
+
// 上传到服务器
|
|
83
|
+
mobileUtil.execute({
|
|
84
|
+
funcName: 'uploadResource',
|
|
85
|
+
param,
|
|
86
|
+
callbackFunc: (result: any) => {
|
|
87
|
+
if (result.status === 'success') {
|
|
88
|
+
const index = imageList.value.findIndex(item => item.uid === tempFile.uid)
|
|
89
|
+
if (index !== -1) {
|
|
90
|
+
imageList.value[index].uid = result.data.id
|
|
91
|
+
imageList.value[index].id = result.data.id
|
|
92
|
+
delete imageList.value[index].message
|
|
93
|
+
imageList.value[index].status = 'done'
|
|
94
|
+
imageList.value[index].url = result.data.f_downloadpath
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
const index = imageList.value.findIndex(item => item.uid === tempFile.uid)
|
|
99
|
+
if (index !== -1) {
|
|
100
|
+
imageList.value[index].status = 'failed'
|
|
101
|
+
imageList.value[index].message = '上传失败'
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (props.outerIndex !== undefined)
|
|
106
|
+
emit('updateFileList', imageList.value.filter(item => item.status === 'done'), props.outerIndex)
|
|
107
|
+
else
|
|
108
|
+
emit('updateFileList', imageList.value.filter(item => item.status === 'done'))
|
|
109
|
+
},
|
|
110
|
+
})
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// 删除图片
|
|
114
|
+
function deleteFileFunction(file: any) {
|
|
115
|
+
if (file.id) {
|
|
116
|
+
deleteFile({ ids: [file.id], f_state: '删除' }).then((res: any) => {
|
|
117
|
+
if (res.msg !== undefined) {
|
|
118
|
+
const targetIndex = imageList.value.findIndex(item => item.id === file.id)
|
|
119
|
+
if (targetIndex !== -1) {
|
|
120
|
+
imageList.value.splice(targetIndex, 1)
|
|
121
|
+
if (props.outerIndex !== undefined)
|
|
122
|
+
emit('updateFileList', imageList.value.filter(item => item.status === 'done'), props.outerIndex)
|
|
123
|
+
else
|
|
124
|
+
emit('updateFileList', imageList.value.filter(item => item.status === 'done'))
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
})
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
</script>
|
|
131
|
+
|
|
132
|
+
<template>
|
|
133
|
+
<div class="uploader-container">
|
|
134
|
+
<van-button
|
|
135
|
+
v-if="props.attr?.addOrEdit !== 'readonly'"
|
|
136
|
+
icon="photograph"
|
|
137
|
+
type="primary"
|
|
138
|
+
@click="triggerCamera"
|
|
139
|
+
>
|
|
140
|
+
拍照
|
|
141
|
+
</van-button>
|
|
142
|
+
|
|
143
|
+
<van-uploader
|
|
144
|
+
v-model="imageList"
|
|
145
|
+
:show-upload="false"
|
|
146
|
+
:deletable="props.attr?.addOrEdit !== 'readonly' && props.authority === 'admin'"
|
|
147
|
+
:multiple="props.authority === 'admin'"
|
|
148
|
+
:preview-image="true"
|
|
149
|
+
:before-delete="props.attr?.addOrEdit !== 'readonly' && props.authority === 'admin' ? deleteFileFunction : undefined"
|
|
150
|
+
/>
|
|
151
|
+
</div>
|
|
152
|
+
</template>
|
|
153
|
+
|
|
154
|
+
<style scoped lang="less">
|
|
155
|
+
.uploader-container {
|
|
156
|
+
display: flex;
|
|
157
|
+
flex-direction: column;
|
|
158
|
+
gap: 16px;
|
|
159
|
+
}
|
|
160
|
+
</style>
|
|
@@ -594,7 +594,7 @@ defineExpose({
|
|
|
594
594
|
class="card_item_title"
|
|
595
595
|
:style="handleFunctionStyle(column.styleFunctionForValue, item)"
|
|
596
596
|
>
|
|
597
|
-
{{ item[column.dataIndex]
|
|
597
|
+
{{ item[column.dataIndex] ?? '--' }}
|
|
598
598
|
</p>
|
|
599
599
|
</div>
|
|
600
600
|
<div v-for="(column) in subTitleColumns" :key="`subtitle_${column.dataIndex}`" class="sub-title">
|