| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- const _Http = getApp().globalData.http,
- MFT = require("../../../utils/matchingFeilType"),
- checkFile = require("../../../utils/checkFile");
- Component({
- options: {
- addGlobalClass: true
- },
- properties: {
- ownertable: String,
- ownerid: String,
- },
- data: {
- content: {
- nocache: true,
- pageNumber: 1,
- pageSize: 10,
- pageTotal: 1,
- total: null,
- usetype: ""
- },
- list: []
- },
- methods: {
- getList(id, init = false) {
- let content = {
- ...this.data.content,
- "ownertable": this.data.ownertable,
- "ownerid": this.data.ownerid,
- nocache: true,
- };
- 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.data,
- icon: "none"
- });
- res.data = MFT.fileList(res.data)
- this.setData({
- "content.pageNumber": res.pageNumber + 1,
- "content.pageTotal": res.pageTotal,
- "content.total": res.total,
- list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data)
- })
- })
- },
- 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.getList(1, true);
- })
- },
- openFile(e) {
- const {
- item
- } = e.currentTarget.dataset;
- checkFile.checkFile(item)
- }
- }
- })
|