- 用户/组织/资源页批量删除改批量接口 + 失败汇总提示 - 角色页新增「分配部门」(dataScope=custom 时显示,部门树勾选) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
45 lines
1.1 KiB
TypeScript
45 lines
1.1 KiB
TypeScript
import { http } from '@/api/http'
|
|
|
|
export interface Org {
|
|
id: string
|
|
tenantCode: string
|
|
parentCode: string | null
|
|
code: string
|
|
name: string
|
|
leader: string | null
|
|
sort: number
|
|
status: 'enabled' | 'disabled'
|
|
createdAt: number
|
|
}
|
|
|
|
/** 组织列表(后端按 sort 升序返回普通数组,前端自行组树)。 */
|
|
export function listOrgs(signal?: AbortSignal): Promise<Org[]> {
|
|
return http.get<Org[]>('/orgs', { signal })
|
|
}
|
|
|
|
export function createOrg(data: {
|
|
code: string
|
|
name: string
|
|
parentCode?: string | null
|
|
leader?: string
|
|
sort?: number
|
|
}): Promise<Org> {
|
|
return http.post<Org>('/orgs', data)
|
|
}
|
|
|
|
export function updateOrg(
|
|
id: string,
|
|
data: { name?: string; parentCode?: string | null; leader?: string; sort?: number; status?: string },
|
|
): Promise<Org> {
|
|
return http.patch<Org>(`/orgs/${id}`, data)
|
|
}
|
|
|
|
export function deleteOrg(id: string): Promise<unknown> {
|
|
return http.delete(`/orgs/${id}`)
|
|
}
|
|
|
|
/** 批量删除组织。 */
|
|
export function batchDeleteOrgs(ids: string[]): Promise<{ total: number; success: number; failed: string[] }> {
|
|
return http.post('/orgs/batch-delete', { ids })
|
|
}
|