vue2-client 1.17.31 → 1.17.33

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.
@@ -1,344 +1,344 @@
1
- <template>
2
- <div>
3
- <template v-if="uploadStyle === 'simple'">
4
- <a-upload
5
- :accept="model.accept?.join('')"
6
- :customRequest="uploadFiles"
7
- :multiple="model.acceptCount && model.acceptCount>1"
8
- :file-list="uploadedFileList"
9
- @preview="handlePreview"
10
- :remove="deleteFileItem"
11
- :show-upload-list="{
12
- showRemoveIcon: !readOnly,
13
- showPreviewIcon: true,
14
- showDownloadIcon: false
15
- }">
16
- <a-space>
17
- <a-button style="margin-top: 2%">
18
- <a-icon type="upload"/>
19
- 上传
20
- </a-button>
21
- <a-button v-if="useScanner" style="margin-top: 2%" @click.stop="useScannerUpload" icon="camera">
22
- 高拍仪
23
- </a-button>
24
- </a-space>
25
- </a-upload>
26
- </template>
27
- <a-upload-dragger
28
- v-else-if="model.type === 'file'"
29
- :accept="model.accept?.join('')"
30
- :customRequest="uploadFiles"
31
- :file-list="uploadedFileList"
32
- @preview="handlePreview"
33
- :multiple="true"
34
- :remove="deleteFileItem"
35
- :show-upload-list="{
36
- showRemoveIcon: !readOnly,
37
- showPreviewIcon: true,
38
- showDownloadIcon: false
39
- }"
40
- name="file">
41
- <p class="ant-upload-drag-icon">
42
- <a-icon type="inbox"/>
43
- </p>
44
- <p class="ant-upload-text">
45
- 点击或拖动文件到该区域上传
46
- </p>
47
- <p class="ant-upload-hint">
48
- 支持单个或多个文件
49
- </p>
50
- <a-button v-if="useScanner" style="margin-top: 2%" @click.stop="useScannerUpload" icon="camera">
51
- 高拍仪
52
- </a-button>
53
- </a-upload-dragger>
54
- <a-upload
55
- v-else
56
- @preview="handlePreview"
57
- :accept="model.accept?.join('')"
58
- :multiple="model.acceptCount && model.acceptCount>1"
59
- :customRequest="uploadFiles"
60
- :file-list="uploadedFileList"
61
- :remove="deleteFileItem"
62
- :show-upload-list="{
63
- showRemoveIcon: !readOnly,
64
- showPreviewIcon: true,
65
- showDownloadIcon: false
66
- }"
67
- list-type="picture-card">
68
- <a-icon v-if="!readOnly" type="plus"/>
69
- <div v-if="!readOnly" class="ant-upload-text">
70
- 上传图片
71
- </div>
72
- <a-button v-if="useScanner" style="margin-top: 2%" @click.stop="useScannerUpload" icon="camera">
73
- 高拍仪
74
- </a-button>
75
- </a-upload>
76
-
77
- <height-scanner v-if="useScanner" @confirmPhoto="confirmPhoto" ref="heightScanner"/>
78
-
79
- <!-- 使用封装的图片预览组件 -->
80
- <image-preview-modal
81
- :visible="previewVisible"
82
- :image-url="previewImage"
83
- :image-name="previewImageName"
84
- @close="previewVisible = false"
85
- />
86
- </div>
87
- </template>
88
-
89
- <script>
90
- import { mapState } from 'vuex'
91
- import { fileDelete, fileDeleteV4, upload } from '@vue2-client/services/api/common'
92
- import HeightScanner from '@vue2-client/components/HeightScanner/index.vue'
93
- import ImagePreviewModal from '@vue2-client/base-client/components/common/ImagePreviewModal'
94
- import { base64ToFile } from '@vue2-client/utils/util'
95
- import moment from 'moment'
96
-
97
- export default {
98
- name: 'Uploads',
99
- components: {
100
- HeightScanner,
101
- ImagePreviewModal
102
- },
103
- data () {
104
- return {
105
- uploadedFileList: [],
106
- previewVisible: false,
107
- previewImage: '',
108
- previewImageName: ''
109
- }
110
- },
111
- props: {
112
- // 表单属性
113
- model: {
114
- type: Object,
115
- default: () => {
116
- return {}
117
- }
118
- },
119
- files: {
120
- type: Array,
121
- default: () => {
122
- return []
123
- }
124
- },
125
- images: {
126
- type: Array,
127
- default: () => {
128
- return []
129
- }
130
- },
131
- serviceName: {
132
- type: String,
133
- default: undefined
134
- },
135
- uploadStyle: {
136
- type: String,
137
- default: undefined
138
- },
139
- // outerContainerIndex,是为了XReport,返回外侧行的Index,每一行都有可能有图片,所以要知道是哪一个Index发出的事件
140
- outerContainerIndex: {
141
- type: [String, Number],
142
- default: undefined
143
- },
144
- // 图片上传后添加前缀
145
- imgPrefix: {
146
- type: String,
147
- default: undefined
148
- },
149
- // 是否开启高拍仪
150
- useScanner: {
151
- type: Boolean,
152
- default: false
153
- },
154
- // 是否只读
155
- readOnly: {
156
- type: Boolean,
157
- default: false
158
- }
159
- },
160
- computed: {
161
- ...mapState('account', { currUser: 'user' }),
162
- ...mapState('setting', ['compatible'])
163
- },
164
- created () {
165
- const list = this.model.type === 'file' ? [...this.files] : [...this.images]
166
- if (this.model.useType) {
167
- // {uid,url,name,f_use_type?,f_form_type?}
168
- this.uploadedFileList = list.filter(item => item.f_use_type === this.model.useType)
169
- } else {
170
- this.uploadedFileList = list
171
- }
172
- // 第三个参数‘created’,是因为XReport,有些图片上传需要外界自己控制上传下载的逻辑
173
- // 如果在组件加载完成就emit的话,外侧组件会以为图片已经更新,会调用后端,造成性能浪费
174
- // 所以外侧需要一个标识来判断,该emit事件是不是初始化的时候发出的
175
- if (this.outerContainerIndex !== undefined) {
176
- this.$emit('setFiles', this.uploadedFileList.filter(item => item.status === 'done'), this.outerContainerIndex, 'created')
177
- } else {
178
- this.$emit('setFiles', this.uploadedFileList.filter(item => item.status === 'done').map(item => item.id), undefined, 'created')
179
- }
180
- },
181
- methods: {
182
- async handlePreview (file) {
183
- if (this.isImageFile(file)) {
184
- // 图片文件:预览
185
- this.previewImage = file.url
186
- this.previewImageName = file.name || 'preview_image'
187
- this.previewVisible = true
188
- } else {
189
- // 其他文件:下载
190
- await this.handleDownload(file)
191
- }
192
- },
193
-
194
- async handleDownload (file) {
195
- const link = document.createElement('a')
196
- link.href = file.url
197
- link.download = file.name || 'download'
198
- link.target = '_blank'
199
- document.body.appendChild(link)
200
- link.click()
201
- document.body.removeChild(link)
202
- },
203
-
204
- isImageFile (file) {
205
- const imageExtensions = ['.jpg', '.jpeg', '.png', '.gif', '.bmp', '.webp']
206
- const fileName = file.name ? file.name.toLowerCase() : ''
207
- return imageExtensions.some(ext => fileName.endsWith(ext))
208
- },
209
-
210
- confirmPhoto (img) {
211
- const fileName = `GaoPaiYi_${moment().format('YYYYMMDDHHmmss')}.png`
212
- const file = base64ToFile(img, fileName)
213
- file.uid = fileName
214
- const info = {
215
- file
216
- }
217
- this.uploadFiles(info)
218
- },
219
-
220
- useScannerUpload (e) {
221
- // 打开高拍仪
222
- this.$refs.heightScanner.show = true
223
- },
224
-
225
- uploadFiles (info) {
226
- if (this.uploadedFileList.length >= this.model.acceptCount) {
227
- this.$message.error(`当前表单限制仅可上传 ${this.model.acceptCount} 个文件`)
228
- return
229
- }
230
- // 初始化文件信息
231
- const fileInfo = {
232
- uid: info.file.uid,
233
- name: info.file.name,
234
- status: 'uploading',
235
- response: '',
236
- url: '',
237
- }
238
- // 放入上传列表中,以便于显示上传进度
239
- this.uploadedFileList.push(fileInfo)
240
- // 组装上传数据
241
- const headers = {
242
- 'Content-Type': 'multipart/form-data',
243
- }
244
- const formData = new FormData()
245
- formData.append('avatar', info.file)
246
- formData.append('resUploadMode', this.model.resUploadMode ?? 'server')
247
- if (this.model.pathKey) {
248
- formData.append('pathKey', this.model.pathKey ?? 'Default')
249
- }
250
- // formData.append('stockAlias', this.model.stockAlias)
251
- formData.append('formType', this.model.type)
252
- formData.append('useType', this.model.useType ?? 'Default')
253
- formData.append('resUploadStock', this.model.resUploadStock ?? 1)
254
- formData.append('filename', info.file.name)
255
- formData.append('filesize', (info.file.size / 1024 / 1024).toFixed(4))
256
- formData.append('f_operator', this.currUser ? this.currUser.username : '')
257
-
258
- upload(formData, this.serviceName, { headers, timeout: 600 * 1000 }).then(res => {
259
- // 根据服务端返回的结果判断成功与否,设置文件条目的状态
260
- if (res.success || res.id) {
261
- fileInfo.status = 'done'
262
- let dataObj
263
- if (res.id) {
264
- dataObj = res
265
- } else if (typeof res.data === 'string') {
266
- dataObj = JSON.parse(res.data)
267
- } else {
268
- dataObj = res.data
269
- }
270
- fileInfo.response = dataObj
271
- fileInfo.id = dataObj.id
272
- // 如果新上传的图片是V4,需要携带serviceName前缀,但是同时也要回显老系统图片
273
- if (this.imgPrefix) {
274
- fileInfo.url = this.imgPrefix + dataObj.f_downloadpath
275
- } else {
276
- fileInfo.url = dataObj.f_downloadpath
277
- }
278
- if (this.outerContainerIndex !== undefined) {
279
- this.$emit('setFiles', this.uploadedFileList.filter(item => item.status === 'done'), this.outerContainerIndex)
280
- } else {
281
- this.$emit('setFiles', this.uploadedFileList.filter(item => item.status === 'done').map(item => item.id))
282
- this.$emit('setFilesAllInfo', this.uploadedFileList.filter(item => item.status === 'done').map(item => item))
283
- }
284
- this.$message.success('上传成功!')
285
- } else {
286
- fileInfo.status = 'error'
287
- fileInfo.response = res.data
288
- this.$message.error('上传失败!')
289
- }
290
- }).catch((e) => {
291
- fileInfo.status = 'error'
292
- fileInfo.response = e
293
- })
294
- },
295
-
296
- // 删除文件
297
- deleteFileItem (file) {
298
- const that = this
299
- this.$confirm({
300
- title: '提醒',
301
- content: '确定删除该文件吗?',
302
- okText: '删除',
303
- okType: 'danger',
304
- cancelText: '取消',
305
- zIndex: 2000,
306
- onOk () {
307
- // 阳春博能工单信息V4页面有时会删除V3照片, V3照片不能通过这个请求删除, 已经在外层进行删除处理
308
- if (file.id && !file.version) {
309
- switch (that.compatible) {
310
- case 'V3':
311
- fileDelete({ id: file.id, f_state: '删除' })
312
- .then(res => {
313
- }).catch(e => {
314
- })
315
- break
316
- case 'V4':
317
- fileDeleteV4({ id: file.id, resDeleteMode: 'server' })
318
- .then(res => {
319
- }).catch(e => {
320
- })
321
- break
322
- }
323
- }
324
- // 找到当前文件所在列表的索引
325
- const index = that.uploadedFileList.indexOf(file)
326
- // 从列表中移除该文件
327
- that.uploadedFileList.splice(index, 1)
328
- if (that.outerContainerIndex !== undefined) {
329
- that.$emit('setFiles', that.uploadedFileList.filter(item => item.status === 'done'), that.outerContainerIndex)
330
- } else {
331
- that.$emit('setFiles', that.uploadedFileList.filter(item => item.status === 'done').map(item => item.id))
332
- }
333
- },
334
- onCancel () {
335
- console.log('取消删除')
336
- },
337
- })
338
- return true
339
- }
340
- }
341
- }
342
- </script>
343
- <style scoped>
344
- </style>
1
+ <template>
2
+ <div>
3
+ <template v-if="uploadStyle === 'simple'">
4
+ <a-upload
5
+ :accept="model.accept?.join('')"
6
+ :customRequest="uploadFiles"
7
+ :multiple="model.acceptCount && model.acceptCount>1"
8
+ :file-list="uploadedFileList"
9
+ @preview="handlePreview"
10
+ :remove="deleteFileItem"
11
+ :show-upload-list="{
12
+ showRemoveIcon: !readOnly,
13
+ showPreviewIcon: true,
14
+ showDownloadIcon: false
15
+ }">
16
+ <a-space>
17
+ <a-button style="margin-top: 2%">
18
+ <a-icon type="upload"/>
19
+ 上传
20
+ </a-button>
21
+ <a-button v-if="useScanner" style="margin-top: 2%" @click.stop="useScannerUpload" icon="camera">
22
+ 高拍仪
23
+ </a-button>
24
+ </a-space>
25
+ </a-upload>
26
+ </template>
27
+ <a-upload-dragger
28
+ v-else-if="model.type === 'file'"
29
+ :accept="model.accept?.join('')"
30
+ :customRequest="uploadFiles"
31
+ :file-list="uploadedFileList"
32
+ @preview="handlePreview"
33
+ :multiple="true"
34
+ :remove="deleteFileItem"
35
+ :show-upload-list="{
36
+ showRemoveIcon: !readOnly,
37
+ showPreviewIcon: true,
38
+ showDownloadIcon: false
39
+ }"
40
+ name="file">
41
+ <p class="ant-upload-drag-icon">
42
+ <a-icon type="inbox"/>
43
+ </p>
44
+ <p class="ant-upload-text">
45
+ 点击或拖动文件到该区域上传
46
+ </p>
47
+ <p class="ant-upload-hint">
48
+ 支持单个或多个文件
49
+ </p>
50
+ <a-button v-if="useScanner" style="margin-top: 2%" @click.stop="useScannerUpload" icon="camera">
51
+ 高拍仪
52
+ </a-button>
53
+ </a-upload-dragger>
54
+ <a-upload
55
+ v-else
56
+ @preview="handlePreview"
57
+ :accept="model.accept?.join('')"
58
+ :multiple="model.acceptCount && model.acceptCount>1"
59
+ :customRequest="uploadFiles"
60
+ :file-list="uploadedFileList"
61
+ :remove="deleteFileItem"
62
+ :show-upload-list="{
63
+ showRemoveIcon: !readOnly,
64
+ showPreviewIcon: true,
65
+ showDownloadIcon: false
66
+ }"
67
+ list-type="picture-card">
68
+ <a-icon v-if="!readOnly" type="plus"/>
69
+ <div v-if="!readOnly" class="ant-upload-text">
70
+ 上传图片
71
+ </div>
72
+ <a-button v-if="useScanner" style="margin-top: 2%" @click.stop="useScannerUpload" icon="camera">
73
+ 高拍仪
74
+ </a-button>
75
+ </a-upload>
76
+
77
+ <height-scanner v-if="useScanner" @confirmPhoto="confirmPhoto" ref="heightScanner"/>
78
+
79
+ <!-- 使用封装的图片预览组件 -->
80
+ <image-preview-modal
81
+ :visible="previewVisible"
82
+ :image-url="previewImage"
83
+ :image-name="previewImageName"
84
+ @close="previewVisible = false"
85
+ />
86
+ </div>
87
+ </template>
88
+
89
+ <script>
90
+ import { mapState } from 'vuex'
91
+ import { fileDelete, fileDeleteV4, upload } from '@vue2-client/services/api/common'
92
+ import HeightScanner from '@vue2-client/components/HeightScanner/index.vue'
93
+ import ImagePreviewModal from '@vue2-client/base-client/components/common/ImagePreviewModal'
94
+ import { base64ToFile } from '@vue2-client/utils/util'
95
+ import moment from 'moment'
96
+
97
+ export default {
98
+ name: 'Uploads',
99
+ components: {
100
+ HeightScanner,
101
+ ImagePreviewModal
102
+ },
103
+ data () {
104
+ return {
105
+ uploadedFileList: [],
106
+ previewVisible: false,
107
+ previewImage: '',
108
+ previewImageName: ''
109
+ }
110
+ },
111
+ props: {
112
+ // 表单属性
113
+ model: {
114
+ type: Object,
115
+ default: () => {
116
+ return {}
117
+ }
118
+ },
119
+ files: {
120
+ type: Array,
121
+ default: () => {
122
+ return []
123
+ }
124
+ },
125
+ images: {
126
+ type: Array,
127
+ default: () => {
128
+ return []
129
+ }
130
+ },
131
+ serviceName: {
132
+ type: String,
133
+ default: undefined
134
+ },
135
+ uploadStyle: {
136
+ type: String,
137
+ default: undefined
138
+ },
139
+ // outerContainerIndex,是为了XReport,返回外侧行的Index,每一行都有可能有图片,所以要知道是哪一个Index发出的事件
140
+ outerContainerIndex: {
141
+ type: [String, Number],
142
+ default: undefined
143
+ },
144
+ // 图片上传后添加前缀
145
+ imgPrefix: {
146
+ type: String,
147
+ default: undefined
148
+ },
149
+ // 是否开启高拍仪
150
+ useScanner: {
151
+ type: Boolean,
152
+ default: false
153
+ },
154
+ // 是否只读
155
+ readOnly: {
156
+ type: Boolean,
157
+ default: false
158
+ }
159
+ },
160
+ computed: {
161
+ ...mapState('account', { currUser: 'user' }),
162
+ ...mapState('setting', ['compatible'])
163
+ },
164
+ created () {
165
+ const list = this.model.type === 'file' ? [...this.files] : [...this.images]
166
+ if (this.model.useType) {
167
+ // {uid,url,name,f_use_type?,f_form_type?}
168
+ this.uploadedFileList = list.filter(item => item.f_use_type === this.model.useType)
169
+ } else {
170
+ this.uploadedFileList = list
171
+ }
172
+ // 第三个参数‘created’,是因为XReport,有些图片上传需要外界自己控制上传下载的逻辑
173
+ // 如果在组件加载完成就emit的话,外侧组件会以为图片已经更新,会调用后端,造成性能浪费
174
+ // 所以外侧需要一个标识来判断,该emit事件是不是初始化的时候发出的
175
+ if (this.outerContainerIndex !== undefined) {
176
+ this.$emit('setFiles', this.uploadedFileList.filter(item => item.status === 'done'), this.outerContainerIndex, 'created')
177
+ } else {
178
+ this.$emit('setFiles', this.uploadedFileList.filter(item => item.status === 'done').map(item => item.id), undefined, 'created')
179
+ }
180
+ },
181
+ methods: {
182
+ async handlePreview (file) {
183
+ if (this.isImageFile(file)) {
184
+ // 图片文件:预览
185
+ this.previewImage = file.url
186
+ this.previewImageName = file.name || 'preview_image'
187
+ this.previewVisible = true
188
+ } else {
189
+ // 其他文件:下载
190
+ await this.handleDownload(file)
191
+ }
192
+ },
193
+
194
+ async handleDownload (file) {
195
+ const link = document.createElement('a')
196
+ link.href = file.url
197
+ link.download = file.name || 'download'
198
+ link.target = '_blank'
199
+ document.body.appendChild(link)
200
+ link.click()
201
+ document.body.removeChild(link)
202
+ },
203
+
204
+ isImageFile (file) {
205
+ const imageExtensions = ['.jpg', '.jpeg', '.png', '.gif', '.bmp', '.webp']
206
+ const fileName = file.name ? file.name.toLowerCase() : ''
207
+ return imageExtensions.some(ext => fileName.endsWith(ext))
208
+ },
209
+
210
+ confirmPhoto (img) {
211
+ const fileName = `GaoPaiYi_${moment().format('YYYYMMDDHHmmss')}.png`
212
+ const file = base64ToFile(img, fileName)
213
+ file.uid = fileName
214
+ const info = {
215
+ file
216
+ }
217
+ this.uploadFiles(info)
218
+ },
219
+
220
+ useScannerUpload (e) {
221
+ // 打开高拍仪
222
+ this.$refs.heightScanner.show = true
223
+ },
224
+
225
+ uploadFiles (info) {
226
+ if (this.uploadedFileList.length >= this.model.acceptCount) {
227
+ this.$message.error(`当前表单限制仅可上传 ${this.model.acceptCount} 个文件`)
228
+ return
229
+ }
230
+ // 初始化文件信息
231
+ const fileInfo = {
232
+ uid: info.file.uid,
233
+ name: info.file.name,
234
+ status: 'uploading',
235
+ response: '',
236
+ url: '',
237
+ }
238
+ // 放入上传列表中,以便于显示上传进度
239
+ this.uploadedFileList.push(fileInfo)
240
+ // 组装上传数据
241
+ const headers = {
242
+ 'Content-Type': 'multipart/form-data',
243
+ }
244
+ const formData = new FormData()
245
+ formData.append('avatar', info.file)
246
+ formData.append('resUploadMode', this.model.resUploadMode ?? 'server')
247
+ if (this.model.pathKey) {
248
+ formData.append('pathKey', this.model.pathKey ?? 'Default')
249
+ }
250
+ // formData.append('stockAlias', this.model.stockAlias)
251
+ formData.append('formType', this.model.type)
252
+ formData.append('useType', this.model.useType ?? 'Default')
253
+ formData.append('resUploadStock', this.model.resUploadStock ?? 1)
254
+ formData.append('filename', info.file.name)
255
+ formData.append('filesize', (info.file.size / 1024 / 1024).toFixed(4))
256
+ formData.append('f_operator', this.currUser ? this.currUser.username : '')
257
+
258
+ upload(formData, this.serviceName, { headers, timeout: 600 * 1000 }).then(res => {
259
+ // 根据服务端返回的结果判断成功与否,设置文件条目的状态
260
+ if (res.success || res.id) {
261
+ fileInfo.status = 'done'
262
+ let dataObj
263
+ if (res.id) {
264
+ dataObj = res
265
+ } else if (typeof res.data === 'string') {
266
+ dataObj = JSON.parse(res.data)
267
+ } else {
268
+ dataObj = res.data
269
+ }
270
+ fileInfo.response = dataObj
271
+ fileInfo.id = dataObj.id
272
+ // 如果新上传的图片是V4,需要携带serviceName前缀,但是同时也要回显老系统图片
273
+ if (this.imgPrefix) {
274
+ fileInfo.url = this.imgPrefix + dataObj.f_downloadpath
275
+ } else {
276
+ fileInfo.url = dataObj.f_downloadpath
277
+ }
278
+ if (this.outerContainerIndex !== undefined) {
279
+ this.$emit('setFiles', this.uploadedFileList.filter(item => item.status === 'done'), this.outerContainerIndex)
280
+ } else {
281
+ this.$emit('setFiles', this.uploadedFileList.filter(item => item.status === 'done').map(item => item.id))
282
+ this.$emit('setFilesAllInfo', this.uploadedFileList.filter(item => item.status === 'done').map(item => item))
283
+ }
284
+ this.$message.success('上传成功!')
285
+ } else {
286
+ fileInfo.status = 'error'
287
+ fileInfo.response = res.data
288
+ this.$message.error('上传失败!')
289
+ }
290
+ }).catch((e) => {
291
+ fileInfo.status = 'error'
292
+ fileInfo.response = e
293
+ })
294
+ },
295
+
296
+ // 删除文件
297
+ deleteFileItem (file) {
298
+ const that = this
299
+ this.$confirm({
300
+ title: '提醒',
301
+ content: '确定删除该文件吗?',
302
+ okText: '删除',
303
+ okType: 'danger',
304
+ cancelText: '取消',
305
+ zIndex: 2000,
306
+ onOk () {
307
+ // 阳春博能工单信息V4页面有时会删除V3照片, V3照片不能通过这个请求删除, 已经在外层进行删除处理
308
+ if (file.id && !file.version) {
309
+ switch (that.compatible) {
310
+ case 'V3':
311
+ fileDelete({ id: file.id, f_state: '删除' })
312
+ .then(res => {
313
+ }).catch(e => {
314
+ })
315
+ break
316
+ case 'V4':
317
+ fileDeleteV4({ id: file.id, resDeleteMode: 'server' })
318
+ .then(res => {
319
+ }).catch(e => {
320
+ })
321
+ break
322
+ }
323
+ }
324
+ // 找到当前文件所在列表的索引
325
+ const index = that.uploadedFileList.indexOf(file)
326
+ // 从列表中移除该文件
327
+ that.uploadedFileList.splice(index, 1)
328
+ if (that.outerContainerIndex !== undefined) {
329
+ that.$emit('setFiles', that.uploadedFileList.filter(item => item.status === 'done'), that.outerContainerIndex)
330
+ } else {
331
+ that.$emit('setFiles', that.uploadedFileList.filter(item => item.status === 'done').map(item => item.id))
332
+ }
333
+ },
334
+ onCancel () {
335
+ console.log('取消删除')
336
+ },
337
+ })
338
+ return true
339
+ }
340
+ }
341
+ }
342
+ </script>
343
+ <style scoped>
344
+ </style>