|
@@ -51,15 +51,13 @@ Component({
|
|
|
*/
|
|
*/
|
|
|
methods: {
|
|
methods: {
|
|
|
handleAdd(file) {
|
|
handleAdd(file) {
|
|
|
- console.log(file)
|
|
|
|
|
- let files = file.detail.files.map(e => {
|
|
|
|
|
|
|
+ let files = this.data.originFiles.concat(file.detail.files.map(e => {
|
|
|
e.status = 'loading'
|
|
e.status = 'loading'
|
|
|
return e
|
|
return e
|
|
|
- })
|
|
|
|
|
|
|
+ }));
|
|
|
this.setData({
|
|
this.setData({
|
|
|
uploadCount: files.length,
|
|
uploadCount: files.length,
|
|
|
- originFiles: files,
|
|
|
|
|
- attachmentids: []
|
|
|
|
|
|
|
+ originFiles: files
|
|
|
})
|
|
})
|
|
|
this.toSetFileData()
|
|
this.toSetFileData()
|
|
|
},
|
|
},
|
|
@@ -85,7 +83,6 @@ Component({
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
handleRemove(data) {
|
|
handleRemove(data) {
|
|
|
- console.log(data)
|
|
|
|
|
let file = {
|
|
let file = {
|
|
|
currentTarget: {
|
|
currentTarget: {
|
|
|
dataset: {
|
|
dataset: {
|
|
@@ -159,21 +156,17 @@ Component({
|
|
|
"serialfilename": res.serialfilename
|
|
"serialfilename": res.serialfilename
|
|
|
}
|
|
}
|
|
|
}).then(rs => {
|
|
}).then(rs => {
|
|
|
-
|
|
|
|
|
|
|
+ that.data.attachmentids.push(rs.data.attachmentids[0])
|
|
|
that.setData({
|
|
that.setData({
|
|
|
|
|
+ uploadCount: that.data.uploadCount - 1,
|
|
|
originFiles: that.data.originFiles.map(e => {
|
|
originFiles: that.data.originFiles.map(e => {
|
|
|
if (e.name === res.filename) {
|
|
if (e.name === res.filename) {
|
|
|
- e.status = ''
|
|
|
|
|
|
|
+ e.status = '';
|
|
|
|
|
+ e.attachmentids = rs.data.attachmentids[0]
|
|
|
}
|
|
}
|
|
|
return e
|
|
return e
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
-
|
|
|
|
|
- that.data.attachmentids.push(rs.data.attachmentids[0])
|
|
|
|
|
-
|
|
|
|
|
- that.setData({
|
|
|
|
|
- uploadCount: that.data.uploadCount - 1
|
|
|
|
|
- })
|
|
|
|
|
}).catch(err => {
|
|
}).catch(err => {
|
|
|
console.log(err)
|
|
console.log(err)
|
|
|
})
|
|
})
|
|
@@ -181,7 +174,6 @@ Component({
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
async filebindData() {
|
|
async filebindData() {
|
|
|
-
|
|
|
|
|
this.data.bindData.attachmentids = this.data.attachmentids
|
|
this.data.bindData.attachmentids = this.data.attachmentids
|
|
|
const res = await api._post({
|
|
const res = await api._post({
|
|
|
"classname": "system.attachment.Attachment",
|
|
"classname": "system.attachment.Attachment",
|