adtec-core-package 2.7.8 → 2.8.0
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
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
<div style="display:flex;flex-direction:column">
|
|
20
20
|
<div v-for="item in uploadFilesList" :key="item.id"
|
|
21
21
|
class="file-item"
|
|
22
|
-
style="display:flex; align-items:center;">
|
|
22
|
+
style="display:flex; align-items:center;overflow: hidden">
|
|
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>
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
height="20px"
|
|
62
62
|
:width="itemWidth"
|
|
63
63
|
>
|
|
64
|
-
<el-flex align="center" justify="flex-start">
|
|
64
|
+
<el-flex align="center" justify="flex-start" style="overflow: hidden">
|
|
65
65
|
<el-tooltip class="box-item" :content="file.name" placement="top">
|
|
66
66
|
<el-text truncated style="cursor: pointer">
|
|
67
67
|
<el-icons :model-value="getIcon(file.name)" style="margin-right: 5px"></el-icons>
|
|
@@ -92,23 +92,19 @@
|
|
|
92
92
|
<script setup lang="ts">
|
|
93
93
|
import { UploadFilled } from '@element-plus/icons-vue'
|
|
94
94
|
import { computed, onMounted, ref, watch } from 'vue'
|
|
95
|
-
import {
|
|
96
|
-
ElMessage,
|
|
97
|
-
ElMessageBox,
|
|
98
|
-
type UploadFile,
|
|
99
|
-
type UploadFiles,
|
|
100
|
-
type UploadUserFile,
|
|
101
|
-
} from 'element-plus'
|
|
95
|
+
import { ElMessage, ElMessageBox, type UploadFile, type UploadFiles, type UploadUserFile } from 'element-plus'
|
|
102
96
|
import type { ISysUploadFiles } from '../../interface/ISysUploadFiles'
|
|
103
97
|
//@ts-ignore
|
|
104
98
|
import useFileView from '../../hooks/useFileView.ts'
|
|
105
99
|
import documentApi from '../../api/DocumentApi.ts'
|
|
106
100
|
import frameworkUtils from '../../utils/FrameworkUtils.ts'
|
|
101
|
+
import { userInfoStore } from '../../stores/userInfoStore'
|
|
107
102
|
|
|
108
103
|
const { fileView: fileView } = useFileView()
|
|
109
104
|
const uploadHeaders = ref({
|
|
110
|
-
Authorization: ''
|
|
105
|
+
Authorization: ''
|
|
111
106
|
})
|
|
107
|
+
const userInfo = userInfoStore()
|
|
112
108
|
const ref_upload = ref()
|
|
113
109
|
const hoverfileName = ref('')
|
|
114
110
|
const props = defineProps({
|
|
@@ -118,7 +114,7 @@ const props = defineProps({
|
|
|
118
114
|
*/
|
|
119
115
|
limit: {
|
|
120
116
|
type: Number,
|
|
121
|
-
default: 1
|
|
117
|
+
default: 1
|
|
122
118
|
},
|
|
123
119
|
/**
|
|
124
120
|
* @description 纵向排列
|
|
@@ -126,7 +122,7 @@ const props = defineProps({
|
|
|
126
122
|
*/
|
|
127
123
|
vertical: {
|
|
128
124
|
type: Boolean,
|
|
129
|
-
default: false
|
|
125
|
+
default: false
|
|
130
126
|
},
|
|
131
127
|
/**
|
|
132
128
|
* @description 上传文件类型
|
|
@@ -135,7 +131,7 @@ const props = defineProps({
|
|
|
135
131
|
*/
|
|
136
132
|
accept: {
|
|
137
133
|
type: String,
|
|
138
|
-
default: ''
|
|
134
|
+
default: ''
|
|
139
135
|
},
|
|
140
136
|
/**
|
|
141
137
|
* @description 业务类型
|
|
@@ -143,7 +139,7 @@ const props = defineProps({
|
|
|
143
139
|
*/
|
|
144
140
|
business: {
|
|
145
141
|
type: String,
|
|
146
|
-
default: 'default'
|
|
142
|
+
default: 'default'
|
|
147
143
|
},
|
|
148
144
|
/**
|
|
149
145
|
* @description 业务id
|
|
@@ -151,14 +147,14 @@ const props = defineProps({
|
|
|
151
147
|
*/
|
|
152
148
|
businessId: {
|
|
153
149
|
type: String,
|
|
154
|
-
default: 'default'
|
|
150
|
+
default: 'default'
|
|
155
151
|
},
|
|
156
152
|
/**
|
|
157
153
|
* 文件列表
|
|
158
154
|
*/
|
|
159
155
|
uploadFilesList: {
|
|
160
156
|
type: Array<ISysUploadFiles>,
|
|
161
|
-
default: () => []
|
|
157
|
+
default: () => []
|
|
162
158
|
},
|
|
163
159
|
/**
|
|
164
160
|
* @description 是否编辑状态
|
|
@@ -167,7 +163,7 @@ const props = defineProps({
|
|
|
167
163
|
*/
|
|
168
164
|
isEdlt: {
|
|
169
165
|
type: Boolean,
|
|
170
|
-
default: true
|
|
166
|
+
default: true
|
|
171
167
|
},
|
|
172
168
|
/**
|
|
173
169
|
* @description 文档上传是否默认关联,默认不关联
|
|
@@ -176,17 +172,17 @@ const props = defineProps({
|
|
|
176
172
|
*/
|
|
177
173
|
association: {
|
|
178
174
|
type: Boolean,
|
|
179
|
-
default: false
|
|
175
|
+
default: false
|
|
180
176
|
},
|
|
181
177
|
size: {
|
|
182
178
|
type: Number,
|
|
183
|
-
default: 50
|
|
179
|
+
default: 50
|
|
184
180
|
},
|
|
185
181
|
//附件宽度
|
|
186
182
|
itemWidth: {
|
|
187
183
|
type: String,
|
|
188
|
-
default: '100%'
|
|
189
|
-
}
|
|
184
|
+
default: '100%'
|
|
185
|
+
}
|
|
190
186
|
})
|
|
191
187
|
const mousemove = (fileName: string) => {
|
|
192
188
|
hoverfileName.value = fileName
|
|
@@ -210,7 +206,7 @@ const getAccept = computed(() => {
|
|
|
210
206
|
} else if (props.accept === 'ppt') {
|
|
211
207
|
return '.ppt,.pptx'
|
|
212
208
|
} else {
|
|
213
|
-
return
|
|
209
|
+
return undefined
|
|
214
210
|
}
|
|
215
211
|
})
|
|
216
212
|
const getIcon = (fileName: string) => {
|
|
@@ -255,7 +251,7 @@ watch(
|
|
|
255
251
|
loading.value = false
|
|
256
252
|
}
|
|
257
253
|
},
|
|
258
|
-
{ deep: true }
|
|
254
|
+
{ deep: true }
|
|
259
255
|
)
|
|
260
256
|
const beforeUpload = (file: File) => {
|
|
261
257
|
const f = props.uploadFilesList.find((c) => c.name === file.name)
|
|
@@ -270,22 +266,26 @@ const beforeUpload = (file: File) => {
|
|
|
270
266
|
?.split(',')
|
|
271
267
|
.map(suffix => suffix.slice(1).toLowerCase())
|
|
272
268
|
const fileSuffix = file.name.split('.').pop()?.toLowerCase()
|
|
273
|
-
if (acceptSuffixes && !acceptSuffixes.includes(fileSuffix)) {
|
|
269
|
+
if (acceptSuffixes && !acceptSuffixes.includes(fileSuffix ?? '')) {
|
|
274
270
|
ElMessage.error(`文件 ${file.name} 格式不支持,仅允许 ${getAccept.value}!`)
|
|
275
271
|
setTimeout(() => {
|
|
276
|
-
ref_upload.value?.clearFiles([
|
|
272
|
+
ref_upload.value?.clearFiles(['ready'])
|
|
277
273
|
}, 1)
|
|
278
274
|
return false
|
|
279
275
|
}
|
|
280
276
|
loadingFiles.value.push(file.name)
|
|
281
277
|
return true
|
|
282
278
|
}
|
|
283
|
-
const fileClick = async (file: UploadFile) => {
|
|
279
|
+
const fileClick = async (file: UploadFile & ISysUploadFiles) => {
|
|
284
280
|
if (file.name === hoverfileName.value) {
|
|
281
|
+
if (file.createBy && userInfo.getUserInfo.userCode !== file.createBy) {
|
|
282
|
+
frameworkUtils.messageError('您没有权限删除此文件!')
|
|
283
|
+
return
|
|
284
|
+
}
|
|
285
285
|
const flag = await ElMessageBox.confirm('删除不可恢复!您确定删除此附件?', '提示', {
|
|
286
286
|
confirmButtonText: '确定',
|
|
287
287
|
cancelButtonText: '取消',
|
|
288
|
-
type: 'warning'
|
|
288
|
+
type: 'warning'
|
|
289
289
|
})
|
|
290
290
|
if (!flag) {
|
|
291
291
|
return
|
|
@@ -348,6 +348,7 @@ defineExpose({
|
|
|
348
348
|
margin-bottom: 0;
|
|
349
349
|
}
|
|
350
350
|
}
|
|
351
|
+
|
|
351
352
|
.file-item {
|
|
352
353
|
position: relative;
|
|
353
354
|
padding: 2px 0;
|
|
@@ -364,6 +365,7 @@ defineExpose({
|
|
|
364
365
|
}
|
|
365
366
|
}
|
|
366
367
|
}
|
|
368
|
+
|
|
367
369
|
.link-name {
|
|
368
370
|
cursor: pointer;
|
|
369
371
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import type { BaseEntity } from '@/interface/BaseEntity.ts'
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Create by丁盼
|
|
3
5
|
* 说明: ISysUploadFiles
|
|
4
6
|
* 创建时间: 2024/12/2 下午3:29
|
|
5
7
|
* 修改时间: 2024/12/2 下午3:29
|
|
6
8
|
*/
|
|
7
|
-
export interface ISysUploadFiles {
|
|
9
|
+
export interface ISysUploadFiles extends BaseEntity{
|
|
8
10
|
id: string
|
|
9
11
|
name: string
|
|
10
12
|
type: string
|