diff --git a/src/api/system/dept.ts b/src/api/system/dept.ts index 17d4807..eddb9ff 100644 --- a/src/api/system/dept.ts +++ b/src/api/system/dept.ts @@ -1,5 +1,5 @@ import request from '@/utils/request' -import type { DeptQueryParams, SysDept, AjaxResult } from '@/types' +import type { DeptQueryParams, SysDept, DeptSortParams, AjaxResult } from '@/types' // 查询部门列表 export function listDept(query?: DeptQueryParams): Promise> { @@ -44,6 +44,15 @@ export function updateDept(data: SysDept): Promise { }) } +// 保存部门排序 +export function updateDeptSort(data: DeptSortParams): Promise { + return request({ + url: '/system/dept/updateSort', + method: 'put', + data: data + }) +} + // 删除部门 export function delDept(deptId: number): Promise { return request({ diff --git a/src/types/api/system/dept.ts b/src/types/api/system/dept.ts index ff29ba5..af6eb1a 100644 --- a/src/types/api/system/dept.ts +++ b/src/types/api/system/dept.ts @@ -8,6 +8,12 @@ export interface DeptQueryParams { status?: string; } +/** 保存部门排序参数 */ +export interface DeptSortParams { + deptIds: string + orderNums: string +} + /** 部门信息 */ export interface SysDept extends BaseEntity { /** 部门编号 */ @@ -28,4 +34,6 @@ export interface SysDept extends BaseEntity { email?: string; /** 状态(0正常 1停用) */ status?: '0' | '1'; + /** 子部门 */ + children?: SysDept[]; } diff --git a/src/views/system/dept/index.vue b/src/views/system/dept/index.vue index 36578b6..63aa50e 100644 --- a/src/views/system/dept/index.vue +++ b/src/views/system/dept/index.vue @@ -36,6 +36,15 @@ v-hasPermi="['system:dept:add']" >新增 + + 保存排序 + - + + +