Initial commit: HZHub project setup with RuoYi-AI base
This commit is contained in:
75
hzhub-admin/apps/web-antd/src/api/system/client/index.ts
Normal file
75
hzhub-admin/apps/web-antd/src/api/system/client/index.ts
Normal file
@@ -0,0 +1,75 @@
|
||||
import type { Client } from './model';
|
||||
|
||||
import type { ID, IDS, PageQuery, PageResult } from '#/api/common';
|
||||
|
||||
import { commonExport } from '#/api/helper';
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
enum Api {
|
||||
clientChangeStatus = '/system/client/changeStatus',
|
||||
clientExport = '/system/client/export',
|
||||
clientList = '/system/client/list',
|
||||
root = '/system/client',
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询客户端分页列表
|
||||
* @param params 请求参数
|
||||
* @returns 列表
|
||||
*/
|
||||
export function clientList(params?: PageQuery) {
|
||||
return requestClient.get<PageResult<Client>>(Api.clientList, { params });
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出客户端excel
|
||||
* @param data 请求参数
|
||||
*/
|
||||
export function clientExport(data: Partial<Client>) {
|
||||
return commonExport(Api.clientExport, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 客户端详情
|
||||
* @param id id
|
||||
* @returns 详情
|
||||
*/
|
||||
export function clientInfo(id: ID) {
|
||||
return requestClient.get<Client>(`${Api.root}/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 客户端新增
|
||||
* @param data 参数
|
||||
*/
|
||||
export function clientAdd(data: Partial<Client>) {
|
||||
return requestClient.postWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 客户端修改
|
||||
* @param data 参数
|
||||
*/
|
||||
export function clientUpdate(data: Partial<Client>) {
|
||||
return requestClient.putWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 客户端状态修改
|
||||
* @param data 状态
|
||||
*/
|
||||
export function clientChangeStatus(data: any) {
|
||||
const requestData = {
|
||||
clientId: data.clientId,
|
||||
status: data.status,
|
||||
};
|
||||
return requestClient.putWithMsg<void>(Api.clientChangeStatus, requestData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 客户端删除
|
||||
* @param ids id集合
|
||||
*/
|
||||
export function clientRemove(ids: IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`${Api.root}/${ids}`);
|
||||
}
|
||||
12
hzhub-admin/apps/web-antd/src/api/system/client/model.d.ts
vendored
Normal file
12
hzhub-admin/apps/web-antd/src/api/system/client/model.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
export interface Client {
|
||||
id: number;
|
||||
clientId: string;
|
||||
clientKey: string;
|
||||
clientSecret: string;
|
||||
grantTypeList: string[];
|
||||
grantType: string;
|
||||
deviceType: string;
|
||||
activeTimeout: number;
|
||||
timeout: number;
|
||||
status: string;
|
||||
}
|
||||
76
hzhub-admin/apps/web-antd/src/api/system/config/index.ts
Normal file
76
hzhub-admin/apps/web-antd/src/api/system/config/index.ts
Normal file
@@ -0,0 +1,76 @@
|
||||
import type { SysConfig } from './model';
|
||||
|
||||
import type { ID, IDS, PageQuery, PageResult } from '#/api/common';
|
||||
|
||||
import { commonExport } from '#/api/helper';
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
enum Api {
|
||||
configExport = '/system/config/export',
|
||||
configInfoByKey = '/system/config/configKey',
|
||||
configList = '/system/config/list',
|
||||
configRefreshCache = '/system/config/refreshCache',
|
||||
root = '/system/config',
|
||||
}
|
||||
|
||||
/**
|
||||
* 系统参数分页列表
|
||||
* @param params 请求参数
|
||||
* @returns 列表
|
||||
*/
|
||||
export function configList(params?: PageQuery) {
|
||||
return requestClient.get<PageResult<SysConfig>>(Api.configList, { params });
|
||||
}
|
||||
|
||||
export function configInfo(configId: ID) {
|
||||
return requestClient.get<SysConfig>(`${Api.root}/${configId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出
|
||||
* @param data 参数
|
||||
*/
|
||||
export function configExport(data: Partial<SysConfig>) {
|
||||
return commonExport(Api.configExport, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新缓存
|
||||
* @returns void
|
||||
*/
|
||||
export function configRefreshCache() {
|
||||
return requestClient.deleteWithMsg<void>(Api.configRefreshCache);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新系统配置
|
||||
* @param data 参数
|
||||
*/
|
||||
export function configUpdate(data: Partial<SysConfig>) {
|
||||
return requestClient.putWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增系统配置
|
||||
* @param data 参数
|
||||
*/
|
||||
export function configAdd(data: Partial<SysConfig>) {
|
||||
return requestClient.postWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除配置
|
||||
* @param configIds ids
|
||||
*/
|
||||
export function configRemove(configIds: IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`${Api.root}/${configIds}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取配置信息
|
||||
* @param configKey configKey
|
||||
* @returns value
|
||||
*/
|
||||
export function configInfoByKey(configKey: string) {
|
||||
return requestClient.get<string>(`${Api.configInfoByKey}/${configKey}`);
|
||||
}
|
||||
9
hzhub-admin/apps/web-antd/src/api/system/config/model.d.ts
vendored
Normal file
9
hzhub-admin/apps/web-antd/src/api/system/config/model.d.ts
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
export interface SysConfig {
|
||||
configId: number;
|
||||
configName: string;
|
||||
configKey: string;
|
||||
configValue: string;
|
||||
configType: string;
|
||||
remark: string;
|
||||
createTime: string;
|
||||
}
|
||||
62
hzhub-admin/apps/web-antd/src/api/system/dept/index.ts
Normal file
62
hzhub-admin/apps/web-antd/src/api/system/dept/index.ts
Normal file
@@ -0,0 +1,62 @@
|
||||
import type { Dept } from './model';
|
||||
|
||||
import type { ID } from '#/api/common';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
enum Api {
|
||||
deptList = '/system/dept/list',
|
||||
deptNodeInfo = '/system/dept/list/exclude',
|
||||
root = '/system/dept',
|
||||
}
|
||||
|
||||
/**
|
||||
* 部门列表
|
||||
* @returns list
|
||||
*/
|
||||
export function deptList(params?: { deptName?: string; status?: string }) {
|
||||
return requestClient.get<Dept[]>(Api.deptList, { params });
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询部门列表(排除节点)
|
||||
* @param deptId 部门ID
|
||||
* @returns void
|
||||
*/
|
||||
export function deptNodeList(deptId: ID) {
|
||||
return requestClient.get<Dept[]>(`${Api.deptNodeInfo}/${deptId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 部门详情
|
||||
* @param deptId 部门id
|
||||
* @returns 部门信息
|
||||
*/
|
||||
export function deptInfo(deptId: ID) {
|
||||
return requestClient.get<Dept>(`${Api.root}/${deptId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 部门新增
|
||||
* @param data 参数
|
||||
*/
|
||||
export function deptAdd(data: Partial<Dept>) {
|
||||
return requestClient.postWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 部门更新
|
||||
* @param data 参数
|
||||
*/
|
||||
export function deptUpdate(data: Partial<Dept>) {
|
||||
return requestClient.putWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 注意这里只允许单删除
|
||||
* @param deptId ID
|
||||
* @returns void
|
||||
*/
|
||||
export function deptRemove(deptId: ID) {
|
||||
return requestClient.deleteWithMsg<void>(`${Api.root}/${deptId}`);
|
||||
}
|
||||
19
hzhub-admin/apps/web-antd/src/api/system/dept/model.d.ts
vendored
Normal file
19
hzhub-admin/apps/web-antd/src/api/system/dept/model.d.ts
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
export interface Dept {
|
||||
createBy: string;
|
||||
createTime: string;
|
||||
updateBy?: string;
|
||||
updateTime?: string;
|
||||
remark?: string;
|
||||
deptId: number;
|
||||
parentId: number;
|
||||
ancestors: string;
|
||||
deptName: string;
|
||||
orderNum: number;
|
||||
leader: string;
|
||||
phone: string;
|
||||
email: string;
|
||||
status: string;
|
||||
delFlag: string;
|
||||
parentName?: string;
|
||||
children?: Dept[];
|
||||
}
|
||||
17
hzhub-admin/apps/web-antd/src/api/system/dict/dict-data-model.d.ts
vendored
Normal file
17
hzhub-admin/apps/web-antd/src/api/system/dict/dict-data-model.d.ts
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
export interface DictData {
|
||||
createBy: string;
|
||||
createTime: string;
|
||||
cssClass: string;
|
||||
default: boolean;
|
||||
dictCode: number;
|
||||
dictLabel: string;
|
||||
dictSort: number;
|
||||
dictType: string;
|
||||
dictValue: string;
|
||||
isDefault: string;
|
||||
listClass: string;
|
||||
remark: string;
|
||||
status: string;
|
||||
updateBy?: any;
|
||||
updateTime?: any;
|
||||
}
|
||||
75
hzhub-admin/apps/web-antd/src/api/system/dict/dict-data.ts
Normal file
75
hzhub-admin/apps/web-antd/src/api/system/dict/dict-data.ts
Normal file
@@ -0,0 +1,75 @@
|
||||
import type { DictData } from './dict-data-model';
|
||||
|
||||
import type { ID, IDS, PageQuery } from '#/api/common';
|
||||
|
||||
import { commonExport } from '#/api/helper';
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
enum Api {
|
||||
dictDataExport = '/system/dict/data/export',
|
||||
dictDataList = '/system/dict/data/list',
|
||||
root = '/system/dict/data',
|
||||
}
|
||||
|
||||
/**
|
||||
* 主要是DictTag组件使用
|
||||
* @param dictType 字典类型
|
||||
* @returns 字典数据
|
||||
*/
|
||||
export function dictDataInfo(dictType: string) {
|
||||
return requestClient.get<DictData[]>(`${Api.root}/type/${dictType}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 字典数据
|
||||
* @param params 查询参数
|
||||
* @returns 字典数据列表
|
||||
*/
|
||||
export function dictDataList(params?: PageQuery) {
|
||||
return requestClient.get<DictData[]>(Api.dictDataList, { params });
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出字典数据
|
||||
* @param data 表单参数
|
||||
* @returns blob
|
||||
*/
|
||||
export function dictDataExport(data: Partial<DictData>) {
|
||||
return commonExport(Api.dictDataExport, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param dictIds 字典ID Array
|
||||
* @returns void
|
||||
*/
|
||||
export function dictDataRemove(dictIds: IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`${Api.root}/${dictIds}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param data 表单参数
|
||||
* @returns void
|
||||
*/
|
||||
export function dictDataAdd(data: Partial<DictData>) {
|
||||
return requestClient.postWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param data 表单参数
|
||||
* @returns void
|
||||
*/
|
||||
export function dictDataUpdate(data: Partial<DictData>) {
|
||||
return requestClient.putWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询字典数据详细
|
||||
* @param dictCode 字典编码
|
||||
* @returns 字典数据
|
||||
*/
|
||||
export function dictDetailInfo(dictCode: ID) {
|
||||
return requestClient.get<DictData>(`${Api.root}/${dictCode}`);
|
||||
}
|
||||
8
hzhub-admin/apps/web-antd/src/api/system/dict/dict-type-model.d.ts
vendored
Normal file
8
hzhub-admin/apps/web-antd/src/api/system/dict/dict-type-model.d.ts
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
export interface DictType {
|
||||
createTime: string;
|
||||
dictId: number;
|
||||
dictName: string;
|
||||
dictType: string;
|
||||
remark: string;
|
||||
status: string;
|
||||
}
|
||||
85
hzhub-admin/apps/web-antd/src/api/system/dict/dict-type.ts
Normal file
85
hzhub-admin/apps/web-antd/src/api/system/dict/dict-type.ts
Normal file
@@ -0,0 +1,85 @@
|
||||
import type { DictType } from './dict-type-model';
|
||||
|
||||
import type { ID, IDS, PageQuery, PageResult } from '#/api/common';
|
||||
|
||||
import { commonExport } from '#/api/helper';
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
enum Api {
|
||||
dictOptionSelectList = '/system/dict/type/optionselect',
|
||||
dictTypeExport = '/system/dict/type/export',
|
||||
dictTypeList = '/system/dict/type/list',
|
||||
dictTypeRefreshCache = '/system/dict/type/refreshCache',
|
||||
root = '/system/dict/type',
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字典类型列表
|
||||
* @param params 请求参数
|
||||
* @returns list
|
||||
*/
|
||||
export function dictTypeList(params?: PageQuery) {
|
||||
return requestClient.get<PageResult<DictType>>(Api.dictTypeList, { params });
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出字典类型列表
|
||||
* @param data 表单参数
|
||||
* @returns blob
|
||||
*/
|
||||
export function dictTypeExport(data: Partial<DictType>) {
|
||||
return commonExport(Api.dictTypeExport, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除字典类型
|
||||
* @param dictIds 字典类型id数组
|
||||
* @returns void
|
||||
*/
|
||||
export function dictTypeRemove(dictIds: IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`${Api.root}/${dictIds}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新字典缓存
|
||||
* @returns void
|
||||
*/
|
||||
export function refreshDictTypeCache() {
|
||||
return requestClient.deleteWithMsg<void>(Api.dictTypeRefreshCache);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param data 表单参数
|
||||
* @returns void
|
||||
*/
|
||||
export function dictTypeAdd(data: Partial<DictType>) {
|
||||
return requestClient.postWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param data 表单参数
|
||||
* @returns void
|
||||
*/
|
||||
export function dictTypeUpdate(data: Partial<DictType>) {
|
||||
return requestClient.putWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询详情
|
||||
* @param dictId 字典类型id
|
||||
* @returns 信息
|
||||
*/
|
||||
export function dictTypeInfo(dictId: ID) {
|
||||
return requestClient.get<DictType>(`${Api.root}/${dictId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 这个在ele用到 v5用不上
|
||||
* 下拉框 返回值和list一样
|
||||
* @returns options
|
||||
*/
|
||||
export function dictOptionSelectList() {
|
||||
return requestClient.get<DictType[]>(Api.dictOptionSelectList);
|
||||
}
|
||||
35
hzhub-admin/apps/web-antd/src/api/system/dict/index.ts
Normal file
35
hzhub-admin/apps/web-antd/src/api/system/dict/index.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import type { DictData } from './dict-data-model';
|
||||
import type { DictType } from './dict-type-model';
|
||||
import { dictDataInfo } from './dict-data';
|
||||
|
||||
export type { DictData, DictType };
|
||||
|
||||
export {
|
||||
dictDataInfo,
|
||||
dictDataList,
|
||||
dictDataExport,
|
||||
dictDataRemove,
|
||||
dictDataAdd,
|
||||
dictDataUpdate,
|
||||
dictDetailInfo,
|
||||
} from './dict-data';
|
||||
|
||||
export {
|
||||
dictTypeList,
|
||||
dictTypeExport,
|
||||
dictTypeRemove,
|
||||
refreshDictTypeCache,
|
||||
dictTypeAdd,
|
||||
dictTypeUpdate,
|
||||
dictTypeInfo,
|
||||
dictOptionSelectList,
|
||||
} from './dict-type';
|
||||
|
||||
/**
|
||||
* 获取字典数据项 (dictDataInfo的别名)
|
||||
* @param dictType 字典类型
|
||||
* @returns 字典数据
|
||||
*/
|
||||
export function getDictItems(dictType: string) {
|
||||
return dictDataInfo(dictType);
|
||||
}
|
||||
92
hzhub-admin/apps/web-antd/src/api/system/menu/index.ts
Normal file
92
hzhub-admin/apps/web-antd/src/api/system/menu/index.ts
Normal file
@@ -0,0 +1,92 @@
|
||||
import type { Menu, MenuOption, MenuQuery, MenuResp } from './model';
|
||||
|
||||
import type { ID, IDS } from '#/api/common';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
enum Api {
|
||||
menuList = '/system/menu/list',
|
||||
menuTreeSelect = '/system/menu/treeselect',
|
||||
roleMenuTree = '/system/menu/roleMenuTreeselect',
|
||||
root = '/system/menu',
|
||||
tenantPackageMenuTreeselect = '/system/menu/tenantPackageMenuTreeselect',
|
||||
}
|
||||
|
||||
/**
|
||||
* 菜单列表
|
||||
* @param params 参数
|
||||
* @returns 列表
|
||||
*/
|
||||
export function menuList(params?: MenuQuery) {
|
||||
return requestClient.get<Menu[]>(Api.menuList, { params });
|
||||
}
|
||||
|
||||
/**
|
||||
* 菜单详情
|
||||
* @param menuId 菜单id
|
||||
* @returns 菜单详情
|
||||
*/
|
||||
export function menuInfo(menuId: ID) {
|
||||
return requestClient.get<Menu>(`${Api.root}/${menuId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 菜单新增
|
||||
* @param data 参数
|
||||
*/
|
||||
export function menuAdd(data: Partial<Menu>) {
|
||||
return requestClient.postWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 菜单更新
|
||||
* @param data 参数
|
||||
*/
|
||||
export function menuUpdate(data: Partial<Menu>) {
|
||||
return requestClient.putWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 菜单删除
|
||||
* @param menuIds ids
|
||||
*/
|
||||
export function menuRemove(menuIds: IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`${Api.root}/${menuIds}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回对应角色的菜单
|
||||
* @param roleId id
|
||||
* @returns resp
|
||||
*/
|
||||
export function roleMenuTreeSelect(roleId: ID) {
|
||||
return requestClient.get<MenuResp>(`${Api.roleMenuTree}/${roleId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下拉框使用 返回所有的菜单
|
||||
* @returns []
|
||||
*/
|
||||
export function menuTreeSelect() {
|
||||
return requestClient.get<MenuOption[]>(Api.menuTreeSelect);
|
||||
}
|
||||
|
||||
/**
|
||||
* 租户套餐使用
|
||||
* @param packageId packageId
|
||||
* @returns resp
|
||||
*/
|
||||
export function tenantPackageMenuTreeSelect(packageId: ID) {
|
||||
return requestClient.get<MenuResp>(
|
||||
`${Api.tenantPackageMenuTreeselect}/${packageId}`,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除菜单
|
||||
* @param menuIds 菜单ids
|
||||
* @returns void
|
||||
*/
|
||||
export function menuCascadeRemove(menuIds: IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`${Api.root}/cascade/${menuIds}`);
|
||||
}
|
||||
57
hzhub-admin/apps/web-antd/src/api/system/menu/model.d.ts
vendored
Normal file
57
hzhub-admin/apps/web-antd/src/api/system/menu/model.d.ts
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
export interface Menu {
|
||||
createBy?: any;
|
||||
createTime: string;
|
||||
updateBy?: any;
|
||||
updateTime?: any;
|
||||
remark?: any;
|
||||
menuId: number;
|
||||
menuName: string;
|
||||
parentName?: string;
|
||||
parentId: number;
|
||||
orderNum: number;
|
||||
path: string;
|
||||
component?: string;
|
||||
query: string;
|
||||
isFrame: string;
|
||||
isCache: string;
|
||||
menuType: string;
|
||||
visible: string;
|
||||
status: string;
|
||||
perms: string;
|
||||
icon: string;
|
||||
children: Menu[];
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 菜单信息
|
||||
* @param label 菜单名称
|
||||
*/
|
||||
export interface MenuOption {
|
||||
id: number;
|
||||
parentId: number;
|
||||
label: string;
|
||||
weight: number;
|
||||
children: MenuOption[];
|
||||
key: string; // 实际上不存在 ide报错
|
||||
menuType: string;
|
||||
icon: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 菜单返回
|
||||
* @param checkedKeys 选中的菜单id
|
||||
* @param menus 菜单信息
|
||||
*/
|
||||
export interface MenuResp {
|
||||
checkedKeys: number[];
|
||||
menus: MenuOption[];
|
||||
}
|
||||
|
||||
/**
|
||||
* 菜单表单查询
|
||||
*/
|
||||
export interface MenuQuery {
|
||||
menuName?: string;
|
||||
visible?: string;
|
||||
status?: string;
|
||||
}
|
||||
52
hzhub-admin/apps/web-antd/src/api/system/notice/index.ts
Normal file
52
hzhub-admin/apps/web-antd/src/api/system/notice/index.ts
Normal file
@@ -0,0 +1,52 @@
|
||||
import type { Notice } from './model';
|
||||
|
||||
import type { ID, IDS, PageQuery } from '#/api/common';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
enum Api {
|
||||
noticeList = '/system/notice/list',
|
||||
root = '/system/notice',
|
||||
}
|
||||
|
||||
/**
|
||||
* 通知公告分页
|
||||
* @param params 分页参数
|
||||
* @returns 分页结果
|
||||
*/
|
||||
export function noticeList(params?: PageQuery) {
|
||||
return requestClient.get<Notice[]>(Api.noticeList, { params });
|
||||
}
|
||||
|
||||
/**
|
||||
* 通知公告详情
|
||||
* @param noticeId id
|
||||
* @returns 详情
|
||||
*/
|
||||
export function noticeInfo(noticeId: ID) {
|
||||
return requestClient.get<Notice>(`${Api.root}/${noticeId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通知公告新增
|
||||
* @param data 参数
|
||||
*/
|
||||
export function noticeAdd(data: Partial<Notice>) {
|
||||
return requestClient.postWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通知公告更新
|
||||
* @param data 参数
|
||||
*/
|
||||
export function noticeUpdate(data: any) {
|
||||
return requestClient.putWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通知公告删除
|
||||
* @param noticeIds ids
|
||||
*/
|
||||
export function noticeRemove(noticeIds: IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`${Api.root}/${noticeIds}`);
|
||||
}
|
||||
11
hzhub-admin/apps/web-antd/src/api/system/notice/model.d.ts
vendored
Normal file
11
hzhub-admin/apps/web-antd/src/api/system/notice/model.d.ts
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
export interface Notice {
|
||||
noticeId: number;
|
||||
noticeTitle: string;
|
||||
noticeType: string;
|
||||
noticeContent: string;
|
||||
status: string;
|
||||
remark: string;
|
||||
createBy: number;
|
||||
createByName: string;
|
||||
createTime: string;
|
||||
}
|
||||
46
hzhub-admin/apps/web-antd/src/api/system/oss-config/index.ts
Normal file
46
hzhub-admin/apps/web-antd/src/api/system/oss-config/index.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import type { OssConfig } from './model';
|
||||
|
||||
import type { ID, IDS, PageQuery } from '#/api/common';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
enum Api {
|
||||
ossConfigChangeStatus = '/resource/oss/config/changeStatus',
|
||||
ossConfigList = '/resource/oss/config/list',
|
||||
root = '/resource/oss/config',
|
||||
}
|
||||
|
||||
// 获取OSS配置列表
|
||||
export function ossConfigList(params?: PageQuery) {
|
||||
return requestClient.get<OssConfig[]>(Api.ossConfigList, { params });
|
||||
}
|
||||
|
||||
// 获取OSS配置的信息
|
||||
export function ossConfigInfo(ossConfigId: ID) {
|
||||
return requestClient.get<OssConfig>(`${Api.root}/${ossConfigId}`);
|
||||
}
|
||||
|
||||
// 添加新的OSS配置
|
||||
export function ossConfigAdd(data: Partial<OssConfig>) {
|
||||
return requestClient.postWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
// 更新现有的OSS配置
|
||||
export function ossConfigUpdate(data: Partial<OssConfig>) {
|
||||
return requestClient.putWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
// 删除OSS配置
|
||||
export function ossConfigRemove(ossConfigIds: IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`${Api.root}/${ossConfigIds}`);
|
||||
}
|
||||
|
||||
// 更改OSS配置的状态
|
||||
export function ossConfigChangeStatus(data: any) {
|
||||
const requestData: Partial<OssConfig> = {
|
||||
ossConfigId: data.ossConfigId,
|
||||
status: data.status,
|
||||
configKey: data.configKey,
|
||||
};
|
||||
return requestClient.putWithMsg(Api.ossConfigChangeStatus, requestData);
|
||||
}
|
||||
16
hzhub-admin/apps/web-antd/src/api/system/oss-config/model.d.ts
vendored
Normal file
16
hzhub-admin/apps/web-antd/src/api/system/oss-config/model.d.ts
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
export interface OssConfig {
|
||||
ossConfigId: number;
|
||||
configKey: string;
|
||||
accessKey: string;
|
||||
secretKey: string;
|
||||
bucketName: string;
|
||||
prefix: string;
|
||||
endpoint: string;
|
||||
domain: string;
|
||||
isHttps: string;
|
||||
region: string;
|
||||
status: string;
|
||||
ext1: string;
|
||||
remark: string;
|
||||
accessPolicy: string;
|
||||
}
|
||||
89
hzhub-admin/apps/web-antd/src/api/system/oss/index.ts
Normal file
89
hzhub-admin/apps/web-antd/src/api/system/oss/index.ts
Normal file
@@ -0,0 +1,89 @@
|
||||
import type { AxiosRequestConfig } from '@vben/request';
|
||||
|
||||
import type { OssFile } from './model';
|
||||
|
||||
import type { ID, IDS, PageQuery, PageResult } from '#/api/common';
|
||||
|
||||
import { ContentTypeEnum } from '#/api/helper';
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
enum Api {
|
||||
ossDownload = '/resource/oss/download',
|
||||
ossInfo = '/resource/oss/listByIds',
|
||||
ossList = '/resource/oss/list',
|
||||
ossUpload = '/resource/oss/upload',
|
||||
root = '/resource/oss',
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件list
|
||||
* @param params 参数
|
||||
* @returns 分页
|
||||
*/
|
||||
export function ossList(params?: PageQuery) {
|
||||
return requestClient.get<PageResult<OssFile>>(Api.ossList, { params });
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询文件信息 返回为数组
|
||||
* @param ossIds id数组
|
||||
* @returns 信息数组
|
||||
*/
|
||||
export function ossInfo(ossIds: ID | IDS) {
|
||||
return requestClient.get<OssFile[]>(`${Api.ossInfo}/${ossIds}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 使用apps/web-antd/src/api/core/upload.ts uploadApi方法
|
||||
* @param file 文件
|
||||
* @returns void
|
||||
*/
|
||||
export function ossUpload(file: Blob | File) {
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
return requestClient.postWithMsg(Api.ossUpload, formData, {
|
||||
headers: { 'Content-Type': ContentTypeEnum.FORM_DATA },
|
||||
timeout: 30 * 1000,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载文件 返回为二进制
|
||||
* @param ossId ossId
|
||||
* @param onDownloadProgress 下载进度(可选)
|
||||
* @returns blob
|
||||
*/
|
||||
export function ossDownload(
|
||||
ossId: ID,
|
||||
onDownloadProgress?: AxiosRequestConfig['onDownloadProgress'],
|
||||
) {
|
||||
return requestClient.get<Blob>(`${Api.ossDownload}/${ossId}`, {
|
||||
responseType: 'blob',
|
||||
timeout: 30 * 1000,
|
||||
isTransformResponse: false,
|
||||
onDownloadProgress,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 在使用浏览器原生下载前检测是否登录
|
||||
* 这里的方案为请求一次接口 如果登录超时会走到response的401逻辑
|
||||
* 如果没有listByIds的权限 也不会弹出无权限提示
|
||||
* 仅仅是为了检测token是否有效使用
|
||||
*
|
||||
* @returns void
|
||||
*/
|
||||
export function checkLoginBeforeDownload() {
|
||||
return requestClient.get<OssFile[]>(`${Api.ossInfo}/1`, {
|
||||
errorMessageMode: 'none',
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除文件
|
||||
* @param ossIds id数组
|
||||
* @returns void
|
||||
*/
|
||||
export function ossRemove(ossIds: IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`${Api.root}/${ossIds}`);
|
||||
}
|
||||
28
hzhub-admin/apps/web-antd/src/api/system/oss/model.d.ts
vendored
Normal file
28
hzhub-admin/apps/web-antd/src/api/system/oss/model.d.ts
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
export interface OssFile {
|
||||
ossId: string;
|
||||
fileName: string;
|
||||
originalName: string;
|
||||
fileSuffix: string;
|
||||
url: string;
|
||||
createTime: string;
|
||||
createBy: number;
|
||||
createByName: string;
|
||||
service: string;
|
||||
}
|
||||
|
||||
export interface OssConfig {
|
||||
ossConfigId: number;
|
||||
configKey: string;
|
||||
accessKey: string;
|
||||
secretKey: string;
|
||||
bucketName: string;
|
||||
prefix: string;
|
||||
endpoint: string;
|
||||
domain: string;
|
||||
isHttps: string;
|
||||
region: string;
|
||||
status: string;
|
||||
ext1: string;
|
||||
remark: string;
|
||||
accessPolicy: string;
|
||||
}
|
||||
85
hzhub-admin/apps/web-antd/src/api/system/post/index.ts
Normal file
85
hzhub-admin/apps/web-antd/src/api/system/post/index.ts
Normal file
@@ -0,0 +1,85 @@
|
||||
import type { DeptTree } from '../user/model';
|
||||
import type { Post } from './model';
|
||||
|
||||
import type { ID, IDS, PageQuery } from '#/api/common';
|
||||
|
||||
import { commonExport } from '#/api/helper';
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
enum Api {
|
||||
postExport = '/system/post/export',
|
||||
postList = '/system/post/list',
|
||||
postSelect = '/system/post/optionselect',
|
||||
root = '/system/post',
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取岗位列表
|
||||
* @param params 参数
|
||||
* @returns Post[]
|
||||
*/
|
||||
export function postList(params?: PageQuery) {
|
||||
return requestClient.get<Post[]>(Api.postList, { params });
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出岗位信息
|
||||
* @param data 请求参数
|
||||
* @returns blob
|
||||
*/
|
||||
export function postExport(data: Partial<Post>) {
|
||||
return commonExport(Api.postExport, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询岗位信息
|
||||
* @param postId id
|
||||
* @returns 岗位信息
|
||||
*/
|
||||
export function postInfo(postId: ID) {
|
||||
return requestClient.get<Post>(`${Api.root}/${postId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 岗位新增
|
||||
* @param data 参数
|
||||
* @returns void
|
||||
*/
|
||||
export function postAdd(data: Partial<Post>) {
|
||||
return requestClient.postWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 岗位更新
|
||||
* @param data 参数
|
||||
* @returns void
|
||||
*/
|
||||
export function postUpdate(data: Partial<Post>) {
|
||||
return requestClient.putWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 岗位删除
|
||||
* @param postIds ids
|
||||
* @returns void
|
||||
*/
|
||||
export function postRemove(postIds: IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`${Api.root}/${postIds}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据部门id获取岗位下拉列表
|
||||
* @param deptId 部门id
|
||||
* @returns 岗位
|
||||
*/
|
||||
export function postOptionSelect(deptId: ID) {
|
||||
return requestClient.get<Post[]>(Api.postSelect, { params: { deptId } });
|
||||
}
|
||||
|
||||
/**
|
||||
* 岗位专用 - 获取部门树
|
||||
* @returns 部门树
|
||||
*/
|
||||
export function postDeptTreeSelect() {
|
||||
return requestClient.get<DeptTree[]>('/system/post/deptTree');
|
||||
}
|
||||
12
hzhub-admin/apps/web-antd/src/api/system/post/model.d.ts
vendored
Normal file
12
hzhub-admin/apps/web-antd/src/api/system/post/model.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @description: Post interface
|
||||
*/
|
||||
export interface Post {
|
||||
postId: number;
|
||||
postCode: string;
|
||||
postName: string;
|
||||
postSort: number;
|
||||
status: string;
|
||||
remark: string;
|
||||
createTime: string;
|
||||
}
|
||||
65
hzhub-admin/apps/web-antd/src/api/system/profile/index.ts
Normal file
65
hzhub-admin/apps/web-antd/src/api/system/profile/index.ts
Normal file
@@ -0,0 +1,65 @@
|
||||
import type { FileCallBack, UpdatePasswordParam, UserProfile } from './model';
|
||||
|
||||
import { buildUUID } from '@vben/utils';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
enum Api {
|
||||
root = '/system/user/profile',
|
||||
updateAvatar = '/system/user/profile/avatar',
|
||||
updatePassword = '/system/user/profile/updatePwd',
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户个人主页信息
|
||||
* @returns userInformation
|
||||
*/
|
||||
export function userProfile() {
|
||||
return requestClient.get<UserProfile>(Api.root);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新用户个人主页信息
|
||||
* @param data
|
||||
* @returns void
|
||||
*/
|
||||
export function userProfileUpdate(data: any) {
|
||||
return requestClient.putWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户修改密码 (需要加密)
|
||||
* @param data
|
||||
* @returns void
|
||||
*/
|
||||
export function userUpdatePassword(data: UpdatePasswordParam) {
|
||||
return requestClient.putWithMsg<void>(Api.updatePassword, data, {
|
||||
encrypt: true,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户更新个人头像
|
||||
* @param fileCallback data
|
||||
* @returns void
|
||||
*/
|
||||
export function userUpdateAvatar(fileCallback: FileCallBack) {
|
||||
/** 直接点击头像上传 filename为空 由于后台通过拓展名判断(默认文件名blob) 会上传失败 */
|
||||
let { file } = fileCallback;
|
||||
const { filename } = fileCallback;
|
||||
/**
|
||||
* Blob转File类型
|
||||
* 1. 在直接点击确认 filename为空 取uuid作为文件名
|
||||
* 2. 选择上传必须转为File类型 Blob类型上传后台获取文件名为空
|
||||
*/
|
||||
file = filename
|
||||
? new File([file], filename)
|
||||
: new File([file], `${buildUUID()}.png`);
|
||||
return requestClient.post(
|
||||
Api.updateAvatar,
|
||||
{
|
||||
avatarfile: file,
|
||||
},
|
||||
{ headers: { 'Content-Type': 'multipart/form-data' } },
|
||||
);
|
||||
}
|
||||
75
hzhub-admin/apps/web-antd/src/api/system/profile/model.d.ts
vendored
Normal file
75
hzhub-admin/apps/web-antd/src/api/system/profile/model.d.ts
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
export interface Dept {
|
||||
deptId: number;
|
||||
parentId: number;
|
||||
parentName?: any;
|
||||
ancestors: string;
|
||||
deptName: string;
|
||||
orderNum: number;
|
||||
leader: string;
|
||||
phone?: any;
|
||||
email: string;
|
||||
status: string;
|
||||
createTime?: any;
|
||||
}
|
||||
|
||||
export interface Role {
|
||||
roleId: number;
|
||||
roleName: string;
|
||||
roleKey: string;
|
||||
roleSort: number;
|
||||
dataScope: string;
|
||||
menuCheckStrictly?: any;
|
||||
deptCheckStrictly?: any;
|
||||
status: string;
|
||||
remark: string;
|
||||
createTime?: any;
|
||||
flag: boolean;
|
||||
superAdmin: boolean;
|
||||
}
|
||||
|
||||
export interface User {
|
||||
userId: number;
|
||||
tenantId: string;
|
||||
deptId: number;
|
||||
userName: string;
|
||||
nickName: string;
|
||||
userType: string;
|
||||
email: string;
|
||||
phonenumber: string;
|
||||
sex: string;
|
||||
avatar: string;
|
||||
status: string;
|
||||
loginIp: string;
|
||||
loginDate: string;
|
||||
remark: string;
|
||||
createTime: string;
|
||||
dept: Dept;
|
||||
roles: Role[];
|
||||
roleIds?: string[];
|
||||
postIds?: string[];
|
||||
roleId: number;
|
||||
deptName: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 用户个人主页信息
|
||||
* @param user 用户信息
|
||||
* @param roleGroup 角色名称
|
||||
* @param postGroup 岗位名称
|
||||
*/
|
||||
export interface UserProfile {
|
||||
user: User;
|
||||
roleGroup: string;
|
||||
postGroup: string;
|
||||
}
|
||||
|
||||
export interface UpdatePasswordParam {
|
||||
oldPassword: string;
|
||||
newPassword: string;
|
||||
}
|
||||
|
||||
interface FileCallBack {
|
||||
name: string;
|
||||
file: Blob;
|
||||
filename: string;
|
||||
}
|
||||
166
hzhub-admin/apps/web-antd/src/api/system/role/index.ts
Normal file
166
hzhub-admin/apps/web-antd/src/api/system/role/index.ts
Normal file
@@ -0,0 +1,166 @@
|
||||
import type { User } from '../user/model';
|
||||
import type { DeptResp, Role } from './model';
|
||||
|
||||
import type { ID, IDS, PageQuery, PageResult } from '#/api/common';
|
||||
|
||||
import { commonExport } from '#/api/helper';
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
enum Api {
|
||||
roleAllocatedList = '/system/role/authUser/allocatedList',
|
||||
roleAuthCancel = '/system/role/authUser/cancel',
|
||||
roleAuthCancelAll = '/system/role/authUser/cancelAll',
|
||||
roleAuthSelectAll = '/system/role/authUser/selectAll',
|
||||
roleChangeStatus = '/system/role/changeStatus',
|
||||
roleDataScope = '/system/role/dataScope',
|
||||
roleDeptTree = '/system/role/deptTree',
|
||||
roleExport = '/system/role/export',
|
||||
roleList = '/system/role/list',
|
||||
roleOptionSelect = '/system/role/optionselect',
|
||||
roleUnallocatedList = '/system/role/authUser/unallocatedList',
|
||||
root = '/system/role',
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询角色分页列表
|
||||
* @param params 搜索条件
|
||||
* @returns 分页列表
|
||||
*/
|
||||
export function roleList(params?: PageQuery) {
|
||||
return requestClient.get<PageResult<Role>>(Api.roleList, { params });
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出角色信息
|
||||
* @param data 查询参数
|
||||
* @returns blob
|
||||
*/
|
||||
export function roleExport(data: Partial<Role>) {
|
||||
return commonExport(Api.roleExport, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询角色信息
|
||||
* @param roleId 角色id
|
||||
* @returns 角色信息
|
||||
*/
|
||||
export function roleInfo(roleId: ID) {
|
||||
return requestClient.get<Role>(`${Api.root}/${roleId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 角色新增
|
||||
* @param data 参数
|
||||
* @returns void
|
||||
*/
|
||||
export function roleAdd(data: Partial<Role>) {
|
||||
return requestClient.postWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 角色更新
|
||||
* @param data 参数
|
||||
* @returns void
|
||||
*/
|
||||
export function roleUpdate(data: Partial<Role>) {
|
||||
return requestClient.putWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改角色状态
|
||||
* @param data 参数
|
||||
* @returns void
|
||||
*/
|
||||
export function roleChangeStatus(data: Partial<Role>) {
|
||||
const requestData = {
|
||||
roleId: data.roleId,
|
||||
status: data.status,
|
||||
};
|
||||
return requestClient.putWithMsg<void>(Api.roleChangeStatus, requestData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 角色删除
|
||||
* @param roleIds ids
|
||||
* @returns void
|
||||
*/
|
||||
export function roleRemove(roleIds: IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`${Api.root}/${roleIds}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新数据权限
|
||||
* @param data
|
||||
* @returns void
|
||||
*/
|
||||
export function roleDataScope(data: any) {
|
||||
return requestClient.putWithMsg<void>(Api.roleDataScope, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 全局并没有用到这个方法
|
||||
*/
|
||||
export function roleOptionSelect(params?: any) {
|
||||
return requestClient.get(Api.roleOptionSelect, { params });
|
||||
}
|
||||
|
||||
/**
|
||||
* 已分配角色的用户分页
|
||||
* @param params 请求参数
|
||||
* @returns 分页
|
||||
*/
|
||||
export function roleAllocatedList(params?: PageQuery) {
|
||||
return requestClient.get<PageResult<User>>(Api.roleAllocatedList, { params });
|
||||
}
|
||||
|
||||
/**
|
||||
* 未授权的用户
|
||||
* @param params
|
||||
* @returns void
|
||||
*/
|
||||
export function roleUnallocatedList(params: any) {
|
||||
return requestClient.get<PageResult<User>>(Api.roleUnallocatedList, {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消用户角色授权
|
||||
* @returns void
|
||||
*/
|
||||
export function roleAuthCancel(data: { roleId: ID; userId: ID }) {
|
||||
return requestClient.putWithMsg<void>(Api.roleAuthCancel, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量取消授权
|
||||
* @param roleId 角色ID
|
||||
* @param userIds 用户ID集合
|
||||
* @returns void
|
||||
*/
|
||||
export function roleAuthCancelAll(roleId: ID, userIds: IDS) {
|
||||
return requestClient.putWithMsg<void>(
|
||||
`${Api.roleAuthCancelAll}?roleId=${roleId}&userIds=${userIds.join(',')}`,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量授权用户
|
||||
* @param roleId 角色ID
|
||||
* @param userIds 用户ID集合
|
||||
* @returns void
|
||||
*/
|
||||
export function roleSelectAll(roleId: ID, userIds: IDS) {
|
||||
return requestClient.putWithMsg<void>(
|
||||
`${Api.roleAuthSelectAll}?roleId=${roleId}&userIds=${userIds.join(',')}`,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据角色id获取部门树
|
||||
* @param roleId 角色id
|
||||
* @returns DeptResp
|
||||
*/
|
||||
export function roleDeptTree(roleId: ID) {
|
||||
return requestClient.get<DeptResp>(`${Api.roleDeptTree}/${roleId}`);
|
||||
}
|
||||
29
hzhub-admin/apps/web-antd/src/api/system/role/model.d.ts
vendored
Normal file
29
hzhub-admin/apps/web-antd/src/api/system/role/model.d.ts
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
export interface Role {
|
||||
roleId: number;
|
||||
roleName: string;
|
||||
roleKey: string;
|
||||
roleSort: number;
|
||||
dataScope: string;
|
||||
menuCheckStrictly: boolean;
|
||||
deptCheckStrictly: boolean;
|
||||
status: string;
|
||||
remark: string;
|
||||
createTime: string;
|
||||
// 用户是否存在此角色标识 默认不存在
|
||||
flag: boolean;
|
||||
superAdmin: boolean;
|
||||
}
|
||||
|
||||
export interface DeptOption {
|
||||
id: number;
|
||||
parentId: number;
|
||||
label: string;
|
||||
weight: number;
|
||||
children: DeptOption[];
|
||||
key: string; // 实际上不存在 ide报错
|
||||
}
|
||||
|
||||
export interface DeptResp {
|
||||
checkedKeys: number[];
|
||||
depts: DeptOption[];
|
||||
}
|
||||
25
hzhub-admin/apps/web-antd/src/api/system/social/index.ts
Normal file
25
hzhub-admin/apps/web-antd/src/api/system/social/index.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import type { SocialInfo } from './model';
|
||||
|
||||
import type { ID } from '#/api/common';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
enum Api {
|
||||
root = '/system/social',
|
||||
socialList = '/system/social/list',
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取绑定的社交信息列表
|
||||
* @returns info
|
||||
*/
|
||||
export function socialList() {
|
||||
return requestClient.get<SocialInfo[]>(Api.socialList);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 并没有用到这个方法
|
||||
*/
|
||||
export function socialInfo(id: ID) {
|
||||
return requestClient.get(`${Api.root}/${id}`);
|
||||
}
|
||||
26
hzhub-admin/apps/web-antd/src/api/system/social/model.d.ts
vendored
Normal file
26
hzhub-admin/apps/web-antd/src/api/system/social/model.d.ts
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
export interface SocialInfo {
|
||||
id: string;
|
||||
userId: number;
|
||||
tenantId: string;
|
||||
authId: string;
|
||||
source: string;
|
||||
accessToken: string;
|
||||
expireIn: number;
|
||||
refreshToken: string;
|
||||
openId: string;
|
||||
userName: string;
|
||||
nickName: string;
|
||||
email: string;
|
||||
avatar: string;
|
||||
accessCode?: any;
|
||||
unionId?: any;
|
||||
scope: string;
|
||||
tokenType: string;
|
||||
idToken?: any;
|
||||
macAlgorithm?: any;
|
||||
macKey?: any;
|
||||
code?: any;
|
||||
oauthToken?: any;
|
||||
oauthTokenSecret?: any;
|
||||
createTime: string;
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
import type { TenantPackage } from './model';
|
||||
|
||||
import type { ID, IDS, PageQuery, PageResult } from '#/api/common';
|
||||
|
||||
import { commonExport } from '#/api/helper';
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
enum Api {
|
||||
packageChangeStatus = '/system/tenant/package/changeStatus',
|
||||
packageExport = '/system/tenant/package/export',
|
||||
packageList = '/system/tenant/package/list',
|
||||
packageSelectList = '/system/tenant/package/selectList',
|
||||
root = '/system/tenant/package',
|
||||
}
|
||||
|
||||
/**
|
||||
* 租户套餐分页列表
|
||||
* @param params 请求参数
|
||||
* @returns 分页列表
|
||||
*/
|
||||
export function packageList(params?: PageQuery) {
|
||||
return requestClient.get<PageResult<TenantPackage>>(Api.packageList, {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 租户套餐下拉框
|
||||
* @returns 下拉框
|
||||
*/
|
||||
export function packageSelectList() {
|
||||
return requestClient.get<TenantPackage[]>(Api.packageSelectList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 租户套餐导出
|
||||
* @param data 参数
|
||||
* @returns blob
|
||||
*/
|
||||
export function packageExport(data: Partial<TenantPackage>) {
|
||||
return commonExport(Api.packageExport, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 租户套餐信息
|
||||
* @param id id
|
||||
* @returns 信息
|
||||
*/
|
||||
export function packageInfo(id: ID) {
|
||||
return requestClient.get<TenantPackage>(`${Api.root}/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 租户套餐新增
|
||||
* @param data data
|
||||
* @returns void
|
||||
*/
|
||||
export function packageAdd(data: Partial<TenantPackage>) {
|
||||
return requestClient.postWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 租户套餐更新
|
||||
* @param data data
|
||||
* @returns void
|
||||
*/
|
||||
export function packageUpdate(data: Partial<TenantPackage>) {
|
||||
return requestClient.putWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 租户套餐状态变更
|
||||
* @param data data
|
||||
* @returns void
|
||||
*/
|
||||
export function packageChangeStatus(data: Partial<TenantPackage>) {
|
||||
const packageId = {
|
||||
packageId: data.packageId,
|
||||
status: data.status,
|
||||
};
|
||||
return requestClient.putWithMsg<void>(Api.packageChangeStatus, packageId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 租户套餐移除
|
||||
* @param ids ids
|
||||
* @returns void
|
||||
*/
|
||||
export function packageRemove(ids: IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`${Api.root}/${ids}`);
|
||||
}
|
||||
17
hzhub-admin/apps/web-antd/src/api/system/tenant-package/model.d.ts
vendored
Normal file
17
hzhub-admin/apps/web-antd/src/api/system/tenant-package/model.d.ts
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* @description 租户套餐
|
||||
* @param packageId id
|
||||
* @param packageName 名称
|
||||
* @param menuIds 菜单id 格式为[1,2,3] 返回为string 提交为数组
|
||||
* @param remark 备注
|
||||
* @param menuCheckStrictly 是否关联父节点
|
||||
* @param status 状态
|
||||
*/
|
||||
export interface TenantPackage {
|
||||
packageId: string;
|
||||
packageName: string;
|
||||
menuIds: number[] | string;
|
||||
remark: string;
|
||||
menuCheckStrictly: boolean;
|
||||
status: string;
|
||||
}
|
||||
137
hzhub-admin/apps/web-antd/src/api/system/tenant/index.ts
Normal file
137
hzhub-admin/apps/web-antd/src/api/system/tenant/index.ts
Normal file
@@ -0,0 +1,137 @@
|
||||
import type { Tenant } from './model';
|
||||
|
||||
import type { ID, IDS, PageQuery } from '#/api/common';
|
||||
|
||||
import { commonExport } from '#/api/helper';
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
enum Api {
|
||||
dictSync = '/system/tenant/syncTenantDict',
|
||||
root = '/system/tenant',
|
||||
tenantDynamic = '/system/tenant/dynamic',
|
||||
tenantDynamicClear = '/system/tenant/dynamic/clear',
|
||||
tenantExport = '/system/tenant/export',
|
||||
tenantList = '/system/tenant/list',
|
||||
tenantStatus = '/system/tenant/changeStatus',
|
||||
tenantSyncPackage = '/system/tenant/syncTenantPackage',
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询租户分页列表
|
||||
* @param params 参数
|
||||
* @returns 分页
|
||||
*/
|
||||
export function tenantList(params?: PageQuery) {
|
||||
return requestClient.get<Tenant[]>(Api.tenantList, { params });
|
||||
}
|
||||
|
||||
/**
|
||||
* 租户导出
|
||||
* @param data data
|
||||
* @returns void
|
||||
*/
|
||||
export function tenantExport(data: Partial<Tenant>) {
|
||||
return commonExport(Api.tenantExport, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询租户信息
|
||||
* @param id id
|
||||
* @returns 租户信息
|
||||
*/
|
||||
export function tenantInfo(id: ID) {
|
||||
return requestClient.get<Tenant>(`${Api.root}/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增租户 必须开启加密
|
||||
* @param data data
|
||||
* @returns void
|
||||
*/
|
||||
export function tenantAdd(data: Partial<Tenant>) {
|
||||
return requestClient.postWithMsg<void>(Api.root, data, { encrypt: true });
|
||||
}
|
||||
|
||||
/**
|
||||
* 租户更新
|
||||
* @param data data
|
||||
* @returns void
|
||||
*/
|
||||
export function tenantUpdate(data: Partial<Tenant>) {
|
||||
return requestClient.putWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 租户状态更新
|
||||
* @param data data
|
||||
* @returns void
|
||||
*/
|
||||
export function tenantStatusChange(data: Partial<Tenant>) {
|
||||
const requestData = {
|
||||
id: data.id,
|
||||
tenantId: data.tenantId,
|
||||
status: data.status,
|
||||
};
|
||||
return requestClient.putWithMsg(Api.tenantStatus, requestData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 租户删除
|
||||
* @param ids ids
|
||||
* @returns void
|
||||
*/
|
||||
export function tenantRemove(ids: IDS) {
|
||||
return requestClient.deleteWithMsg(`${Api.root}/${ids}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 动态切换租户
|
||||
* @param tenantId 租户ID
|
||||
* @returns void
|
||||
*/
|
||||
export function tenantDynamicToggle(tenantId: string) {
|
||||
return requestClient.get<void>(`${Api.tenantDynamic}/${tenantId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除 动态切换租户
|
||||
* @returns void
|
||||
*/
|
||||
export function tenantDynamicClear() {
|
||||
return requestClient.get<void>(Api.tenantDynamicClear);
|
||||
}
|
||||
|
||||
/**
|
||||
* 租户套餐同步
|
||||
* @param tenantId 租户id
|
||||
* @param packageId 套餐id
|
||||
* @returns void
|
||||
*/
|
||||
export function tenantSyncPackage(tenantId: string, packageId: string) {
|
||||
return requestClient.get<void>(Api.tenantSyncPackage, {
|
||||
params: { packageId, tenantId },
|
||||
successMessageMode: 'message',
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步租户字典
|
||||
* @param tenantId 租户ID
|
||||
* @returns void
|
||||
*/
|
||||
export function dictSyncTenant(tenantId?: string) {
|
||||
return requestClient.get<void>(Api.dictSync, {
|
||||
params: { tenantId },
|
||||
successMessageMode: 'message',
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步租户配置
|
||||
* @returns void
|
||||
*/
|
||||
export function syncTenantConfig() {
|
||||
return requestClient.get<void>('/system/tenant/syncTenantConfig', {
|
||||
successMessageMode: 'message',
|
||||
});
|
||||
}
|
||||
16
hzhub-admin/apps/web-antd/src/api/system/tenant/model.d.ts
vendored
Normal file
16
hzhub-admin/apps/web-antd/src/api/system/tenant/model.d.ts
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
export interface Tenant {
|
||||
accountCount: number;
|
||||
address?: string;
|
||||
companyName: string;
|
||||
contactPhone: string;
|
||||
contactUserName: string;
|
||||
domain?: string;
|
||||
expireTime?: string;
|
||||
id: number;
|
||||
intro: string;
|
||||
licenseNumber?: any;
|
||||
packageId: string;
|
||||
remark?: string;
|
||||
status: string;
|
||||
tenantId: string;
|
||||
}
|
||||
171
hzhub-admin/apps/web-antd/src/api/system/user/index.ts
Normal file
171
hzhub-admin/apps/web-antd/src/api/system/user/index.ts
Normal file
@@ -0,0 +1,171 @@
|
||||
import type {
|
||||
DeptTree,
|
||||
ResetPwdParam,
|
||||
User,
|
||||
UserImportParam,
|
||||
UserInfoResponse,
|
||||
} from './model';
|
||||
|
||||
import type { ID, IDS, PageQuery, PageResult } from '#/api/common';
|
||||
|
||||
import { commonExport, ContentTypeEnum } from '#/api/helper';
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
enum Api {
|
||||
deptTree = '/system/user/deptTree',
|
||||
listDeptUsers = '/system/user/list/dept',
|
||||
root = '/system/user',
|
||||
userAuthRole = '/system/user/authRole',
|
||||
userExport = '/system/user/export',
|
||||
userImport = '/system/user/importData',
|
||||
userImportTemplate = '/system/user/importTemplate',
|
||||
userList = '/system/user/list',
|
||||
userResetPassword = '/system/user/resetPwd',
|
||||
userStatusChange = '/system/user/changeStatus',
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户列表
|
||||
* @param params
|
||||
* @returns User
|
||||
*/
|
||||
export function userList(params?: PageQuery) {
|
||||
return requestClient.get<PageResult<User>>(Api.userList, { params });
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
* @param data data
|
||||
* @returns blob
|
||||
*/
|
||||
export function userExport(data: Partial<User>) {
|
||||
return commonExport(Api.userExport, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 从excel导入用户
|
||||
* @param data
|
||||
* @returns void
|
||||
*/
|
||||
export function userImportData(data: UserImportParam) {
|
||||
return requestClient.post<{ code: number; msg: string }>(
|
||||
Api.userImport,
|
||||
data,
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': ContentTypeEnum.FORM_DATA,
|
||||
},
|
||||
isTransformResponse: false,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载用户导入模板
|
||||
* @returns blob
|
||||
*/
|
||||
export function downloadImportTemplate() {
|
||||
return requestClient.post<Blob>(
|
||||
Api.userImportTemplate,
|
||||
{},
|
||||
{
|
||||
isTransformResponse: false,
|
||||
responseType: 'blob',
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 可以不传ID 返回部门和角色options 需要获得原始数据
|
||||
* 不传ID时一定要带最后的/
|
||||
* @param userId 用户ID
|
||||
* @returns 用户信息
|
||||
*/
|
||||
export function findUserInfo(userId?: ID) {
|
||||
const url = userId ? `${Api.root}/${userId}` : `${Api.root}/`;
|
||||
return requestClient.get<UserInfoResponse>(url);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户
|
||||
* @param data data
|
||||
* @returns void
|
||||
*/
|
||||
export function userAdd(data: Partial<User>) {
|
||||
return requestClient.postWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新用户
|
||||
* @param data data
|
||||
* @returns void
|
||||
*/
|
||||
export function userUpdate(data: Partial<User>) {
|
||||
return requestClient.putWithMsg<void>(Api.root, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新用户状态
|
||||
* @param data data
|
||||
* @returns void
|
||||
*/
|
||||
export function userStatusChange(data: Partial<User>) {
|
||||
const requestData = {
|
||||
userId: data.userId,
|
||||
status: data.status,
|
||||
};
|
||||
return requestClient.putWithMsg<void>(Api.userStatusChange, requestData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户
|
||||
* @param userIds 用户ID数组
|
||||
* @returns void
|
||||
*/
|
||||
export function userRemove(userIds: IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`${Api.root}/${userIds}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置用户密码 需要加密
|
||||
* @param data
|
||||
* @returns void
|
||||
*/
|
||||
export function userResetPassword(data: ResetPwdParam) {
|
||||
return requestClient.putWithMsg<void>(Api.userResetPassword, data, {
|
||||
encrypt: true,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 这个方法未调用过
|
||||
* @param userId
|
||||
* @returns void
|
||||
*/
|
||||
export function getUserAuthRole(userId: ID) {
|
||||
return requestClient.get(`${Api.userAuthRole}/${userId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 这个方法未调用过
|
||||
* @param userId
|
||||
* @returns void
|
||||
*/
|
||||
export function userAuthRoleUpdate(userId: ID, roleIds: number[]) {
|
||||
return requestClient.putWithMsg(Api.userAuthRole, { roleIds, userId });
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取部门树
|
||||
* @returns 部门树数组
|
||||
*/
|
||||
export function getDeptTree() {
|
||||
return requestClient.get<DeptTree[]>(Api.deptTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取部门下的所有用户信息
|
||||
*/
|
||||
export function listUserByDeptId(deptId: ID) {
|
||||
return requestClient.get<User[]>(`${Api.listDeptUsers}/${deptId}`);
|
||||
}
|
||||
117
hzhub-admin/apps/web-antd/src/api/system/user/model.d.ts
vendored
Normal file
117
hzhub-admin/apps/web-antd/src/api/system/user/model.d.ts
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
/**
|
||||
* @description: 用户导入
|
||||
* @param updateSupport 是否覆盖数据
|
||||
* @param file excel文件
|
||||
*/
|
||||
export interface UserImportParam {
|
||||
updateSupport: boolean;
|
||||
file: Blob | File;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 重置密码
|
||||
*/
|
||||
export interface ResetPwdParam {
|
||||
userId: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
export interface Dept {
|
||||
deptId: number;
|
||||
parentId: number;
|
||||
parentName?: string;
|
||||
ancestors: string;
|
||||
deptName: string;
|
||||
orderNum: number;
|
||||
leader: string;
|
||||
phone?: string;
|
||||
email?: string;
|
||||
status: string;
|
||||
createTime?: string;
|
||||
}
|
||||
|
||||
export interface Role {
|
||||
roleId: string;
|
||||
roleName: string;
|
||||
roleKey: string;
|
||||
roleSort: number;
|
||||
dataScope: string;
|
||||
menuCheckStrictly?: boolean;
|
||||
deptCheckStrictly?: boolean;
|
||||
status: string;
|
||||
remark: string;
|
||||
createTime?: string;
|
||||
flag: boolean;
|
||||
superAdmin: boolean;
|
||||
}
|
||||
|
||||
export interface User {
|
||||
userId: string;
|
||||
tenantId: string;
|
||||
deptId: number;
|
||||
userName: string;
|
||||
nickName: string;
|
||||
userType: string;
|
||||
email: string;
|
||||
phonenumber: string;
|
||||
sex: string;
|
||||
avatar?: string;
|
||||
status: string;
|
||||
loginIp: string;
|
||||
loginDate: string;
|
||||
remark: string;
|
||||
createTime: string;
|
||||
dept: Dept;
|
||||
roles: Role[];
|
||||
roleIds?: string[];
|
||||
postIds?: number[];
|
||||
roleId: string;
|
||||
deptName: string;
|
||||
}
|
||||
|
||||
export interface Post {
|
||||
postId: number;
|
||||
postCode: string;
|
||||
postName: string;
|
||||
postSort: number;
|
||||
status: string;
|
||||
remark: string;
|
||||
createTime: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 用户信息
|
||||
* @param user 用户个人信息
|
||||
* @param roleIds 角色IDS 不传id为空
|
||||
* @param roles 所有的角色
|
||||
* @param postIds 岗位IDS 不传id为空
|
||||
* @param posts 所有的岗位
|
||||
*/
|
||||
export interface UserInfoResponse {
|
||||
user?: User;
|
||||
roleIds?: string[];
|
||||
roles: Role[];
|
||||
postIds?: number[];
|
||||
posts?: Post[];
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 部门树
|
||||
*/
|
||||
export interface DeptTree {
|
||||
id: number;
|
||||
/**
|
||||
* antd组件必须要这个属性 实际是没有这个属性的
|
||||
*/
|
||||
key: string;
|
||||
parentId: number;
|
||||
label: string;
|
||||
weight: number;
|
||||
children?: DeptTree[];
|
||||
}
|
||||
|
||||
export interface DeptTreeData {
|
||||
id: number;
|
||||
label: string;
|
||||
children?: DeptTreeData[];
|
||||
}
|
||||
Reference in New Issue
Block a user