Blame view

src/api/fee/roomFeeImportApi.js 2.4 KB
a0f584aa   wuxw   费用公摊开发完成
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
  import request from '@/utils/request'
  import { getCommunityId } from '@/api/community/communityApi'
  
  /**
   * 查询费用导入列表
   * @param {Object} params 查询参数
   * @returns {Promise} Promise对象
   */
  export function queryImportFee(params) {
    return new Promise((resolve, reject) => {
      const queryParams = {
        ...params,
        communityId: getCommunityId()
      }
      request({
        url: '/importFee/queryImportFee',
        method: 'get',
        params: queryParams
      }).then(response => {
        const res = response.data
        resolve({
          data: res.data,
          total: res.total,
          records: res.records
        })
      }).catch(error => {
        reject(error)
      })
    })
  }
  
  /**
   * 导入费用数据
   * @param {FormData} formData 表单数据
   * @returns {Promise} Promise对象
   */
  export function importRoomFeeData(formData) {
    return new Promise((resolve, reject) => {
      request({
ac99dc05   wuxw   优化代码
40
        url: '/callComponent/upload/assetImport/importData',
a0f584aa   wuxw   费用公摊开发完成
41
42
43
44
45
46
47
        method: 'post',
        data: formData,
        headers: {
          'Content-Type': 'multipart/form-data'
        }
      }).then(response => {
        const res = response.data
fb7bc2c7   wuxw   代码暂存
48
          resolve(res)
a0f584aa   wuxw   费用公摊开发完成
49
      }).catch(error => {
34ac5192   wuxw   v1.9 优化性别不显示bug
50
        console.log('error:', error.response.data)
0fd4eb05   wuxw   费用导入功能测试完成
51
        reject(error.response.data)
a0f584aa   wuxw   费用公摊开发完成
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
      })
    })
  }
  
  /**
   * 下载导入模板
   * @param {Object} params 查询参数
   * @returns {Promise} Promise对象
   */
  export function downloadImportTemplate(params) {
    return new Promise((resolve, reject) => {
      request({
        url: '/export.exportData',
        method: 'get',
        params: {
          ...params,
          communityId: getCommunityId()
        }
      }).then(response => {
        const res = response.data
        if (res.code === 0) {
ac99dc05   wuxw   优化代码
73
          resolve(res)
a0f584aa   wuxw   费用公摊开发完成
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
        } else {
          reject(new Error(res.msg))
        }
      }).catch(error => {
        reject(error)
      })
    })
  }
  
  /**
   * 获取费用导入详情
   * @param {String} importFeeId 导入ID
   * @returns {Promise} Promise对象
   */
  export function getImportFeeDetail(importFeeId) {
    return new Promise((resolve, reject) => {
      request({
        url: '/importFee/getImportFeeDetail',
        method: 'get',
        params: {
          importFeeId,
          communityId: getCommunityId()
        }
      }).then(response => {
        const res = response.data
        if (res.code === 0) {
          resolve(res.data)
        } else {
          reject(new Error(res.msg))
        }
      }).catch(error => {
        reject(error)
      })
    })
  }