Skip to content

Commit f5d7d45

Browse files
committed
👔 系统组织架构的 API
link gh-3
1 parent cd201e5 commit f5d7d45

File tree

2 files changed

+58
-3
lines changed

2 files changed

+58
-3
lines changed

src/api/system/organization/index.ts

+35-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,41 @@
11
import httpClient from '@/utils/axios'
22
import type { ApiResult } from '@/api/types'
3-
import type { SysOrganizationVO } from '@/api/system/organization/types'
3+
import type { SysOrganizationDTO, SysOrganizationVO } from '@/api/system/organization/types'
44

5-
/** 查询组织机构列表 */
5+
/**
6+
* 查询组织机构列表
7+
*/
68
export function listOrganizations() {
79
return httpClient.get<ApiResult<SysOrganizationVO[]>>('/system/organization/list')
810
}
11+
12+
/**
13+
* 新建组织
14+
* @param data
15+
*/
16+
export function createOrganization(data: SysOrganizationDTO) {
17+
return httpClient.post<ApiResult<void>>('/system/organization', data)
18+
}
19+
20+
/**
21+
* 修改组织
22+
* @param data
23+
*/
24+
export function updateOrganization(data: SysOrganizationDTO) {
25+
return httpClient.put<ApiResult<void>>('/system/organization', data)
26+
}
27+
28+
/**
29+
* 删除组织
30+
* @param id 组织id
31+
*/
32+
export function removeOrganization(id: number) {
33+
return httpClient.delete<ApiResult<void>>(`/system/organization/${id}`)
34+
}
35+
36+
/**
37+
* 修正组织机构层级
38+
*/
39+
export function revisedOrganization() {
40+
return httpClient.patch<ApiResult<void>>('/system/organization/revised')
41+
}

src/api/system/organization/types.ts

+23-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/**
2+
* 组织架构视图对象
3+
*/
14
export interface SysOrganizationVO {
25
id: number
36
// 组织名称
@@ -22,8 +25,27 @@ export interface SysOrganizationVO {
2225
updateTime: string
2326
}
2427

28+
/**
29+
* 组织架构树
30+
*/
2531
export interface SysOrganizationTree extends SysOrganizationVO {
26-
key: number
32+
key?: number
2733
// 下级组织
2834
children?: SysOrganizationVO[]
2935
}
36+
37+
/**
38+
* 组织架构传输对象
39+
*/
40+
export interface SysOrganizationDTO {
41+
// 组织ID
42+
id?: number
43+
// 组织名称
44+
name: string
45+
// 父级ID
46+
parentId: number
47+
// 备注
48+
remarks: string
49+
// 排序字段,由小到大
50+
sort: number
51+
}

0 commit comments

Comments
 (0)