|
|
@@ -52,13 +52,16 @@ export default {
|
|
|
total: String,
|
|
|
type: {
|
|
|
type: Number,
|
|
|
- default: 0
|
|
|
+ default: 0,
|
|
|
}
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
show: false,
|
|
|
- currentRow: null
|
|
|
+ currentRow: null,
|
|
|
+ libraryList: [],
|
|
|
+ saveCount: 0,
|
|
|
+ fileList: [],
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
@@ -98,7 +101,6 @@ export default {
|
|
|
},
|
|
|
success(res) {
|
|
|
this.fileList = res.fileList.map(res => {
|
|
|
- console.log('dddd' + res)
|
|
|
const item = {}
|
|
|
item.title = res.response.data.originalFileName
|
|
|
item.suffix = res.response.data.suffix
|
|
|
@@ -111,13 +113,27 @@ export default {
|
|
|
}
|
|
|
return item
|
|
|
})
|
|
|
- this.addFile()
|
|
|
+ this.fileList.forEach(sub => {
|
|
|
+ this.saveLibrary(sub)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ saveLibrary(sub) {
|
|
|
+ let data = {category: 4, content: ''}
|
|
|
+ this.$api.common.submit(Object.assign(sub, data)).then(res => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.saveCount++
|
|
|
+ this.libraryList.push(res.data.id)
|
|
|
+ if (this.saveCount === this.fileList.length) {
|
|
|
+ console.log(this.fileList.length + 'ddjdjfyydju')
|
|
|
+ this.saveCount = 0
|
|
|
+ this.addFile()
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.msg)
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
addFile() {
|
|
|
- if (this.fileList.length === 0) {
|
|
|
- this.$message.error('请先上传相关文件')
|
|
|
- return
|
|
|
- }
|
|
|
this.$api.project.fileAdd(this.fileList).then(res => {
|
|
|
if (res.code === 200) {
|
|
|
this.show = false
|