From f5d7d45be8eb5fa5ea8aff470fc11b37ba3c921e Mon Sep 17 00:00:00 2001 From: Hccake Date: Sun, 12 Jun 2022 15:43:40 +0800 Subject: [PATCH] =?UTF-8?q?:necktie:=20=E7=B3=BB=E7=BB=9F=E7=BB=84?= =?UTF-8?q?=E7=BB=87=E6=9E=B6=E6=9E=84=E7=9A=84=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit link gh-3 --- src/api/system/organization/index.ts | 37 ++++++++++++++++++++++++++-- src/api/system/organization/types.ts | 24 +++++++++++++++++- 2 files changed, 58 insertions(+), 3 deletions(-) diff --git a/src/api/system/organization/index.ts b/src/api/system/organization/index.ts index dd9ad51..dc78884 100644 --- a/src/api/system/organization/index.ts +++ b/src/api/system/organization/index.ts @@ -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>('/system/organization/list') } + +/** + * 新建组织 + * @param data + */ +export function createOrganization(data: SysOrganizationDTO) { + return httpClient.post>('/system/organization', data) +} + +/** + * 修改组织 + * @param data + */ +export function updateOrganization(data: SysOrganizationDTO) { + return httpClient.put>('/system/organization', data) +} + +/** + * 删除组织 + * @param id 组织id + */ +export function removeOrganization(id: number) { + return httpClient.delete>(`/system/organization/${id}`) +} + +/** + * 修正组织机构层级 + */ +export function revisedOrganization() { + return httpClient.patch>('/system/organization/revised') +} diff --git a/src/api/system/organization/types.ts b/src/api/system/organization/types.ts index a30641e..42a5d19 100644 --- a/src/api/system/organization/types.ts +++ b/src/api/system/organization/types.ts @@ -1,3 +1,6 @@ +/** + * 组织架构视图对象 + */ export interface SysOrganizationVO { id: number // 组织名称 @@ -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 +}