riku
2022-10-17 eb7366f400867d3f401fe60f06d848d6d1448457
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import b_upload from "../../../base/behaviors/b_upload"
import ledgerservice from"../../../service/ledgerservice"
import b_loadingStatus from '../../../base/behaviors/b_loadingStatus'
 
const app = getApp()
 
/**
 * 台账上传管理
 */
module.exports = Behavior({
  behaviors: [b_upload, b_loadingStatus],
  data: {
    ledger: {},
    remark: '',
  },
  methods: {
    _uploadLedger() {
      if (this.data.imgFiles.length == 0) return
      
      var that = this
      let path = []
      this.data.imgFiles.forEach(f => {
        path.push(f.url)
      });
      let ledger = this.data.ledger
      ledger.remark1 = this.data.remark
 
      this.setData({loading: true})
      ledgerservice.uploadLedger(app.globalData.accessToken.userId, ledger, path, {
        success (res) {
          that.setData({loading: false})
          if (typeof that._success === 'function') {
            that._success(res)
          }
        },
        complete (res) {
        }
      })
    },
  }
})