|
|
@@ -250,20 +250,21 @@ export default {
|
|
|
this.$api.dispatch.homeFile(data).then(res => {
|
|
|
if (res.code === 200) {
|
|
|
const tmp = res.data
|
|
|
- this.data = this.data.map(sub => {
|
|
|
- const item = tmp.find(ele => ele.type === sub.dispatchType)
|
|
|
- if (item) {
|
|
|
- sub = Object.assign(sub, item)
|
|
|
- }
|
|
|
- return sub
|
|
|
- })
|
|
|
- const img = tmp.filter(ele => ele.type === 4)
|
|
|
- if (img && img.length > 0) {
|
|
|
- img.forEach(i => {
|
|
|
- this.srcList.push(i.fileFolder.url)
|
|
|
+ if (tmp && tmp.length > 0) {
|
|
|
+ this.data = this.data.map(sub => {
|
|
|
+ const item = tmp.find(ele => ele.type === sub.dispatchType)
|
|
|
+ if (item) {
|
|
|
+ sub = Object.assign(sub, item)
|
|
|
+ }
|
|
|
+ return sub
|
|
|
})
|
|
|
+ const img = tmp.filter(ele => ele.type === 4)
|
|
|
+ if (img && img.length > 0) {
|
|
|
+ img.forEach(i => {
|
|
|
+ this.srcList.push(i.fileFolder.url)
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
- console.log(this.srcList)
|
|
|
} else {
|
|
|
this.$message.error(res.msg)
|
|
|
}
|
|
|
@@ -295,13 +296,13 @@ export default {
|
|
|
},
|
|
|
beforeOpen(done, type) {
|
|
|
if (type === 'view') {
|
|
|
- this.previewFile(this.form.fileIds)
|
|
|
+ this.previewFile(this.form.fileId)
|
|
|
} else if (type === 'edit') {
|
|
|
console.log(this.form)
|
|
|
this.$router.push({
|
|
|
path: '/home/files',
|
|
|
query: {
|
|
|
- id: this.form.fileFolders[0].parentId,
|
|
|
+ id: this.form.fileFolder.parentId,
|
|
|
projectId: this.projectId
|
|
|
}
|
|
|
})
|
|
|
@@ -310,7 +311,8 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
previewFile(id) {
|
|
|
- if (id.length === 0) {
|
|
|
+ console.log(id)
|
|
|
+ if (id === undefined || id.length === 0) {
|
|
|
return
|
|
|
}
|
|
|
const routeData = this.$router.resolve({
|
|
|
@@ -349,7 +351,9 @@ export default {
|
|
|
window.open(routeUrl.href, '_blank')
|
|
|
},
|
|
|
fileDownload(res) {
|
|
|
- window.open(res.fileFolders[0].url)
|
|
|
+ if (Object.hasOwn(res.fileFolder, 'url')) {
|
|
|
+ window.open(res.fileFolder.url)
|
|
|
+ }
|
|
|
},
|
|
|
exportFile() {
|
|
|
this.$message.success('开始下载,请稍后...')
|