tj
2025-06-05 bba272999cc546f65781bf3d20245a3f819af67f
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
/* eslint-disable class-methods-use-this */
import _axios, { get, put, _delete } from '@/lin/plugin/axios'
 
// 我们通过 class 这样的语法糖使模型这个概念更加具象化,其优点:耦合性低、可维护性。
class ProjectDaily {
  // constructor() {}
 
  // 类中的方法可以代表一个用户行为
  async createProjectDaily(data) {
    return _axios({
      method: 'post',
      url: 'v1/projectDaily',
      data,
    })
  }
 
  // 在这里通过 async await 语法糖让代码同步执行
  // 1. await 一定要搭配 async 来使用
  // 2. await 后面跟的是一个 Promise 对象
  async getProjectDaily(id) {
    const res = await get(`v1/projectDaily/${id}`)
    return res
  }
 
  async getProjectDailyByDailyDate(dailyDate) {
    const res = await get(`v1/projectDaily/byDate/${dailyDate}`)
    return res
  }
 
  async editProjectDaily(id, info) {
    const res = await put(`v1/projectDaily/${id}`, info)
    return res
  }
 
  async deleteProjectDaily(id) {
    const res = await _delete(`v1/projectDaily/${id}`)
    return res
  }
 
  async getProjectDailyList(keyword) {
    return _axios({
      method: 'get',
      url: 'v1/projectDaily/list',
      params: { keyword },
      handleError: true,
    })
  }
 
  async getProjectDailyPage(params) {
    return _axios({
      method: 'get',
      url: 'v1/projectDaily/page',
      params,
      handleError: true,
    })
  }
 
  async getProjectDailyPagePersonal(params) {
    return _axios({
      method: 'get',
      url: 'v1/projectDaily/pagePersonal',
      params,
      handleError: true,
    })
  }
 
  async commitProjectDaily(id) {
    const res = await put(`v1/projectDaily/commit/${id}`, null)
    return res
  }
 
  async commitBatchProjectDaily(info) {
    const res = await put('v1/projectDaily/commit-batch', info)
    return res
  }
 
  async confrimBatch(info) {
    const res = await put('v1/projectDaily/confirm-batch', info)
    return res
  }
 
  async unConfrimBatch(info) {
    const res = await put('v1/projectDaily/unconfirm-batch', info)
    return res
  }
 
  async confirmProjectDaily(id, info) {
    const res = await put(`v1/projectDaily/confirm/${id}`, info)
    return res
  }
 
  async unConfirmProjectDaily(id, info) {
    const res = await put(`v1/projectDaily/unConfirm/${id}`, null)
    return res
  }
 
  /**
   * 获取所有用户
   */
  async getAllUsers() {
    return _axios({
      method: 'get',
      url: 'v1/projectDaily/userList',
      params: {},
      handleError: true,
    })
  }
 
  /**
   * 获取看板信息
   * @param {*} params
   * @returns
   */
  async getProjectDailyBoardList(params) {
    return _axios({
      method: 'get',
      url: 'v1/projectDaily/dailyBoardList',
      params,
      handleError: true,
    })
  }
 
  // 类中的方法可以代表一个用户行为
  async createProjectDailyBatch(data) {
    return _axios({
      method: 'post',
      url: 'v1/projectDaily/saveBatch',
      data,
    })
  }
 
  // 类中的方法可以代表一个用户行为
  async supplementaryProjectDailyBatch(data) {
    return _axios({
      method: 'post',
      url: 'v1/projectDaily/supplementaryBatch',
      data,
    })
  }
 
  async editProjectDailyActualHours(id, info) {
    const res = await put(`v1/projectDaily/actualHours/${id}`, info)
    return res
  }
 
  async editActualHoursBatch(info) {
    const res = await put('v1/projectDaily/actualHours/batch', info)
    return res
  }
 
  async getDailyDateList(dailyDate) {
    return _axios({
      method: 'get',
      url: 'v1/projectDaily/dailyDateList',
      params: { daily_date: dailyDate },
      handleError: true,
    })
  }
 
  /**
   * 获取计划工时
   * @param {*} params
   * @returns
   */
  async getDailyDatePlanTime(dailyDate, createUserId) {
    return _axios({
      method: 'get',
      url: 'v1/projectDaily/dailyDatePlanTime',
      params: { dailyDate, createUserId },
      handleError: true,
    })
  }
 
  /**
   * 获取实际工时
   * @param {*} params
   * @returns
   */
  async getDailyDateActualTime(dailyDate, createUserId) {
    return _axios({
      method: 'get',
      url: 'v1/projectDaily/dailyDateActualTime',
      params: { dailyDate, createUserId },
      handleError: true,
    })
  }
 
  async getExistsHours(dailyDate, ids) {
    return _axios({
      method: 'get',
      url: 'v1/projectDaily/existsHours',
      params: { dailyDate, ids },
      handleError: true,
    })
  }
 
  async createBatchWithTask(data) {
    return _axios({
      method: 'post',
      url: 'v1/projectDaily/batch/task',
      data,
    })
  }
}
 
export default new ProjectDaily()