| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- const _Http = getApp().globalData.http,
- MFT = require("../../utils/matchingFeilType"),
- checkFile = require("../../utils/checkFile");
- Component({
- options: {
- addGlobalClass: true
- },
- properties: {
- ownertable: {
- type: String
- },
- ownerid: {
- type: String
- },
- disabled: {
- type: Boolean,
- value: true
- }
- },
- data: {
- content: {
- nocache: true,
- pageNumber: 1,
- pageSize: 10,
- pageTotal: 1,
- total: null,
- usetype: ""
- },
- list: []
- },
- lifetimes: {
- attached: function () {
- getApp().globalData.Language.getLanguagePackage(this)
- }
- },
- 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.code != '1') 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.code != '1') return wx.showToast({
- title: res.msg,
- icon: "none"
- });
- this.getList(1, true);
- })
- },
- openFile(e) {
- const {
- item
- } = e.currentTarget.dataset;
- checkFile.checkFile(item)
- }
- }
- })
|