liu
3 天以前 fe2d6627b8f1002af7a31b08f6f43bec034d04ee
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
import type { PageParam, PageResult } from '@vben/request';
 
import { requestClient } from '#/api/request';
 
export namespace VehicleApplicationApi {
  /** 用车申请状态 */
  export const Status = {
    DRAFT: 0,
    APPROVING: 15,
    APPROVED: 20,
    REJECTED: 35,
  } as const;
 
  /** 用车申请 */
  export interface Application {
    id?: number;
    no?: string;
    applicantId?: number;
    applicantName?: string;
    useStartTime?: string;
    useEndTime?: string;
    departure?: string;
    destination?: string;
    passengers?: number;
    reason?: string;
    vehicleNo?: string;
    status?: number;
    statusName?: string;
    processInstanceId?: string;
    approveTime?: string;
    remark?: string;
    createTime?: string;
  }
 
  /** 审批流程定义 */
  export interface ProcessDefinition {
    id: string;
    key: string;
    name: string;
  }
}
 
/** 查询用车申请分页 */
export function getVehicleApplicationPage(params: PageParam) {
  return requestClient.get<PageResult<VehicleApplicationApi.Application>>(
    '/vehicle/application/page',
    { params },
  );
}
 
/** 查询用车申请详情 */
export function getVehicleApplication(id: number) {
  return requestClient.get<VehicleApplicationApi.Application>(
    `/vehicle/application/get?id=${id}`,
  );
}
 
/** 新增用车申请 */
export function createVehicleApplication(
  data: VehicleApplicationApi.Application,
) {
  return requestClient.post('/vehicle/application/create', data);
}
 
/** 修改用车申请 */
export function updateVehicleApplication(
  data: VehicleApplicationApi.Application,
) {
  return requestClient.put('/vehicle/application/update', data);
}
 
/** 删除用车申请 */
export function deleteVehicleApplication(id: number) {
  return requestClient.delete('/vehicle/application/delete', {
    params: { id },
  });
}
 
/** 提交用车审批 */
export function submitVehicleApplication(
  id: number,
  processDefinitionKey: string,
) {
  return requestClient.post('/vehicle/application/submit', null, {
    params: { id, processDefinitionKey },
  });
}
 
/** 获取用车审批流程列表 */
export function getVehicleApproveProcessList() {
  return requestClient.get<VehicleApplicationApi.ProcessDefinition[]>(
    '/vehicle/application/approve-process-list',
  );
}