diff --git a/src/api/auth/types.ts b/src/api/auth/types.ts index 0814d674..641530b9 100644 --- a/src/api/auth/types.ts +++ b/src/api/auth/types.ts @@ -7,10 +7,11 @@ export interface LoginData { } /** - * 登录详情 + * 登录响应 */ export interface LoginResult { accessToken: string; + tokenType: string; refreshToken: string; expires: number; } diff --git a/src/api/dept/index.ts b/src/api/dept/index.ts index 510924e2..2ba1e202 100644 --- a/src/api/dept/index.ts +++ b/src/api/dept/index.ts @@ -1,13 +1,13 @@ import request from '@/utils/request'; import { AxiosPromise } from 'axios'; -import { DeptForm, DeptQuery, Dept } from './types'; +import { DeptForm, DeptQuery, DeptVO } from './types'; /** * 部门树形表格 * * @param queryParams */ -export function listDepartments(queryParams?: DeptQuery): AxiosPromise { +export function listDepts(queryParams?: DeptQuery): AxiosPromise { return request({ url: '/api/v1/dept', method: 'get', @@ -18,7 +18,7 @@ export function listDepartments(queryParams?: DeptQuery): AxiosPromise { /** * 部门下拉列表 */ -export function listDeptOptions(): AxiosPromise { +export function listDeptOptions(): AxiosPromise<[]> { return request({ url: '/api/v1/dept/options', method: 'get' @@ -30,7 +30,7 @@ export function listDeptOptions(): AxiosPromise { * * @param id */ -export function getDeptForm(id: string): AxiosPromise { +export function getDeptForm(id: number): AxiosPromise { return request({ url: '/api/v1/dept/' + id + '/form', method: 'get' @@ -56,7 +56,7 @@ export function addDept(data: DeptForm) { * @param id * @param data */ -export function updateDept(id: string, data: DeptForm) { +export function updateDept(id: number, data: DeptForm) { return request({ url: '/api/v1/dept/' + id, method: 'put', diff --git a/src/api/dept/types.ts b/src/api/dept/types.ts index b99f819b..408c39c4 100644 --- a/src/api/dept/types.ts +++ b/src/api/dept/types.ts @@ -2,33 +2,70 @@ * 部门查询参数 */ export interface DeptQuery { - keywords: string | undefined; - status: number | undefined; + keywords?: string; + status?: number; } /** * 部门类型 */ -export interface Dept { - id: string; - name: string; - parentId: string; - treePath: string; - sort: number; - status: number; - leader?: string; - mobile?: string; - email?: string; - children: Dept[]; +export interface DeptVO { + /** + * 子部门 + */ + children?: DeptVO[]; + /** + * 创建时间 + */ + createTime?: Date; + /** + * 部门ID + */ + id?: number; + /** + * 部门名称 + */ + name?: string; + /** + * 父部门ID + */ + parentId?: number; + /** + * 排序 + */ + sort?: number; + /** + * 状态(1:启用;0:禁用) + */ + status?: number; + /** + * 修改时间 + */ + updateTime?: Date; } /** * 部门表单类型 */ export interface DeptForm { - id?: string; - parentId: string; - name: string; - sort: number; - status: number; + /** + * 部门ID(新增不填) + */ + id?: number; + /** + * 部门名称 + */ + name?: string; + /** + * 父部门ID + */ + parentId: number; + /** + * 排序 + */ + sort?: number; + /** + * 状态(1:启用;0:禁用) + */ + status?: number; } diff --git a/src/api/dict/index.ts b/src/api/dict/index.ts index 3fcb5df2..fa10577f 100644 --- a/src/api/dict/index.ts +++ b/src/api/dict/index.ts @@ -1,31 +1,31 @@ import request from '@/utils/request'; import { AxiosPromise } from 'axios'; import { - DictQuery, - DictPageResult, + DictTypeQuery, + DictTypePageResult, DictTypeForm, - DictItemQuery, - DictItemPageResult, - DictItemForm + DictQuery, + DictForm, + DictPageResult } from './types'; /** - * 获取字典类型分页列表 + * 字典类型分页列表 * * @param queryParams */ -export function listDictTypePages( - queryParams: DictQuery -): AxiosPromise { +export function getDictTypePage( + queryParams: DictTypeQuery +): AxiosPromise { return request({ - url: '/api/v1/dict/types/pages', + url: '/api/v1/dict/types/page', method: 'get', params: queryParams }); } /** - * 获取字典类型表单数据 + * 字典类型表单数据 * * @param id */ @@ -78,7 +78,7 @@ export function deleteDictTypes(ids: string) { * * @param typeCode 字典类型编码 */ -export function getDictionaries(typeCode: string): AxiosPromise { +export function getDictOptions(typeCode: string): AxiosPromise { return request({ url: '/api/v1/dict/types/' + typeCode + '/items', method: 'get' @@ -86,36 +86,36 @@ export function getDictionaries(typeCode: string): AxiosPromise { } /** - * 获取字典项分页列表 + * 字典分页列表 */ -export function listDictItemPages( - queryParams: DictItemQuery -): AxiosPromise { +export function getDictPage( + queryParams: DictQuery +): AxiosPromise { return request({ - url: '/api/v1/dict/items/pages', + url: '/api/v1/dict/page', method: 'get', params: queryParams }); } /** - * 获取字典数据项表单数据 + * 获取字典表单数据 * * @param id */ -export function getDictItemData(id: number): AxiosPromise { +export function getDictFormData(id: number): AxiosPromise { return request({ - url: '/api/v1/dict/items/' + id + '/form', + url: '/api/v1/dict/' + id + '/form', method: 'get' }); } /** - * 新增字典项 + * 新增字典 * * @param data */ -export function saveDictItem(data: DictItemForm) { +export function addDict(data: DictForm) { return request({ url: '/api/v1/dict/items', method: 'post', @@ -129,22 +129,22 @@ export function saveDictItem(data: DictItemForm) { * @param id * @param data */ -export function updateDictItem(id: number, data: DictItemForm) { +export function updateDict(id: number, data: DictForm) { return request({ - url: '/api/v1/dict/items/' + id, + url: '/api/v1/dict/' + id, method: 'put', data: data }); } /** - * 批量删除字典数据项 + * 删除字典 * * @param ids 字典项ID,多个以英文逗号(,)分割 */ -export function deleteDictItems(ids: string) { +export function deleteDict(ids: string) { return request({ - url: '/api/v1/dict/items/' + ids, + url: '/api/v1/dict/' + ids, method: 'delete' }); } diff --git a/src/api/dict/types.ts b/src/api/dict/types.ts index 3e301f2f..68c37337 100644 --- a/src/api/dict/types.ts +++ b/src/api/dict/types.ts @@ -1,44 +1,74 @@ /** - * 字典查询参数 + * 字典类型查询参数 */ -export interface DictQuery extends PageQuery { +export interface DictTypeQuery extends PageQuery { /** - * 字典名称 + * 字典类型名称 */ name?: string; } /** - * 字典类型 + * 字典类型分页对象 */ -export interface Dict { +export interface DictTypePageVO { + /** + * 字典类型ID + */ id: number; + /** + * 类型编码 + */ code: string; + /** + * 类型名称 + */ name: string; - status: number; - remark: string; + /** + * 状态(1:启用;0:禁用) + */ + status?: number; + /** + * 备注 + */ + remark?: string; } /** * 字典分页项类型声明 */ -export type DictPageResult = PageResult; +export type DictTypePageResult = PageResult; /** * 字典表单类型声明 */ export interface DictTypeForm { - id: number | undefined; - name: string; - code: string; + /** + * 字典类型ID + */ + id?: number; + /** + * 类型名称 + */ + name?: string; + /** + * 类型编码 + */ + code?: string; + /** + * 类型状态:1:启用;0:禁用 + */ status: number; - remark: string; + /** + * 备注 + */ + remark?: string; } /** - * 字典项查询参数类型声明 + * 字典查询参数 */ -export interface DictItemQuery extends PageQuery { +export interface DictQuery extends PageQuery { /** * 字典项名称 */ @@ -50,35 +80,63 @@ export interface DictItemQuery extends PageQuery { } /** - * 字典数据项类型 + * 字典分页对象 */ -export interface DictItem { - id: number; - name: string; - value: string; - typeCode: string; - sort: number; - status: number; - defaulted: number; +export interface DictPageVO { + /** + * 字典ID + */ + id?: number; + /** + * 字典名称 + */ + name?: string; + /** + * 状态(1:启用;0:禁用) + */ + status?: number; + /** + * 字典值 + */ + value?: string; +} + +/** + * 字典分页 + */ +export type DictPageResult = PageResult; + +/** + * 字典表单 + */ +export interface DictForm { + /** + * 字典ID + */ + id?: number; + /** + * 字典名称 + */ + name?: string; + /** + * 排序 + */ + sort?: number; + /** + * 状态(1:启用;0:禁用) + */ + status?: number; + /** + * 类型编码 + */ + typeCode?: string; + /** + * 值 + */ + value?: string; + + /** + * 备注 + */ remark?: string; } - -/** - * 字典分页项类型声明 - */ -export type DictItemPageResult = PageResult; - -/** - * 字典表单类型声明 - */ -export interface DictItemForm { - id?: number; - typeCode?: string; - typeName?: string; - name: string; - code: string; - value: string; - status: number; - sort: number; - remark: string; -} diff --git a/src/api/menu/index.ts b/src/api/menu/index.ts index baffdc81..78761fcd 100644 --- a/src/api/menu/index.ts +++ b/src/api/menu/index.ts @@ -1,6 +1,6 @@ import request from '@/utils/request'; import { AxiosPromise } from 'axios'; -import { MenuQuery, Menu, Resource, MenuForm } from './types'; +import { MenuQuery, MenuVO, MenuForm } from './types'; /** * 获取路由列表 @@ -13,11 +13,11 @@ export function listRoutes() { } /** - * 获取菜单表格列表 + * 获取菜单树形列表 * * @param queryParams */ -export function listMenus(queryParams: MenuQuery): AxiosPromise { +export function listMenus(queryParams: MenuQuery): AxiosPromise { return request({ url: '/api/v1/menus', method: 'get', @@ -36,22 +36,13 @@ export function listMenuOptions(): AxiosPromise { } /** - * 获取资源(菜单+权限)树形列表 - */ -export function listResources(): AxiosPromise { - return request({ - url: '/api/v1/menus/resources', - method: 'get' - }); -} - -/** - * 获取菜单详情 + * 获取菜单表单数据 + * * @param id */ -export function getMenuDetail(id: string): AxiosPromise { +export function getMenuForm(id: number): AxiosPromise { return request({ - url: '/api/v1/menus/' + id, + url: '/api/v1/menus/' + id + '/form', method: 'get' }); } @@ -84,13 +75,13 @@ export function updateMenu(id: string, data: MenuForm) { } /** - * 批量删除菜单 + * 删除菜单 * - * @param ids 菜单ID,多个以英文逗号(,)分割 + * @param id 菜单ID */ -export function deleteMenus(ids: string) { +export function deleteMenu(id: number) { return request({ - url: '/api/v1/menus/' + ids, + url: '/api/v1/menus/' + id, method: 'delete' }); } diff --git a/src/api/menu/types.ts b/src/api/menu/types.ts index 8de7056c..7cbd05e3 100644 --- a/src/api/menu/types.ts +++ b/src/api/menu/types.ts @@ -1,30 +1,72 @@ +import { MenuTypeEnum } from '@/enums/MenuTypeEnum'; + /** - * 菜单查询参数类型声明 + * 菜单查询参数类型 */ export interface MenuQuery { keywords?: string; } /** - * 菜单分页列表项声明 + * 菜单视图对象类型 */ - -export interface Menu { +export interface MenuVO { + /** + * 子菜单 + */ + children?: MenuVO[]; + /** + * 组件路径 + */ + component?: string; + /** + * ICON + */ + icon?: string; + /** + * 菜单ID + */ id?: number; - parentId: number; - type?: string | 'CATEGORY' | 'MENU' | 'EXTLINK'; - createTime: string; - updateTime: string; - name: string; - icon: string; - component: string; - sort: number; - visible: number; - children: Menu[]; + /** + * 菜单名称 + */ + name?: string; + /** + * 父菜单ID + */ + parentId?: number; + /** + * 按钮权限标识 + */ + perm?: string; + /** + * 跳转路径 + */ + redirect?: string; + /** + * 路由名称 + */ + routeName?: string; + /** + * 路由相对路径 + */ + routePath?: string; + /** + * 菜单排序(数字越小排名越靠前) + */ + sort?: number; + /** + * 菜单类型 + */ + type?: MenuTypeEnum; + /** + * 菜单是否可见(1:显示;0:隐藏) + */ + visible?: number; } /** - * 菜单表单类型声明 + * 菜单表单对象类型 */ export interface MenuForm { /** @@ -34,11 +76,11 @@ export interface MenuForm { /** * 父菜单ID */ - parentId: string; + parentId?: number; /** * 菜单名称 */ - name: string; + name?: string; /** * 菜单是否可见(1:是;0:否;) */ @@ -55,7 +97,7 @@ export interface MenuForm { /** * 路由路径 */ - path: string; + path?: string; /** * 跳转路由路径 */ @@ -64,42 +106,10 @@ export interface MenuForm { /** * 菜单类型 */ - type: string; + type: MenuTypeEnum; /** * 权限标识 */ perm?: string; } - -/** - * 资源(菜单+权限)类型 - */ -export interface Resource { - /** - * 菜单值 - */ - value: string; - /** - * 菜单文本 - */ - label: string; - /** - * 子菜单 - */ - children: Resource[]; -} - -/** - * 权限类型 - */ -export interface Permission { - /** - * 权限值 - */ - value: string; - /** - * 权限文本 - */ - label: string; -} diff --git a/src/api/role/index.ts b/src/api/role/index.ts index 68ab349b..e0171d61 100644 --- a/src/api/role/index.ts +++ b/src/api/role/index.ts @@ -7,11 +7,11 @@ import { RoleQuery, RolePageResult, RoleForm } from './types'; * * @param queryParams */ -export function listRolePages( +export function getRolePage( queryParams?: RoleQuery ): AxiosPromise { return request({ - url: '/api/v1/roles/pages', + url: '/api/v1/roles/page', method: 'get', params: queryParams }); @@ -33,11 +33,11 @@ export function listRoleOptions( } /** - * 获取角色拥有的资源ID集合 + * 获取角色的菜单ID集合 * * @param queryParams */ -export function getRoleMenuIds(roleId: string): AxiosPromise { +export function getRoleMenuIds(roleId: number): AxiosPromise { return request({ url: '/api/v1/roles/' + roleId + '/menuIds', method: 'get' @@ -45,12 +45,12 @@ export function getRoleMenuIds(roleId: string): AxiosPromise { } /** - * 修改角色资源权限 + * 分配菜单权限给角色 * * @param queryParams */ export function updateRoleMenus( - roleId: string, + roleId: number, data: number[] ): AxiosPromise { return request({ @@ -65,9 +65,9 @@ export function updateRoleMenus( * * @param id */ -export function getRoleDetail(id: number): AxiosPromise { +export function getRoleForm(id: number): AxiosPromise { return request({ - url: '/api/v1/roles/' + id, + url: '/api/v1/roles/' + id + '/form', method: 'get' }); } diff --git a/src/api/role/types.ts b/src/api/role/types.ts index 4684c3b3..2d259c7f 100644 --- a/src/api/role/types.ts +++ b/src/api/role/types.ts @@ -1,40 +1,78 @@ /** - * 角色查询参数类型 + * 角色查询参数 */ export interface RoleQuery extends PageQuery { keywords?: string; } /** - * 角色分页列表项 + * 角色分页对象 */ -export interface Role { - id: string; - name: string; - code: string; - sort: number; - status: number; - deleted: number; - menuIds?: any; - permissionIds?: any; +export interface RolePageVO { + /** + * 角色编码 + */ + code?: string; + + /** + * 角色ID + */ + id?: number; + /** + * 角色名称 + */ + name?: string; + /** + * 排序 + */ + sort?: number; + /** + * 角色状态 + */ + status?: number; + /** + * 创建时间 + */ + createTime?: Date; + /** + * 修改时间 + */ + updateTime?: Date; } /** - * 角色分页项类型 + * 角色分页 */ -export type RolePageResult = PageResult; +export type RolePageResult = PageResult; /** - * 角色表单 + * 角色表单对象 */ export interface RoleForm { + /** + * 角色ID + */ id?: number; - name: string; + + /** + * 角色编码 + */ code: string; - sort: number; - status: number; /** * 数据权限 */ - dataScope: number; + dataScope?: number; + + /** + * 角色名称 + */ + name: string; + /** + * 排序 + */ + sort?: number; + /** + * 角色状态(1-正常;0-停用) + */ + status?: number; } diff --git a/src/api/user/index.ts b/src/api/user/index.ts index 3d43d42a..637ab014 100644 --- a/src/api/user/index.ts +++ b/src/api/user/index.ts @@ -17,11 +17,11 @@ export function getUserInfo(): AxiosPromise { * * @param queryParams */ -export function listUserPages( +export function getUserPage( queryParams: UserQuery ): AxiosPromise> { return request({ - url: '/api/v1/users/pages', + url: '/api/v1/users/page', method: 'get', params: queryParams }); @@ -139,14 +139,13 @@ export function exportUser(queryParams: UserQuery) { * * @param file */ -export function importUser(deptId: number, roleIds: string, file: File) { +export function importUser(deptId: number, file: File) { const formData = new FormData(); formData.append('file', file); - formData.append('deptId', deptId.toString()); - formData.append('roleIds', roleIds); return request({ url: '/api/v1/users/_import', method: 'post', + params: { deptId: deptId }, data: formData, headers: { 'Content-Type': 'multipart/form-data' diff --git a/src/api/user/types.ts b/src/api/user/types.ts index 81a6bc48..613ad6e1 100644 --- a/src/api/user/types.ts +++ b/src/api/user/types.ts @@ -12,9 +12,9 @@ export interface UserInfo { * 用户查询对象类型 */ export interface UserQuery extends PageQuery { - keywords: string; - status: number; - deptId: number; + keywords?: string; + status?: number; + deptId?: number; } /** @@ -109,11 +109,3 @@ export interface UserForm { */ username?: string; } - -/** - * 用户导入视图对象类型 - */ -export interface UserImportVO { - deptId: number; - roleIds: number[]; -} diff --git a/src/enums/MenuTypeEnum.ts b/src/enums/MenuTypeEnum.ts new file mode 100644 index 00000000..96c612e4 --- /dev/null +++ b/src/enums/MenuTypeEnum.ts @@ -0,0 +1,19 @@ +export enum MenuTypeEnum { + /** + * 目录 + */ + CATALOG = 'CATALOG', + /** + * 菜单 + */ + MENU = 'MENU', + + /** + * 按钮 + */ + BUTTON = 'BUTTON', + /** + * 外链 + */ + EXTLINK = 'EXTLINK' +} diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index dbbdab7e..b61af479 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -13,8 +13,8 @@ import { useStorage } from '@vueuse/core'; export const useUserStore = defineStore('user', () => { // state const token = useStorage('accessToken', ''); - const nickname = ref(''); - const avatar = ref(''); + const nickname = ref(''); + const avatar = ref(''); const roles = ref>([]); // 用户角色编码集合 → 判断路由权限 const perms = ref>([]); // 用户权限编码集合 → 判断按钮权限 @@ -28,8 +28,8 @@ export const useUserStore = defineStore('user', () => { return new Promise((resolve, reject) => { loginApi(loginData) .then(response => { - const { accessToken } = response.data; - token.value = accessToken; + const { tokenType, accessToken } = response.data; + token.value = tokenType + ' ' + accessToken; resolve(); }) .catch(error => { diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 2963d15a..462c0428 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -72,8 +72,6 @@ + + + + diff --git a/src/views/system/dict/components/DictItem.vue b/src/views/system/dict/components/DictItem.vue deleted file mode 100644 index cacd144c..00000000 --- a/src/views/system/dict/components/DictItem.vue +++ /dev/null @@ -1,290 +0,0 @@ - - - - - diff --git a/src/views/system/dict/components/DictType.vue b/src/views/system/dict/components/DictType.vue deleted file mode 100644 index 6bf53eb6..00000000 --- a/src/views/system/dict/components/DictType.vue +++ /dev/null @@ -1,250 +0,0 @@ - - - - - diff --git a/src/views/system/dict/index.vue b/src/views/system/dict/index.vue index e6dfd200..d30d84dc 100644 --- a/src/views/system/dict/index.vue +++ b/src/views/system/dict/index.vue @@ -1,55 +1,333 @@ + + + - 导出 @@ -619,24 +547,30 @@ onMounted(() => { prop="createTime" width="180" > - + @@ -653,7 +587,7 @@ onMounted(() => { - + { @close="closeDialog" > { + + + + + + + + + + + + + + { 禁用 - - - - - - - - - - - - - - - + { append-to-body @close="closeImportDialog" > - - + + - - - - - - { :limit="1" > - +
将文件拖到此处,或 @@ -805,7 +719,7 @@ onMounted(() => {