// components/signName/index.js
import api from '../../api/api'
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    bindData: {
      value: {},
      type: Object
    }
  },

  /**
   * 组件的初始数据
   */
  data: {

  },
  lifetimes: {
    attached() {
      setTimeout(() => {
        this.fileData()
      }, 1000);
    }
  },
  /**
   * 组件的方法列表
   */
  methods: {
    async fileData() {
      let page = getCurrentPages()[getCurrentPages().length - 1]
      if (page.data.bindSignNameData) {
        const res = await api._post({
          "classname": "system.attachment.Attachment",
          "method": "queryFileLink",
          "content": page.data.bindSignNameData
        })
        this.setData({
          originFiles: res.data
        })
      }
    },
    async deleteFile(data) {
      let item = data.detail.file
      const res = await api._post({
        "classname": "system.attachment.Attachment",
        "method": "deleteFileLink",
        "content": {
          "linksids": [item.linksid]
        }
      })
      this.fileData()
    },
    // 签字
    signName() {

      wx.navigateTo({
        url: '/Eservice/signName/index?id=' + this.data.bindData.ownerid,
      })
    },
  }
})