Skip to content

Commit

Permalink
👔 系统组织架构的 API
Browse files Browse the repository at this point in the history
link gh-3
  • Loading branch information
Hccake committed Jun 12, 2022
1 parent cd201e5 commit f5d7d45
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 3 deletions.
37 changes: 35 additions & 2 deletions src/api/system/organization/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,41 @@
import httpClient from '@/utils/axios'
import type { ApiResult } from '@/api/types'
import type { SysOrganizationVO } from '@/api/system/organization/types'
import type { SysOrganizationDTO, SysOrganizationVO } from '@/api/system/organization/types'

/** 查询组织机构列表 */
/**
* 查询组织机构列表
*/
export function listOrganizations() {
return httpClient.get<ApiResult<SysOrganizationVO[]>>('/system/organization/list')
}

/**
* 新建组织
* @param data
*/
export function createOrganization(data: SysOrganizationDTO) {
return httpClient.post<ApiResult<void>>('/system/organization', data)
}

/**
* 修改组织
* @param data
*/
export function updateOrganization(data: SysOrganizationDTO) {
return httpClient.put<ApiResult<void>>('/system/organization', data)
}

/**
* 删除组织
* @param id 组织id
*/
export function removeOrganization(id: number) {
return httpClient.delete<ApiResult<void>>(`/system/organization/${id}`)
}

/**
* 修正组织机构层级
*/
export function revisedOrganization() {
return httpClient.patch<ApiResult<void>>('/system/organization/revised')
}
24 changes: 23 additions & 1 deletion src/api/system/organization/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* 组织架构视图对象
*/
export interface SysOrganizationVO {
id: number
// 组织名称
Expand All @@ -22,8 +25,27 @@ export interface SysOrganizationVO {
updateTime: string
}

/**
* 组织架构树
*/
export interface SysOrganizationTree extends SysOrganizationVO {
key: number
key?: number
// 下级组织
children?: SysOrganizationVO[]
}

/**
* 组织架构传输对象
*/
export interface SysOrganizationDTO {
// 组织ID
id?: number
// 组织名称
name: string
// 父级ID
parentId: number
// 备注
remarks: string
// 排序字段,由小到大
sort: number
}

0 comments on commit f5d7d45

Please sign in to comment.