adtec-core-package 2.9.5 → 2.9.6
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
|
@@ -6,29 +6,27 @@
|
|
|
6
6
|
<div v-if="!isEdit">
|
|
7
7
|
<el-auto-tool-tip v-if="uploadFilesList?.length">
|
|
8
8
|
<template #tooltipContent>
|
|
9
|
-
<div style="display:flex;flex-direction:column">
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
style="margin: 0 2px"
|
|
14
|
-
>{{ item.name }}
|
|
15
|
-
</span>
|
|
9
|
+
<div style="display: flex; flex-direction: column">
|
|
10
|
+
<span v-for="item in uploadFilesList" :key="item.id" style="margin: 0 2px"
|
|
11
|
+
>{{ item.name }}
|
|
12
|
+
</span>
|
|
16
13
|
</div>
|
|
17
14
|
</template>
|
|
18
15
|
<template #content>
|
|
19
|
-
<div style="display:flex;flex-direction:column">
|
|
20
|
-
<div
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
<div style="display: flex; flex-direction: column">
|
|
17
|
+
<div
|
|
18
|
+
v-for="item in uploadFilesList"
|
|
19
|
+
:key="item.id"
|
|
20
|
+
class="file-item"
|
|
21
|
+
style="display: flex; align-items: center; overflow: hidden"
|
|
22
|
+
>
|
|
23
23
|
<el-icons :model-value="getIcon(item.name)" style="margin-right: 5px"></el-icons>
|
|
24
24
|
<span class="link-name" @click="fileView(item.id)">{{ item.name }}</span>
|
|
25
25
|
</div>
|
|
26
26
|
</div>
|
|
27
27
|
</template>
|
|
28
28
|
</el-auto-tool-tip>
|
|
29
|
-
<div style="text-align: center;color: var(--el-disabled-text-color)" v-else>
|
|
30
|
-
暂无附件
|
|
31
|
-
</div>
|
|
29
|
+
<div style="text-align: center; color: var(--el-disabled-text-color)" v-else>暂无附件</div>
|
|
32
30
|
</div>
|
|
33
31
|
<el-upload
|
|
34
32
|
v-else
|
|
@@ -46,7 +44,15 @@
|
|
|
46
44
|
:before-upload="beforeUpload"
|
|
47
45
|
drag
|
|
48
46
|
:accept="getAccept"
|
|
49
|
-
:action="
|
|
47
|
+
:action="
|
|
48
|
+
'/api/doc/uploadFile/' +
|
|
49
|
+
business +
|
|
50
|
+
'/' +
|
|
51
|
+
businessId +
|
|
52
|
+
'/' +
|
|
53
|
+
association +
|
|
54
|
+
(watermarkCode ? '?watermarkCode=' + watermarkCode : '')
|
|
55
|
+
"
|
|
50
56
|
multiple
|
|
51
57
|
:limit="limit"
|
|
52
58
|
:headers="uploadHeaders"
|
|
@@ -75,7 +81,7 @@
|
|
|
75
81
|
</el-flex>
|
|
76
82
|
<el-flex align="center" justify="flex-end" width="50px">
|
|
77
83
|
<el-text v-if="!file?.businessId && file.percentage !== 100"
|
|
78
|
-
|
|
84
|
+
>{{ file.percentage }}%
|
|
79
85
|
</el-text>
|
|
80
86
|
<el-icons
|
|
81
87
|
v-if="file?.businessId || file.percentage === 100"
|
|
@@ -96,18 +102,24 @@
|
|
|
96
102
|
<script setup lang="ts">
|
|
97
103
|
import { UploadFilled } from '@element-plus/icons-vue'
|
|
98
104
|
import { computed, onMounted, ref } from 'vue'
|
|
99
|
-
import {
|
|
105
|
+
import {
|
|
106
|
+
ElMessage,
|
|
107
|
+
ElMessageBox,
|
|
108
|
+
type UploadFile,
|
|
109
|
+
type UploadFiles,
|
|
110
|
+
type UploadUserFile,
|
|
111
|
+
} from 'element-plus'
|
|
100
112
|
import type { ISysUploadFiles } from '../../interface/ISysUploadFiles'
|
|
101
113
|
//@ts-ignore
|
|
102
114
|
import useFileView from '../../hooks/useFileView.ts'
|
|
103
115
|
import documentApi from '../../api/DocumentApi.ts'
|
|
104
116
|
import frameworkUtils from '../../utils/FrameworkUtils.ts'
|
|
105
117
|
import { userInfoStore } from '../../stores/userInfoStore'
|
|
106
|
-
import { getAcceptString } from '
|
|
118
|
+
import { getAcceptString } from '../../utils/uploadAccept.ts'
|
|
107
119
|
|
|
108
120
|
const { fileView: fileView } = useFileView()
|
|
109
121
|
const uploadHeaders = ref({
|
|
110
|
-
Authorization: ''
|
|
122
|
+
Authorization: '',
|
|
111
123
|
})
|
|
112
124
|
const emit = defineEmits(['success'])
|
|
113
125
|
const userInfo = userInfoStore()
|
|
@@ -122,7 +134,7 @@ const props = defineProps({
|
|
|
122
134
|
*/
|
|
123
135
|
limit: {
|
|
124
136
|
type: Number,
|
|
125
|
-
default: 1
|
|
137
|
+
default: 1,
|
|
126
138
|
},
|
|
127
139
|
/**
|
|
128
140
|
* @description 纵向排列
|
|
@@ -130,7 +142,7 @@ const props = defineProps({
|
|
|
130
142
|
*/
|
|
131
143
|
vertical: {
|
|
132
144
|
type: Boolean,
|
|
133
|
-
default: false
|
|
145
|
+
default: false,
|
|
134
146
|
},
|
|
135
147
|
/**
|
|
136
148
|
* @description 上传文件类型
|
|
@@ -139,7 +151,7 @@ const props = defineProps({
|
|
|
139
151
|
*/
|
|
140
152
|
accept: {
|
|
141
153
|
type: String,
|
|
142
|
-
default: ''
|
|
154
|
+
default: '',
|
|
143
155
|
},
|
|
144
156
|
/**
|
|
145
157
|
* @description 业务类型
|
|
@@ -147,7 +159,7 @@ const props = defineProps({
|
|
|
147
159
|
*/
|
|
148
160
|
business: {
|
|
149
161
|
type: String,
|
|
150
|
-
default: 'default'
|
|
162
|
+
default: 'default',
|
|
151
163
|
},
|
|
152
164
|
/**
|
|
153
165
|
* @description 业务id
|
|
@@ -155,7 +167,7 @@ const props = defineProps({
|
|
|
155
167
|
*/
|
|
156
168
|
businessId: {
|
|
157
169
|
type: String,
|
|
158
|
-
default: 'default'
|
|
170
|
+
default: 'default',
|
|
159
171
|
},
|
|
160
172
|
/**
|
|
161
173
|
* @description 是否编辑状态
|
|
@@ -164,7 +176,7 @@ const props = defineProps({
|
|
|
164
176
|
*/
|
|
165
177
|
isEdit: {
|
|
166
178
|
type: Boolean,
|
|
167
|
-
default: true
|
|
179
|
+
default: true,
|
|
168
180
|
},
|
|
169
181
|
/**
|
|
170
182
|
* @description 文档上传是否默认关联,默认不关联
|
|
@@ -173,37 +185,37 @@ const props = defineProps({
|
|
|
173
185
|
*/
|
|
174
186
|
association: {
|
|
175
187
|
type: Boolean,
|
|
176
|
-
default: false
|
|
188
|
+
default: false,
|
|
177
189
|
},
|
|
178
190
|
size: {
|
|
179
191
|
type: Number,
|
|
180
|
-
default: 50
|
|
192
|
+
default: 50,
|
|
181
193
|
},
|
|
182
194
|
//附件宽度
|
|
183
195
|
itemWidth: {
|
|
184
196
|
type: String,
|
|
185
|
-
default: '100%'
|
|
197
|
+
default: '100%',
|
|
186
198
|
},
|
|
187
199
|
isConfirmDelete: {
|
|
188
200
|
type: Boolean,
|
|
189
|
-
default: true
|
|
201
|
+
default: true,
|
|
190
202
|
},
|
|
191
203
|
overwrite: {
|
|
192
204
|
type: Boolean,
|
|
193
|
-
default: true
|
|
205
|
+
default: true,
|
|
194
206
|
},
|
|
195
207
|
autoUpload: {
|
|
196
208
|
type: Boolean,
|
|
197
|
-
default: true
|
|
209
|
+
default: true,
|
|
198
210
|
},
|
|
199
211
|
showOptMessage: {
|
|
200
212
|
type: Boolean,
|
|
201
|
-
default: true
|
|
213
|
+
default: true,
|
|
202
214
|
},
|
|
203
215
|
watermarkCode: {
|
|
204
216
|
type: String,
|
|
205
|
-
default: () => undefined
|
|
206
|
-
}
|
|
217
|
+
default: () => undefined,
|
|
218
|
+
},
|
|
207
219
|
})
|
|
208
220
|
/**
|
|
209
221
|
* 文件列表
|
|
@@ -255,7 +267,7 @@ const success = (response: any, uploadFile: UploadFile, uploadFiles: UploadFiles
|
|
|
255
267
|
const loading = defineModel<boolean>('loading')
|
|
256
268
|
const loadingFiles = ref<string[]>([])
|
|
257
269
|
const hasPendingFiles = computed(() => {
|
|
258
|
-
return fileList.value.some(file => {
|
|
270
|
+
return fileList.value.some((file) => {
|
|
259
271
|
return file.status !== 'success' && file.status !== 'error'
|
|
260
272
|
})
|
|
261
273
|
})
|
|
@@ -281,9 +293,7 @@ const beforeUpload = async (file: File) => {
|
|
|
281
293
|
ElMessage.warning('文件大小不能超过' + props.size + 'MB')
|
|
282
294
|
return false
|
|
283
295
|
}
|
|
284
|
-
const acceptSuffixes = getAccept.value
|
|
285
|
-
?.split(',')
|
|
286
|
-
.map(suffix => suffix.slice(1).toLowerCase())
|
|
296
|
+
const acceptSuffixes = getAccept.value?.split(',').map((suffix) => suffix.slice(1).toLowerCase())
|
|
287
297
|
const fileSuffix = file.name.split('.').pop()?.toLowerCase()
|
|
288
298
|
if (acceptSuffixes && !acceptSuffixes.includes(fileSuffix ?? '')) {
|
|
289
299
|
ElMessage.error(`文件 ${file.name} 格式不支持,仅允许 ${getAccept.value}!`)
|
|
@@ -305,7 +315,7 @@ const fileClick = async (file: UploadFile & ISysUploadFiles) => {
|
|
|
305
315
|
const flag = await ElMessageBox.confirm('删除不可恢复!您确定删除此附件?', '提示', {
|
|
306
316
|
confirmButtonText: '确定',
|
|
307
317
|
cancelButtonText: '取消',
|
|
308
|
-
type: 'warning'
|
|
318
|
+
type: 'warning',
|
|
309
319
|
})
|
|
310
320
|
if (!flag) {
|
|
311
321
|
return
|
|
@@ -324,17 +334,21 @@ const exceed = async (files: File[], uploadFiles: UploadUserFile[]) => {
|
|
|
324
334
|
if (props.limit === 1 && props.overwrite && uploadFilesList.value.length >= 1) {
|
|
325
335
|
const existingFile = uploadFilesList.value[0]
|
|
326
336
|
if (!props.isConfirmDelete) {
|
|
327
|
-
const flag = await ElMessageBox.confirm(
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
337
|
+
const flag = await ElMessageBox.confirm(
|
|
338
|
+
'只允许上传一个附件,是否点击确定覆盖原有附件?',
|
|
339
|
+
'提示',
|
|
340
|
+
{
|
|
341
|
+
confirmButtonText: '确定',
|
|
342
|
+
cancelButtonText: '取消',
|
|
343
|
+
type: 'warning',
|
|
344
|
+
},
|
|
345
|
+
)
|
|
332
346
|
if (!flag) {
|
|
333
347
|
return
|
|
334
348
|
}
|
|
335
349
|
try {
|
|
336
350
|
loading.value = true
|
|
337
|
-
await documentApi.delSysUploadFile(existingFile.id).catch(err => {
|
|
351
|
+
await documentApi.delSysUploadFile(existingFile.id).catch((err) => {
|
|
338
352
|
frameworkUtils.messageError(err)
|
|
339
353
|
})
|
|
340
354
|
} catch (err) {
|
|
@@ -401,7 +415,7 @@ const confirm = async (autoDelete: boolean = true) => {
|
|
|
401
415
|
try {
|
|
402
416
|
loading.value = true
|
|
403
417
|
if (props.isConfirmDelete && deleteFiles.value.length > 0 && autoDelete) {
|
|
404
|
-
await documentApi.delSysUploadFiles(deleteFiles.value.map(item => item.id))
|
|
418
|
+
await documentApi.delSysUploadFiles(deleteFiles.value.map((item) => item.id))
|
|
405
419
|
}
|
|
406
420
|
if (!props.autoUpload) {
|
|
407
421
|
//此处判断是否存在需要上传的文件
|
|
@@ -426,7 +440,7 @@ onMounted(() => {
|
|
|
426
440
|
})
|
|
427
441
|
defineExpose({
|
|
428
442
|
remove,
|
|
429
|
-
confirm
|
|
443
|
+
confirm,
|
|
430
444
|
})
|
|
431
445
|
</script>
|
|
432
446
|
<style scoped lang="scss">
|