Blame view

src/api/fee/roomFeeImportApi.js 2.43 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
48
49
50
        method: 'post',
        data: formData,
        headers: {
          'Content-Type': 'multipart/form-data'
        }
      }).then(response => {
        const res = response.data
        if (res.code === 0) {
          resolve(res.data)
        } else {
0fd4eb05   wuxw   费用导入功能测试完成
51
          reject(res.msg)
a0f584aa   wuxw   费用公摊开发完成
52
53
        }
      }).catch(error => {
0fd4eb05   wuxw   费用导入功能测试完成
54
        reject(error.response.data)
a0f584aa   wuxw   费用公摊开发完成
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
      })
    })
  }
  
  /**
   * 下载导入模板
   * @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   优化代码
76
          resolve(res)
a0f584aa   wuxw   费用公摊开发完成
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
109
110
111
        } 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)
      })
    })
  }