const _Http = getApp().globalData.http; Component({ options: { addGlobalClass: true }, properties: { ownertable: { type: String }, ownerid: { type: String }, disabled: { type: Boolean } }, data: { content: { nocache: true, pageNumber: 1, pageSize: 999, pageTotal: 1, total: null, usetype: "" }, list: [] }, methods: { getList(id, init = false) { let content = { ...this.data.content, "ownertable": this.data.ownertable, "ownerid": this.data.ownerid, }; if (init) content.pageNumber = 1 _Http.basic({ "classname": "system.attachment.Attachment", "method": "queryFileLink", content }).then(res => { console.log("附件列表", res) if (res.msg != '成功') return wx.showToast({ title: res.msg, icon: "none" }); this.setData({ "content.pageNumber": res.pageNumber + 1, "content.pageTotal": res.pageTotal, "content.total": res.total }) this.selectComponent("#Yl_Files").handleFiles(res.data, true) }) }, addFiles({ detail }) { _Http.basic({ "classname": "system.attachment.Attachment", "method": "createFileLink", "content": { "ownertable": this.data.ownertable, "ownerid": this.data.ownerid, "usetype": "default", "attachmentids": detail } }).then(res => { console.log('上传附件', res) if (res.msg != '成功') return wx.showToast({ title: res.msg, icon: "none" }); this.selectComponent("#Yl_Files").handleFiles(res.data); this.setData({ "content.total": this.data.content.total + res.total }) }) }, deleteFiles() { this.setData({ "content.total": this.data.content.total - 1 }) } } })